Skip to content

fix(han-coding): gate out-of-scope production changes in tdd and automated-test-planning - #191

Merged
mxriverlynn merged 1 commit into
v5.4.0-betafrom
fix/188-tdd-scope-gate
Aug 20, 2026
Merged

fix(han-coding): gate out-of-scope production changes in tdd and automated-test-planning#191
mxriverlynn merged 1 commit into
v5.4.0-betafrom
fix/188-tdd-scope-gate

Conversation

@mxriverlynn

Copy link
Copy Markdown
Collaborator

Closes #188.

The defect

An honestly-evidenced finding at CRIT could walk a production change into a build that never authorized it.

In automated-test-planning, every adversarial-security-analyst item lands at CRIT. One such item's own text said the test "requires first adding an explicit order" — a production change to shared code, packaged as a test to write. Nothing asked whether that change belonged to the ticket.

In tdd, the item entered the behavior list carrying that CRIT label, which the YAGNI gate read as evidence. The test went red exactly as designed, the observed-failure gate was satisfied mechanically, and green arrived by editing a model in a shared Rails engine that every application in the monorepo consumes. The red was genuine. Nobody checked whether the test deserved to exist in that build.

What changed

tdd gains a scope gate

The observed-failure gate proves a red is real. It does not prove this build owns producing the missing behavior. The scope gate is its companion, wired at four points:

  1. Step 1 records a scope boundary in files and directories. Inside: the files the request names plus their tests. Outside: shared libraries, engines, packages, anything a second consumer also uses, and code another team owns per CODEOWNERS. When the request names no files, the boundary is the application the behavior lives in, with its dependencies outside.
  2. Step 2 tests every list item against it, hardest on items arriving from a test plan or agent finding with a severity label. A three-rung resolution ladder handles the ones that trip: redesign the test so it does not need the out-of-scope behavior; defer the item as its own ticket with the file and its consumers named; escalate only when the requested behavior cannot be delivered without the change.
  3. The Red phase names the files green would touch before touching any of them.
  4. Step 5 reports what the gate moved and which rung resolved it.

references/failure-modes.md documents this as failure mode 10, including how it compounds: a later test leans on the new behavior for a deterministic fixture, so the out-of-scope change becomes load-bearing for work that could have arranged its own setup. Rung 1 catches that case explicitly.

automated-test-planning gains a prerequisite sweep

A new Step 3 sweep, run before IDs and priorities are assigned, pulls any item that cannot be tested until shipped code changes first. Those leave the priority tiers for a Blocked by a Production Change section recording the change needed, the file that would carry it, and that file's other consumers, so a reader can see the blast radius and open a separate ticket.

The sweep applies to security items on the same terms as every other. The SEC classification rule now says so directly: CRIT ranks a finding's severity and says nothing about whose ticket the fix belongs to.

The blocked count sits in the Summary bullets rather than only in the Technical Reference, because the issue's own report noted that "the CRIT/HIGH labels got more attention than the caveats did."

Files

File Change
han-coding/skills/tdd/SKILL.md Scope-gate constraint, Step 1 boundary, Step 2 gate and ladder, Red-phase check, Step 5 reporting
han-coding/skills/tdd/references/failure-modes.md Failure mode 10, plus the closing check now covering both gates
han-coding/skills/automated-test-planning/SKILL.md Prerequisite sweep, SEC classification note, Step 4 section list
han-coding/skills/automated-test-planning/references/template.md Blocked by a Production Change section and Summary bullet
han-coding/docs/skills/tdd.md Scope gate in Key concepts, What you get back, and In more detail
han-coding/docs/skills/automated-test-planning.md Prerequisite sweep in Key concepts, What you get back, In more detail

Verification

npm run lint (13 hooks) and npm test (80 Bats assertions) both pass. tdd/SKILL.md is 285 lines and automated-test-planning/SKILL.md is 274, both well under the 500-line progressive-disclosure ceiling; the narrative failure-mode content went to references/, and the gate's conditional logic stayed in the SKILL body. No version bumped and no AskUserQuestion added to allowed-tools.

…mated-test-planning

An honestly-evidenced finding at CRIT could walk a production change into a
build that never authorized it. In automated-test-planning, a security item
whose own text named "first add an explicit order" landed in the plan as a
test to write. In tdd, the observed-failure gate confirmed the red was real,
and green arrived by editing a shared engine every application in the monorepo
consumes. Neither skill asked whether the test deserved to exist in that build.

tdd gains a scope gate as the observed-failure gate's companion. Step 1 records
a scope boundary in files and directories. Step 2 tests every list item against
it and works a three-rung resolution ladder when one trips: redesign the test,
defer the item as its own ticket, or escalate when the requested behavior
cannot be delivered without the change. The Red phase names the files green
would touch before touching any of them, and Step 5 reports what the gate
moved. failure-modes.md documents the failure as mode 10, including the way it
compounds when a later test leans on the new behavior for a deterministic
fixture.

automated-test-planning gains a prerequisite sweep before priorities are
assigned. An item that cannot be tested until shipped code changes leaves the
priority tiers for a Blocked by a Production Change section carrying the change,
the file, and the file's other consumers. The sweep runs over security items on
the same terms, because CRIT ranks a finding's severity and says nothing about
whose ticket the fix belongs to. The blocked count sits in the Summary bullets,
where a caveat beneath the Technical Reference would lose the attention contest
to a CRIT label above it.

Closes #188
@mxriverlynn
mxriverlynn marked this pull request as ready for review August 20, 2026 15:09
@mxriverlynn
mxriverlynn merged commit fce6cc3 into v5.4.0-beta Aug 20, 2026
2 checks passed
@mxriverlynn
mxriverlynn deleted the fix/188-tdd-scope-gate branch August 20, 2026 15:09
mxriverlynn added a commit that referenced this pull request Aug 20, 2026
collecting updates for a v5.4.0 release

* #184 
* #186 
* #189
* #190
* #191
* #192 
* misc documentation updates
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.

1 participant