Repository navigation
🐛 fix(controller): make inventory store source Start non-blocking (DR-FIND-01) - #143
Merged
Merged
Conversation
inventoryNamespaceSource.Start ran a forever select loop and only returned on ctx.Done(). controller-runtime waits for every raw-source Start to return before starting a controller's workers, so the namespaced KollectInventory controller never started workers and inventory CRs never reconciled/exported (DR-FIND-01, reproduced on driving-range v0.9.0 and v0.10.0). Arm the store subscription synchronously, then run the coalescing dispatch loop in a goroutine and return nil immediately. Move the unsubscribe defer into the goroutine; drop the blocking ctx.Done() wait from the nil-guard. Tests: nil-deps now asserts prompt return under an un-cancelled context; the enqueue test calls Start directly (no manual goroutine) then Upserts with no sleep, proving Start is non-blocking and the subscription is armed before it returns.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
konih
added a commit
that referenced
this pull request
Jul 31, 2026
Bump chart version/appVersion 0.10.0 -> 0.11.0 for the next minor. Unreleased since v0.10.0: feat(netguard) NET-01 --allow-private-sinks opt-in (#146) + fix(controller) inventory store source Start non-blocking / DR-FIND-01 (#143), plus DR-FIND-03 lab-bootstrap docs (#148), UI-TEST-01 (#147), SEC-04j CI-hardening (#150).
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.



DR-FIND-01 (P0) — KollectInventory controller never starts workers
Root cause.
inventoryNamespaceSource.Startran a foreverfor/selectloop and only returned onctx.Done(). controller-runtime waits for every raw-sourceStart(wired viaWatchesRawSourceatkollectinventory_controller.go:637) to return before starting a controller's workers — so the namespacedKollectInventorycontroller never started workers, inventory CRs never reconciled/exported. Reproduced on driving-range v0.9.0 and v0.10.0 (dr-20260731-80aef1).KollectClusterInventorywas unaffected (it doesn't use this source).Fix. Arm the store subscription synchronously on the caller goroutine, run the coalescing dispatch loop in a goroutine, and
return nilimmediately. The unsubscribedefermoves into the goroutine; the nil-guard branch no longer blocks onctx.Done(). Timer/coalesce (50ms) semantics unchanged.Tests.
nilDependenciesReturnsPromptlyasserts prompt return under an un-cancelled context (old code hangs → fails).enqueuesInventoryRequestsnow callsStartdirectly (no manual goroutine) thenUpserts with no sleep — proving Start is non-blocking and the subscription is armed before it returns. Both discriminate the regression.Gates.
go build✅ · controller envtest suite (43 specs) ✅ ·go test -race✅ race-clean ·go vet✅ · custommake lint0 issues ✅.Independent review: APPROVE, no P0/P1 (3 P3 optional follow-ups: dead-but-harmless mutex, add a bounded per-test timeout guard, add a dedicated 'workers start' envtest).