Skip to content

feat(agent): any-port deprecation shim with its own counter (037 Phase 2 shim) - #900

Merged
bpalermo merged 1 commit into
mainfrom
feat/037-anyport-shim
Sep 22, 2026
Merged

bpalermo merged 1 commit into
mainfrom
feat/037-anyport-shim

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Phase 4 cannot be done, and this is why — plus the prerequisite for doing it later.

Phase 4 proposes deleting the portless floor chain. It is the only step in proposal 037 that changes what an existing client observes, and the proposal gates it on evidence that no client observes it:

One release after Phase 2, if cap_tcp_anyport_* stayed at zero on talos for the whole release: delete the shim.

That counter did not exist in this implementation — the shim was never built, so the portless chain shared its stat prefix with every other way of reaching the floor. Phase 4 was therefore blocked twice: no evidence, and no way to gather it.

What ships

A TCP-primary service's floor is now three chains, all copies of the same passthrough-or-TCPRoute-weighted chain so they cannot drift:

chain match survives Phase 4
cap_tcp_<svc>_18082 /32 + destination_port 18082 yes
cap_tcp_<svc>_<primary> /32 + destination_port <primary> yes
cap_tcp_anyport_<svc> /32 only — the shim no

The shim is the least specific chain, so Envoy selects it only for a port that no destination_port chain claimed — exactly the traffic Phase 4 proposes to stop serving, and nothing else.

Why the separate stat prefix is the whole point

Phase 4's gate is tcp.cap_tcp_anyport_<svc>.downstream_cx_total reading zero across a full release. Sharing a prefix with the supported spellings would leave that counter unable to distinguish "a client depends on the deprecated behaviour" from "a client used a supported spelling" — and the removal would be a guess dressed as evidence.

Adding the primary-port spelling is also what makes the eventual removal narrow: afterwards :18082, :<primary> and every registered TCP port still work. Only an unregistered port stops, which is the behaviour being deprecated.

Negative control

Giving the shim the same stat prefix as the floor fails with "the shim must have its own stat prefix, or Phase 4 has no evidence to act on".

Also

Chain-count assertions in capture_test.go were rewritten to assert on chain names where the count was load-bearing. An index-based lookup for the HCM chain was made name-based too — it silently asserted on whichever chain happened to be first, which is how it broke when the blackhole chain was added.

bazel build //... clean, 109 tests pass, lint clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

…e 2 shim)

Phase 4 proposes deleting the portless floor chain — the only step in proposal
037 that changes what an existing client observes — and gates it on evidence
that no client observes it. That evidence needs a counter this implementation
did not have, so Phase 4 could not be done and the shim had to be built first.

A TCP-primary service's floor is now three chains, all copies of the same
passthrough-or-TCPRoute-weighted chain so they cannot drift:

  cap_tcp_<svc>_18082        the well-known TCP mesh spelling
  cap_tcp_<svc>_<primary>    the service's own primary port
  cap_tcp_anyport_<svc>      portless, LAST — the shim

The first two survive Phase 4. The shim, being the least specific chain, is
selected only for a port that no destination_port chain claimed — which is
exactly the traffic Phase 4 proposes to stop serving, and nothing else.

Its separate stat prefix is the entire point. Phase 4's gate is
tcp.cap_tcp_anyport_<svc>.downstream_cx_total reading zero across a full
release on talos. Sharing a prefix with the supported spellings would make that
counter unable to distinguish "a client depends on the deprecated behaviour"
from "a client used a supported spelling", and the removal would be a guess
dressed as evidence.

Adding the primary-port spelling is also what makes the eventual removal
narrow: after Phase 4, :18082, :<primary> and every registered TCP port still
work. Only an UNREGISTERED port stops, which is the behaviour being deprecated.

PHASE 4 IS NOT DONE and cannot be from here: it needs a release of readings
this commit makes possible. The shim starts that clock.

Negative control: giving the shim the same stat prefix as the floor fails
TestAnyPortShimIsCountedSeparately with "the shim must have its own stat
prefix, or Phase 4 has no evidence to act on".

Chain-count assertions in capture_test.go were rewritten to assert on chain
NAMES where the count was load-bearing; an index-based lookup for the HCM chain
was also made name-based, since it silently asserted on whichever chain
happened to be first.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit 24cc1d7 into main Sep 22, 2026
22 checks passed
@bpalermo
bpalermo deleted the feat/037-anyport-shim branch September 22, 2026 13:38
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