Skip to content

fix: avoid incorrect cyclic error when two packages import each other on separate component chains#3460

Merged
AustinAbro321 merged 16 commits intomainfrom
fix-import-false-positives
Feb 6, 2025
Merged

fix: avoid incorrect cyclic error when two packages import each other on separate component chains#3460
AustinAbro321 merged 16 commits intomainfrom
fix-import-false-positives

Conversation

@AustinAbro321
Copy link
Copy Markdown
Member

@AustinAbro321 AustinAbro321 commented Feb 3, 2025

Description

Fixes #3457

Checklist before merging

Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 3, 2025

Deploy Preview for zarf-docs canceled.

Name Link
🔨 Latest commit 837f603
🔍 Latest deploy log https://app.netlify.com/sites/zarf-docs/deploys/67a37e6fc72f7f00078d9475

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
src/internal/packager2/layout/import.go 44.05% <100.00%> (+4.90%) ⬆️

Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
@AustinAbro321 AustinAbro321 changed the title Fix import false positives when two different packages import each other with different components Fix import false positives when two packages import each other on separate chains Feb 3, 2025
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
@AustinAbro321 AustinAbro321 changed the title Fix import false positives when two packages import each other on separate chains fix: avoid false positive cyclic chain error when two packages import each other on separate component chains Feb 3, 2025
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
@AustinAbro321 AustinAbro321 marked this pull request as ready for review February 4, 2025 14:15
@AustinAbro321 AustinAbro321 requested review from a team as code owners February 4, 2025 14:15
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
@AustinAbro321 AustinAbro321 changed the title fix: avoid false positive cyclic chain error when two packages import each other on separate component chains fix: avoid incorrect cyclic error when two packages import each other on separate component chains Feb 4, 2025
AustinAbro321 and others added 2 commits February 4, 2025 15:24
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Copy link
Copy Markdown
Contributor

@mkcp mkcp left a comment

Choose a reason for hiding this comment

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

Stepped through everything and LGTM 👍

// Zarf imports merge in the top level package objects variables and constants
// however, imports are defined at the component level.
// Two packages can both import one another as long as the importing components are on a different chains.
// To detect cyclic imports, the stack is checked to see if the package has already been imported on that chain.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@AustinAbro321 AustinAbro321 added this pull request to the merge queue Feb 6, 2025
@AustinAbro321 AustinAbro321 added this to the v0.49.0 milestone Feb 6, 2025
Merged via the queue into main with commit e5a9d91 Feb 6, 2025
@AustinAbro321 AustinAbro321 deleted the fix-import-false-positives branch February 6, 2025 14:40
nevinaragam pushed a commit to nevinaragam/zarf that referenced this pull request May 20, 2025
… on separate component chains (zarf-dev#3460)

Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: NevinAragam <nevin.aragam@gmail.com>
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.

cyclic imports detection logic evaluates components that are not included in the package

2 participants