Skip to content

fix(cli): preserve command status when update checks fail - #1603

Merged
Lorenzobattistela merged 2 commits into
bendlang:mainfrom
vicmcorrea:fix/update-cache-command-status
Oct 16, 2026
Merged

Lorenzobattistela merged 2 commits into
bendlang:mainfrom
vicmcorrea:fix/update-cache-command-status

Conversation

@vicmcorrea

Copy link
Copy Markdown
Contributor

Problem and fix

A fresh, parseable update cache with a non-string ver, or a newer version with a non-string notice, can throw after the command finishes. A program may print its correct result but exit 1; an explicit exit 7 also becomes 1.

Catch rejection from the optional daily check at its sole CLI callsite. This preserves the documented rule that the check never fails the command, without adding cache-validation or repair machinery.

Blast radius

Two files: one production line in bend2/main.ts, and eight regression lines in the existing gates/ping.ts daily-check cases. The tests reuse its private cache and helpers; existing cleanup resets the cache afterward.

Valid notices, refresh behavior, telemetry opt-out and command failures retain their behavior. No public API or cache-format change.

Regression evidence

The two fresh-cache cases cover null version and null notice. Both exact assertions fail against the original compiled CLI, which prints help then exits 1 with a TypeError, and pass against the corrected binary with identical help, exit 0 and empty stderr.

Source and compiled CLI controls also cover valid current/newer/stale-offline caches. Independent source checks verify preserved checker failures, exit 7, notice sanitation/truncation and no HTTP requests for fresh caches.

Checks

  • Source and freshly compiled CLI probes, including the exact added regression assertions, pass their baseline/branch expectations.
  • git diff --check passes.
  • Scoped TypeScript checking reports seven byte-identical existing diagnostics in bend.ts and safe.ts; no new diagnostics. This is not a clean typecheck.
  • Repository gate: 53/54. Its sole failure is unchanged comp.ts at 64,092/64,000 ttok, also present on main's #1600 check. This PR leaves comp.ts untouched.

Validation limits

Local checks used macOS arm64 and Bun 1.3.11. Full ping skips because the sibling site repository is unavailable; replaying its added assertions does not validate the full installer/release flow. Linux/WSL, Windows and cluster checks were not run. The inherited compiler-cap failure prevents a green repository gate.

Malformed cache data remains on disk until normal refresh; this change preserves the command result rather than repairing that data.

@Lorenzobattistela
Lorenzobattistela merged commit e192c1e into bendlang:main Oct 16, 2026
1 check failed
@Lorenzobattistela Lorenzobattistela mentioned this pull request Oct 20, 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.

2 participants