Skip to content

feat: opaque v1 cursors, piefed route parity, seeded read state - #73

Merged
aeharding merged 1 commit into
mainfrom
fake-opaque-cursors
Jul 25, 2026
Merged

feat: opaque v1 cursors, piefed route parity, seeded read state#73
aeharding merged 1 commit into
mainfrom
fake-opaque-cursors

Conversation

@aeharding

Copy link
Copy Markdown
Owner

From an adversarial review of Voyager's matrix suite, which proved a real hole rather than speculating about one.

Opaque cursors. The v1 fake minted seed-offset:40 — a cursor a client can derive. The reviewer patched Voyager to ignore next_page and fabricate cursors from an offset formula: the matrix pagination test still passed on lemmyv1 (it failed on piefed, whose page numbers can't be guessed). Cursors are now opaque tokens resolved through a per-instance map, so echoing the server's cursor is the only way to advance. Counter-based rather than random, so runs stay reproducible. PieFed still pages by number — that's its real API, not a shortcut.

PieFed route parity. GET /api/alpha/community/list, GET /api/alpha/federated_instances and POST /api/alpha/post/mark_as_read had no derived defaults, so they 404'd. The last one mattered: a shared mark-read spec asserted a request the fake was rejecting, passing only because the app fires and forgets. The handler accepts either post_id or post_ids, as the real API does (checked against the OpenAPI schema).

Read state. SeedPost.read, mutated by mark-as-read on both providers and surfaced in post views (v1 post_actions.read_at, piefed PostView.read) — so specs can assert the effect, not just the call.

458 tests (3 new matrix/v1 tests covering all three), live smoke + fidelity 22/22.

Adversarial review of a consumer's suite proved a hole: the v1 fake's
cursor encoded its own offset, so an app that ignored the server's cursor
and computed one still paged correctly and its tests passed. Cursors are
now opaque tokens resolved through a per-instance map — echoing what the
server sent is the only way to advance (counter-based, so runs stay
reproducible). PieFed keeps page numbers; those genuinely are its API.

PieFed parity: derived community/list, federated_instances, and
post/mark_as_read (accepting either post_id or post_ids, as the real API
does). The last one 404'd, which made a shared mark-read spec assert a
request the fake was rejecting.

Posts carry read state, mutated by mark-as-read on both providers, so
that spec can assert the effect rather than just the request.
@aeharding
aeharding merged commit f70e209 into main Jul 25, 2026
1 check passed
@aeharding
aeharding deleted the fake-opaque-cursors branch July 25, 2026 19:08
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