Skip to content

fix(cli): stop the upgrade path from reporting success it did not have - #424

Merged
Sunrisepeak merged 1 commit into
mainfrom
fix/upgrade-honesty
Jul 27, 2026
Merged

Sunrisepeak merged 1 commit into
mainfrom
fix/upgrade-honesty

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

What

Two places where xlings reported success it did not have. Both found while measuring whether an existing 0.4.69 user reaches 2026.7.27.3 without noticing.

1. self update swallowed a failed upgrade

cmd_update ran xlings install xlings@latest -y and on non-zero logged a warning and returned 0. The error scrolled past under the progress bar; the command reported success; the user kept running the old binary.

Reproduced end to end — a 0.4.69 client resolving 2026.7.27.3 against a CN mirror not yet topped up got HTTP 404, and self update still exited 0:

[error] download failed for xim:[email protected]: HTTP 404
[warn] xlings package not available or install failed, skipping
  self update 总耗时  13.0s  rc=0        ← reported success
  $H/bin/xlings     : xlings 0.4.69      ← still on the old version

Install and activation now both propagate, and the message says the version did not change.

2. Report panels clipped to one screen

Dimension::Fit(doc) takes extend_beyond_screen = false by default, clamping the fitted height to the terminal's. With stdout on a pipe ftxui reports a default 80×24, so every row past 24 was dropped with no marker.

Findings print first and totals last, so self doctor on a real home showed a wall of red and lost the line saying how bad it is:

before after
self doctor (real DB) 24 lines, no summary 86 lines, broken payloads 23
list --all (246 targets) 25 lines full

The redraw-in-place progress renderers keep the old behaviour on purpose — they overwrite a counted number of rows and must stay inside the screen.

Not a regression from this release

0.4.69 and 2026.7.27.3 behave identically on both. Byte-for-byte on the truncation: 24 lines / 7007 bytes from each.

Tests

  • E2E-38 self_update_failure_test.sh (new) — a fixture whose install hook fails; asserts non-zero exit and an actionable message
  • self_doctor_test.sh S12 — 30 broken-payload entries; asserts the report exceeds 24 rows and the summary survives

Both verified to fail against the released 2026.7.27.3 binary and pass against this branch. mcpp test: 22/22.

Also checked, not changed

A missing shim report for library-only packages (zlib, openssl) looked like a third defect, but it only appears in a home with no binary at <home>/bin/xlings. On a faithful layout the unfixed binary reports status OK. It was an artifact of the test home, so the change I had written for it was reverted rather than shipped.

Two ways `xlings` told a user things had gone fine when they had not.
Both found while measuring whether an existing 0.4.69 user can reach
2026.7.27.3 without noticing.

`self update` swallowed a failed upgrade. cmd_update ran
`xlings install xlings@latest -y` and, on a non-zero exit, logged a
*warning* and returned 0. The error scrolled past under the progress
bar and the command reported success, so the user carried on with the
old binary believing they were current. Reproduced end to end: a 0.4.69
client resolving 2026.7.27.3 against a CN mirror that had not been
topped up yet got HTTP 404, and `self update` still exited 0. Now the
install and the activation both propagate, and the message says
plainly that the version did not change.

Report panels were clipped to one screen. ftxui's Dimension::Fit takes
extend_beyond_screen = false by default, which clamps the fitted height
to the terminal's -- and with stdout on a pipe ftxui reports a default
80x24. Everything past row 24 was dropped with no marker. Findings
print first and totals last, so on a real home `self doctor` showed a
wall of red and lost the line saying "broken payloads 23"; measured on
one, output went 24 -> 86 lines with the fix. `xlings list` was capped
the same way. The redraw-in-place progress renderers deliberately keep
the old behaviour: they overwrite a counted number of rows and have to
stay inside the screen.

Both regressions are older than this release -- 0.4.69 and 2026.7.27.3
behave identically -- so this is not a fix for something 2026.7.27.x
introduced.

Tests: E2E-38 self_update_failure_test.sh (new) and self_doctor S12.
Both verified to fail against the released 2026.7.27.3 binary and pass
against this one.
@Sunrisepeak

Copy link
Copy Markdown
Member Author

Third command hit by the same clamp, found while sanity-checking the change: xlings --help.

released 2026.7.27.3  --help → 24 lines, ends mid-OPTIONS:
      OPTIONS
        -y, --yes                 Skip confirmation prompts     ← cut here

this branch          --help → 32 lines, ends:
      If you are an LLM/AI agent, run `xlings agent` FIRST.
      It contains usage instructions designed specifically for you.

So the block telling an AI agent to run xlings agent was invisible to exactly the audience it is written for — any agent shelling out to xlings --help gets stdout on a pipe, which is the case that clamps to 24.

Unchanged and out of scope here: the width half of the same problem (Dimension::Full() truncating long descriptions to 80 cols on a pipe). info_panel.cppm already carries a comment about it and works around it with raw ANSI for subos status lines.

@Sunrisepeak
Sunrisepeak merged commit ddf1451 into main Jul 27, 2026
7 checks passed
Sunrisepeak added a commit that referenced this pull request Jul 27, 2026
…tely leaves

The harness filed `self-update-effective` as a blocker because the recorded
client version stayed at v0.4.69 across the upgrade. That is now designed
behaviour, and a findings table with a known-false row is a table people learn
to skip.

`self update` runs the OLD binary. It cannot know whether the new one will find
anything to migrate, so it does not claim the home is reconciled; `self doctor
--fix` stamps the field when the migration actually happens, and the mismatch
in between is precisely what the new client reads to know it should tell the
user. The defect became the marker.

So the phase now asserts the two things separately:

- self update REPLACED THE BINARY -- fingerprinted before and after, because
  its exit code is not evidence of anything (a 0.4.69 client answered 404 from
  a CN mirror and still reported success, #424)
- the recorded version deliberately did NOT move

The second assertion is the interesting one: it fails if someone later makes
`self update` stamp the field, which would silently switch the migration hint
off for every home that upgrades without being repaired.
Sunrisepeak added a commit that referenced this pull request Jul 27, 2026
…tely leaves (#438)

The harness filed `self-update-effective` as a blocker because the recorded
client version stayed at v0.4.69 across the upgrade. That is now designed
behaviour, and a findings table with a known-false row is a table people learn
to skip.

`self update` runs the OLD binary. It cannot know whether the new one will find
anything to migrate, so it does not claim the home is reconciled; `self doctor
--fix` stamps the field when the migration actually happens, and the mismatch
in between is precisely what the new client reads to know it should tell the
user. The defect became the marker.

So the phase now asserts the two things separately:

- self update REPLACED THE BINARY -- fingerprinted before and after, because
  its exit code is not evidence of anything (a 0.4.69 client answered 404 from
  a CN mirror and still reported success, #424)
- the recorded version deliberately did NOT move

The second assertion is the interesting one: it fails if someone later makes
`self update` stamp the field, which would silently switch the migration hint
off for every home that upgrades without being repaired.
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