Repository navigation
Conversation
After the last setup step (starting diff servers), simulate rendered every composite and planned its managed resources with nothing on screen; to the user the CLI looked hung. Show a 'Simulating changes' spinner for that stretch, updated with which composite of how many is being processed, resolving to a checkmark before the plan output so it matches the setup step style. Progress lines need their text to change over time, which the event model keyed by text could not express: events gain an optional Name that identifies an operation across text changes, an Updated status, and the multi-spinner keys its lines accordingly. Plain (non-TTY) output prints the started and resolved lines and drops the in-place updates. Signed-off-by: Christopher Haar <christopher.haar@upbound.io>
Codecov Report❌ Patch coverage is 🚀 New features to boost your workflow:
|
jcogilvie
left a comment
There was a problem hiding this comment.
Approving with one comment:
The new keyed and updated path isn't tested yet. TestSimulateWithProgress runs the plain printer, which drops Updated events by design, so AddKeyed, UpdateKeyed and SuccessKeyed and the processors' Report calls are never exercised. I'd like to see:
- table-driven tests for
MultiSpinner - tests that give
PerformDiffandcollectXRDiffsaProgressand check the(done, total, detail)sequence they report.
| @@ -254,6 +258,13 @@ func WithIncludeManual(includeManual bool) ProcessorOption { | |||
| } | |||
|
|
|||
| // WithAdvisories sets the collector advisories are raised on and drained from for structured output. | |||
There was a problem hiding this comment.
WithProgress insertion happened between this doc comment and its function below. Please fix
| if !ran { | ||
| t.Fatal("simulateWithProgress did not run the wrapped function") | ||
| } | ||
| if progressFn := progress; progressFn == nil { |
There was a problem hiding this comment.
How would you lose this if progress is a local?
| for _, xr := range xrs { | ||
| for i, xr := range xrs { | ||
| resourceID := dt.MakeDiffKeyFromResource(xr) | ||
| p.config.Progress.Report(i, len(xrs), resourceID) |
There was a problem hiding this comment.
nit: Is it worth prefixing this with the composition being processed?
adamwg
left a comment
There was a problem hiding this comment.
Thanks for the update, I like this overall. Couple of notes inline.
| // exits 3; one that fails only schema validation returns one that exits 2. | ||
| // ctx must not be cancelled by its owner until simulate returns, so a | ||
| // cancellation reads as an interrupt. | ||
| // simulatingMsg is the progress line shown while composites render and their |
There was a problem hiding this comment.
Looks like this was added between the simulate fucntion's comment and its implementation :-).
| for update := range updateChan { | ||
| switch update.Status { | ||
| case async.EventStatusStarted: | ||
| multi.Add(update.Text) |
There was a problem hiding this comment.
I think these are the only callers of the MultiSpinner's Add/Success/Fail. Can we just update the signatures to be keyed rather than introducing the new Keyed variants?
Description of your changes
After the last setup step (starting diff servers), simulate rendered every composite and planned its managed resources with nothing on screen; to the user the CLI looked hung. Show a 'Simulating changes' spinner for that stretch, updated with which composite of how many is being processed, resolving to a checkmark before the plan output so it matches the setup step style.
Progress lines need their text to change over time, which the event model keyed by text could not express: events gain an optional Name that identifies an operation across text changes, an Updated status, and the multi-spinner keys its lines accordingly. Plain (non-TTY) output prints the started and resolved lines and drops the in-place updates.
Now that stretch shows a spinner updated with which composite of how many is being processed, and resolves to a checkmark before the plan output, matching the setup step style:
Fixes #545
I have:
./nix.sh flake checkto ensure this PR is ready for review.backport release-x.ylabels to auto-backport this PR.Need help with this checklist? See the cheat sheet.