test: checkpoint read/write and resume detection tests#262
Merged
snipcodeit merged 1 commit intomainfrom Mar 6, 2026
Merged
Conversation
Adds test/checkpoint.test.js (36 tests, 5 groups) covering all 4 checkpoint functions in lib/state.cjs via vitest ESM format: - updateCheckpoint(): null init, step_progress shallow merge, artifacts/ step_history append-only, resume full-replace, updated_at always set - detectCheckpoint(): null for missing/null/triage-only checkpoints; non-null for plan/execute/verify/pr steps - resumeFromCheckpoint(): all 6 documented action→resumeStage mappings; null/unknown action defaults to 'planning'; completedSteps from step_history - clearCheckpoint(): reset to null, cleared:true/false, atomic (no .tmp), preserves other state fields - Forward-compat: unknown top-level and step_progress fields preserved on read-modify-write round-trip Also adds vitest.config.js, test/setup.js, and vitest ^2.1.9 devDependency (same pattern as PR #250 branch) to enable the vitest test runner. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Mar 6, 2026
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.
Summary
test/checkpoint.test.jswith 36 tests across 5 describe groups covering all 4 checkpoint functions inlib/state.cjsupdateCheckpoint()merge semantics,detectCheckpoint()triage-only null returns,resumeFromCheckpoint()action→stage mapping,clearCheckpoint()reset, and forward-compat unknown-field preservationvitest.config.js,test/setup.js, andvitest ^2.1.9devDependency to support the vitest test runner (same pattern as PR Write integration tests for validate_and_load and state file lifecycle #250 / PR test: integration tests for validate_and_load and state lifecycle #261)Closes #251
Milestone Context
Changes
test/checkpoint.test.js— 36 vitest ESM tests, 5 groupstest/setup.js— global vitest setup with conditional mock loadingvitest.config.js— vitest config (node env, .test.js include, .test.cjs exclude)package.json— vitest ^2.1.9 devDependency; test/test:node/test:watch scriptsTest Coverage Detail
updateCheckpoint()merge semanticsdetectCheckpoint()null-return semanticsresumeFromCheckpoint()action→stage mappingclearCheckpoint()resetTest Plan
npx vitest run test/checkpoint.test.js— 36/36 pass, 0 failureslib/state.cjstest/*.test.cjsfilespackage-lock.jsonupdated for vitest dependency