Skip to content

Instrument intermittently missing from the subject graph selector moments after its record is created #1474

Description

@joshunrau

Summary

Intermittent, not reliably reproducible. Navigating straight from completing an instrument to that subject's Graph tab sometimes leaves the instrument missing from the Graph tab's instrument selector, even though the record exists.

Detail

Path: apps/web/src/routes/_app/datahub/$subjectId/graph.tsxuseInstrumentVisualizationuseInstrumentInfoQuery (GET /v1/instruments/info).

Observed in roughly 1 of every 8 full Playwright suite runs while developing e2e coverage. At the exact same point the instrument is reliably present when checked via the Table tab instead, whose data-fetch path looks equivalent.

Static reading turned up no obvious cause on either side:

  • Client: staleTime: 0, and switching tabs fully remounts the route.
  • Server: apps/api/src/instruments/instruments.service.ts#find, filtering on records.some.subjectId.

A page.reload() sometimes recovered it and sometimes did not, which reads more like a write-visibility race between the record write and this specific read than a client-side caching problem.

Status

Unconfirmed — filed so it is not lost. Worth a look with real network tracing if it recurs; the MongoDB read-concern / replica-set visibility angle seems the most likely place to start.

Workaround in the test suite

SubjectGraphPage.selectInstrument (testing/src/pages/_app/datahub/$subjectId/graph.page.ts, branch e2e-tests) uses a bounded retry-and-reload loop rather than asserting the race away.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions