Skip to content

[A6b] Type-check test files in CI and check published types with skipLibCheck off #244

Description

@LinuxDevil

Goal

Finish A6: fix the remaining test type errors, run npm run typecheck:tests in CI so tests cannot drift from the API again, and prove that a consumer with skipLibCheck: false gets clean types from the published declarations. Plan row A6 ("Type-check the test files in CI; skipLibCheck: false consumers get clean types").

Current state

Verified on main at cc5ddb8:

  • After A6a, tsconfig.tests.json and npm run typecheck:tests exist, and src/execution/, src/context/, src/session/, src/subagents/, src/acp/, src/testing/ are clean.
  • Remaining errors on cc5ddb8 (78): src/tools/ 29 (15 in src/tools/built-in/index.test.ts, for example :33 "Argument of type '{}' is not assignable to parameter of type 'ToolExecutionOptions'", :52 "'dayNameTool.tool.execute' is possibly 'undefined'"), src/providers/ 14, src/triggers/ 6, src/multimodalInput.test.ts 6, src/cli/ 5, src/evals/ 4, and 1-2 each in src/utils/, src/spec/, src/flows/ (FlowExecutor.test.ts:41: "'type' does not exist in type 'AgentConfig'"), src/deploy/, src/channels/, src/ui/, src/schedules/, src/memory/, src/dynamicConfig.test.ts.
  • CI: .github/workflows/ci.yml:24 npx tsc --noEmit, :42 npm run test:types; the typecheck-zod4 job (:78-92) runs tsc --noEmit and test:types with zod 4.
  • Published declarations: scripts/pack-smoke.ts:228-255 checkTypes() type-checks an entry file importing the root, ./testing, ./tools, ./hooks from the installed tarball with skipLibCheck: true (:247), in bundler and node16 modes. Nothing checks the declarations with skipLibCheck: false. A local check of dist/*.d.ts for every entry with skipLibCheck: false against the repository's node_modules gave 0 errors on cc5ddb8, so this is a guard, not a fix.

Scope

In:

  • Fix every remaining npm run typecheck:tests error (same rules as A6a: change tests, not source; no any, no @ts-ignore; @ts-expect-error only with a reason; open an issue for a real public-type bug instead of fixing it here).
  • CI: in .github/workflows/ci.yml, add - run: npm run typecheck:tests right after npx tsc --noEmit in the main job, and in the typecheck-zod4 job after its tsc --noEmit.
  • scripts/pack-smoke.ts checkTypes(): add a third mode strict-libs (module: 'esnext', moduleResolution: 'bundler', skipLibCheck: false) whose entry imports a type or value from every exports subpath whose optional peer is installed in the smoke project (read the list with the existing listExports(); skip ./react, ./vue, ./svelte, ./otel, ./sqlite unless their peer resolves in the temp project, and log each skip). The log line names the subpaths checked.
  • CONTRIBUTING.md: one line in the checks list: npm run typecheck:tests (tests are type-checked).
  • BRIEF-2's verification list is not in this repository; mention in the pull request that npm run typecheck:tests should be added to it.

Out:

  • examples/** and Agent Forge tests.
  • Changing tsconfig.json's exclude (the build config must keep excluding tests from dist).

Acceptance criteria

  • npm run typecheck:tests exits 0; the before and after counts are in the pull request.
  • ci.yml runs it in the main job and in typecheck-zod4.
  • npm run pack-smoke passes and prints the strict-libs line with the subpaths checked.
  • Every changed test still passes; full verification list in BRIEF-2.md passes.
  • Pull request lists each test whose assertion changed and why.
  • CHANGELOG entry under ### Changed (maintainers): "Test files are type-checked (npm run typecheck:tests, in CI); pack-smoke also checks the published declarations with skipLibCheck: false."

Live test

None: this ticket spends nothing.

Dependencies

  • A6a must merge first. A1, A3 and A5 should have merged (they rename or move code these tests import; fixing types before them means fixing twice).
  • Conflicts: open tickets that edit tests in src/tools/, src/providers/, src/triggers/ (M1, M2, M8, N1, N2, N13a); rebase before merging.
  • ci.yml is CI configuration but not a release step, so no owner decision is needed.

Notes for the implementer

  • src/tools/built-in/index.test.ts calls tool.execute({}, {}) on the legacy tool.execute; use getToolExecute() (src/tools/toolContract.ts) or pass a minimal ToolExecutionOptions built once at the top of the file.
  • FlowExecutor.test.ts:41 builds an AgentConfig with type; check what the test meant (probably the flow's agent definition) before deleting the field.
  • The typecheck-zod4 job installs zod 4 with --no-save; tests that build zod schemas may report different errors there. Run npm install --no-save zod@4 && npm run typecheck:tests locally once, then restore with npm ci.
  • pack-smoke's temp project installs the SDK tarball plus the peers it lists (scripts/pack-smoke.ts:281); @types/react is not among them, so ./react must be skipped in strict-libs unless you add it to that install.

Round 2 ticket A6b. Before starting, read the agent brief (worktree rules, verification list, live-test budget) and the plan. One ticket is one pull request; put Closes #<this issue> in it.

Activity

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

    model:sonnetWell specified; a Sonnet agent can take itround-2Round 2 plan ticketwave-4Round 2, wave 4

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions