Skip to content

keeper: validate round IDs before queue persistence - #181

Merged
karagozemin merged 1 commit into
Sub-Rosa-Issue:mainfrom
emrekayat:emrekayat/issue-173-keeper-round-ids
Jul 21, 2026
Merged

keeper: validate round IDs before queue persistence#181
karagozemin merged 1 commit into
Sub-Rosa-Issue:mainfrom
emrekayat:emrekayat/issue-173-keeper-round-ids

Conversation

@emrekayat

Copy link
Copy Markdown

Closes #173

Summary

  • normalize positive round IDs across keeper store operations
  • reject zero, negative, fractional, unsafe, empty, and non-numeric values
  • quarantine persisted stores containing invalid round IDs before sorting
  • return a concise non-zero CLI error without creating a store file
  • add store and subprocess CLI coverage

Verification

  • pnpm keeper:test (68 passing)
  • pnpm --filter @sub-rosa/keeper typecheck

Copilot AI review requested due to automatic review settings July 21, 2026 13:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 across KeeperStore round operations (add/remove/update/get) and store loading.
  • Updated queue CLI add/remove to 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 karagozemin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round IDs are normalized before persistence and CLI use; keeper tests pass 68/68 and typecheck passes.

@karagozemin
karagozemin merged commit 540dbfe into Sub-Rosa-Issue:main Jul 21, 2026
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.

keeper: validate round IDs before queue persistence

3 participants