Repository navigation
feat(ffi): rename one instance by its path, as exclude leaves one out - #243
Conversation
Quest-Claim: 7afeee5fe49388a4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f6b61d62e
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /// named through its new name. Paths match as `exclude`'s do, so an instance's renames | ||
| /// it alone, and a field is named by its path as `exclude` names it. |
There was a problem hiding this comment.
Defer instance renaming until a consumer needs it
The commit explicitly states that moq has no consumer for this feature, and the only added uses are synthetic fixture renames. This violates AGENTS.md's requirement that every change have a consumer using it now, with moq as the first consumer. The deleted quest also explicitly deferred this work until a consumer encounters a clash that existing renames cannot resolve. Keep the feature deferred until that concrete use exists, or include the consumer that justifies expanding the configuration and naming machinery.
AGENTS.md reference: AGENTS.md:L33-L33
Useful? React with 👍 / 👎.
| let exact = shown[..len].join("::"); | ||
| let generic: Vec<&str> = shown[..len].iter().map(|s| s.split('<').next().unwrap_or(s)).collect(); | ||
| let generic = Some(generic.join("::")).filter(|generic| *generic != exact); | ||
| std::iter::once(exact).chain(generic).map(move |key| (len, key)) |
There was a problem hiding this comment.
Preserve owner arguments when matching generic method renames
For a generic method on a generic type instance, the matcher emits only the fully instantiated path and the fully generic path, omitting the key that selects all method instances on one owner instance. For example, the existing fixture's Pair<u32>::beside<dep_fixture::Size> produces neither Pair<u32>::beside nor a match for a rename keyed that way. method_name consequently ignores that rename, and unused_renames rejects the export as naming nothing. Generate the intermediate key with the owner's arguments retained and the method's arguments removed so renaming a member of one type instance also works for generic members.
Useful? React with 👍 / 👎.
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit 9f6b61d.
P2 confirmed: referencing the existing owner-specific generic-method finding, not duplicating its inline comment. ffi/src/config.rs:49–54 emits the fully instantiated path and fully generic path, but omits Pair<u32>::beside for Pair<u32>::beside<dep_fixture::Size>. exclude already accepts that key because collect.rs:1560–1563 checks the method before instantiation; ABI rename sees only the final path and rejects the same key as unused. Preserve owner arguments when genericizing the method segment, define its precedence, and add a rename/exclude parity fixture.
Direction: reusing displayed paths and one matcher is sensible, but the matcher's input stages currently differ. I also share the existing scope concern: the deleted quest explicitly deferred this API expansion until a concrete consumer needed it, and the PR says none does. Prefer keeping it deferred or identifying the consumer that justifies the naming machinery rather than treating synthetic fixtures as that need.
Verification: static GitHub review of matching, suffix grouping, collector paths and fixtures, including an independent pass. No builds, differential tests or moq generation executed; reported passing checks were not independently reproduced.
(Written by OpenAI)
# Conflicts: # quest/m3/ffi-instance-rename.md
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
WalkthroughThe FFI naming pipeline now supports renames for specific generic instances. It uses displayed paths and longest-first path keys for rename and exclusion matching. The C, C++, and Kotlin API tests use the renamed instances. Rejection output includes a diagnostic for a rename that names nothing exported. The quest list and proposal document no longer include the deferred instance-renaming task. Priority: Merge Risk:
|
…-rename # Conflicts: # ffi/fixtures/reject/expected.txt # quest/m3/ffi-instance-rename.md
…to quest/m3/ffi-instance-rename
Completes quest/m3/ffi-instance-rename.md.
Problem
excludetakes an instance's path ("catalog::Producer<moq_mux::catalog::hang::Extra>"), butrenamematched only generic paths, so it could rename every instance of a generic item and never just one. An instance key was rejected as naming nothing exported.Approach
config::keyslists the keys that name an item, longest first. Each prefix of its path is listed with its instance's arguments, then without them.excludein collect andrenamein the ABI both look up those keys, so they match the same paths. This replaces the substring matchexcludeused.shownpath (the pathexcludeand the census already use), so the ABI matches renames against exactly the same spelling.Producer<X>::stats), and fields (field@Slot<u8>::value).Pair<..>totaggedclashed withfn taggedand was reported asstruct api_fixture::Pair<dep_fixture::Size, u8>.Pair<dep_fixture::Size, u8>tosize_tagandCounter::seeded<dep_fixture::Size>tocounter_from_size. Their other instances keep their names:api_pair_u8_size,api_pair_u32,api_counter_seeded_point,api_counter_seeded_polar_point.Cell<u16>and expects the loud error.Impact
ffi.tomlrename(and[crates.*].rename) also accepts an instance's path. This is additive: every key that worked before means the same thing.excludenow matches whole path segments. Before, a key that ended partway through an instance's arguments (such asPair<u8) could match by string prefix. No real key did this, so there is no MIGRATE entry.Alternatives
exclude, sorenamereuses its matching instead of adding a new key.Api::rustwould avoid the new IR field. Its spelling differs from collect'sspellfor some arguments, so a key could match one and miss the other.Choices made without asking
PairandPair<u32>can both be renamed.Follow-ups
None.
Review
Codex (
quest review --deep), gpt-6-astra, medium effort, round 1 on head9f6b61d62e0a1ddd2a1b1e8bc8f280dc8877fd63: no findings.Head
1bb07191293ee4a67bbcf0529c3548a4e43e4f62skips a new review as a trivial merge of origin/main. It changes no code:ffi/fixtures/reject/expected.txtwas regenerated withUPDATE_EXPECT=1and checked to be exactly the three-way union of both sides.quest/m3/ffi-instance-rename.md(main changed only a link to moq-dev) keeps the deletion.7b86b7f8) is merged in too, and leaves the tree unchanged.just ciandjust ffi moq(C, C++, Kotlin) pass on this tree.🤖 Generated with Claude Code
(written by Claude Opus 5.5)