Skip to content

Support to linux zcode - #20

Closed
eltonacosta wants to merge 5 commits into
notmike101:mainfrom
eltonacosta:main
Closed

eltonacosta wants to merge 5 commits into
notmike101:mainfrom
eltonacosta:main

Conversation

@eltonacosta

Copy link
Copy Markdown

Summary

This PR fixes two Linux portability issues reported together:

1. Portable updater test archives (no more bsdtar)

The Linux test path shelled out to bsdtar to build fixture archives, but that binary is not a project dependency and isn't provisioned by CI. On a clean Linux environment without libarchive-tools, bun test failed with an executable-not-found error before exercising the updater. Both compress() helpers in tests/extension-updater.test.ts and tests/host-updater.test.ts now use a single in-process ZIP writer.

Changes:

  • New tests/fixtures/archive.ts: an in-process ZIP builder (store/deflate, CRC32 table, UTF-8 filename flags, Unix mode attributes) with no external dependencies.
  • tests/extension-updater.test.ts / tests/host-updater.test.ts: compress() delegates to writeZipFromDirectory(); bsdtar/Compress-Archive shell-outs removed on every platform.
  • Added a round-trip test that extracts the generated fixture with the production reader (extractArchive/yauzl), so the fixture format stays honest.

2. Remove generated zcode.desktop on uninstall

When no desktop entry existed, readShortcut returned undefined, so installOrRepair stored no shortcut state — yet still created zcode.desktop. uninstall only restored state.shortcut, so a fresh Linux install left a broken launcher pointing at the deleted zdp-launcher.

Changes:

  • src/cli/shortcut.ts: new captureShortcut() records created: true when no entry exists, and new removeLauncherShortcut() removes launcher-created entries, restores pre-existing ones, and safely handles legacy install states (matches the stored target against the launcher path) or missing state (skips non-launcher entries).
  • src/cli/installer.ts: installOrRepair now always persists shortcut state (including created); uninstall delegates to removeLauncherShortcut() even when no state was recorded.
  • src/shared/schemas.ts: shortcut schema accepts an empty originalTarget and the optional created flag; older states remain valid.

Tests (tests/installer.test.ts):

  • Fresh install → generated .desktop removed on uninstall.
  • Legacy state without shortcut data → generated entry still removed.
  • Pre-existing entry → restored byte-for-byte on uninstall.
  • Verified the new removal test fails against the pre-fix code (state.shortcut was undefined on fresh installs).

Verification

  • bun run check passes fully: typecheck, 58 tests / 0 failures, SDK packaging check, example build, and host build.
  • Real-machine doctor run confirms shortcutManaged: true with the existing install intact.

Files changed

File | Change -- | -- tests/fixtures/archive.ts | New in-process ZIP fixture writer tests/extension-updater.test.ts | Uses fixture writer; adds extraction round-trip test tests/host-updater.test.ts | Uses fixture writer src/cli/shortcut.ts | Shortcut capture/removal lifecycle (created tracking) src/cli/installer.ts | Persists shortcut state; uninstall removes generated entries src/shared/schemas.ts | Schema relaxations for generated-shortcut states tests/installer.test.ts | Fresh-install removal, legacy-state, and restore coverage

elton costa added 5 commits September 13, 2026 18:17
Write updater test archives with an in-process ZIP writer so Linux tests
no longer shell out to bsdtar, and make the in-process archive the only
fixture source on every platform.

Record whether the installer generated the ZCode shortcut, remove that
entry on uninstall, and fall back to matching the stored target against
the launcher path for install states written before this change.

Relax the install state schema so a generated shortcut can carry an empty
original target, and cover fresh installs, legacy states without shortcut
data, and restored pre-existing desktop entries in the installer tests.
@eltonacosta eltonacosta changed the title Fix generated Linux desktop entries left behind on uninstall + portable updater test archives Support to linux zcode Sep 15, 2026
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.

1 participant