Skip to content

feat(atlas-search): recommendation snapshot paging state machine (#10158) - #12873

Open
dezren39 wants to merge 1 commit into
mainfrom
queue/17008-10158-recommendation-paging
Open

dezren39 wants to merge 1 commit into
mainfrom
queue/17008-10158-recommendation-paging

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Implements slice C9139-01 (task 17008).

What

  • pkgs/atlas-search/worker/src/recommendation_state.ts (new): pinned parent snapshot with the total order materialized once (score DESC, then immutable recommendation ID ASC, cutoff-pinned; post-cutoff arrivals belong to the next snapshot); per-page signed envelopes with their own EnvelopeId; cursors binding only the parent SnapshotId plus position (and optional expiry); wrong-parent and expired-cursor rejection; done as the terminal signal, computed independently of page emptiness.
  • pkgs/atlas-search/worker/test/recommendation_state.test.ts (new): 14 tests naming the fixture oracle.

Oracle / evidence

Identities are byte-identical to doc/2026-11-13T03-40-00Z_design_id-atlas-summit/part-c/recommendation-page-fixture.json as recomputed by recommendation-page-oracle.py: parent snapshot id sha256:8797b6bd…, page envelope ids sha256:e67e1aa7… and sha256:50edb5f8…. The oracle script run in the worktree reproduces the same ids.

  • npx vitest run test/recommendation_state.test.ts (laptop, package dir): 14 passed, 14 total.
  • npm run typecheck (laptop): clean.
  • Note: plain npm install in this package currently fails with ERESOLVE (wrangler 4.152.0 wants @cloudflare/workers-types ^5 vs the pinned ^4); npm ci from the lockfile works and was used for verification. Pre-existing repo issue, not touched here.

Supersedes the earlier unimplemented test sketch on this branch: that draft used placeholder envelope ids and a pluggable sign stub, so it could not verify the fixture vectors.

Closes #10158


Run Proof on this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

)

Implements slice C9139-01: pinned parent snapshot with materialized
total order (score DESC, immutable recommendation ID ASC), per-page
signed envelopes with their own EnvelopeId, cursors binding only the
parent SnapshotId plus position, wrong-parent and expired-cursor
rejection, and terminal done semantics. Identities are byte-identical
to the fixture oracle in
doc/2026-11-13T03-40-00Z_design_id-atlas-summit/part-c/.

Supersedes the earlier unimplemented test sketch on this branch: that
draft used placeholder envelope ids and a pluggable sign stub, so it
could not verify the fixture vectors; the new test asserts the exact
fixture parent snapshot id and page envelope ids.

Refs #10158
@dezren39
dezren39 requested a review from a team as a code owner November 23, 2026 04:11
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 18 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4a1f0c9e-04d1-4d5a-bf72-1326c3690687
Commits

Reviewing files that changed from the base of the PR and between 4656bfe and 7e55bb1.

Files selected for processing: 2

  • pkgs/atlas-search/worker/src/recommendation_state.ts
  • pkgs/atlas-search/worker/test/recommendation_state.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39
dezren39 removed the request for review from a team November 23, 2026 05:55

This branch has not been deployed

No deployments
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.

Recommendation snapshot paging state machine

1 participant