chore(stub-debt): simplify gate to zero-tolerance and delete baseline — Bite C#2459
Merged
alexey-pelykh merged 1 commit intomainfrom Apr 22, 2026
Merged
Conversation
… — 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bite C of the #2354 umbrella. Retires the
.stub-debt-baselinefile and flips the@ts-expect-errorcounter inscripts/check-stub-debt.mjsto zero-tolerance.d75ea3da45): baseline 12 → 6 (non-fork-stub suppressions viaX as unknown as Tcasts).5ec00ef7e9): baseline 6 → 0 (fork-stub typing mismatches viavi.fn<Fn>()typed mocks,#2352closed).@ts-expect-errorinsrc/,extensions/, orui/.The H8 fork-boundary-mock counter (
.fork-boundary-mock-baseline = 132) is unchanged — still baselined, still ratchetable.Changes
scripts/check-stub-debt.mjsreadBaseline+reportCounter). Helpers remain for H8 use. Docstring updated..stub-debt-baseline0).CLAUDE.md:121stub-debt-gatebullet: zero-tolerance H5 + link toCONTRIBUTING.md § Fork-boundary mocksfor H8 detail.CONTRIBUTING.md:217H8 stub-debt + fork-boundary-mock baselines→H5 stub-debt (strict) + H8 fork-boundary-mock(also corrects pre-existing H5-mislabeled-as-H8)..github/workflows/sync-pr-audit.yml:116${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
reportCounterwould reintroduce the baseline-centric wording that Bite C is retiring.Gate failure message
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).@ts-expect-errorundersrc/) → 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.git ls-files | xargs grep -l "\.stub-debt-baseline"→ zero tracked references remain.Test plan
node scripts/check-stub-debt.mjsexits 0 with zero suppressions + H8 inventory unchangedpnpm checkexit 0pnpm testfull suite green (7010 passed / 3 skipped).stub-debt-baselinein tracked filesbuild,test,lint,docs,rebrand-gate,zombie-import-gate,stub-debt-gate(with simplified script),throwing-stub-callers-gate,obsolescence-audit-gate,attestation-gateContext
d75ea3da45(2026-04-21).5ec00ef7e9(2026-04-22, closed fix(test): resolve 6 fork-stub typing mismatches in agent-runner e2e test #2352).Closes #2354
Refs: #2457, #2458, ADR 0005 H5
🤖 Generated with Claude Code