Skip to content

test(mesh): lock in GAMMA-on-capture feature application + diagnose the runtime gap - #424

Merged
bpalermo merged 1 commit into
mainfrom
fix/gamma-capture-features
Jun 28, 2026
Merged

bpalermo merged 1 commit into
mainfrom
fix/gamma-capture-features

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Summary

Investigation + test hardening for the MESH-HTTP GAMMA-feature-on-capture gap (MeshHTTPRouteRequestHeaderModifier, MeshHTTPRouteRedirectHostAndStatus, MeshHTTPRouteWeight failing; MeshTrafficSplit/MeshHTTPRouteMatching/MeshBasic passing).

Key finding: the brief's hypothesis is incorrect against current origin/main. The capture path is not a reduced/parallel action — captureVhosts already calls the same proxy.BuildOutboundServiceVirtualHost builder 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-023 echo → echo-v1/echo-v2 fanout) carrying the exact conformance shapes and asserts the generated cap_http Envoy routes emit:
    • request set+add+remove and response set+remove header maps,
    • a Route_Redirect (host + 301, no cluster forward),
    • 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 — ruling out a runtime NACK.

Evidence the config is correct

  1. Code: captureVhosts (both the captureAuthority loop and the route-target loop) → BuildOutboundServiceVirtualHost, the identical builder the outbound path uses. Header maps, Route_Redirect, and weighted_clusters are all emitted; the reconciler (buildGammaRoute) already parses all three filters.
  2. Unit test dumps the generated /set route → 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 bare echo and echo:80, so the conformance authority echo host-matches.
  3. envoy --mode validate accepts all three shapes (no NACK).
  4. WeightedCluster.total_weight is 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 /set in the failing CI run carries Envoy-added headers (X-Forwarded-Proto, X-Request-Id, X-Envoy-Expected-Rq-Timeout-Ms) but is missing X-Header-Set — i.e. the request reaches a backend through an Envoy but bypasses the cap_http /set GAMMA 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-target echo cap_http vhost not being active in the proxy snapshot when these requests run, so they fall to the redirect-all passthrough_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-http run 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) ✅
  • Cannot workflow_dispatch the conformance suite from a non-default branch; the mesh-http (soft) job must run post-merge. GATEWAY-HTTP hard gate (43/0) untouched; no production mTLS path change.

🤖 Generated with Claude Code

…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
bpalermo force-pushed the fix/gamma-capture-features branch from 104d3b6 to 8afadc5 Compare June 28, 2026 21:50
@bpalermo
bpalermo merged commit fdece3f into main Jun 28, 2026
14 checks passed
@bpalermo
bpalermo deleted the fix/gamma-capture-features branch June 28, 2026 21:53
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant