Skip to content

test: typecheck the tests in langchain, sdk, and core — hole 3 closed - #510

Merged
blove merged 3 commits into
mainfrom
blove/typecheck-remaining-tests
Aug 27, 2026
Merged

test: typecheck the tests in langchain, sdk, and core — hole 3 closed#510
blove merged 3 commits into
mainfrom
blove/typecheck-remaining-tests

Conversation

@blove

@blove blove commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Finishes the hole-3 sweep (#505, #507): after this, every package's tests are type-checked. Three commits, one per package, each with the full defect breakdown in its message.

  • @dawn-ai/langchain (20 errors): a fixture prop the type never had, ES2023 findLast under the ES2022 lib, a contravariantly-unsatisfiable helper signature (now the same structural cast the adapter makes internally), missing required appRoot in context literals, __interrupt__ reads off invoke results whose static type doesn't carry it, a no-arg-typed vi.fn mock whose calls tuple hid a cast, and two exactOptionalPropertyTypes violations.
  • @dawn-ai/sdk (29 errors): the DAWN_ERRORS union vs its descriptor interface, a type-surface test that predated RuntimeContext.fs, two disagreeing module augmentations of the same RouteScenarioMap key across test files (program-wide, so they must be identical), a Record<string, fn> escape hatch that noUncheckedIndexedAccess makes uncallable, and WebAssembly having no declaration in any node lib (narrow ambient declaration matching the suite's runtime feature-detect).
  • @dawn-ai/core (51 errors → 72 once 13 extensionless imports resolved and exposed the files behind them): stale RouteSegment/ExtractedToolType fixtures, a defined.kind widened to string, fake tools whose zero-arg run propagated into the wrapped tool's own call signature, unnarrowed index accesses, boolean where DelegationVerdict wants literal true, a backend fixture missing required realPath, and a destructure that would have surfaced a regression as a TypeError instead of the assertion meant to catch it.

Verified: repo pnpm lint 27/27, pnpm typecheck 51/51 tasks, node scripts/check-docs.mjs clean, and the full CI test path (pnpm test) green — 4782 passed / 217 skipped — plus each package's own suite (221 / 110 / 506).

🤖 Generated with Claude Code

blove and others added 3 commits August 27, 2026 07:42
20 errors, the usual handful of shapes rather than 20 defects:

- agent-adapter-interrupt passed a `run` the SubagentTaskPlaceholder type
  never had, and used ES2023's findLast under an ES2022 lib (now
  filter().at(-1)).
- logical-identity-graph's collectRawEvents helper typed streamEvents
  concretely, which createReactAgent's generic signature can never satisfy
  contravariantly; it now makes the same structural cast the adapter under
  test makes internally.
- planning omitted the required top-level appRoot from its
  CapabilityMarkerContext literals.
- subagent-tool-bridge read `__interrupt__` off invoke results whose static
  state type does not carry it (cast to the langgraph Interrupt shape), left
  `callbacks` as an evolving any[], and passed toolCall to an uncast
  RunnableConfig literal.
- summarization-hook's summarize mock was vi.fn(async () => ...), typing
  mock.calls[0] as the empty tuple; typed to the real SummarizeFn the cast
  over its argument disappears, replaced by a thrown guard.
- tool-converter's `seen` capture used optional fields that
  exactOptionalPropertyTypes rejects for explicitly-undefined assignments.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
29 errors, three causes:

- errors.test iterated DAWN_ERRORS as the union of its const-asserted
  entries, on which `docsPath` does not exist for every member; the entries
  are now typed as DawnErrorDescriptor, which is what the registry's
  `satisfies` already guarantees.
- runtime-context.test predated RuntimeContext gaining the required `fs`
  field — the type-surface assertion and the literal both now carry it, so
  the test again pins the real contract.
- scenario-builder.test's module augmentation of RouteScenarioMap
  "/research" disagreed with scenario-builder.contract.ts's augmentation of
  the same key (augmentations are program-wide, so they must be identical),
  and its UnsafeBuilder escape hatch was a Record<string, fn> that
  noUncheckedIndexedAccess makes uncallable; it is now an explicit total
  interface that still bypasses the staged builder types.
- scenario-snapshot.test uses WebAssembly, which no ES2022/node lib
  declares; a narrow ambient declaration covers exactly the slice the suite
  feature-detects at runtime.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
51 errors on first measure, 72 once thirteen extensionless relative imports
resolved and exposed the files behind them. The causes:

- Ten typegen suites imported ../src modules with no extension, which
  nodenext rejects — and while unresolved, those files' bodies were
  invisible to the compiler.
- render-route-types/render-tool-types/compiler-route-analysis fixtures
  predated two type changes: RouteSegment's static arm renamed value->raw
  (dynamic requires raw), and ExtractedToolType made `description`
  required. The renderer never reads description, so the fill is inert.
- memory.test's context builder widened defined.kind to string; a single
  `as const` restores the MemoryKindLike literal.
- permission-gate.test's fake tools declared zero-arg `run`s;
  wrapToolWithApproval preserves the tool's own signature, so the wrapped
  calls with (input, context) could not typecheck. The fakes now declare
  the real arity (context is `unknown` — the wrapper's C is uninferrable
  from its constraint and resolves to unknown).
- discover-routes indexed manifest.routes[0] without narrowing;
  subagents-static/registry built segments as bare strings; policy.test
  returned boolean where DelegationVerdict wants literal true, and read
  `.message` off an unnarrowed GuardedSubagentResult; workspace-fs's
  text-only backend was missing the required realPath;
  integration-dx-improvements destructured [schema] where a regression
  would have thrown a TypeError instead of failing an assertion.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@blove
blove temporarily deployed to vercel-preview August 27, 2026 14:42 — with GitHub Actions Inactive
@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dawnai Ready Ready Preview Aug 27, 2026 2:45pm

Request Review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

@blove
blove merged commit c3375be into main Aug 27, 2026
21 of 22 checks passed
@blove
blove deleted the blove/typecheck-remaining-tests branch August 27, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant