Repository navigation
test(mesh): lock in GAMMA-on-capture feature application + diagnose the runtime gap - #424
Merged
Merged
Conversation
…rect/weight)
The MESH-HTTP conformance gap (MeshHTTPRouteRequestHeaderModifier /
RedirectHostAndStatus / Weight failing on the capture path) was hypothesised to
be a "reduced" capture route action. It is not: the capture path
(captureVhosts → BuildOutboundServiceVirtualHost) already reuses the SAME full
GAMMA builder as the outbound path. These tests prove it and guard against any
future regression to a partial capture action:
- agent/internal/xds/cache: TestCaptureVhosts_RouteTargetGAMMAFeatures builds
a route TARGET (the proposal-023 "echo" → echo-v1/echo-v2 fanout shape)
carrying the EXACT conformance feature shapes and asserts the resulting
cap_http Envoy routes emit:
* request set+add+remove + response set+remove header maps,
* a Route_Redirect (host + 301, no cluster forward), and
* a 70/30 weighted_clusters split.
- test/envoy_validate: the route-target capture bootstrap now exercises a
redirect route (no backend), a full request+response header mutation, and a
2-backend 70/30 weighted split, so `envoy --mode validate` proves stock
Envoy ACCEPTS the capture-path config for all three features (rules out a
runtime NACK as the cause).
Both pass against unmodified origin/main capture code: the cap_http config
aether generates for these features is correct and Envoy-accepted. The residual
conformance failures are therefore NOT in config generation — the failing
requests reach a backend but bypass the GAMMA cap_http vhost at runtime (the CI
echo-reflected request carries Envoy headers yet lacks X-Header-Set), i.e. a
capture-path runtime convergence/scoping issue to be confirmed by the post-merge
mesh-http CI run, not a builder fix.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N7oY7W8oDXrqDzFgoZh25S
bpalermo
force-pushed
the
fix/gamma-capture-features
branch
from
June 28, 2026 21:50
104d3b6 to
8afadc5
Compare
bpalermo
added a commit
that referenced
this pull request
Jun 29, 2026
…arget (#432) The MESH-HTTP feature tests (RequestHeaderModifier / MeshFrontend / Redirect / Weight) flaked: the modifier applied 271x in-suite but never hit RequiredConsecutiveSuccesses=3 in a row. Root cause is an RDS-reload convergence race under the conformance suite's own cross-test apply/delete churn — NOT config generation (proven correct by #423/#424/#430 + stable-config curl). Mechanism: a GAMMA HTTPRoute add/delete makes the gamma reconciler re-list and re-`SetServiceRoutes` between two reconciles. In the delete→create gap the route target's `serviceRoutes` entry is momentarily empty, so its dedicated cap_http vhost is absent. Envoy's per-RouteConfiguration RDS apply is atomic, so the leak implies the PUSHED table was itself missing the vhost: an in-flight captured request to that KNOWN target then lands on the redirect-all catch-all (domain "*") and falls to `passthrough_original_dst` → kube-proxy → the GAMMA filters are silently skipped ("got some-other-value"), resetting the consecutive-success counter. Not reproducible manually (the stable-config curl always runs between rebuilds); only under the suite's rapid churn. Fix (direction 2, the robust invariant): the passthrough must never shadow a service the mesh knows about. The redirect-all catch-all now carries a known-target safety net — one `:authority` safe_regex route per in-scope mesh authority (all non-mesh cluster.local spellings, any port), pinning it to its mesh cluster BEFORE the passthrough fallthrough. The set is derived from the STABLE signals (captureAuthorities, fed by the generated mesh Services and untouched by HTTPRoute churn, plus current route targets) — deliberately NOT the demand-scoped dependency set, whose route-target membership churns with the rule and would re-introduce the race. A known service's captured traffic therefore fails CLOSED into the mesh (a brief 503 if the demand-scoped cluster is momentarily absent, which the harness cleanly retries) instead of OPEN to kube-proxy. The dedicated vhost still wins on host-match precedence when present and carries the GAMMA filters; this is the floor. Scope: redirect-all capture only (no passthrough ⇒ nothing to shadow ⇒ catch-all keeps its hard 404). GATEWAY-HTTP (edge) and production mTLS paths untouched. Tests: proxy-level (a known target resolves to its cluster under every spelling + port, never the passthrough; foreign/mesh-shaped authorities unaffected; gated on redirect-all), cache-level (the safety net survives a simulated GAMMA-rule-clear churn even as the dedicated vhost vanishes), and `envoy --mode validate` accepts the new route shape. Claude-Session: https://claude.ai/code/session_01N7oY7W8oDXrqDzFgoZh25S Co-authored-by: Claude Opus 4.8 <[email protected]>
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.
Summary
Investigation + test hardening for the MESH-HTTP GAMMA-feature-on-capture gap (
MeshHTTPRouteRequestHeaderModifier,MeshHTTPRouteRedirectHostAndStatus,MeshHTTPRouteWeightfailing;MeshTrafficSplit/MeshHTTPRouteMatching/MeshBasicpassing).Key finding: the brief's hypothesis is incorrect against current
origin/main. The capture path is not a reduced/parallel action —captureVhostsalready calls the sameproxy.BuildOutboundServiceVirtualHostbuilder as the outbound path, so it emits the full GAMMA feature set (header mutation, redirect, weighted split). This PR proves that and guards it; the actual residual is a runtime capture-path issue, not a config-generation bug.What this PR adds (both pass against unmodified capture code)
agent/internal/xds/cache—TestCaptureVhosts_RouteTargetGAMMAFeatures: builds a route TARGET (the proposal-023echo→echo-v1/echo-v2fanout) carrying the exact conformance shapes and asserts the generated cap_http Envoy routes emit:Route_Redirect(host + 301, no cluster forward),weighted_clusterssplit.test/envoy_validate: the route-target capture bootstrap now exercises a redirect route (no backend), a full request+response header mutation, and a 2-backend 70/30 weighted split, soenvoy --mode validateproves stock Envoy ACCEPTS the capture-path config for all three features — ruling out a runtime NACK.Evidence the config is correct
captureVhosts(both the captureAuthority loop and the route-target loop) →BuildOutboundServiceVirtualHost, the identical builder the outbound path uses. Header maps,Route_Redirect, andweighted_clustersare all emitted; the reconciler (buildGammaRoute) already parses all three filters./setroute →requestHeadersToAdd: X-Header-Set=set-overwrites-values, the redirect route →RedirectAction{host_redirect=example.org, 301}, and the weighted route →{echo-v1:70, echo-v2:30}. Domains include bareechoandecho:80, so the conformance authorityechohost-matches.envoy --mode validateaccepts all three shapes (no NACK).WeightedCluster.total_weightis deprecated; Envoy uses the sum of weights (70+30) — the construction is complete.The real runtime gap (needs the post-merge CI run to confirm)
The CI failures are NOT in config generation. The echo-reflected request for
/setin the failing CI run carries Envoy-added headers (X-Forwarded-Proto,X-Request-Id,X-Envoy-Expected-Rq-Timeout-Ms) but is missingX-Header-Set— i.e. the request reaches a backend through an Envoy but bypasses the cap_http/setGAMMA route. Combined with the weight test's fast wrong-distribution (~50/50, the kube-proxy signature) and the passing tests barely converging (53–88s), this points to the route-targetechocap_http vhost not being active in the proxy snapshot when these requests run, so they fall to the redirect-allpassthrough_original_dst→ kube-proxy. This is a capture-path runtime convergence/scoping issue, not a "feature dropped in the builder."This PR's value: it locks in that the config aether generates is correct and Envoy-accepted, so a still-failing post-merge
mesh-httprun is conclusively a runtime/scoping problem (config-dump introspection on a live kind proxy), and any future regression to a partial capture action is caught offline.Validation
bazel test //agent/internal/xds/cache:cache_test✅bazel test //test/envoy_validate:envoy_validate_test✅ (envoy --mode validate, offline)bazel test //agent/... --test_arg=-test.short(cache/proxy/gamma) ✅workflow_dispatchthe conformance suite from a non-default branch; themesh-http(soft) job must run post-merge. GATEWAY-HTTP hard gate (43/0) untouched; no production mTLS path change.🤖 Generated with Claude Code