keeper: validate round IDs before queue persistence - #181
Merged
karagozemin merged 1 commit intoJul 21, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements shared round ID validation/normalization for keeper queue operations so invalid IDs never get persisted and corrupted stores with invalid IDs are quarantined before any numeric sorting occurs.
Changes:
- Added a
normalizeRoundId()helper and applied it acrossKeeperStoreround operations (add/remove/update/get) and store loading. - Updated queue CLI
add/removeto validate IDs and return a concise non-zero error on invalid input. - Added unit tests for round ID normalization, invalid persistence prevention, corrupted-store backup behavior, and queue CLI subprocess behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| services/keeper/src/store.ts | Adds round ID normalization/validation and validates persisted store entries while loading. |
| services/keeper/src/store.test.ts | Adds tests covering normalization, rejection cases, persistence prevention, and corruption backup. |
| services/keeper/src/queue.ts | Validates CLI round IDs and exits non-zero with concise error output on failure. |
| services/keeper/src/queue-cli.test.ts | Adds subprocess test ensuring invalid CLI input doesn’t create a store file. |
| services/keeper/package.json | Includes the new queue CLI test in the keeper test script. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -38,7 +65,16 @@ export class KeeperStore { | |||
| if (!parsed.rounds || typeof parsed.rounds !== "object") { | |||
karagozemin
approved these changes
Jul 21, 2026
karagozemin
left a comment
Collaborator
There was a problem hiding this comment.
Round IDs are normalized before persistence and CLI use; keeper tests pass 68/68 and typecheck passes.
5 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.
Closes #173
Summary
Verification
pnpm keeper:test(68 passing)pnpm --filter @sub-rosa/keeper typecheck