Skip to content

harness/tsconfig.json excludes test, so harness test files are never typechecked #190

Closed

Description

@pdettori

Problem

harness/tsconfig.json has:

"include": ["src"]

so make typecheck and CI both typecheck harness/src and never harness/test. By contrast packages/k8s-sandbox/tsconfig.json has "include": ["src", "test"].

Why it matters, concretely

PR #188 added a required field (truncated) to the seam's ExecResult and leaned on "required, so a fourth implementation is a compile error" as a central design argument. That forcing function works in packages/ and does not reach harness/:

  • In packages/k8s-sandbox, tsc immediately flagged a hand-built fake in test/extension.test.ts, and it was fixed.
  • In harness/test, three SandboxTransport fakes silently kept compiling without the required field — two in run-leaf.test.ts and several in converge.test.ts. They passed only because undefined is falsy where the code reads truncated. They were found by review, not by the compiler.

So the design's own guarantee is only true for part of the repo, and the gap is invisible: a green make typecheck says nothing about harness test files.

A related symptom from the same PR: three type errors in packages/k8s-sandbox/test/operations.test.ts shipped in one commit because the task ran only vitest (which does not typecheck) — the compiler caught them one commit later. In harness/test, nothing would ever have caught them.

Acceptance

  • harness/tsconfig.json includes test.
  • make typecheck and CI are green afterwards (expect a batch of fixes to hand-built fakes on the first run).
  • Audit the other packages for the same asymmetry (packages/knative-server, packages/sandbox-relay, packages/ibac-stub, experiments) so the rule is uniform rather than per-package.

Refs

Found while executing #188 (ST6). Both the missing-field instances there are already fixed on that branch; this issue is about closing the hole that let them exist.

Activity

  1. added 2 commits that reference this issue on Sep 6, 2026
  2. pdettori commented on Sep 6, 2026

    @pdettori
    MemberAuthor

    Done in #226 (7c12049), merged to main as 1b5d4ef.

    Acceptance

    • harness/tsconfig.json includes test — now "include": ["src", "test"].
    • make typecheck and CI green afterwards. The batch of fixes this issue predicted was 33 errors across 8 files.
    • Audit the other packages. This was already satisfied when the work started — every other package with a test/ directory already had ["src", "test"], so harness/ was the last holdout. Rather than leave that as a one-time audit, harness/test/typecheck-coverage.test.ts now asserts it for every package with a test/ directory, so the rule is enforced instead of periodically re-checked. Verified failing with exactly ['harness'] when the old include is restored.

    On the prediction in "Why it matters." It was right about the mechanism and understated the extent. The truncated fakes named here were fixed on #188's branch, but the same class of drift was sitting in five more places that only the compiler could have found:

    • FakeStore in buffered-redis-backend.test.ts declared implements LogStore<FileEntry> without positionOfId — a required interface method that checkpoint-extension.ts calls on the real store.
    • The WorkQueue fake in leaf-job-runner.test.ts was missing deleteConsumer, gcIdleConsumers and reapDeadLetters.
    • Both TurnSandbox fakes in run-turn-sandbox.test.ts omitted context, a required key on K8sSandboxConfig.
    • The round-trip record in leaf-result-store.test.ts omitted the required usage, so that assertion never actually covered the field.
    • run-leaf-promoted.test.ts read r.reason / r.message after expect(r.status).toBe('failed') — which asserts at runtime but does not narrow, so those reads were unchecked.
    • A @ts-expect-error in pool-live-smoke.test.ts suppressed nothing (TS permits bracket access to a private member deliberately).

    Worth recording precisely, since it bears on the design argument this issue is about: none of these was a dead assertion. Every one ran and asserted. What was missing is that nothing checked they asserted against the real contracts — which is exactly the failure mode "a required field is a compile error" is supposed to rule out, and it was ruled out in packages/ only.

    The fakes were fixed by satisfying the interfaces rather than by narrowing what they claim to be: positionOfId is implemented the way the real store implements it, and the three unexercised WorkQueue methods throw rather than no-op, so the day something does reach one it fails loudly instead of quietly succeeding against a stub.

    Closing the sibling hole this exposed is #191.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions