Files
krow_talent_app/MIGRATION_BASELINE.md
Aravind 1775395256 chore(ts-migration): establish TypeScript migration checkpoint
Phases 0-3 of the JS/JSX -> TS/TSX migration. No runtime behaviour changes:
every converted file emits byte-identical JavaScript, verified file by file.

Phase 0 - harness hardening, before any rename:
  - scripts/ssr-resolve.mjs wraps `ssrLoadModule` so the ~170 literal module
    paths in the check scripts resolve .js/.jsx/.ts/.tsx. Without it the first
    rename would have silently destroyed the 1642-check suite that guards the
    Owliver flow.
  - eslint.config.js gains a TypeScript block. Its `files` globs listed only
    {js,mjs,cjs,jsx}, so a renamed file would have dropped out of the run while
    `eslint .` went on exiting 0 - the quietest failure mode available.
  - MIGRATION_BASELINE.md records the measured starting point, including the
    pre-existing seed-fixture failure and the already-broken standalone
    owliver-baseline.mjs, so neither is later mistaken for migration damage.

Phase 1 - tsconfig.json succeeds jsconfig.json, carrying every option across at
its old value. `types` moves from [] to ["vite/client"], which fixes the eight
import.meta errors; @types/node is deliberately excluded so setTimeout stays a
number in browser code. allowJs and checkJs stay on, strict stays off.

Phase 2 - src/types/{api,entities,user}.ts. Transport envelope, error shape,
the entity-name union (the same 18 names are written down twice today, in
httpClient and base44Client, with nothing checking they agree), and the user
record. Every field transcribed from the API contract, the migrations and the
/me projection in me.go - not inferred. Entity record shapes are deliberately
absent: derivable, but nothing consumes them yet.

Phase 3 - nine leaf utilities renamed to .ts with annotations added only where
they could be established from existing usage. Entity records are typed `any`
with a comment naming what they are, rather than a guessed interface.

Verified: tsc 64 errors (65 before; one pre-existing TS2559 genuinely fixed,
none introduced), lint unchanged at 0 errors, skill-check 1641/1642 with only
the known failure, Owliver baseline section 59/59 green, production build
succeeds with the API origin inlined.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HBG1wnuRfJKCstGB8Fekr8
2026-09-11 15:52:01 +05:30

6.2 KiB

TypeScript migration — baseline

The state of this repository immediately before the first source file was renamed, measured rather than assumed. Everything the migration does is checked against these numbers; a figure that moves without a phase claiming it is a regression.

Measured on 2026-09-11, on main with a clean tree, before any change in Milestone 1.

The numbers

Check Command Baseline
Types npm run typecheck FAILS — 71 errors across 27 files
Lint npm run lint PASSES, exit 0
Lint (with warnings) npx eslint . 289 problems — 0 errors, 289 warnings
Files linted npx eslint . --format json 302
Behaviour npm test 1641 / 1642 checks passed
Build npm run build succeeds
Owliver, via the suite npm test section 21 all green — schema, skills, routes, and per-context skills, suggestions, prompts and intent routing
Owliver, standalone node scripts/owliver-baseline.mjs FAILS — pre-existing, see below

The 71 type errors, by code

Code Count What it is
TS2339 38 Property does not exist on an inferred type
TS2741 9 Missing required prop in JSX
TS2353 9 Unknown property in an object literal
TS2345 6 Argument type mismatch
TS2554 2 Wrong argument count
TS2362 / TS2363 4 Arithmetic on a non-number
TS2739 / TS2559 / TS2349 3 Missing props / no common props / not callable

These are pre-existing. They were not introduced by the migration and the migration is not obliged to fix them; they are the backlog it has to avoid adding to. Six of them are import.meta errors that Phase 1 resolves as a side effect of configuring vite/client.

Note that npm run typecheck is not run by CI (.github/workflows/ci.yml runs lint, test, build and the seed check). That is how 71 errors accumulated without anyone seeing them. Wiring it in is the last phase of the migration, not the first — it cannot be a gate until it is green.

The standalone Owliver script is already broken

node scripts/owliver-baseline.mjs fails before any of this began — verified by stashing every change and running it on a clean main, where it fails identically. It is not caused by the migration.

Failed to scan for dependencies from entries:
  index.html
  scripts/__baseline__/activity-page.pre-migration.html
  … the other seven snapshots …
  ✘ [ERROR] The server is being restarted or closed. Request is outdated [plugin vite:dep-scan]
Owliver behaviour has DRIFTED from the baseline.

Two things are going on, and neither is a real drift. Vite's dependency scanner treats every *.html under the project root as an entry point, so the eight captured SSR snapshots in scripts/__baseline__/ are scanned as if they were pages of the app. The script then calls server.close() as soon as captureBaseline returns, while that scan is still running, and the scan reports that it was cancelled. The capture comes back incomplete and the comparison calls it drift.

The coverage itself is not lost. skill-check.mjs imports the same captureBaseline and the same BASELINE_PATH and asserts against them in section 21, and it does enough other work afterwards that the scan finishes. Run npm test and the whole section is green:

── Owliver behaviour baseline ──
[  ok  ] baseline schema matches — expected 1, got 1
[  ok  ] every skill that existed before the agent layer still registers — 23 kept, 1 added since
[  ok  ] every route that resolved before resolves the same way — 18 unchanged
[  ok  ] controlCenter: keeps every skill it had — 7 skill(s), unchanged
…per context: page key, skills, suggestions, prompts, intent routing

So npm test is the Owliver drift check for the duration of the migration, and the standalone script is a convenience wrapper that needs repairing on its own terms — excluding scripts/__baseline__ from the scan, or awaiting the optimizer before closing. That repair is not part of the migration: it changes a script's behaviour, and this milestone's whole claim is that it changed none.

The one failing check

1641/1642 checks passed

Failed:
  - the backend fixture is in step with this seed (stale — run `npm run seed:fixture`)

scripts/__baseline__ is intact and owliver-baseline.mjs matches; this is not an Owliver failure. seed/fixtures/seed.json in the sibling krow-backend checkout has drifted from src/api/seed.js.

This failure predates the migration and is unrelated to it. It is recorded here so that it is never mistaken for something the migration caused, and it is deliberately left alone — regenerating the fixture would write into another repository and change what the backend seeds, which is a product change wearing a migration's clothes. Fix it separately, on its own terms.

What "unchanged" means for the Owliver / agent flow

The agent flow is ~112 files and 38% of the codebase, and it is converted last, by rename and type annotation only. The evidence that it still behaves identically is already in the repository and needs nothing new:

  • npm test — 1642 checks covering skill discovery, routing, context resolution and SSR-rendered markup.
  • scripts/__baseline__/owliver-baseline.json — contexts, skill ids and routes.
  • scripts/__baseline__/*.pre-migration.html — eight pages of byte-level SSR output.
  • node scripts/owliver-baseline.mjs — the drift check.
  • CI's FLOOR = 900 — fails if the suite silently shrinks.

These artifacts are read-only for the duration of the migration. If the baseline drifts, revert the change. Regenerating it to clear a red check records the regression instead of catching it, which is worse than having no baseline — owliver-baseline.mjs says as much in its own header.

src/agents/**/*.md and src/skills/**/*.md are likewise untouched throughout: they are the definitions the flow is built from, not code being migrated.

How to re-measure

npm run typecheck; echo "exit=$?"
npm run typecheck 2>&1 | grep -c "error TS"
npm run lint; echo "exit=$?"
npx eslint . --format json | python3 -c "import json,sys;print(len(json.load(sys.stdin)))"
npm test
node scripts/owliver-baseline.mjs
npm run build
git diff --stat -M