fix(enforce-tdd): stop the red step being blocked for not failing first - #52
Open
wazum wants to merge 1 commit into
Open
fix(enforce-tdd): stop the red step being blocked for not failing first#52wazum wants to merge 1 commit into
wazum wants to merge 1 commit into
Conversation
The red-phase rule that gates production code on a prior failing run was phrased with the test as its subject: "A test added to drive new behavior must be observed failing ... before production code may be written to satisfy it." Read on a diff that only adds a test, the leading clause matches and the trailing qualifier gets lost, so the validator blocks the very write that would create the test. The demand is impossible: the test cannot fail before it exists, and retrying reproduces the block, so the cycle deadlocks. The session shape that triggers it is a deletion followed by a green run (an obsolete test removed before its replacement is written). No failing run sits in the window and no completed red->green cycle anchors the judgment, so the misread has nothing to correct it. Rephrase the rule so its subject is the production write, and state the circular case explicitly: a test cannot fail before it exists, so "no failing run yet" is never a reason to block adding one. The gate on production code is unchanged. Replaying a captured hook payload 8 times per variant: 4/8 denied on the released prompt, 0/8 with only this bullet reworded. Adds an integration test pinning the case (new test written after a deletion, last run green). Closes nizos#51
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.
Fixes #51.
Problem
The red-phase rule that gates production code reads:
The subject is "A test added to drive new behavior". On a diff that only adds a
test, the leading clause matches and the trailing "before production code may be
written" gets lost, so the validator blocks the write that creates the test. That
is impossible to satisfy: the test cannot fail before it exists, and retrying
gives the same block, so the cycle deadlocks.
The trigger is a deletion followed by a green run (an obsolete test removed
before its replacement is written). No failing run is in the window, and no
completed red->green cycle anchors the judgment.
Change
Rephrase so the subject is the production write, and name the circular case:
The gate on production code is unchanged.
Evidence
Replaying a captured hook payload (same transcript window, same file before and
after), 8 runs per variant:
Tests
Adds an integration test pinning the case: an obsolete test is deleted, the suite
runs green, then one new test is added. Fixtures are generic (
renderBanner).npm run checkspasses. The AI suite passes, including the deny cases. Note therefactor-enforcement deny test is flaky independently of this change — 3/5 on
main and 4/5 with the change in my runs.
Because the misfire is probabilistic and current
mainalready allows thisscenario in my sampling, the new test pins the behavior rather than failing
before the change. Happy to reshape it if you'd prefer a different form.