Skip to content

Merge identical target imports when linking source modules - #343

Merged
flyingrobots merged 1 commit into
mainfrom
fix/dedupe-target-imports
Nov 19, 2026
Merged

flyingrobots merged 1 commit into
mainfrom
fix/dedupe-target-imports

Conversation

@flyingrobots

Copy link
Copy Markdown
Owner

Plain-English Walkthrough

TL;DR

Flattening a multi-module source closure now emits one target import per target profile instead of one per module [claim:merge, confidence:1.00]. Conflicting pins of the same target are refused at link time with ConflictingTargetImport [claim:conflict, confidence:1.00]. Echo requires exactly one target import, which this unblocks for the rope.

Walkthrough

source_linker::collect_names now records the alias chosen for each target coordinate. A later module that imports the same target with the same digest reuses that alias, and link_source_closure emits each alias once. A different digest for the same target is refused. Core does not encode import aliases, and module order is fixed by coordinate, so the Core bytes do not depend on the order dependencies are listed in.

Verification.

  • RED: three target imports were emitted, and conflicting pins linked without error.
  • GREEN: one import, identical bytes in both dependency orders, and conflicting pins refused.
  • cargo xtask verify exits 0.
Appendix: Citations
Claim Evidence Confidence Notes
claim:merge identical_target_imports_merge_into_one, merged_core_bytes_do_not_depend_on_dependency_order @eda1a838 1.00
claim:conflict different_digests_for_one_target_are_refused 1.00

Closes #342

Flattening a source-module closure gave every module its own `target`
import, so the rope's linked Core carried five identical imports of
echo.dpo@2, which Echo's identity check refuses. Identical `use target`
imports (same target, same digest) now share one alias and the linked
module emits a single import. Different digests for one target refuse
at link time with the new ConflictingTargetImport kind.

RED: identical_target_imports_merge_into_one saw 3 target imports;
different_digests_for_one_target_are_refused linked without error.
GREEN: 3/3; existing module-compilation tests pass; xtask verify exit 0.

Agent-Session: AFC0A5E0-B032-49DC-8B18-CB932831DCC2
Agent-Tool: Claude Code
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: b0b7c9c9-1019-49d0-89c0-ebf428ad0a25
Commits

Reviewing files that changed from the base of the PR and between 26a201e and eda1a83.

Files selected for processing: 4

  • CHANGELOG.md
  • crates/amblicit-cli/src/main.rs
  • crates/amblicit-syntax/src/source_linker.rs
  • crates/amblicit-syntax/tests/source_module_target_imports.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@flyingrobots
flyingrobots marked this pull request as ready for review November 19, 2026 07:33
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-19T07:33:35.257857Z
We couldn’t complete this review. Comment @codex review to try again.
eda1a83 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@flyingrobots
flyingrobots merged commit 343e4c5 into main Nov 19, 2026
6 checks passed
@flyingrobots
flyingrobots deleted the fix/dedupe-target-imports branch November 19, 2026 07:33
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.

Deduplicate identical target imports when flattening source-module closures

1 participant