fix(provision): clean, definitive fduty self-update logs#75
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)offduty update's raw multi-line output, which appeared with literal\nescapes 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;ensureFdutyCLIpasses the pre-update version intofdutySelfUpdate(prevVersion).fduty update, re-read the version and log the real outcome:fduty CLI upgraded from=… to=…, oralready up to date.lastLine(out)(the actual error) instead of a truncated head.firstLine/lastLinehelpers replace thehead()byte-truncator.Before / after
output_head="flashduty version 1.3.6 (…)\n"version="flashduty version 1.3.6 (…)"output_head="Current version…\n…/fla"(truncated)fduty CLI upgraded from="…1.3.6…" to="…1.3.12…"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.servesmoke, all 3 scenarios: self-check (clean version), upgrade (from→to), update-failure (single-line error). No\nsoup, no truncation.Target:
feat/ai-sre.