Skip to content

🐛 fix(controller): clear Ready when a namespaced export fails - #387

Merged
konih merged 1 commit into
PlatformRelay:mainfrom
SebTardif:fix/inventory-ready-on-degrade
Oct 1, 2026
Merged

konih merged 1 commit into
PlatformRelay:mainfrom
SebTardif:fix/inventory-ready-on-degrade

Conversation

@SebTardif

Copy link
Copy Markdown
Contributor

Summary

Clear Ready on a namespaced KollectInventory when the export fails outright, including the helper that sets Degraded directly.

Problem

setInventoryDegraded sets Synced false and Degraded true, and it used to leave Ready untouched. A watcher that treats Ready=True as healthy kept that condition across a total failure.

updateStatus had two branches. Zero failures and no export error set Ready true and clear Degraded. A partial export (ExportedCount > 0) set Ready true with PartiallySynced. A total failure that also debounced (FailedCount > 0, ExportedCount == 0, DebouncedCount > 0) matched neither branch, so Ready and Degraded stayed at the previous reconcile.

The cluster reconciler already removes Ready inside setDegraded. This change is limited to the namespaced inventory reconciler. Cluster updateStatus still has the same missing branch.

Status text uses the export error string, matching the existing per-sink messages.

Change

  • Remove the Ready condition at the start of setInventoryDegraded.
  • When updateStatus sees failures and zero exported items, set Degraded true and Ready false with reason ExportFailed. The message is outcome.ExportErr when present, otherwise export failed.

Validation

  • Red: go test -count=1 ./internal/controller/ -run 'TestKollectInventoryReconciler_setInventoryDegraded|TestKollectInventoryReconciler_updateStatus_' failed in TestKollectInventoryReconciler_updateStatus_failedWithNoExport because Ready stayed True with reason Exported.
  • Green: the same command passed (ok github.com/platformrelay/kollect/internal/controller).
  • golangci-lint run ./internal/controller/ with the repo custom binary and Go 1.26.6 reported 0 issues. golangci-lint fmt --diff was empty.

Origin

setInventoryDegraded landed in b40252ffd (2026-06-05). The updateStatus switch landed in 6b1fa364b (2026-06-05).

Adjacent work in the same file, different bug: #378 (spill handling). It does not clear Ready.

@SebTardif
SebTardif requested a review from konih as a code owner September 29, 2026 18:29
@codecov

codecov Bot commented Sep 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

A namespaced inventory left Ready=True after setInventoryDegraded, and updateStatus did not refresh Ready or Degraded when every attempted sink failed. Match the cluster reconciler on the degrade path, and mark Ready false when nothing was exported.

Signed-off-by: Sebastien Tardif <[email protected]>
@konih
konih force-pushed the fix/inventory-ready-on-degrade branch from b35d91d to 38720e0 Compare October 1, 2026 16:19
@konih
konih merged commit 71f050a into PlatformRelay:main Oct 1, 2026
35 of 36 checks passed
@SebTardif
SebTardif deleted the fix/inventory-ready-on-degrade branch October 1, 2026 20:05
konih pushed a commit to SebTardif/Kollect that referenced this pull request Oct 2, 2026
A KollectClusterInventory that was already Ready stayed Ready when one
sink was inside its export interval and another write failed.
isTotalExportFailure ignores that mix because DebouncedCount is non-zero,
and updateStatus had no branch for failed with zero exports. The
namespaced inventory learned that branch in PlatformRelay#387.

The new status test failed on main with Ready still True.

Signed-off-by: Sebastien Tardif <[email protected]>
konih pushed a commit to SebTardif/Kollect that referenced this pull request Oct 2, 2026
A KollectClusterInventory that was already Ready stayed Ready when one
sink was inside its export interval and another write failed.
isTotalExportFailure ignores that mix because DebouncedCount is non-zero,
and updateStatus had no branch for failed with zero exports. The
namespaced inventory learned that branch in PlatformRelay#387.

The new status test failed on main with Ready still True.

Signed-off-by: Sebastien Tardif <[email protected]>
konih pushed a commit to SebTardif/Kollect that referenced this pull request Oct 4, 2026
A KollectClusterInventory that was already Ready stayed Ready when one
sink was inside its export interval and another write failed.
isTotalExportFailure ignores that mix because DebouncedCount is non-zero,
and updateStatus had no branch for failed with zero exports. The
namespaced inventory learned that branch in PlatformRelay#387.

The new status test failed on main with Ready still True.

Signed-off-by: Sebastien Tardif <[email protected]>
konih pushed a commit that referenced this pull request Oct 4, 2026
A KollectClusterInventory that was already Ready stayed Ready when one
sink was inside its export interval and another write failed.
isTotalExportFailure ignores that mix because DebouncedCount is non-zero,
and updateStatus had no branch for failed with zero exports. The
namespaced inventory learned that branch in #387.

The new status test failed on main with Ready still True.

Signed-off-by: Sebastien Tardif <[email protected]>
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.

2 participants