Repository navigation
fix(packaging): exercise the appimage-test mock explicitly (#2566) - #2618
Conversation
…#2566) `just appimage-test` created `$TMP_BASE/mock-appimagetool`, but the script resolved a command literally named `appimagetool` (or a cached copy), so a clean host fell through to the download path and failed. Honor an explicit `APPIMAGETOOL` executable path and fail closed when it is unusable; PATH discovery, cache, and download behavior are otherwise unchanged. The test injects the mock through `APPIMAGETOOL`, adds a same-named PATH stub and a failing curl stub so a bypass cannot pass silently or touch the network, and asserts the invocation marker, mock-only payload, and fail-closed override.
|
Warning Review limit reachedYou'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 21 minutes. View limit details
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. Comment |
Xuepoo
left a comment
There was a problem hiding this comment.
Guard verification (independent agent, bitty blitz guard tick, 2026-10-24 14:20 CST)
Head 009cb2b1 (ctx-1500/fix-appimage-test-mock). Checks on the exact head SHA: 20 pass,
0 fail, 0 pending.
What was verified independently:
- The defect statement is mechanically checkable and matches the code:
just appimage-test
created$TMP_BASE/mock-appimagetoolwhilescripts/make-appimage.shlooked up a command
literally namedappimagetool, so on a clean host the mock could never be reached and the
test fell through to the network or a cached/tmp/bitty/appimagetool. - The fix is opt-in and fail-closed:
APPIMAGETOOLis honoured only when set and must be an
executable file, otherwise the script errors; PATH discovery, cache lookup, download and
dry-run behaviour are unchanged when the variable is absent. That is the right shape for a
test-only seam — it cannot alter normal packaging paths. - The test is adversarial rather than decorative: it injects the mock through
APPIMAGETOOL,
keeps a same-namedappimagetoolPATH stub that records any bypass, and a failingcurl
stub so a download is impossible; it asserts the invocation marker, a mock-only payload,
the fail-closed unusable-override case, and that dry-run never invokes the tool. - No hardcoded host paths/usernames/ports beyond the repo's existing XDG/tmp conventions.
Verdict: merge-eligible on this evidence (CI + diff scope + no-network claim is asserted by the
stub, not merely described).
Priority: P2 | Area: packaging | Labels: fix,P2,area:packaging | Milestone: v0.0.28 | Task: CTX-1500
Closes #2566
Summary
just appimage-testcreated$TMP_BASE/mock-appimagetool, butscripts/make-appimage.shresolved a command literally named
appimagetool(then a cached/tmp/bitty/appimagetool,then the download). On a clean host the mock was never used and the test fell through to
the network.
Fix
scripts/make-appimage.shhonors an explicitAPPIMAGETOOLexecutable path and failsclosed when that override is not an executable file. PATH discovery, cache lookup,
download, and dry-run behavior are otherwise unchanged (
APPIMAGETOOLis opt-in).scripts/tests/make-appimage.test.shinjects the mock throughAPPIMAGETOOL, keeps asame-named
appimagetoolPATH stub that records any bypass, and a failingcurlstub soa download can never run. It asserts the invocation marker, a mock-only output payload,
and a fail-closed unusable override. Dry-run is asserted not to invoke the tool.
Verification
Clean host (
command -v appimagetool mksquashfs zsyncmakeempty,/tmp/bitty/appimagetoolremoved):shellcheck -S warning scripts/make-appimage.sh scripts/tests/make-appimage.test.sh— cleanshfmt -d scripts/make-appimage.sh scripts/tests/make-appimage.test.sh— cleanscripts/make-appimage.shfails withFAIL: appimagetool mock was bypassed (no invocation marker)(rc 1)./tmp/bitty/appimagetoolcache present, the fixed teststill used its mock and passed; the cache was then removed for the clean-host run above.
APPIMAGETOOLand a PATHappimagetool, the scriptstill assembles and emits the sha256 sidecar.
Residual risks
APPIMAGETOOLto a bare command name (instead of a path) now fails;the variable is documented as an executable path.
just ci-local/ fulljust checkwere not run for this shell-only change; CI isthe acceptance gate.