feat: require a zero-error product typecheck and a test type-debt ratchet

Adds tsconfig.json (strict) over product code, fixes its remaining 90
diagnostics (type-only, interface corrections, and explicit narrowing),
and adds a typecheck job to the required free-tests aggregate running
bun run typecheck, the test-code ratchet (identity -> count baseline, fails
on new, repeated, or unlocked fixed diagnostics), and the lib/cso format
check. Reuses fixes from #2447 where they still applied.
This commit is contained in:
garrytan committed 2026-09-29 14:34:02 +00:00
1 parent 03e5911dba
commit 42e53413da
38 files changed
+1254 -62

No files matched your search

+11 -6
View File
@@ -516,8 +516,13 @@ function maybeSpawnPty(ws: any, session: PtySession): boolean {
return true;
}
interface TerminalAgentWsData {
cookie: string;
sessionId: string | null;
}
function buildServer(port: number) {
return Bun.serve({
return Bun.serve<TerminalAgentWsData>({
hostname: '127.0.0.1',
// #2314: allocated from the SAME fixed 10000-60000 scan range the main
// server uses (port-allocator.ts, decision 8) — never `port: 0`. Binding
@@ -695,8 +700,8 @@ function buildServer(port: number) {
* after `spawned: true` is a no-op.
*/
open(ws) {
const sessionId = (ws.data as any)?.sessionId ?? null;
const cookie = (ws.data as any)?.cookie || '';
const sessionId = ws.data?.sessionId ?? null;
const cookie = ws.data?.cookie || '';
// Commit 3 re-attach: if this sessionId already has a detached
// PtySession in sessionsById, REPLACE its liveWs ref and replay
@@ -770,9 +775,9 @@ function buildServer(port: number) {
proc: null,
cols: 80,
rows: 24,
cookie: (ws.data as any)?.cookie || '',
cookie: ws.data?.cookie || '',
liveWs: ws,
sessionId: (ws.data as any)?.sessionId ?? null,
sessionId: ws.data?.sessionId ?? null,
spawned: false,
pingInterval: null,
ringBuffer: [],
@@ -850,7 +855,7 @@ function buildServer(port: number) {
// Always drop the WS-keyed map entry and the per-attach
// attachToken — the attach grant was single-use.
sessions.delete(ws);
const cookie = (ws.data as any)?.cookie;
const cookie = ws.data?.cookie;
if (cookie) validTokens.delete(cookie);
// A reattach can replace liveWs before the old socket's close arrives.
// That stale callback must not retire the new socket, grant or child.