Incremental state step 2: central recompute and diff #629
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 239 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.328
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #629"
general
weight: 0.35
justinsb
Implements Step 2 of [docs/incremental-state.md](docs/incremental-state.md) ("Central recompute and diff").
Key Changes
1. All inputs live in
State:-
GatewayClassandGatewayAddressesare recorded intoState.- Stamped with a monotonically increasing revision counter (
uint64) only on actual input mutations (spec, relevant metadata labels, secret data, configmap data, service ports/IP, etc.).- Replaced
len(gw.Status.Addresses) > 0inCompileModelso status computation never reads the status we wrote.2. Pure Output Computation (
ComputeOutputs):- Pure function computing desired statuses per Gateway, HTTPRoute, ListenerSet, BackendTLSPolicy, GatewayClass, proxy config, certificates, and resolved gateways.
- Status merging (preserving
LastTransitionTimeand foreign controller entries) happens purely at write time.3. Central Recompute & Diff:
-
Statecentrally recomputes and diffs desired statuses against previous outputs, emitting change events on per-kind channels.- Background coalescing/debouncing worker batches rapid bursts of watch events.
- Updates the proxy and calls
OnGatewaysUpdatecentrally once per recompute when outputs change.4. Simplified Reconcilers:
- Reconcilers now strictly record inputs into
Stateand write merged status viaWatchesRawSource(source.Channel(...)).- Deleted all 19 cross-object
EnqueueRequestsFromMapFuncmapping functions across all reconcilers.5. Tests & Benchmarks:
- Added unit tests in
pkg/state/state_test.goverifying diffing and dependency propagation without mapping functions (e.g. Namespace label change, ReferenceGrant deletion, ConfigMap corruption).- Added
BenchmarkState_Recomputeinpkg/state/state_benchmark_test.gotesting 100 Gateways and 1000 HTTPRoutes (~6.7ms per recompute).- All unit tests and conformance/e2e suites pass.
Fixes #628