← Back to Pull requests

fix(monty-js): publish the component facade declaration in dist #1008

Closed
unknown closed this pull request without merging on Oct 09, 2026 16:54 UTC
View on GitHub
unknown unknown commented on Oct 09, 2026 15:03 UTC
Author

Fixes #982

scripts/build-component.mjs builds two declarations for the WASI component: Jco's raw one, and a small facade that re-exports the WIT types with export * from './interfaces/pydantic-monty-worker.js'. Only the facade is imported by the library — host.ts pulls DispatchResult and Request from it, transport.ts pulls ConfigureRequest — and only the facade was written into the TypeScript source tree. dist/ got Jco's version, which declares just ImportObject, Root and instantiate.

The shipped dist/worker/host.d.ts and dist/worker/transport.d.ts therefore import names that ./component/monty.component.js does not export. Against @pydantic/monty@1.1.0, import { Monty } from '@pydantic/monty/wasm' with skipLibCheck: false:

node_modules/@pydantic/monty/dist/worker/host.d.ts(1,15): error TS2305: Module '"./component/monty.component.js"' has no exported member 'DispatchResult'.
node_modules/@pydantic/monty/dist/worker/host.d.ts(1,58): error TS2305: Module '"./component/monty.component.js"' has no exported member 'Request'.
node_modules/@pydantic/monty/dist/worker/transport.d.ts(3,15): error TS2305: Module '"./component/monty.component.js"' has no exported member 'ConfigureRequest'.

The fix

  • build-component.mjs writes the facade into dist/ as well, replacing Jco's monty.component.d.ts (nothing imports it). Both copies are byte-identical, and the file list Jco returns is otherwise unchanged.

  • make check-wasm-types gains npm run check:dist-types: a skipLibCheck: false pass over the built dist/worker/index.d.ts, in a new tsconfig.dist.json. The package's own tsconfig.json builds from ts, so it can never catch this. I confirmed the new check reports the three TS2305 errors against the published 1.1.0 dist and is clean against a dist built with this change.
  • npm run lint (oxlint + tsc -p __test__/tsconfig.json) and prettier --check are clean.

    <!-- This is an auto-generated description by cubic. -->
    ---

    Summary by cubic


    Fixes #982: consumers of @pydantic/monty/wasm no longer hit TS2305 errors on DispatchResult, Request, and ConfigureRequest when compiling with skipLibCheck: false.

    Previously the published dist/worker/component/monty.component.d.ts was Jco's generated declaration, not the facade that re-exports the WIT types, so host.d.ts and transport.d.ts shipped dangling imports.

  • Copies the facade into dist in place of Jco's declaration, which nothing imports.

  • Adds npm run check:dist-types, a strict consumer-side pass over the built declarations, run by make check-wasm-types.
  • <sup>Written for commit e78543d4b6a824f9f8ab4510bdd2256e22322d6e. Summary will update on new commits.</sup>

    <a href="https://cubic.dev/pr/pydantic/monty/pull/1008?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>

    <!-- End of auto-generated description by cubic. -->

    Diff: 409 lines (+306 / -103) across 5 files Reviewer: davidhewitt Review duration: 110m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 409 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.360
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1008"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 44.9% (MEDIUM) · Higher = larger blast radius
    44.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.7% · Safe to merge
    17.7%
    Repository