Repository navigation
feat(ffi)!: name a field apart from the method of its name with field@ - #145
Conversation
Quest-Claim: d493ca2cdba1f552
A field and a method of one name claimed one C name that `rename` could
not split, so moq's config excluded moq-tokio's `Backoff::{initial,max,timeout}`
both ways. As in rustdoc, a path a method or constant shares with a field now
names the method, and `field@` before it names the field, in `exclude` and
`rename`. moq exports both: `moq_backoff_initial` resolves the default and
`moq_backoff_initial_setting` reads the field.
The quest keeps what remains: moq-clock's C names, which wait on moq moving
it into kio::clock.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Decision (maintainer, 2026-10-27): a field and the method of its name are told apart by (written by Opus 5.5) |
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: 07906cecca
ℹ️ 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".
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 07906ce
P2: Confirmed the existing impl-applicability finding at ffi/src/collect.rs:1184–1188. A method present only on Holder incorrectly makes Holder's field shared, invalidating a previously valid bare field exclusion. Reuse the instance/bound checks from methods() before setting shared, with a regression covering both instances. No duplicate inline comment added.
Direction: explicit field@ disambiguation is a focused way to preserve both configured and resolved getters without a blanket C naming change. The instance-sensitive lookup needs the same semantics as method collection. The independent migration-documentation concern is already recorded separately. No additional actionable bugs found.
Verification: static inspection of collection, ABI naming, config normalization, glue and fixtures only; I did not run tests or generate/compile the C bindings.
A method of another instance's impl, or whose bounds the instance fails, no longer takes a field's bare path. Add ffi/MIGRATE.md for the breaking config change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 844b72eedb5cd6ee4d74f22dd4f7c6ec6227e87b
The prior impl-applicability P2 is fixed: getters() now uses impl_args and applies, matching method collection, and the Slot<u8>/Slot<u32> fixture covers the instance-specific exclusion regression. The independently reported migration-documentation gap is also addressed in ffi/MIGRATE.md.
No new actionable bugs found in the update since 07906cecca18053e0394fb40ef8d372fdc21d72e. Direction: reusing the existing applicability checks is a focused fix with appropriate regression coverage, without introducing a second matching mechanism.
Verification: static inspection of the changed collection logic, existing applicability helpers, fixture/config/C transcript additions, and migration guidance only. I did not run tests or generate/compile bindings.
…rates # Conflicts: # ffi/fixtures/reject/src/lib.rs # ffi/tests/api.c
|
Merging: CI (written by Opus 5.5) |
Problem
A field and a method of one name claim one C name, and
renamekeys by path, so it could not tell them apart. moq's config excluded moq-tokio'sBackoff::{initial,max,timeout}both ways, though moq-ffi reads the methods (the resolved values) and writes the fields.Approach
excludeandrenamename a field as rustdoc's intra-doc links do: a path a method or constant shares with a field names the method, andfield@before it names the field. A field no method shares keeps its bare path, so no other config changes.sharedwhen apubinherent method or constant has its name, from an impl that applies to the instance and with bounds the instance meets, asmethods()checks. Its exclude matchesfield@<path>, or the bare path when not shared. A refused shared field is reported, and listed in the census, asfield@<path>.field@rename first, and a bare one only when not shared. A clash names a getterfield, notfn, and its help points atfield@.Backoffexcludes go.field@Backoff::{initial,max,timeout}rename the fields tobackoff_<field>_setting, somoq_backoff_initialreturns the resolvedmoq_durationandmoq_backoff_initial_settingthe configuredmoq_cli_durationor null.Log::level's field, refused for a foreign type, now needs its ownfield@Log::levelexclude.moq/moq.creads both on a default backoff.Retryrenames one field withfield@and excludes another withfield@, keeping its method; the C transcript matches native Rust. Its genericSlothas avalue()method only onSlot<u8>, so a bare path excludesSlot<u32>'s field andfield@excludesSlot<u8>'s. The reject fixture'sLimitclashes without a rename, and afield@rename of a missing field is an error.moq_now,moq_origin), which wait on moq's kio::clock quest. It is rewritten to that wait.Consumer: moq's export (
just ffi moq), which now exports the 6Backofffunctions it left out.Impact
ffi.toml(breaking): a bareexcludeorrenamepath that a field shares with a method or constant of its instance now names only the method. A config that relied on it naming both needs afield@entry for the field. Newffi/MIGRATE.mdrecords it.ffi.toml:field@<path>names a field inexcludeandrename.Access::Fieldcarriesshared.moq_backoff_{initial,max,timeout}andmoq_backoff_{initial,max,timeout}_setting.Decided
field@in the config now, as this PR does. The newest AGENTS.md rule makes it a config gap; a C naming rule that retires moq's renames will close it, planned separately. Rejected: every object getter as<type>_get_<field>(renames every getter, andget_xmethods still clash), and a rule suffix on shared fields only (adding a method silently renames a getter).Choices made without asking:
backoff_<field>_setting, by role: the field is the setting as configured, and the method resolves its default.crates.md) under its new title, so its branch claim holds.Alternatives
field@required on every field: Rust-faithful too, but it rewrites about 60 field excludes in moq's config for no gain.Follow-ups
Backoff's fields (connect.backoff.initial = ...), and the export has only getters.rename: a naming rule that needs norenamefor moq's 24 clashes, which the maintainer will plan separately.Checks
just check: passed.just ffi test: 14 passed.just ffi moq: moq's export at the pin builds, andmoq/moq.cpasses.just ffi census: no clashes; moq-tokio's exclude list matches the config.just test: passed (ts, ffi, driver, uniffi).(written by Opus 5.5)
🤖 Generated with Claude Code