feat: opaque v1 cursors, piefed route parity, seeded read state - #73
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 ignorenext_pageand 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_instancesandPOST /api/alpha/post/mark_as_readhad 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 eitherpost_idorpost_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 (v1post_actions.read_at, piefedPostView.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.