Files
buzz/desktop/scripts
Matt TooheyandClaude Fable 5 8d962a4062 fix(desktop): preserve unselected targets in partial ACP lock bumps
A partial run like `just bump-acp-tools --target aarch64-apple-darwin`
rewrote the entire acp-tools.lock.json with only the selected targets,
silently dropping the other three targets' entries. Because ensure/
prepare treat a target with zero lock entries as success (stage
nothing, exit 0), a later desktop-release-build for a dropped target
would ship an empty resources/acp and silently fall back to unpinned
user installs — exactly the drift the bundling series exists to
prevent.

Make --target runs merge instead of replace: before resolving, read
the existing lock and carry over every entry whose target is not
selected, then write the union. The guard rails match the script's
fail-loudly ethos:

- A missing lock preserves nothing (there is nothing to drop) and the
  run proceeds — first-time generation with --target still works.
- An unreadable, unparseable, or tools-array-less lock aborts the
  partial run before any registry work, refusing to overwrite pins it
  cannot see.
- Full runs (no --target, or all four targets) never read the lock,
  so `just bump-acp-tools` can still regenerate a corrupt lock from
  scratch.

Preserved entries are logged ("Preserved 6 existing lock entries for
unselected targets") so a partial bump's diff is explainable from its
output, and the usage text documents the merge behaviour.

Addresses the partial-run finding from the bundling-series code
review (review 2ed3d00d on b52a665a).

Verification (against the Block registry, temp lock files):
- --target aarch64-apple-darwin on a copy of the committed lock:
  6 unselected entries preserved byte-identically; merged lock
  byte-identical to the committed lock (registry pins unchanged);
  8 entries across all 4 targets.
- --target with no existing lock: writes only the selected target's
  2 entries, exit 0.
- --target with corrupt JSON / {"tools":"nope"}: exits 1 in <1s with
  a refusing-to-overwrite message; lock file left untouched.
- pnpm exec biome check + node scripts/check-file-sizes.mjs: clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
2026-07-15 13:52:14 +10:00
..