Skip to content

fix(packaging): exercise the appimage-test mock explicitly (#2566) - #2618

Merged
Xuepoo merged 1 commit into
mainfrom
ctx-1500/fix-appimage-test-mock
Oct 24, 2026
Merged

Xuepoo merged 1 commit into
mainfrom
ctx-1500/fix-appimage-test-mock

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Priority: P2 | Area: packaging | Labels: fix,P2,area:packaging | Milestone: v0.0.28 | Task: CTX-1500

Closes #2566

Summary

just appimage-test created $TMP_BASE/mock-appimagetool, but scripts/make-appimage.sh
resolved 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.sh honors an explicit APPIMAGETOOL executable path and fails
    closed when that override is not an executable file. PATH discovery, cache lookup,
    download, and dry-run behavior are otherwise unchanged (APPIMAGETOOL is opt-in).
  • scripts/tests/make-appimage.test.sh injects the mock through APPIMAGETOOL, keeps a
    same-named appimagetool PATH stub that records any bypass, and a failing curl stub so
    a 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 zsyncmake empty,
/tmp/bitty/appimagetool removed):

$ just appimage-test
PASS: dry-run did not invoke appimagetool
PASS: assembly with the explicit appimagetool mock succeeded
PASS: mock invocation marker recorded
PASS: script did not resolve a PATH appimagetool
PASS: script did not attempt a download
PASS: output payload came from the mock
PASS: AppImage bundle and sha256 sidecar emitted
PASS: unusable APPIMAGETOOL override fails closed
PASS: fail-closed run did not fall back to a PATH appimagetool
PASS: fail-closed run did not attempt a download
make-appimage.test: PASS
  • shellcheck -S warning scripts/make-appimage.sh scripts/tests/make-appimage.test.sh — clean
  • shfmt -d scripts/make-appimage.sh scripts/tests/make-appimage.test.sh — clean
  • Regression proof: the same test against the pre-fix scripts/make-appimage.sh fails with
    FAIL: appimagetool mock was bypassed (no invocation marker) (rc 1).
  • With the previously downloaded /tmp/bitty/appimagetool cache present, the fixed test
    still used its mock and passed; the cache was then removed for the clean-host run above.
  • Production discovery sanity: with no APPIMAGETOOL and a PATH appimagetool, the script
    still assembles and emits the sha256 sidecar.

Residual risks

  • A caller that sets APPIMAGETOOL to a bare command name (instead of a path) now fails;
    the variable is documented as an executable path.
  • Local just ci-local / full just check were not run for this shell-only change; CI is
    the acceptance gate.

…#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.
@Xuepoo Xuepoo added this to the v0.0.28 milestone Oct 24, 2026
@Xuepoo Xuepoo added fix Bug fix P2 Priority: medium area:packaging labels Oct 24, 2026
@coderabbitai

coderabbitai Bot commented Oct 24, 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 21 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: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a7b91aea-e90f-4214-8605-017d2771f122
Commits

Reviewing files that changed from the base of the PR and between 7c5a5a9 and 009cb2b.

Files selected for processing: 2
  • scripts/make-appimage.sh
  • scripts/tests/make-appimage.test.sh
  • 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

Comment @coderabbitai help to get the list of available commands.

@Xuepoo Xuepoo left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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:

  1. The defect statement is mechanically checkable and matches the code: just appimage-test
    created $TMP_BASE/mock-appimagetool while scripts/make-appimage.sh looked up a command
    literally named appimagetool, 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.
  2. The fix is opt-in and fail-closed: APPIMAGETOOL is 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.
  3. The test is adversarial rather than decorative: it injects the mock through APPIMAGETOOL,
    keeps a same-named appimagetool PATH stub that records any bypass, and a failing curl
    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.
  4. 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).

@Xuepoo
Xuepoo merged commit d8fc6ba into main Oct 24, 2026
20 checks passed
@Xuepoo
Xuepoo deleted the ctx-1500/fix-appimage-test-mock branch October 24, 2026 06:04
@Xuepoo Xuepoo mentioned this pull request Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:packaging fix Bug fix P2 Priority: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[0.0.28] appimage-test bypasses its mock and requires a cached appimagetool

1 participant