fix(requirements): stop review-test self-reinforcing loop (Closes #182) - #186
Merged
Conversation
3 tasks
Owner
Author
Superintendentによるレビュー(PR #186, Issue #182)
差分の内容確認
懸念点
推奨実装の正確性・テストカバレッジともに良好で、Issueの受け入れ条件を満たしています。人間による承認後のマージを推奨します。マージ時はREQ-015番号衝突の解消をお願いします。 |
This was referenced Jul 28, 2026
#182) The reconcile sweep hashed the entire requirement block, including the 実装状況 (implementation status) field. Resolving a review-test issue writes findings into that field, which changed the hash and made the next sweep think the requirement text had changed again — a self-reinforcing loop with zero real regression detections. Hash is now computed only from AcceptanceCriteria and Verify (the actual spec), via specHash. HashStore gained a scheme version (HashSchemeVersion) so upgrading doesn't cause every requirement to look "changed" at once: a version mismatch is treated as "no change" for one sweep, hashes are just recomputed and persisted under the new scheme. Also fixed a related gap where flipping verify: test<->manual never triggered review-test, since the manual short-circuit ran before the hash comparison. Assumption: HashSchemeVersion starts at 2 (implicit prior scheme is 1), and legacy on-disk hash files with no version envelope are treated as version 0 so they go through the same migration path.
ytnobody
force-pushed
the
hermit/ytnobody/issue-182
branch
from
July 28, 2026 02:52
bf11c52 to
e9ab359
Compare
Owner
Author
|
|
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
review-testwas re-firing forever becauseRequirement.Hashwas computed from the entire requirement block, which includes the- 実装状況:(implementation status) field. Resolving areview-testissue means writing findings into実装状況, which changed the hash and made the next sweep think the requirement text had changed again — a closed self-reinforcing loop with zero real regression detections.Requirement.Hashis now computed only fromAcceptanceCriteriaandVerifyvia a newspecHashfunction (internal/requirements/requirements.go), excluding the header title, free-form description, and実装状況.HashStore(internal/requirements/hashstore.go) now carries aHashSchemeVersion(currently2).Sweep(internal/requirements/sweep.go) treats a stored-version mismatch as "no change" for one sweep — it recomputes and persists hashes under the current scheme without firingreview-testfor the whole document, per the Issue's migration requirement. Pre-review-test が自己増殖する — ハッシュ対象に実装状況が含まれ、解決作業自体が次の発火を確定させる #182 on-disk hash files (a bare map, no version envelope) are detected and treated as version0so they go through the same migration path.verify: test↔manualnever triggeredreview-test, because theverify:manualshort-circuit ran before the hash comparison. Hash comparison (and the resultingreview-testissue) now happens first; the manual short-circuit only skips test execution and implement/regression issue logic.Assumptions (documented per Human Input Policy — no ambiguity was escalated to chat)
HashSchemeVersionstarts at2(implicit prior/unversioned scheme is1); legacy on-disk files with noversionenvelope are parsed as version0so they're always treated as "old scheme" regardless of exact prior value.HashStore.Load/Savesignatures changed toLoad() (version int, hashes map[string]string, err error)/Save(version int, hashes map[string]string) error. This is an internal-package interface (HashStore,FileHashStore,memHashStoreare all withininternal/requirements), so no external API surface is affected.Test plan
go test ./...passesgo vet ./...passes,gofmt -l .cleanTestSweep_ImplementationStatusOnlyChange_DoesNotFireReviewTestreproduces the exact review-test が自己増殖する — ハッシュ対象に実装状況が含まれ、解決作業自体が次の発火を確定させる #182 loop scenario (baseline sweep, then a sweep where only実装状況was added) and assertsreview-testdoes not re-fireTestSweep_HashSchemeMigration_DoesNotFireReviewTest_JustRecomputesAndSavesverifies the version-mismatch migration path fires no issues and persists hashes under the current schemerequirements_test.go:TestParse_HashUnaffectedByImplementationStatusField,TestParse_HashUnaffectedByTitleOrDescriptionOnly,TestParse_HashChangesWithVerifyModeTestREQ016_ReviewTestHashIgnoresImplementationStatusadded per REQ-ID naming convention (internal/requirements/sweep_test.go), matchestest_command's^TestREQ016pattern, and covers every clause of REQ-016's acceptance criteria end-to-endREQUIREMENTS.mdupdated with newREQ-016Closes #182