Code health receipts

September 7, 2026 ยท View on GitHub

Kody is a source-available codebase written almost entirely by AI agents. Instead of asking readers to take code quality on faith, this page records the measured numbers and the enforcement that keeps them from regressing. All figures below were measured directly against the repository (2026-08-30).

Measured baseline

SignalValue
as any casts in packages/1
TODO comments in packages/0
@ts-expect-error suppressions in packages/1
Duplicated lines (jscpd, min 70 tokens, non-test source)1.96%
Runtime dependencies of the main worker package28
Decision records in docs/contributing/decisions/45
Checks in the npm run validate gate23

Enforcement, not promises

  • npm run validate is the single authoritative gate: format, lint, typecheck, node/workers/e2e/mcp test suites, build checks for every worker, migrations, deploy guardrails, temporal-docs and decision-record checks, the file-size ratchet, and knip dead-code analysis.
  • tools/file-size-ratchet.json enforces budgets of 800 lines for client routes and 2,000 lines for node test files. Files may only shrink out of the grandfathered list; new oversized files fail CI.
  • knip fails the gate on unused files, exports, and types.
  • tools/check-decorative-banners.ts rejects decorative comment banners.

Oversized-file cleanup receipts

Every grandfathered file over budget was split along behavior boundaries with no runtime or assertion changes, and its ratchet exception removed in the same PR. The ratchet covers each of those files.

Client routes (budget: 800 lines)

RouteBeforeAfterPR
connect-oauth.tsx2,192795#1852
account-integrations.tsx2,167581#1851
onboarding.tsx1,628713#1853
account-secrets.tsx1,610777#1854
community-detail.tsx1,490800#1865
onboarding-mcp-client-tabs.tsx1,477556#1869
account.tsx1,440791#1855
admin-users.tsx1,435784#1866
login.tsx1,335773#1870
admin-insights.tsx1,289134#1871
account-mcp-servers.tsx1,251598#1858
account-jobs.tsx1,146554#1872
admin-codemods.tsx1,100789#1875
admin-platform-integrations.tsx1,098565#1877
account-activity.tsx954516#1878
account-email.tsx891487#1861
record-table.tsx (shared table module)837586#1863
home.tsx808562#1857

Extraction pattern: routes keep loader consumption, mutations, and lifecycle orchestration; extracted modules are render-only sections/forms/detail panels plus shared URL/filter helpers.

Node test suites (budget: 2,000 lines)

SuiteBeforeAfter (entrypoints)PR
jobs/service.node.test.ts5,5965 workflow suites, 723โ€“1,286 each#1864
package-runtime/module-graph.node.test.ts3,093990 + 1,161 + 892#1879
mcp/run-kody-registry.node.test.ts2,8891,039 + 1,305#1880
package-invocations/service.node.test.ts2,8571,212 + 820#1881
repo/repo-session-do.node.test.ts2,7641,288 + 1,193#1882
package-runtime/package-workflows.node.test.ts2,534999 + 1,239#1883
app/account-deletion.node.test.ts2,2341,110 + 615#1884
account/export.node.test.ts2,147771 + 1,234#1885

Every split preserved every test and assertion (verified by matching test counts before and after), moved reusable fixtures to packages/worker/src/test-support/, and kept vi.mock wiring file-local because Vitest hoists mocks per test file. No production code changed.

What was intentionally not done

  • No Durable Object rewrites: large DOs are frozen by the ratchet and shrink opportunistically.
  • No test behavior changes: splits reorganize, never weaken, coverage.
  • No suppression sweeps: the near-zero as any/TODO counts are the actual state of the tree, not a lint-ignore artifact.