← Back to Pull requests

Refactor: compile Gateway and ListenerSet listeners into one effective-listener model #614

Closed
unknown closed this pull request without merging on Oct 04, 2026 23:49 UTC
View on GitHub
unknown unknown commented on Oct 04, 2026 20:40 UTC
Author

This implements step 1 of the plan in docs/incremental-state.md: compiling Gateway and ListenerSet listeners into a unified effective-listener model in pkg/state without behaviour change.

Summary of Changes

1. Effective Listener Model (pkg/state/compiled.go):
- Combines Gateway listeners and allowed ListenerSet listeners in precedence order into []*EffectiveListener on each CompiledGateway.
- Records listener owner (kind Gateway or ListenerSet, namespace, name), parent Gateway, and spec.
- Consolidates listener validation (supported protocols, route kinds, TLS secret validation, and cross-namespace ReferenceGrant checks) into a single pure ValidateListener function.
2. Unified Route Binding:
- Single route-binding pass (bindRouteParentRef) resolves parent (Gateway or ListenerSet -> parent Gateway) and binds routes against EffectiveListener candidates.
- Computes route Accepted condition, increments listener AttachedRoutes, and populates InternalRoute rules.
3. Certificate Extraction:
- ExtractCertificates extracts TLS certificates once across all effective listeners with owner-aware ReferenceGrant validation and Gateway-only default certificate fallback.
4. Pure Status Computation:
- Added pure status computation functions (ComputeDesiredGatewayStatus, ComputeDesiredListenerSetStatus, ComputeDesiredHTTPRouteStatus).
- Controllers (GatewayReconciler, ListenerSetReconciler, HTTPRouteReconciler) and updateProxy call these functions and write status only when changed.
5. Testing & Documentation:
- Table-driven unit tests for the compiled model in pkg/state/compiled_test.go.
- All unit tests (ap test), linter (ap lint), and full e2e/conformance suite (ap e2e) pass.
- Updated conformance skill journal in .agents/skills/implement-conformance-test/journal/listenerset.md.

Fixes #611

Diff: 239 lines (+179 / -60) across 2 files Reviewer: justinsb Review duration: 189m
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
0.37
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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 #614"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 37.2% (MEDIUM) · Higher = larger blast radius
37.2%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 14.7% · Safe to merge
14.7%