diff --git a/review/specialists/testing.md b/review/specialists/testing.md index 475ebfb4c..743dde892 100644 --- a/review/specialists/testing.md +++ b/review/specialists/testing.md @@ -58,6 +58,17 @@ red tests. Unit tests suit logic; real integration/E2E tests protect boundaries - Unicode and special characters in user-facing inputs - Concurrent access patterns with no race-condition test +### Negative Assertions +- A new assertion that something is absent (`not.toContain`, `not in`, `assertNotIn`, + `pytest.raises` on a call that used to succeed) records a behavior removal, not coverage. + Cite the spec line, plan item or PR text that authorizes the removal; with none, report it + as a product decision shipped as a test. +- A rename or removal in this diff can empty a standing negative assertion: a test asserting + the old token is absent now passes forever and guards nothing. For each identifier, flag, + heading or string the diff renames or deletes, grep the test suite for negative assertions + naming the old value, including inside tests that assert something else, and report each + as a coverage gap whose fix names the new value. + ### Test Isolation Violations - Tests sharing mutable state (class variables, global singletons, DB records not cleaned up) - Order-dependent tests (pass in sequence, fail when randomized) diff --git a/test/review-workflow-clarity.test.ts b/test/review-workflow-clarity.test.ts index bf46bc7aa..c267b58d4 100644 --- a/test/review-workflow-clarity.test.ts +++ b/test/review-workflow-clarity.test.ts @@ -7,7 +7,7 @@ import { generatePlanCompletionAuditReview, generatePlanCompletionAuditShip, gen import { generateQAReview } from '../scripts/resolvers/qa'; import { generateConfidenceCalibration } from '../scripts/resolvers/confidence'; import { HOST_PATHS, type TemplateContext } from '../scripts/resolvers/types'; -import { expectMentions } from './helpers/prompt-structure'; +import { between, compact, expectMentions, expectTokens } from './helpers/prompt-structure'; const root = join(import.meta.dir, '..'); const skill = readFileSync(join(root, 'review/SKILL.md.tmpl'), 'utf8'); @@ -466,3 +466,14 @@ test('ship and review count unverified or unavailable outside reviews as missing expect(read(rel)).toMatch(/`unverified` or `unavailable` is (listed as )?missing coverage[^.]*never (as )?(a )?pass/i); } }); + +test('testing specialist treats negative assertions as decisions and catches ones a rename emptied', () => { + const specialist = between(readFileSync(join(root, 'review/specialists/testing.md'), 'utf8'), '### Negative Assertions', '\n### '); + expectTokens(specialist, ['not.toContain', 'assertNotIn'], 'testing specialist'); + expectMentions(compact(specialist), [ + ['new', 'absent', 'removal', 'not coverage'], + ['authorizes', 'removal'], + ['rename', 'negative assertion', 'passes forever'], + ['grep', 'negative assertions', 'old value'], + ], 'testing specialist'); +});