jsdoc typing round, phases 3-4: the clerk (tool/memory.mjs) and the SPA (web/) typed under strict -- row shapes local to their owners (the clerk's five tables in its header; the SPA's response envelopes in the new web/shapes.mjs, the server's shared shapes imported at their use sites: User, LogEvent, JobState, HttpError); the db boundary cast at every .get()/.all(), fail as @returns {never} so guard-narrowing works; web via a second tsconfig (tsconfig.web.json: DOM libs in their own program, node types riding along because shapes.mjs's Provider typedef pulls provider.mjs in), npm run typecheck runs both; every non-annotation delta audited onto a small intended list (COUNT(*) Number() wraps, impossible-path guards, ?? ''/?? undefined null-absorbers, the RewordOp reason fix -- the validator demands it, the reminder-find naming its tag); smoke 110/110 + restart + reminder + repo checks + a zero-console-error browser pass green; the typing round is complete

This commit is contained in:
2026-11-15 19:57:07 +00:00
parent f81b188ce1
commit 8d4a6b91df
22 changed files with 567 additions and 227 deletions
+46 -20
View File
@@ -91,16 +91,35 @@ memory the agent owes itself across sessions.
launch from the new path.
- The test scripts: `smoke.mjs` expects a CLEAN state/ plus a running
`--mock` server, prints its run ids, and leaves a temp token file
for `restart-check.mjs`; `check-reminder.mjs` takes a run id;
`check-repo.mjs` needs no server. Clean up state/ and the smoke
runs afterwards -- only the real runs stay. The type gate:
`npm.cmd run typecheck` (plain `npx.cmd tsc -p tsconfig.json`)
runs tsc as a no-emit checker over the JSDoc annotations --
dev-only tooling (typescript + @types/node in devDependencies,
node_modules gitignored); the runtime stays zero-dependency
(QUESTIONS #4 amended 2026-11-15). Server core is typed under
strict; the clerk (tool/memory.mjs) and web/ are phases to come --
widen tsconfig include as they land.
for `restart-check.mjs`; `check-reminder.mjs` takes a run id --
one whose NEWEST LOGGED session has GM turns (post-smoke that is
the fork lineage, e.g. the refork id in the token file; the source
run's newest logged session is the near-empty session 4, and
aiming it there fails on 0 reminders -- learned 2026-11-15);
`check-repo.mjs` needs no server. The smoke cannot run twice --
the second run dies on the dirty state (learned 2026-11-15): stop
the server, Remove-Item state/ and runs/, restart, run once. Clean
up state/ and the smoke runs afterwards -- only the real runs
stay. The type gate: `npm.cmd run typecheck` runs TWO no-emit
tsc passes over the JSDoc annotations -- `tsconfig.json` (server
+ tool, node types) and `tsconfig.web.json` (web/, DOM libs; node
types ride along because server/shapes.mjs's Provider typedef
pulls provider.mjs into the web program). Dev-only tooling
(typescript + @types/node in devDependencies, node_modules
gitignored); the runtime stays zero-dependency (QUESTIONS #4
amended 2026-11-15). All four phases are typed under strict:
server core, the clerk, and web/. Typing lessons (2026-11-15,
the round): assigning an any (api()/JSON.parse result) to a
`?T` variable does NOT strip the null -- declare the variable
plain `T` and let definite assignment carry the try/catch (the
catch returns); under the web program's DOM+node merge the
browser timers resolve to node's overloads, so annotate them
`?ReturnType<typeof setTimeout>` and `clearTimeout(x ??
undefined)`.
- A fresh git worktree has neither server.json (gitignored) nor
node_modules: copy server.json in from the main repo before the
mock server starts (it exits without one), and run npm.cmd
install before typecheck (2026-11-15, this worktree).
## State pointers
@@ -204,16 +223,23 @@ memory the agent owes itself across sessions.
RESOLVED BY PLAN (2026-11-15): the dormant-session rework kills
the autorestart, and during dormancy the latest log IS the
just-closed session; the replay default never needed to move.
- Active work: the entity round, the variant round, and the
dormant-session rework are BUILT (2026-11-15, uncommitted, awaiting
the GM's eye). **The rework is now SMOKE-PROVEN end to end
(2026-11-15, evening): smoke 105/105, restart-check, check-reminder,
check-repo, and a full browser pass, all green; test state cleaned.
The Irene hand-migration is DONE the same sitting (fork proven end
to end, then real her mutated identically, reads green, zero writes
to her log -- see HANDOFF "Where we are"). Next: the op's one-time
first start under multiuser (HANDOFF step 2), then the first real
housekeeping pass (step 3).** Plan of record:
- Active work: the JSDoc typing round is COMPLETE (2026-11-15,
evening) -- all four phases. Phases 1-2 (the server core) are
committed (`f81b188`); phases 3 (the clerk) and 4 (web/, via the
second tsconfig) are done and land with this commit -- typecheck
green on both programs, smoke 110/110, restart-check on a genuine
restart, check-reminder, check-repo, and a full zero-console-error
browser pass over the SPA; test state cleaned. The audit lists of
non-annotation deltas live in HANDOFF ("Where we are"). Working
lessons from the rounds: in checkJs a JSDoc typedef sharing a
name with a runtime import conflicts (TS2440) -- the import
already carries the type, just use the imported name in
annotations; the any/null and DOM-timer lessons live in the type
gate bullet above. The earlier rounds (entity, variant,
dormant-session rework, Irene hand-migration) are all committed
and live in the git log; the next operational steps remain the
op's one-time first start under multiuser (HANDOFF step 1), then
the first real housekeeping pass (step 2). Plan of record:
HANDOFF ("The dormant-session rework"); status: HANDOFF ("Where we
are"). En-route fix flagged to the GM: the roll retirement had
missed bundle.mjs's tool list;