Skip to content

fix: prefer ignores x-arch paths - #330

Open
lczyk wants to merge 1 commit into
canonical:mainfrom
lczyk:fix/prefer-arch
Open

lczyk wants to merge 1 commit into
canonical:mainfrom
lczyk:fix/prefer-arch

Conversation

@lczyk

@lczyk lczyk commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor
  • Have you signed the CLA?

did some formal verification (fizzbee, my specs are here and here) of the cut path and found 7 minor bugs:

# slices/test-package1.yaml
package: test-package1
slices:
  myslice:
    contents:
      /file: {arch: amd64}
# slices/test-package2.yaml
package: test-package2
slices:
  myslice:
    contents:
      /file: {prefer: test-package1}

for some non-amd64 arch:

$ chisel cut --release ./ --arch arm64 --root $rootfs test-package1_myslice test-package2_myslice
$ test -f $rootfs/file || echo missing
missing

no error from cut. /file silently missing.

repro using chisel-proxy:

$ alias chisel-proxy='go run github.com/lczyk/chisel-proxy/cmd/chisel-proxy@v0.3.0'
$ mkdir -p test-package1 test-package2
$ echo foo > test-package1/file
$ echo bar > test-package2/file
$ chisel-proxy cut --arch arm64 ./test-package1 ./test-package2 ./test-package1.yaml ./test-package2.yaml \
    -- --root ./rootfs test-package1_myslice test-package2_myslice
Extracting files from package "test-package1"...
Extracting files from package "test-package2"...
$ test -f ./rootfs/file || echo missing
missing

fix

Selection now records the arch it was made for (Select already takes it) and Prefers skips listings that do not apply to it.

Selection.Prefers walked every path in the selected slices regardless of
the "arch" field, so a package listing a path only for other
architectures still won the "prefer" relationship on the requested one.
The losing package then skipped the path during extraction and nothing
provided it, without any error.

The selection now records the architecture it was made for and Prefers
skips listings that do not apply to it.
@lczyk lczyk changed the title fix: prefer ignores paths listed for other architectures fix: prefer ignores x-arch paths Oct 10, 2026
@lczyk lczyk added Polish Refactorings, etc Bug An undesired feature ;-) labels Oct 10, 2026
@lczyk

lczyk commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor Author

mmm... 🤔 lemme check that this kind of bug does not accidentally extend to release validation too...

edit: no

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved blocking issues were identified.

0 open findings

What changed in this PR

Fixes architecture-aware prefer resolution so paths restricted to other architectures do not suppress valid providers.

Changes:

  • Records the selected architecture.
  • Filters architecture-inapplicable preferred paths.
  • Adds setup and slicer regression tests.
File Description
internal/​setup/​setup.go Tracks architecture and filters preferences.
internal/​setup/​setup_test.go Tests architecture-specific preference selection.
internal/​slicer/​slicer_test.go Adds end-to-end regression coverage.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug An undesired feature ;-)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants