Skip to content

test: fix 3 typecheck failures blocking all PR merges (PKT-565) - #456

Merged
bugsyhewitt merged 1 commit into
mainfrom
fix/565-typescript-typecheck-failures-on-existing-test-code
Aug 8, 2026
Merged

test: fix 3 typecheck failures blocking all PR merges (PKT-565)#456
bugsyhewitt merged 1 commit into
mainfrom
fix/565-typescript-typecheck-failures-on-existing-test-code

Conversation

@bugsyhewitt

Copy link
Copy Markdown
Owner

Summary

Fixes 3 pre-existing TypeScript typecheck errors on main that are causing the TypeScript typecheck CI gate to fail on every open PR. Zero production code changes.

Blocked PRs unblocked by this fix: 30+ open PRs with auto-merge-ok label, including #418#448.

Defects fixed

Defect 1 (TS2769) — governance-loop-handleJobFailed-legacy.test.ts lines 191, 238
([state]: [string]) => in a .filter() callback fails TypeScript 7.x because any[] (the inferred type of mock.calls elements) is not assignable to [string] (a 1-tuple). Fixed by moving the tuple annotation inside the body as a cast:

// before
(call): boolean => { const [state] = call as [string]; return state === 'AWAITING_ADVICE'; }

Defect 2 (TS2345) — hierarchy-bootstrap-online-fitness.test.ts line 153
The getRegistry mock was missing bestForTool and size (added to RegistryStore after this test was authored in PKT-295). RegistryStore has private store/toolIndex fields so an object literal cannot satisfy it structurally — the fix adds the missing public members and uses as unknown as ReturnType<typeof getRegistry>, the only correct pattern for class types with private fields.

Defect 3 (TS2345) — test/utils.test.ts:200
Only existed in a dirty working tree from prior cycles; not present on clean main. Not applicable to this branch.

Evidence

  • Baseline: pnpm exec tsc --noEmit exits 1 with 3 errors on clean main
  • After fix: exits 0, no output
  • Vitest: 138 test files, 2188/2234 tests passed (46 skipped) — unchanged
  • Binding review: APPROVED by alienclaw-architect (no blocking items)

Refs

🤖 Generated with Claude Code

Defect 1 (TS2769): mock.calls.filter with destructured tuple annotation
([state]: [string]) fails TypeScript 7.x because any[] is not assignable
to [string]. Replace with explicit call parameter and inline cast.

Defect 2 (TS2345): getRegistry mock missing bestForTool/size members added
since PKT-295. RegistryStore has private fields so use as unknown cast.

Defect 3 (test/utils.test.ts:200) was only in a dirty working tree from
prior cycles and does not exist on clean main — not applicable here.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bugsyhewitt bugsyhewitt added the auto-merge-ok Binding review passed + ship-gate green — cleared for auto-merge label Aug 8, 2026
@bugsyhewitt
bugsyhewitt merged commit fb7d963 into main Aug 8, 2026
7 checks passed
@bugsyhewitt
bugsyhewitt deleted the fix/565-typescript-typecheck-failures-on-existing-test-code branch August 8, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-ok Binding review passed + ship-gate green — cleared for auto-merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant