Skip to content

Show progress while simulate renders and plans composites - #565

Merged
haarchri merged 3 commits into
crossplane:mainfrom
haarchri:feat/simulate-progress
Nov 21, 2026
Merged

haarchri merged 3 commits into
crossplane:mainfrom
haarchri:feat/simulate-progress

Conversation

@haarchri

Copy link
Copy Markdown
Member

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.

✓ Pulling provider package xpkg.upbound.io/upbound/provider-aws-ec2:v2.9.5
✓ Starting diff server for xpkg.upbound.io/upbound/provider-aws-ec2:v2.9.5
<nothing, possibly for minutes>

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:

✓ Starting diff server for xpkg.upbound.io/upbound/provider-aws-ec2:v2.9.5
⠋ Simulating changes (3/14 composites: ec2.aws.m.upbound.io/v1beta1, Kind=Network/prod-network)
...
✓ Simulating changes
[~] Composition.apiextensions.crossplane.io networks.aws.platform.upbound.io (update)

Fixes #545

I have:

  • Read and followed Crossplane's contribution process.
  • Read and followed Crossplane's AI policy and confirmed a human stands behind this PR.
  • Run ./nix.sh flake check to ensure this PR is ready for review.
  • Added or updated unit tests.
  • Linked a PR or a docs tracking issue to document this change.
  • Added backport release-x.y labels to auto-backport this PR.

Need help with this checklist? See the cheat sheet.

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>
@haarchri
haarchri requested review from a team, jcogilvie and tampakrap as code owners November 19, 2026 21:26
@haarchri
haarchri requested review from negz and removed request for a team November 19, 2026 21:26
@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.52632% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.58%. Comparing base (cd703a0) to head (90157d1).
⚠️ Report is 64 commits behind head on main.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jcogilvie jcogilvie left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 PerformDiff and collectXRDiffs a Progress and check the (done, total, detail) sequence they report.

Comment thread internal/simulate/run_test.go Resolved

@adamwg adamwg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, I like this overall. Couple of notes inline.

Comment thread internal/simulate/run.go Resolved
Comment thread internal/terminal/spinner.go Resolved
Collapse the Keyed method variants into MultiSpinner's Add/Success/Fail
signatures - asyncPretty was their only caller. The keyed update is named
UpdateText because Update is taken by the tea.Model interface.

Prefix the per-composite progress detail with the composition being
processed, so composites of the same name stay apart when several
compositions are simulated in one run.

Restore the doc comments WithProgress and simulatingMsg were inserted
into, and drop a vacuous nil check on a local in TestSimulateWithProgress.

Cover the keyed path: table-driven MultiSpinner tests pin how keys
identify lines whose titles change, and progress-sequence tests pin the
(done, total, detail) reports from PerformDiff and collectXRDiffs.

Signed-off-by: Christopher Haar <christopher.haar@upbound.io>

@adamwg adamwg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

Signed-off-by: Christopher Haar <christopher.haar@upbound.io>
@haarchri
haarchri merged commit d397cf4 into crossplane:main Nov 21, 2026
12 checks passed
@haarchri
haarchri deleted the feat/simulate-progress branch November 21, 2026 11:08
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.

simulate: show a spinner while the simulation is running after the diff server starts

3 participants