Repository navigation
♻️ refactor(controller,api): generic family-sink reconciler (AR-08/F68) - #39
Conversation
GATE REPORT — family-sink-generic-reconciler @ ee17624 — NO SELF-VERDICT — 2026-07-02Lane: AR-08/F68 — collapse This is the author's own PR, so per this repo's auto-mode policy no self-verdict is posted here — this is a gate report for the maintainer to review, not an APPROVE. Gate matrix
FindingsNone at P0/P1/P2. One self-identified gap, fixed before opening this PR: the new Functional correctnessOne Table-driven tests in Coverage delta
SummaryTDD: red test written first against the not-yet-existing generic types (confirmed compile failure via |
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Follow-up notes (after posting the gate report above)Scope clarification for future backlog updates: BACKLOG.md §5 and the archived audit tie AR-08/F68/AR-14 together ("AR-08 = F68 = AR-14 (no golden schema) = EC-P2-02"). This PR delivers AR-08 (collapse) and F68 (shared reconcile-entrypoint coverage for all three kinds). It does not touch AR-14 — the Snapshot golden schema is still missing (Database/Event already have one) — and Database/Event still lack a real "runs connection test on reconcile" envtest spec analogous to Snapshot's in CI:
Re-ran both failed jobs ( |
|
Both re-run jobs ( |
REVIEW — family-sink-generic-reconciler @ 64fbdf6 — APPROVE — 2026-07-06Verdict: APPROVE Gate matrix (run locally against
|
| Gate | Result |
|---|---|
| go build ./... | PASS |
| task verify | PASS — RBAC/CRD codegen (combined kubebuilder markers) regenerated clean, no drift |
| task lint | PASS — 0 issues |
| task arch-lint | PASS |
| task test (full incl. envtest) | PASS — all packages green |
| task coverage | PASS — internal/ 82.6% (floor 72%) |
| task scrub | PASS — clean |
| task changelog:verify | PASS — resynced via task changelog:write, stable across repeated runs |
Findings
None. Verified the FamilySinkReconciler[T, PT] generic collapse behaviorally: familySinkPtr[T]
correctly constrains PT to *T satisfying both client.Object and the new
FamilySinkObject interface; p.FamilySinkStatus() returns a pointer into the actual object's
status struct (not a copy), so &status.Conditions/&status.Preview still mutate the real object
before the guarded Status().Update. Confirmed +k8s:deepcopy-gen=false is correctly applied
to the new FamilySinkObject interface (an interface type, not a struct — deepcopy-gen would
otherwise choke on it), and task verify regenerated zz_generated.deepcopy.go/CRD/RBAC bases
with no diff beyond what's expected. Confirmed the removed dedicated
TestFamilySnapshotSinkReconciler_recoversReconcilePanic is not a coverage loss — it's superseded
by the new table-driven TestFamilySinkReconciler_{Snapshot,Database,Event}_recoversReconcilePanic
in family_sink_generic_test.go, which additionally extends the same coverage to Database/Event
(previously untested at the Reconcile-entrypoint level). One intentional behavior addition, not a
regression: Reconcile() now logs connection-test failures uniformly for all three kinds (Database/
Event previously swallowed the log line silently, per the PR's own gate report) — error still
propagated to guardReconcile either way, no retry/status change.
Summary
Diff vs current origin/main is exactly the 8 expected files. Clear to merge.
Collapse FamilySnapshotSinkReconciler/FamilyDatabaseSinkReconciler/ FamilyEventSinkReconciler into one FamilySinkReconciler[T,PT], driven by a new FamilySinkObject accessor interface on the three CRD kinds. Reduces three near-identical Reconcile/SetupWithManager pairs to one. Only KollectSnapshotSink had direct Reconcile()-entrypoint test coverage before this (envtest + panic-recovery); the new table-driven tests in family_sink_generic_test.go exercise all three kinds through the shared implementation, closing that gap for Database and Event. EC-P2-02 (panic-guarded family-sink reconcile) was already done on all three reconcilers before this change; not claimed as new work here.
The generic FamilySinkReconciler (AR-08) is already exercised through internal/controller's table-driven tests, but Go's per-package coverage profile doesn't attribute those cross-package calls back to api/v1alpha1 — leaving FamilySinkSpec/FamilySinkCommon/FamilySinkStatus at 0% self-coverage. Add direct tests so the accessor wiring for each of the three kinds has its own coverage record.
64fbdf6 to
5d9eb08
Compare
# Conflicts: # CHANGELOG.md
REVIEW — /kollect-mr-reviewVerdict: APPROVE Scope: Generic family-sink reconciler (AR-08/F68) — replaces three near-identical reconcilers ( Gate matrix: GitHub CI green on head
Non-blocking: Merging via merge-commit. |
♻️ refactor(controller,api): generic family-sink reconciler (AR-08/F68)
Summary
FamilySnapshotSinkReconciler/FamilyDatabaseSinkReconciler/FamilyEventSinkReconcilerinto one genericFamilySinkReconciler[T,PT], driven by a newFamilySinkObjectaccessor interface implemented by the three family-sink CRD kinds (api/v1alpha1/sink_adapter.go).KollectSnapshotSinkhad directReconcile()-entrypoint test coverage (envtest + panic-recovery). The new table-driven tests ininternal/controller/family_sink_generic_test.goexercise all three kinds (panic-recovery, NotFound, preview-annotation happy path) through the shared implementation, closing that gap for Database and Event.Reconcile()now logs connection-test failures for all three kinds (previously only Snapshot logged; Database/Event silently swallowed the log line while still propagating the error for requeue).TDD
Red first:
family_sink_generic_test.gowas written against the not-yet-existingfamilySinkPtr/FamilySinkReconcilertypes (confirmed compile failure viago vet), then the generic reconciler +FamilySinkObjectinterface were implemented to turn it green.Test plan
go build ./...task verify(codegen drift — added+k8s:deepcopy-gen=falseon the newFamilySinkObjectinterface so controller-gen skips it)task lint/task arch-linttask test(full unit + envtest suite)task coverage— 80.9% (floor 72%)task scrub— cleantask changelog:verify🤖 Generated with Claude Code