Repository navigation
Conversation
Planner.Plan already fetches each managed resource's live counterpart; it now records that object's health on the plan it returns. A create has no live object and so no health. No cluster reads are added. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Plan output gives each managed resource that isn't healthy before apply a ⚠ line under its plan, unchanged inputs included, and adds a Health: line after Plan: when anything is unhealthy. Healthy runs print what they printed before. --full-messages prints condition messages in full, wrapped, rather than cut to one line. The JSON and YAML result carries summary.health, counted from the plans' health, beside the per-plan health. HealthSummary moves to plan so both results share it. formatVersion stays 0.2, which plan.ResultFormatVersion already shares with the other simulate commands. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
resource simulate's exit status is now the same bitmask the other simulate commands use: 3 for changes, 4 when a resource was failing (Synced=False) before apply, 7 for both. Not ready and paused resources don't set bit 4. An errored plan still exits 1 whatever else was found. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Add an output section to resource simulate's help covering the ⚠ line, the Health: line, --full-messages and the JSON health fields, and rewrite its exit statuses to match the bitmask. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
…yaml Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Replaces TestWarnIgnoredFullMessages, which called the warning directly, with a test of the renderer and report functions Run calls. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
…space differently Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Add a HealthBuilder in internal/health/healthtest for *health.Health, for the health ownership tests that follow. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Pin today's behaviour of Key and OwnedElsewhere before the health model refactor. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Add TestRenderDiffsHealth cases for 2- and 3-level nesting in flat and grouped layouts, a nested input XR without health, and an unchanged diff counted in the Health: line. Composed health is flattened with Via set, as RenderedResources.Merge builds it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
…tput Add TestRenderCompDiffHealth cases for 2- and 3-level nesting, truncated and full messages, a nested XR shared across compositions, the changed XR's repeated message, and a filtered impact. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Pin plan text, JSON and assembled composites for 2- and 3-level nested XRs built through FromCompReport, assert Failing() agrees with what the Health: line counts, and pin the equal-diff edge where -o diff counts a resource that summary.health and exit bit 4 do not. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Pin the plan text health lines and Health: line for every health state, long message cutting and --full-messages wrapping, Failing per state, and the 0/3/4/7 exit bits, each checked against the Health: line's failing count. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Add health.Run and health.Build, which resolve a run's health ownership and tally its counts and failing bit in one pass, in simulate's order. Shown resources with no kind and no name never share a key. Nothing calls Build yet. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
The assembler builds a health.Run once with health.Build and lists each composite's Unhealthy from Run.Owned. Result's Health, Failing and HealthLine read a Run built from its resolved lists, so healthTally goes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Resource simulate builds one health.Run from its plans with health.Build. The Health: line, summary.health and exit bit 4 read it; plan.HealthCounts and plan.Failing stay for their test callers until they are removed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
The xr -o diff renderer reads one health.Run, passed in through the new DiffOptions.Health, for which group lists each unhealthy resource and for the Health: line, in both the flat and grouped layouts. renderXRReport builds it from the Result's composites and plans, so the Health: line now counts plans, as summary.health and exit bit 4 do (D-1): an unhealthy equal diff dropped for a missing provider plan is no longer counted. groupsOwnedElsewhere loses its last caller and goes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
The composition -o diff renderer reads one health.Run, passed in through DiffOptions.Health, for which XR lists each unhealthy resource and for the Health: line, with one composite per impact of every composition in run order. renderCompReport builds it with compRun from the Result's composites and plans. tallyComposite, unhealthyOwnedElsewhere and the renderer's unhealthyBlock lose their last callers and go. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Delete plan.HealthCounts and plan.Failing; tests read plan.HealthRun instead. Pin that plans with no kind and no name each count on their own. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
The assembler stores the Run it resolved Unhealthy from on Result, and the diff renderers get that exact Run. The second walk over the report (xrRun, compRun) is gone; Results without a stored Run still rebuild it from Composites. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
With DiffOptions.Health nil the diff renderers print no Health: line and no unhealthy blocks, so the run's model is the only count source. The groupsRun and compRun fallbacks are deleted; the renderer tests build the run's health with health.Build. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Render multi-composition and grouped xr reports through the assembler's stored Run, and pin that a Run of the wrong length is an error. The composition diff's inner renderer now gets no health, since its groups are not the run's composites. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Unexport tally, entry and ownedElsewhere, which only Build uses. Share composition diff's listed-impact rule through one helper, fix two doc comments, and tidy two tests' names and fields. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Codecov Report❌ Patch coverage is 🚀 New features to boost your workflow:
|
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.
Description of your changes
Fixes #612
Stacked on #566; review only the commits after
test(simulate): require summary.health before comparing its counts.Health in simulate output used to be worked out separately for each output. The plan text, xr
-o diff, composition-o diff, resource simulate, JSON/YAML and the exit status each walked the results themselves to decide which XR lists an unhealthy resource and what to count. That's how #554 ended up needing three separate fixes for nested XRs. This PR builds one health model per simulate run and has every output read from it.health.Build(composites, shown)returns ahealth.Run. It records, for each composite, which composed resources it owns once nested XRs are resolved (Owned), plus the run'sCountsandFailing. Ownership and counting live only ininternal/health.Tally,EntryandOwnedElsewhereare now unexported.Result.Health(),Failing(),HealthLine(),MarshalJSONand both-o diffrenderers (throughDiffOptions.Health) read that copy. Resource simulate builds its own withplan.HealthRun, which also replacesplan.HealthCountsandplan.Failing, and keeps feat(resource): report live health in resource simulate #566'sLiveNamespacerule.Health:line from the run instead of tallying diffs. If the run doesn't match the report they're rendering, they return an error rather than panic. With no run (DiffOptions.Healthnil) they print no health at all. The diff-counting fallback is gone.Health:line under-o diffnow counts from plans, matching JSON and the exit status, where it used to count diffs. Resource simulate plans that have no kind and no name now each count once, so the count always agrees with exit bit 4.Health:line when only an XR is failing.internal/diff/testutilsto a newinternal/health/healthtestpackage.testutilsimportsinternal/plan, soplan's own tests couldn't use it there.Tests. The first five commits pin today's output for every path before anything changes. That includes 2- and 3-level nested XRs, XRs shared across compositions and filtered impacts,
--full-messages, JSON round-trips and exit codes. The refactor commits leave those expected values alone. New table tests coverhealth.Build, rendering through the stored run for composition and grouped xr diff, the run-mismatch error, and resource simulate plans with no kind and no name.I have:
./nix.sh flake checkto ensure this PR is ready for review.Linked a PR or a docs tracking issue to document this change.No user-facing change.Addedbackport release-x.ylabels to auto-backport this PR.Need help with this checklist? See the cheat sheet.
🤖 Generated with Claude Code