os-sdlc: test-discipline lint gate after test-writer + correction loop #340

Open
opened 2026-08-11 14:40:59 +00:00 by jared · 1 comment
Owner

Add a post-test-writer lint gate enforcing Sandi Metz test discipline (POODR ch.9), plus a mechanical correction loop.

Deterministic cops (start cops-only, measure before adding an AI judge tier):

  • Privates untested: flag send(:...), __send__, instance_variable_get/set on the class under test; reopening the class under test in a test file.
  • Mock-budget: stub/mock count per test above a threshold.
  • Testing the mock: stubbing a message then asserting that same stubbed message's return.
  • Verifying a query: an expectation whose stub only supplies a return value with no side effect asserted (proxy for "mocked an outgoing query").

Not deterministic (deferred): command-vs-query classification ("should have been ignored, not mocked") — needs side-effect knowledge; candidate for a closed-catalog Tier-2 judge later, os-aidd-lint style.

Correction loop: failing lints produce a mechanical correction list routed back to test-writer (the only role allowed to edit tests). Routing lives in the stepper map (lib/os_sdlc/runner/transition_table.rb) as data, per ADR-0097 — never in skill prose. The red gate re-runs automatically because it is a post-agent hook on test-writer, so a corrected suite is re-verified to fail for the original reason for free.

Blocked by #327 (base stepper must be complete first).

Planned additional transitions

Once this gate is complete, the following transitions will be added to the stepper (routing lives in lib/os_sdlc/runner/transition_table.rb as data, per ADR-0097):

  1. test-writer → test-lint gate → correction loop back to test-writer — failing lints route back to test-writer for mechanical correction
  2. reviewer → mechanical transform list → code-write → re-lint → close — judgment items still fail with verdict to code-probe

Details tracked in the code-review skill and ADR-0097.

Add a post-test-writer lint gate enforcing Sandi Metz test discipline (POODR ch.9), plus a mechanical correction loop. **Deterministic cops (start cops-only, measure before adding an AI judge tier):** - Privates untested: flag `send(:...)`, `__send__`, `instance_variable_get/set` on the class under test; reopening the class under test in a test file. - Mock-budget: stub/mock count per test above a threshold. - Testing the mock: stubbing a message then asserting that same stubbed message's return. - Verifying a query: an expectation whose stub only supplies a return value with no side effect asserted (proxy for "mocked an outgoing query"). **Not deterministic (deferred):** command-vs-query classification ("should have been ignored, not mocked") — needs side-effect knowledge; candidate for a closed-catalog Tier-2 judge later, os-aidd-lint style. **Correction loop:** failing lints produce a mechanical correction list routed back to test-writer (the only role allowed to edit tests). Routing lives in the stepper map (`lib/os_sdlc/runner/transition_table.rb`) as data, per ADR-0097 — never in skill prose. The red gate re-runs automatically because it is a post-agent hook on test-writer, so a corrected suite is re-verified to fail for the original reason for free. Blocked by #327 (base stepper must be complete first). ## Planned additional transitions Once this gate is complete, the following transitions will be added to the stepper (routing lives in `lib/os_sdlc/runner/transition_table.rb` as data, per ADR-0097): 1. **test-writer → test-lint gate → correction loop back to test-writer** — failing lints route back to test-writer for mechanical correction 2. **reviewer → mechanical transform list → code-write → re-lint → close** — judgment items still fail with verdict to code-probe Details tracked in the code-review skill and ADR-0097.
Author
Owner

Frozen in the 2026-08-16 backlog reset — see #419 for the expiry procedure. Do not work unless a live run rediscovers this issue.

Frozen in the 2026-08-16 backlog reset — see #419 for the expiry procedure. Do not work unless a live run rediscovers this issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#340
No description provided.