Skip to content

chore(stub-debt): simplify gate to zero-tolerance and delete baseline — Bite C#2459

Merged
alexey-pelykh merged 1 commit intomainfrom
chore/2354-stub-debt-bite-c-simplify-gate
Apr 22, 2026
Merged

chore(stub-debt): simplify gate to zero-tolerance and delete baseline — Bite C#2459
alexey-pelykh merged 1 commit intomainfrom
chore/2354-stub-debt-bite-c-simplify-gate

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Summary

Bite C of the #2354 umbrella. Retires the .stub-debt-baseline file and flips the @ts-expect-error counter in scripts/check-stub-debt.mjs to zero-tolerance.

The H8 fork-boundary-mock counter (.fork-boundary-mock-baseline = 132) is unchanged — still baselined, still ratchetable.

Changes

File What
scripts/check-stub-debt.mjs Inline the H5 counter as zero-tolerance (was readBaseline + reportCounter). Helpers remain for H8 use. Docstring updated.
.stub-debt-baseline DELETED (last value was 0).
CLAUDE.md:121 Rewrote the stub-debt-gate bullet: zero-tolerance H5 + link to CONTRIBUTING.md § Fork-boundary mocks for H8 detail.
CONTRIBUTING.md:217 Row label: H8 stub-debt + fork-boundary-mock baselinesH5 stub-debt (strict) + H8 fork-boundary-mock (also corrects pre-existing H5-mislabeled-as-H8).
.github/workflows/sync-pr-audit.yml:116 Same row-label update; exit-code variable ${H8:-?} kept (intentional — internal naming, not user-visible).

The inline-for-H5 / helper-for-H8 asymmetry is intentional: the two counters are now fundamentally different patterns — H5 has no baseline, no ratchet, no "grew vs decreased" messaging; H8 still does. Forcing H5 through reportCounter would reintroduce the baseline-centric wording that Bite C is retiring.

Gate failure message

@ts-expect-error inventory (N total):

  src/foo.ts:42  // @ts-expect-error — ...

FAIL: stub-debt gate — N @ts-expect-error suppressions in src/, extensions/, or ui/.

The gate is zero-tolerance: @ts-expect-error is not allowed in
fork-owned or test code. Either:
  1. Fix the underlying type mismatch.
  2. Narrow with \`as unknown as T\` at the call site (see PR #2457,
     Bite A of #2354, for the cast pattern).
  3. Rework the mock scaffold to properly type the spy (see PR #2458,
     Bite B of #2354, for the \`vi.fn<Fn>()\` pattern).

Reference: ADR 0005 H5.

Verification

  • node scripts/check-stub-debt.mjsstub-debt check passed: 0 @ts-expect-error suppressions. + fork-boundary-mock check passed: 132 == baseline 132. (exit 0).
  • Failure probe (temp @ts-expect-error under src/) → inventory + remediation guide printed, exit 1.
  • pnpm check (format + tsgo + lint + lint:tmp + lint:no-remoteclaw-ai) → exit 0.
  • pnpm test (full unit+extensions+gateway suite) → 7010 passed / 3 skipped / 7013 total.
  • Rescan: git ls-files | xargs grep -l "\.stub-debt-baseline" → zero tracked references remain.
  • Adversarial validation (fresh-context subclaude): 5 AC + 13 adversarial checks PASS; 1 MINOR cross-repo finding (HQ ADR 0005 H5 addendum needed post-merge) tracked as follow-up, does not block this PR.

Test plan

  • node scripts/check-stub-debt.mjs exits 0 with zero suppressions + H8 inventory unchanged
  • Failure-path probe confirms exit 1 on any hit
  • pnpm check exit 0
  • pnpm test full suite green (7010 passed / 3 skipped)
  • No stale references to .stub-debt-baseline in tracked files
  • CI green on build, test, lint, docs, rebrand-gate, zombie-import-gate, stub-debt-gate (with simplified script), throwing-stub-callers-gate, obsolescence-audit-gate, attestation-gate

Context

Closes #2354

Refs: #2457, #2458, ADR 0005 H5

🤖 Generated with Claude Code

… — Bite C (#2354)

**Bite C** of the #2354 umbrella (drive stub-debt baseline to zero and
remove it). Bites A (#2457, baseline 12 → 6) and B (#2458, baseline 6 → 0)
drove the H5 `@ts-expect-error` count to zero across `src/`, `extensions/`,
and `ui/`. This PR retires the H5 baseline entirely and flips the gate to
zero-tolerance.

The H8 fork-boundary-mock counter (`.fork-boundary-mock-baseline = 132`)
is untouched — still baselined, still ratchetable.

Changes:
- `scripts/check-stub-debt.mjs`: inline the H5 counter as a zero-tolerance
  check (was baseline-gated via `readBaseline`+`reportCounter`). Any
  `@ts-expect-error` in a gated file fails the script with an inventory
  and a remediation pointer to Bite A (`as unknown as T` cast pattern,
  PR #2457) and Bite B (`vi.fn<Fn>()` typed-mock pattern, PR #2458). The
  H8 branch — `readBaseline` + `reportCounter` for `.fork-boundary-mock-baseline`
  — is byte-identical to pre-change; inline-for-H5 / helper-for-H8
  asymmetry is intentional since the two counters are now fundamentally
  different patterns.
- `.stub-debt-baseline`: DELETED (last value was `0`).
- `CLAUDE.md:121`: rewrote the `stub-debt-gate` bullet to reflect
  zero-tolerance H5 + link to `CONTRIBUTING.md § Fork-boundary mocks`
  for H8 detail.
- `CONTRIBUTING.md:217`: row label for the sync-pr-audit composite
  summary updated from `H8 stub-debt + fork-boundary-mock baselines`
  to `H5 stub-debt (strict) + H8 fork-boundary-mock` — also corrects
  pre-existing mislabel of H5 as H8. Script reference unchanged.
- `.github/workflows/sync-pr-audit.yml:116`: same row-label update;
  script invocation and exit-code variable `H8` intentionally unchanged
  to minimize churn.

Verification:
- `node scripts/check-stub-debt.mjs` → `stub-debt check passed: 0
  @ts-expect-error suppressions.` + `fork-boundary-mock check passed:
  132 == baseline 132.` (exit 0).
- Failure-path probe (temp `@ts-expect-error` under `src/`) →
  script prints inventory, remediation guide, and exits 1. Confirms
  the zero-tolerance branch.
- `pnpm check` (format + tsgo + lint + project-specific lints) →
  exit 0.
- `pnpm test` (full unit+extensions+gateway suite) → 7010 passed /
  3 skipped / 7013 total.
- Rescan: `git ls-files | xargs grep -l "\.stub-debt-baseline"` →
  zero hits. No stale references remain.
- Adversarial validation (fresh-context subclaude): 5 AC PASS +
  13 adversarial checks PASS; 1 MINOR cross-repo finding (HQ ADR
  0005 H5 staleness) tracked as post-merge HQ follow-up, does NOT
  block this PR.

Closes #2354

Refs: #2457, #2458, ADR 0005 H5

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alexey-pelykh alexey-pelykh merged commit f6434b4 into main Apr 22, 2026
15 checks passed
@alexey-pelykh alexey-pelykh deleted the chore/2354-stub-debt-bite-c-simplify-gate branch April 22, 2026 08:12
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.

chore(ci): drive stub debt baseline to zero and remove it fix(test): resolve 6 fork-stub typing mismatches in agent-runner e2e test

1 participant