Repository navigation
test(indexer): mixed schema_version fixtures and stop-on-unknown coverage - #43
Open
jdjioe5-cpu wants to merge 1 commit into
Open
jdjioe5-cpu wants to merge 1 commit into
jdjioe5-cpu wants to merge 1 commit into
Conversation
…rage - Closes Kinlock-Org#34 - Covers Roadmap rows M2-10 and M2-14 - Add forward-compatible v2 handler stubs (lockCreatedV2, releasedV2) registered in HANDLERS - Add synthesized mixed-versions.json fixture covering interleaved v1 and v2 schema events on the same lock (Lock 3) - Verify ingest handles mixed event streams without double counting or state corruption - Prove identical database state when replayed multiple times across varying batch sizes (1, 4, 100) - Add stop-on-unknown coverage verifying schema_version 0 and 99 halt ingest immediately with UnsupportedEventError - Add missing schema_version coverage verifying DecodeError triggers atomic batch rollback - Update ROADMAP.md row statuses and changelog entry
10 tasks
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.
What and why
Implements test coverage and fixtures for indexer mixed schema_version event streams and stop-on-unknown error behavior per Roadmap rows M2-10 and M2-14 (Closes #34). Proves that the indexer gracefully processes interleaved event versions without double counting, reproduces identical state on replay, and halts with full batch rollback when encountering unknown versions or missing version tags.
Changes
services/indexer/src/handlers/lock-created.ts: ExportedlockCreatedV2forward-compatible handler stub.services/indexer/src/handlers/released.ts: ExportedreleasedV2forward-compatible handler stub.services/indexer/src/handlers/index.ts: RegisteredlockCreatedV2andreleasedV2under version 2 inHANDLERS.services/indexer/test/fixtures/events/mixed-versions.json: Generated 15-event fixture interleaving v1 and v2 events, specifically covering Lock 3 created with v2 and released across v2 and v1 tranches.services/indexer/test/helpers/fixtures.ts: ExportedmixedFixtureandmixedFixtureLocksloader helpers.services/indexer/test/ingest.test.ts: Added suitedescribe("ingest: mixed schema_versions (v1 + v2) and stop-on-unknown (M2-10, M2-14)"):Lock 3markedCompleted).schema_version(0, 99) halts immediately withUnsupportedEventErrorand rolls back without dirty writes.schema_versionhalts immediately withDecodeErrorand rolls back cursor and events.ROADMAP.md: UpdatedM2-10andM2-14toDONE, refreshed Phase 3 (76%) and overall (41%) progress snapshots, and added Section 17 Changelog entry.Hard rules / invariants touched
schema_versionrather than silently skip or discard.chain_eventsintegrity).Tests
Commands executed locally and verified all green:
pnpm test(vitest run):Test Files: 15 passed (15)
Tests: 171 passed (171)
pnpm typecheck(tsc --noEmit): Scope 2 of 3 packages clean (0 errors)pnpm lint(biome check .): Checked 74 files, 0 errorspnpm build(tsc -p tsconfig.json): All packages build cleanDocs / ADR
ROADMAP.md: Updated Section 3 Progress snapshot and Section 17 Changelog; row status updated.Roadmap
M2-10(DONE),M2-14(DONE).Assumptions and open questions
None. No business logic in existing v1 handlers was modified, and zero migrations or core SDK code touched.