Skip to content

fix(search): poll a snapshot's operation only at the path built from its id - #124

Merged
jm-rivera merged 1 commit into
fix/share-card-result-dropfrom
fix/snapshot-date-poll
Nov 5, 2026
Merged

jm-rivera merged 1 commit into
fix/share-card-result-dropfrom
fix/snapshot-date-poll

Conversation

@jm-rivera

@jm-rivera jm-rivera commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

captureSnapshot in src/lib/search/snapshot.ts polled the paths the Datasets API returned, on the server, without checking them. It now refuses an operation id that fails OPERATION_SHAPE before any poll, and polls /api/datasets/operations/<id> on every round, ignoring each response's poll. OPERATION_SHAPE and the new operationPath live in operationPoll.ts, and shareDownload.ts and PreparingDownload.tsx use them in place of their own copies. forwardablePath was the wrong check here, because it checks segments and passes paths such as /api/graph/x.

The snapshot banner needs no code change. A search snapshot is stored seconds after its mint, so its createdAt is the right "data as of", and a switched canvas share dates each card from its serving history. The one gap left is a Studio share made directly as a snapshot, whose saved frame can be older than the share, and no field in dfo-apis' share answers dates a frame. That goes to an issue in dfo-apis. The corpus copy fix is in DevelopmentFinanceObservatory/docs and lands here as a re-sync layer at the top of this stack.

Refs #79

Testing: pnpm lint, pnpm typecheck, pnpm test (2287 pass), pnpm build. The new snapshot tests feed hostile poll paths (another surface, a .. segment, an absolute URL) and malformed ids, and assert the exact URLs fetched; they fail on the old code.

…its id

captureSnapshot followed the poll paths the Datasets API returned, on the server. It now checks the operation id against OPERATION_SHAPE and polls /api/datasets/operations/<id> on every round, through operationPath in operationPoll.ts, which shareDownload.ts and PreparingDownload.tsx share.

Refs #79
@jm-rivera
jm-rivera added this pull request to stack #127 November 5, 2026 11:00
@jm-rivera
jm-rivera marked this pull request as ready for review November 5, 2026 11:16
@jm-rivera
jm-rivera merged commit 3cf1760 into dev Nov 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant