test: typecheck the tests in langchain, sdk, and core — hole 3 closed - #510
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, ES2023findLastunder the ES2022 lib, a contravariantly-unsatisfiable helper signature (now the same structural cast the adapter makes internally), missing requiredappRootin context literals,__interrupt__reads off invoke results whose static type doesn't carry it, a no-arg-typedvi.fnmock whose calls tuple hid a cast, and twoexactOptionalPropertyTypesviolations.@dawn-ai/sdk(29 errors): the DAWN_ERRORS union vs its descriptor interface, a type-surface test that predatedRuntimeContext.fs, two disagreeing module augmentations of the same RouteScenarioMap key across test files (program-wide, so they must be identical), aRecord<string, fn>escape hatch thatnoUncheckedIndexedAccessmakes uncallable, andWebAssemblyhaving 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): staleRouteSegment/ExtractedToolTypefixtures, adefined.kindwidened tostring, fake tools whose zero-argrunpropagated into the wrapped tool's own call signature, unnarrowed index accesses,booleanwhereDelegationVerdictwants literaltrue, a backend fixture missing requiredrealPath, and a destructure that would have surfaced a regression as a TypeError instead of the assertion meant to catch it.Verified: repo
pnpm lint27/27,pnpm typecheck51/51 tasks,node scripts/check-docs.mjsclean, 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