Read the git-stage gate before archive moves the file it lives in - #188
Merged
Merged
Conversation
shouldRunGitStage reads openspec/changes/<name>/harness.json, and it ran after the archive stage had moved that directory to openspec/changes/archive/. The read therefore always found nothing, always resolved to "not configured", and the git stage was always skipped. It could never have run at the end of a real chain, under any configuration. The unit tests could not see it because mockArchiveSucceeds only returned success - nothing moved, so the file was still there when the gate read it. A mock that reports success without doing what success does certifies the wrong thing. The mock now performs the move, and the gate is read immediately before archive runs, which is the last moment the file exists. Verified by reverting the source fix and re-running: the test fails with zero push calls and passes with the fix. Checked deliberately, because two tests found earlier today passed no matter what the code did. A side effect worth naming: a malformed harness.json now fails the chain before archive rather than after, which is the better order for an irreversible step. This sat exactly inside the boundary drawn yesterday in task 4.4a. The live run recorded under 4.4 verified push, pull request, checks and merge through the real git and gh; it did not verify the chain's own wiring, and that is where the defect was. Also in this commit, two corrections to things I wrote. harness-config.test.ts matched fenced JSON blocks with a bare \n. On Windows HARNESS.md is checked out CRLF - 500 pairs, no bare LF - so the pattern found zero blocks and the assertion failed, while CI's Linux checkout found both and passed. Green in CI and red on the machine of whoever edits the document is the worst of the two, and it is the third line-ending or path-separator assumption found in tests today. core-test-worker-contention said a single fork makes git.push.test.ts pass. A full packages/core run with that flag still fails it at the 5000 ms default, so "parallel workers contend" is too narrow: something accumulates over a long run regardless. The two-file experiment behind that claim was too small to see it, and the proposal now says so - its first task is to name the cause rather than to apply the workaround. harness-mechanical-checks 6.6 is closed by the repository owner's own live run, recorded in that change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
The defect
shouldRunGitStagereadsopenspec/changes/<name>/harness.json, and it ran after thearchivestage had moved that directory toopenspec/changes/archive/.So the read always found nothing, always resolved to "not configured", and the
gitstage was always skipped. It could never have run at the end of a real chain, under any configuration.The unit tests could not see it because
mockArchiveSucceedsonly returned success — nothing moved, so the file was still there when the gate read it. A mock that reports success without doing what success does certifies the wrong thing.The fix
Read the gate immediately before
archiveruns — the last moment the file exists — and make the archive mock perform the move.Verified by reverting the source fix and re-running:
Zero push calls without the fix; passes with it. Checked deliberately, because two tests found earlier today passed no matter what the code did.
A side effect worth naming: a malformed
harness.jsonnow fails the chain beforearchiverather than after — the better order for an irreversible step.This sat exactly inside the boundary drawn in task 4.4a. The live run recorded under 4.4 verified push, pull request, checks and merge through the real
gitandgh; it explicitly did not verify the chain's own wiring, and that is where the defect was.Two corrections to things I wrote
harness-config.test.tsmatched fenced JSON blocks with a bare\n. On WindowsHARNESS.mdis checked out CRLF — 500 pairs, no bare LF — so the pattern found zero blocks and the assertion failed, while CI's Linux checkout found both and passed.Green in CI and red on the machine of whoever edits the document is the worst of the two combinations, and this is the third line-ending or path-separator assumption found in tests today.
core-test-worker-contentionsaid a single fork makesgit.push.test.tspass. A fullpackages/corerun with that flag still fails it at the 5000 ms default. So "parallel workers contend" is too narrow — something accumulates over a long run regardless of a second worker. The two-file experiment behind that claim was too small to see it; the proposal now says so, and its first task is to name the cause rather than apply the workaround.Also
harness-mechanical-checks6.6 is closed by the repository owner's own live run: a chain on a change whose task declared`check(path-unchanged, README.md)`with a deliberate uncommitted edit reported the failing check by name, made zero agent calls, and cleared the checkbox; restoring the file and re-running marked it with no agent having claimed it.agentic-harness-documentation/tasks.mdis deliberately not in this PR — 6.7 and 3.4 are being worked on separately as this lands.Test plan
harness-chain-runner.test.ts— 36/36harness-config.test.ts— 87/87 (was 86/87 on Windows)npm run typecheck,npm run lint— cleanopenspec change validate --strict— valid🤖 Generated with Claude Code