Skip to content

fix(verifier): stand in for globals a module declares ambiently - #638

Open
aidenybai wants to merge 1 commit into
realizefrom
ambient-global-stand-ins
Open

aidenybai wants to merge 1 commit into
realizefrom
ambient-global-stand-ins

Conversation

@aidenybai

Copy link
Copy Markdown
Owner

A module can use a value it only declares, such as declare function send(message: string): void; or declare const invariant: ..., and expect the page or another script to provide it. The verifier's browser page has no such global. A component that read one during render never mounted, and a handler that called one threw before it reached its setter. SendButton in guarded-handlers.tsx reported a counterexample against a model that was right, and 11 other repros failed to mount with errors like useTheme is not defined.

The verifier now collects the names a module declares ambiently:

  • declare function
  • declare const, let and var
  • declare class
  • the members of declare global {}

For each name, it assigns the stand-in the harness already uses for server-only packages, unless that global already exists. The assignment lives in a virtual module imported at the end of the file, so the coverage counters' offsets don't move. Function overloads and type-only declarations get no stand-in.

Results

conformance verify on conformance-repros, realize against this branch:

realize This branch
Failing components 19 7
  • Now verified:
    • SendButton
    • ThemeBadge
    • DeclaredStore
    • SignUp
    • SuggestionEditor
    • InvariantCount
    • InvariantLength
    • UsageLink
    • UnknownSpread
    • SubscribedHelper
    • ConfiguredLabel
    • DerivedMemo
  • Still failing:
  • Covers less: TwoFactor loses its error branch. On realize, await verify(...) threw a ReferenceError inside its try, and the catch covered that branch by accident. It still verifies with no counterexamples.
  • No regressions: every other difference is extra transitions checked, or Avatar and LogoRow, whose verdicts vary from run to run.

react-tests verdicts are identical. ambient-globals.test.ts covers name collection, overloads and the generated module.

@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
bippy Ready Ready Preview Nov 4, 2026 5:44am UTC
1 Skipped Deployment
Project Deployment Actions Updated
bippy-analyzer Ignored Ignored Preview Nov 4, 2026 5:44am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 871730b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Nov 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/bippy@638

commit: 871730b

This branch was successfully deployed

1 active deployment
Preview – bippy — 871730bb Deployed Nov 4, 2026 by vercel[bot]
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