Skip to content

fix(ts): resolve a binding through a renamed dependency - #182

Merged
kixelated merged 4 commits into
mainfrom
quest/m3/ts-bind-gaps
Oct 28, 2026
Merged

kixelated merged 4 commits into
mainfrom
quest/m3/ts-bind-gaps

Conversation

@kixelated

@kixelated kixelated commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Part of quest/m3/ts-bind-gaps.md: the renamed-dependency gap. The quest now lists only the collection-key gap.

Problem

A binding's path named a dependency by its crate name. With foo = { package = "bar" }, foo::Item was "no such item", and only bar::Item, a path the package's own source can't write, resolved.

Approach

  • The first segment resolves through rustc's CStore::resolved_extern_crate: the --extern name the package loaded the crate by, so a renamed dependency goes by its new name, and of several versions of a crate, the one the package names wins.
  • A crate the package reaches only through another still goes by its own crate name, if exactly one crate of that name is built. A crate the package depends on directly is never found by its crate name, so a renamed one has one name.
  • Dropped: the "pick the direct one among several versions" fallback, which the --extern name now covers.

Tests

  • The bind fixture depends on blob as buf = { package = "blob" } and binds buf::Blob. Differential against native wasm32: 16,273 cases, 1,387 matching panics, 0 differences. Its output snapshot is unchanged, since modules still go under the crate's own name.
  • refused.toml binds blob::Blob, the renamed crate's own name: "no such item".
  • just check and just test pass.

Census

just ts census at the pinned moq revision, base vs head: unchanged, and the reports are byte-identical. moq renames none of the crates it binds.

Target Base Head
moq-net (net.toml) 2,977 2,977
model (model.toml) 954 954
kio 386 386

Impact

  • Breaking: a binding path names a renamed dependency as the package does (foo::Item), no longer by its crate name (bar::Item). ts/MIGRATE.md has the entry.

Alternatives

  • Resolve only as Rust source would, so a crate the package reaches only through another can't be bound. Rejected: dependencies translate as one program with the package, so their dependencies' types may need bindings.
  • Keep accepting the crate name too. Rejected: two names for one crate, and ambiguous where another version of the crate is built.

Follow-ups

  • No test binds an item of a crate the package reaches only through another. That behavior is unchanged here.
  • Collection keys of a bound type stay in the quest. They share no code with path resolution, and no consumer keys by one yet.

(written by Claude Opus 5.5)

🤖 Generated with Claude Code

kixelated and others added 3 commits October 28, 2026 08:24
Quest-Claim: c9a29eabe67bf368
…s name for it

A binding's path named a dependency by its crate name, so `foo = { package = "bar" }`
could only be bound as `bar::Item`, a path the package's source can't write. Resolve
the first segment through the `--extern` name rustc loaded the crate by, and a crate
the package reaches only through another by its own name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Binding gaps fix(ts): resolve a binding through a renamed dependency Oct 28, 2026
@kixelated
kixelated marked this pull request as ready for review October 28, 2026 22:50
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T22:51:40.054858Z fdf02b6 Draft marked ready
🔒 Security Review ✅ Completed 2026-10-28T22:53:08.861192Z fdf02b6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Automated review by review (OpenAI)
Reviewed commit: fdf02b6

No actionable bugs found in the renamed-dependency resolution change. Using rustc's resolved extern name is a simpler and more appropriate source of identity than selecting a direct dependency among matching crate names. Local-item precedence is preserved, and the migration note makes the old-name incompatibility explicit. The renamed fixture and refusal of its old name exercise the central change.

Verification: static review of the complete diff, surrounding binding/path resolution, and fixture configuration. I did not run builds, differential tests, or census; the multi-version and indirect-only dependency paths are not demonstrated by the added fixture.

(Written by OpenAI)

@kixelated
kixelated merged commit 769ac34 into main Oct 28, 2026
1 check passed
@kixelated
kixelated deleted the quest/m3/ts-bind-gaps branch October 28, 2026 23:12
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