Skip to content

fix(provision): clean, definitive fduty self-update logs#75

Merged
ysyneu merged 1 commit into
feat/ai-srefrom
fix/fduty-selfupdate-logging
Jun 15, 2026
Merged

fix(provision): clean, definitive fduty self-update logs#75
ysyneu merged 1 commit into
feat/ai-srefrom
fix/fduty-selfupdate-logging

Conversation

@ysyneu

@ysyneu ysyneu commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

What

Follow-up to the side-mode provisioning work (#73, v0.0.24). A colleague ran v0.0.24 successfully but the fduty logs were messy and truncated — the old code logged head(out, 300) of fduty update's raw multi-line output, which appeared with literal \n escapes and cut off mid-string (e.g. …Downloading https://static.flashcat.cloud/fla").

This makes the fduty logs clean, single-line, and definitive:

  • verifyFdutyOnPath() returns the resolved version line; ensureFdutyCLI passes the pre-update version into fdutySelfUpdate(prevVersion).
  • After a successful fduty update, re-read the version and log the real outcome: fduty CLI upgraded from=… to=…, or already up to date.
  • The failure path logs lastLine(out) (the actual error) instead of a truncated head.
  • firstLine/lastLine helpers replace the head() byte-truncator.

Before / after

before (colleague's logs) after
self-check output_head="flashduty version 1.3.6 (…)\n" version="flashduty version 1.3.6 (…)"
upgrade output_head="Current version…\n…/fla" (truncated) fduty CLI upgraded from="…1.3.6…" to="…1.3.12…"
update fail output_head=<truncated preamble> error="exit status 1" detail="<actual error line>"

Testing

  • go build / go vet / go test ./cmd/... / gofumpt -l cmd/ — all green.
  • Live mac serve smoke, all 3 scenarios: self-check (clean version), upgrade (fromto), update-failure (single-line error). No \n soup, no truncation.
  • Quality gates (simplify + adversarial review) run on the diff: review clean (no P1/P2); simplifier applied one dead-fallback cleanup.

Target: feat/ai-sre.

The success path logged head(out,300) of `fduty update`'s raw multi-line
output, which surfaced in logs as literal `\n` escapes truncated mid-string
(a colleague reported messy/cut-off logs). Replace it with single-line,
definitive logging:

- verifyFdutyOnPath now returns the resolved version line; ensureFdutyCLI
  passes the pre-update version into fdutySelfUpdate(prevVersion).
- after a successful `fduty update`, re-read the version and log the actual
  outcome: "fduty CLI upgraded" from->to, or "already up to date".
- the failure path logs the last output line (the real error) via lastLine
  instead of a truncated head.
- firstLine/lastLine helpers replace the head() byte-truncator.
@ysyneu ysyneu merged commit 95b0833 into feat/ai-sre Jun 15, 2026
5 checks passed
@ysyneu ysyneu deleted the fix/fduty-selfupdate-logging branch June 15, 2026 11:57
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