Skip to content

test: paired-negative tests for .claude/hooks/check-doc-authority.sh - #198

Merged
artyhoo merged 3 commits into
stagingfrom
test/m4-check-doc-authority
May 24, 2026
Merged

test: paired-negative tests for .claude/hooks/check-doc-authority.sh#198
artyhoo merged 3 commits into
stagingfrom
test/m4-check-doc-authority

Conversation

@artyhoo

@artyhoo artyhoo commented May 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds packages/core/hooks/check-doc-authority.test.ts — 8 vitest functional tests for the flagship PostToolUse edit-time gate (check-doc-authority.sh)
  • Wave 3 git.ts analog: this hook previously had 0 tests; now has a full paired-negative contract
  • Also fixes pre-existing principle 10 violation: 2026-05-23-ast-test-drop-honest-accounting.md was missing <!-- scope:... --> annotation (committed in a separate chore commit)

Test contract (8 tests)

# Test Expected
1 PAIRED-NEGATIVE: REQUIRED_HEADER_DOC without > **Authoritative for:** exit 1 + FAIL on stderr
2 PAIRED-POSITIVE: same file WITH header exit 0
3 off-path: non-required file inside repo exit 0
4 off-path: path outside repo entirely exit 0
5 off-path: empty stdin file_path exit 0
6 boundary: Authoritative for: in mid-prose (no blockquote) exit 1
7 boundary: marker inside fenced code block (stripped) exit 1
8 sanity: FIXTURE_REQUIRED_DOC is actually in REQUIRED_HEADER_DOCS pass

Mutation-sanity verified

Hook broken → 3 ❌ tests fail; hook restored → 8/8 pass.

Implementation notes

  • Reference pattern: check-hook-marker.test.ts (vitest + spawnSync + cwd=REPO_ROOT)
  • Isolation: writeFixtureOverRepoFile saves original content + restores in afterEach; never deletes required docs
  • FIXTURE_REQUIRED_DOC = '.claude/rules/doc-authority-hierarchy.md' (exists in worktree, is in REQUIRED_HEADER_DOCS)
  • cwd: REPO_ROOT in spawnSync — required so process.cwd() in 09-doc-authority-hierarchy.ts:168 resolves to repo root
  • Skips gracefully when jq unavailable (describe.skipIf(!JQ))

§1.7 Forward-check applied

  • No new capability: test additions for existing hook (check-doc-authority.sh) — not a capability commit per CLAUDE.md definition
  • Prior-art: skipped — test additions for existing capability escape hatch correct; warn-only flag from pre-push is expected and passes
  • doc-authority-hierarchy.md §2: test files explicitly exempt from authority headers
  • No production code changes; no lint rules, no principles modified

§1.7 Backward-check applied

  • Only files touched: packages/core/hooks/check-doc-authority.test.ts (new), docs/meta-factory/research-patches/2026-05-23-ast-test-drop-honest-accounting.md (scope annotation added)
  • No existing artifact superseded; all pre-existing principle tests still pass (17/17 passed in pre-push)
  • Pre-existing failures (hooks/pre-push.test.ts, principles/09-doc-authority-hierarchy.test.ts) were confirmed pre-existing before this branch — both caused by CLAUDE.md missing in the main repo's main branch at the time of worktree creation (CLAUDE.md was restored to worktree before push; pre-push passes)

artyhoo and others added 3 commits May 24, 2026 00:34
chore: resync staging→main (promote 38 PRs + 3 merge-commits)
Wave 3 git.ts analog — flagship edit-time gate previously had 0 tests.

❌ REQUIRED_HEADER_DOC (.claude/rules/doc-authority-hierarchy.md) edited
   without `> **Authoritative for:**` → exit 1 + FAIL on stderr
✅ same file WITH header → exit 0
✅ non-required file inside repo / path outside repo → off-path skip, exit 0
✅ boundary: mid-prose mention (no blockquote) → exit 1
✅ boundary: marker inside fenced code block (stripped) → exit 1
✅ empty stdin file_path → exit 0

Reference pattern: check-hook-marker.test.ts (vitest + spawnSync + cwd=REPO_ROOT).
Isolation: writeFixtureOverRepoFile saves/restores original content; never deletes.
Mutation-sanity verified: hook broken → 3 ❌ tests fail; hook restored → 8/8 pass.

Prior-art: skipped — test additions for existing capability, no new capability introduced (Track M.4.1 kickoff §3).
…ate)

2026-05-23-ast-test-drop-honest-accounting.md was present in the worktree
without the required <!-- scope:... --> on line 1, causing principle 10
pre-push check to fail.

Prior-art: skipped — structural annotation fix, no new capability.
@artyhoo
artyhoo enabled auto-merge (squash) May 24, 2026 11:23
@artyhoo
artyhoo merged commit 1e36267 into staging May 24, 2026
22 checks passed
artyhoo added a commit that referenced this pull request May 25, 2026
… detection) (#220)

Run `bash .claude/skills/meta-orchestrator/helpers/plan-currency-check.sh`
(L2 Stage 3 detection shipped in #217) → 88 UNTRACKED-N entries surfaced
between the 2026-05-22 reconciliation and origin/staging tip (#217). Map
each to an existing §0 / Track row by adding the PR number to its evidence
cell, or to a new §0 row for two umbrellas that landed in full since the
prior snapshot. Re-run helper → 0 UNTRACKED remaining.

Key changes:

- Snapshot date 2026-05-22 → 2026-05-25 (header + §0).
- N8 row: A-phase 🔲 → 🟡 — C1 SSOT-existence (#170), C2 kickoff
  T-enumeration floor (#174), C3 principle 13 §1.7 substance (#178),
  C4 delivery-channel marker (#177), activation #180. C5 + cost-levers
  remain gated on §5.3 utilisation trigger.
- Track M.1 / M.4 → DONE: M.1 codified T20 via #212 (with NB note —
  recommendation-laziness took the T20 slot, mutation-equivalence
  T-bump 20→21 still pending); M.4 6 paired-negative bash-hook tests
  shipped #195/#196/#197/#198/#199/#200.
- Two new §0 rows: Meta-orchestrator skill (Track P) — BUILD #186 +
  audit rounds #192/#193/#194/#201/#202 + UX refactor #203/#204/#205
  + planner-completeness #213/#214/#217 + §1.7 PR-body mandate #216;
  Recommendation-laziness discipline — R-phase #206/#207, benchmark
  #210, I-phase Sub-waves A/C/D #211/#212/#215.
- N7 row: + dogfood research-patch #135 / §4 demotion #166 / live-trial
  verified #171. N4b row: + design #136 / record #118.
- Infra paragraph: PR refs for I.1 follow-ups (#121/#123/#124/#125/
  #128/#130/#131/#143/#145/#146/#147/#148/#149/#172/#187), I.2
  (#139/#142/#154/#175), I.3 DN-4 (#126/#132/#133/#138/#140/#152/
  #159/#161/#162/#167).
- Track 2.3 (channel-earliness audit) → DONE 2026-05-23 (#181); removed
  from "What actually remains".
- Footer subsection: standalone work (#191 satellite-arch / #189
  guard-liveness / #173 storm-readiness / #176 §10 port / #182 cleanup),
  Wave 10 follow-ups (#110/#112/#113), plan-revision history (#108/
  #109/#153/#155/#157/#160/#164/#165/#168/#179/#185).

Verification:
- `bash .claude/skills/meta-orchestrator/helpers/plan-currency-check.sh
  | grep -c '^UNTRACKED'` → 0 (down from 88).
- `npx markdownlint-cli docs/meta-factory/wave-sequencing-plan.md`
  → no violations.
- `npx vitest run packages/core/skills/plan-currency-check.test.ts`
  → 14/14 passed.

Prior-art: skipped — chore, doc reconciliation only, no new capability
or rule introduced.
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