Skip to content

Fix ABI record lookup for qualified paths - #29622

Open
1sgtpepper wants to merge 10 commits into
ProvableHQ:masterfrom
1sgtpepper:fix/29615-abi-record-location
Open

Fix ABI record lookup for qualified paths#29622
1sgtpepper wants to merge 10 commits into
ProvableHQ:masterfrom
1sgtpepper:fix/29615-abi-record-location

Conversation

@1sgtpepper

@1sgtpepper 1sgtpepper commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Motivation

ABI generation classified composites by terminal name, so a module struct could be mistaken for a same-named record. Resolve composites by their complete (program, path) identity, including direct interface record prototypes.

Fixes #29615.

Compatibility

Leo source syntax and the ABI schema are unchanged. The fix changes only the Record versus Struct classification for qualified composites, including program and interface ABI output. Concrete lookup covers the current program, imported Leo programs, Aleo stubs, and libraries. Interface ABI conversion classifies direct record prototypes only; it does not add parent-interface record prototypes to a child interface, and inherited interface member behavior is unchanged.

Test Plan

  • Exact-location unit coverage for local, imported Leo, Aleo, and library composites, including wrong-program, sibling-module, missing-item, and module-qualified-Aleo rejection cases.
  • End-to-end CLI fixture checking the corrected Record/Struct classification in both program and interface ABI output.
  • cargo +nightly fmt --all -- --check
  • git diff --check
  • bash -n tests/tests/cli/test_abi_record_identity/COMMANDS
  • CircleCI: code-quality, leo-executable, test-linux, test-macos, test-windows.

Related PRs

#29623 fixes the related dynamic-interface location bug independently; this PR targets master and does not depend on it.

@1sgtpepper
1sgtpepper force-pushed the fix/29615-abi-record-location branch 2 times, most recently from 678f836 to 05eaca0 Compare August 6, 2026 14:05
@1sgtpepper
1sgtpepper force-pushed the fix/29615-abi-record-location branch from caf5e18 to 4cf276a Compare August 6, 2026 16:05
@1sgtpepper
1sgtpepper marked this pull request as ready for review August 7, 2026 09:25
Comment thread crates/abi/src/lib.rs
let found = match stub {
ast::Stub::FromAleo { program, .. } => {
program.composites.iter().find(|(sym, _)| *sym == name).map(|(_, c)| c.is_record)
match stubs.get(&location.program)? {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

When ABI generation processes a FromLeo dependency, this map is the dependency nested Program.stubs, so sibling dependencies are absent and valid external records can be emitted as Plaintext::Struct. Please thread the outer reachable stub map into dependency and external-interface ABI conversion, and add a three-program regression test that asserts Record in both generated ABIs.

@mohammadfawaz mohammadfawaz self-assigned this Aug 19, 2026
@mohammadfawaz mohammadfawaz added 馃悰 bug Something isn't working 馃К JSON ABI Everything related to the JSON ABI labels Aug 19, 2026
@1sgtpepper
1sgtpepper marked this pull request as draft August 20, 2026 07:29
@1sgtpepper
1sgtpepper marked this pull request as ready for review August 21, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

馃悰 bug Something isn't working 馃К JSON ABI Everything related to the JSON ABI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ABI misclassifies a module struct as a record

2 participants