Skip to content

test: drop duplicate integration targets, Docker-free -short for etcd tests, no sleeps in sync_test; stop proxy/*.md edits triggering Envoy releases (#772) - #788

Merged
bpalermo merged 6 commits into
mainfrom
test/772-c1-hygiene
Sep 16, 2026

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Phase C1 of #772.

test: delete the two duplicate :server_integration_test targets (#772, C1)

//agent/internal/cni/server:server_integration_test and
//agent/internal/xds/server:server_integration_test added no assertions.
Each declared a strict subset of the srcs of the sibling :server_test in
the same package, and :server_test already lists server_integration_test.go
itself — so every TestIntegration_* executed twice on a full
bazel test //.... Re-proved on this tree with
comm -23 <(bazel query 'labels(srcs, <pkg>:server_integration_test)') <(bazel query 'labels(srcs, <pkg>:server_test)'),
empty for both packages:

cni/server :server_integration_test = {pod_test.go, server_integration_test.go}
:server_test = those + ghostsweep_lock_test.go,
ghostsweep_test.go, identity_test.go,
lifecycle_race_test.go, liveness_test.go,
metrics_test.go, resubscribe_test.go,
termination_test.go
xds/server :server_integration_test = {server_integration_test.go, server_test.go}
:server_test = those + identity_hold_test.go,
initial_snapshot_test.go, odcds_test.go,
refresh_identity_test.go, refresh_test.go

No Go test file and no test function is removed: after the deletion
--test_filter=TestIntegration_ still runs 9 cases in cni/server and 4 in
xds/server, from the surviving :server_test targets.

The integration tag was the expensive part. scripts/ci-impacted-targets.sh:41
selects the CI integration leg purely by
attr(tags, "integration", tests(//...)), so any change touching either package
scheduled a whole extra GitHub runner (checkout + setup-bazel + artifact
download) to re-run tests the test leg had just run. Nothing in
.github/workflows/ or bazel/ selects these targets by name, and the
integration job is already conditional on has_integration == 'true', so no
workflow change is needed — the job simply stops being scheduled for
agent-only changes. After the deletion the tag selects only the two genuine
testcontainers targets:

$ bazel query 'attr(tags, integration, tests(//...))'
//registrar/internal/replicator:replicator_test
//registry/internal/etcd:etcd_test

(which also retires the false no-remote-exec justification comment on the
deleted targets — neither imported testcontainers, and .bazelrc:71 already
pins every test action to the runner.)

Verification: bazel query output above; both :server_test targets pass with
--test_filter=TestIntegration_; bazel run //:gazelle produces no churn.

test(etcd): make -test.short actually Docker-free (#772, C1)

registry/internal/etcd/etcd_test.go guards all 17 container-backed tests with
testing.Short(), but TestMain started, waited on, and terminated the etcd
container before m.Run() regardless — so --test_arg=-test.short skipped
every test and still required a working Docker daemon and still paid the
pull/start/readiness cost.

Parse the test flags and check testing.Short() before touching testcontainers,
exactly as registrar/internal/replicator/replicator_test.go:29 already does.
flag.Parse() is required: testing.Short() reads a flag value that is not
populated until the test flags are parsed, and in TestMain that has not
happened yet.

The short path still runs the suite rather than exiting, because
TestEtcdRegistry_CloseWithoutStart deliberately has no short guard — it closes
a registry that was never started and needs no endpoint. #776's
TestEtcdRegistry_CloseRacesWatchLoop does carry the guard and is unaffected.

No production code and no test case changed.

Verification:

short: Docker untouched

$ docker ps -aq | wc -l -> 2 (before)
$ bazel test //registry/internal/etcd:etcd_test --nocache_test_results
--test_arg=-test.short --test_arg=-test.v
PASSED in 0.1s (was ~4.6s)
$ docker ps -aq | wc -l -> 2 (after, no etcd container ever created)
17 SKIP + 1 PASS (TestEtcdRegistry_CloseWithoutStart)

full: unchanged, 18/18 pass incl. #776's test

$ bazel test //registry/internal/etcd:etcd_test --nocache_test_results --test_arg=-test.v
PASSED in 4.4s, --- PASS: TestEtcdRegistry_CloseRacesWatchLoop

test(proxy): delete the misnamed TestSortRoutesBySpecificity_HeaderCountRanksHigher (#772, C1)

This is the one sanctioned test deletion in C1 (the tests report's move #10).

agent/internal/xds/proxy/edge_test.go:859 was named for
sortRoutesBySpecificity, but it never called it — it cannot: that function is
unexported and lives in a different package
(agent/internal/xds/cache/edge.go:90). What the body actually did was build
two routes with BuildEdgeRoute and assert that one ended up with two
HeaderMatcher entries and the other with one, then comment "the route with 2
headers must sort before the route with 1" without asserting any ordering. So
it tested header copying under a name that promised specificity ordering — the
worst failure mode for a test, because the name is what a reader trusts when
deciding whether a behaviour is covered.

Both halves are already covered, properly, elsewhere:

  • header copying: TestBuildEdgeRoute_HeaderMatch
    (agent/internal/xds/proxy/edge_test.go:730) asserts the exact and regex
    HeaderMatcher shapes this one only counted.
  • specificity ordering: agent/internal/xds/cache/edge_test.go calls the real
    sortRoutesBySpecificity directly at :1030, :1051, :1157, :1171, :1185 and
    :1213 and asserts the resulting order.

Deleting it rather than renaming it, because a rename would leave a third
BuildEdgeRoute header-count assertion with nothing to say that
TestBuildEdgeRoute_HeaderMatch does not already say more precisely.

Verification: bazel test //agent/internal/xds/proxy:proxy_test //agent/internal/xds/cache:cache_test both pass.

test(registrar): synchronise sync_test on conditions, not on time.Sleep (#772, C1)

registrar/internal/server/sync_test.go was the one package in the tree that
consistently slept instead of waiting: 10 time.Sleep calls (30–200 ms) used as
synchronisation, ~930 ms of hard-coded wall time and the target's only flake
surface. A sleep that is long enough today is a flake on a loaded CI runner and
dead time on every other run.

Each one is replaced by the narrowest observable condition:

  • Waiting for the initial sync now uses Syncer.Synced(), the channel the
    production code already closes after the first successful cycle
    (sync.go:184) — exact, not approximate. requireSynced wraps it with a
    5 s deadline. Used by InitialSync, VersionAdvancesOnSync,
    EmptyRegistryPopulatesEmptySnapshot, MultipleEndpointsAcrossServices,
    NoEventsAfterInitialSync, RegistryErrorOnSubsequentSyncDoesNotCrash and
    StopsOnContextCancellation.
  • BroadcastsChangesOnSubsequentSync waits for the event to reach the watcher
    (len(eventCh) > 0) rather than for two poll intervals to elapse.
  • RegistryErrorDoesNotCrash has no observable effect to wait on — a failing
    cycle closes neither Synced() nor the snapshot — so mockRegistry gains
    an atomic listCalls counter and the test waits for the call itself.
  • RegistryErrorOnSubsequentSyncDoesNotCrash's cycle counter httpCalls became
    an atomic.Int64 so the test goroutine can read it; the test waits for two
    failing periodic cycles instead of 200 ms.
  • NoEventsAfterInitialSync waits for 2*len(syncedProtocols) further list
    calls, i.e. two real cycles, derived from the production protocol list
    instead of hard-coded.

The two remaining time.After calls are assertion deadlines (Start must return
within 500 ms of cancellation), not synchronisation, and stay. The poll
intervals of the two change-detecting tests drop 60 ms → 20 ms now that nothing
depends on a sleep lining up with them.

No production code changed and no test case was removed or renamed.

Verification:
$ bazel test //registrar/internal/server:server_test --runs_per_test=10 --config=race
PASSED in 2.8s, Stats over 10 runs: max = 2.8s, min = 2.8s, dev = 0.0s
$ grep -c time.Sleep registrar/internal/server/sync_test.go -> 0
TestSyncer subset, uncached: 1.2s -> 0.4s

ci: stop a proxy docs edit from rebuilding Envoy (#772, C1)

PR #773 changed one line of proxy/README.md. proxy-release.yml's push
trigger filters on paths: ["proxy/**"], so the merge compiled Envoy on both
RBE pools, pushed a new multi-arch image and opened chart-pin PR #786 — for a
comment. proxy.yml had the same hole at PR time: its changes job's
dorny/paths-filter pattern is also proxy/**, so a README-only PR ran the
heavy compile on both arches before anyone could review it.

Exclude Markdown under proxy/ from both.

proxy-release.yml (GitHub-native paths): GitHub rejects paths and
paths-ignore on the same event, so the exclusion has to be a negated pattern
inside paths. GitHub evaluates the list in order and a later negative wins,
so "!proxy/**/*.md" must follow "proxy/**"; the trailing workflow-self
entry is unaffected because the negation does not match it. proxy/**/*.md
covers proxy/README.md as well as nested files — in GitHub's filter patterns
**/ matches zero directories (their own cheat sheet lists docs/README.md
under docs/**/*.md).

proxy.yml (dorny/paths-filter@v4): the same ! spelling would NOT work under
the action's default quantifier. It ORs the compiled patterns, and picomatch
compiles a leading ! into "matches everything the positive pattern does not",
so '!proxy/**/*.md' would match .github/**, agent/**, … and the filter
would be permanently true. v4 ships predicate-quantifier: 'some-with-excludes'
for exactly this: a file matches when at least one positive pattern matches it
and no negated pattern does. Set it, then add the same '!proxy/**/*.md'.
Verified against the action's own matching logic (filter.ts isInclude /
isExclude, the latter being excludes.some(m => !m(path))) with picomatch:

proxy/README.md -> false proxy/BUILD.bazel -> true
proxy/docs/a.md -> false proxy/MODULE.bazel -> true
agent/main.go -> false .github/workflows/proxy.yml -> true

Exclusion is per changed file, so a PR touching both proxy/README.md and a
real proxy source file still builds. The proxy gate job is if: always()
(proxy.yml:120), so a docs-only proxy PR still reports the required check —
same path a control-plane-only PR already takes.

Verification: both files parse under python3 -c 'import yaml,sys; yaml.safe_load(open(sys.argv[1]))'; dorny behaviour simulated as above.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

bpalermo and others added 6 commits September 15, 2026 21:36
… C1)

`//agent/internal/cni/server:server_integration_test` and
`//agent/internal/xds/server:server_integration_test` added no assertions.
Each declared a strict *subset* of the srcs of the sibling `:server_test` in
the same package, and `:server_test` already lists `server_integration_test.go`
itself — so every `TestIntegration_*` executed twice on a full
`bazel test //...`. Re-proved on this tree with
`comm -23 <(bazel query 'labels(srcs, <pkg>:server_integration_test)') <(bazel query 'labels(srcs, <pkg>:server_test)')`,
empty for both packages:

  cni/server  :server_integration_test = {pod_test.go, server_integration_test.go}
              :server_test             = those + ghostsweep_lock_test.go,
                                         ghostsweep_test.go, identity_test.go,
                                         lifecycle_race_test.go, liveness_test.go,
                                         metrics_test.go, resubscribe_test.go,
                                         termination_test.go
  xds/server  :server_integration_test = {server_integration_test.go, server_test.go}
              :server_test             = those + identity_hold_test.go,
                                         initial_snapshot_test.go, odcds_test.go,
                                         refresh_identity_test.go, refresh_test.go

No Go test file and no test function is removed: after the deletion
`--test_filter=TestIntegration_` still runs 9 cases in cni/server and 4 in
xds/server, from the surviving `:server_test` targets.

The `integration` tag was the expensive part. `scripts/ci-impacted-targets.sh:41`
selects the CI `integration` leg purely by
`attr(tags, "integration", tests(//...))`, so any change touching either package
scheduled a whole extra GitHub runner (checkout + setup-bazel + artifact
download) to re-run tests the `test` leg had just run. Nothing in
`.github/workflows/` or `bazel/` selects these targets by name, and the
`integration` job is already conditional on `has_integration == 'true'`, so no
workflow change is needed — the job simply stops being scheduled for
agent-only changes. After the deletion the tag selects only the two genuine
testcontainers targets:

  $ bazel query 'attr(tags, integration, tests(//...))'
  //registrar/internal/replicator:replicator_test
  //registry/internal/etcd:etcd_test

(which also retires the false `no-remote-exec` justification comment on the
deleted targets — neither imported testcontainers, and `.bazelrc:71` already
pins every test action to the runner.)

Verification: `bazel query` output above; both `:server_test` targets pass with
`--test_filter=TestIntegration_`; `bazel run //:gazelle` produces no churn.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
`registry/internal/etcd/etcd_test.go` guards all 17 container-backed tests with
`testing.Short()`, but `TestMain` started, waited on, and terminated the etcd
container before `m.Run()` regardless — so `--test_arg=-test.short` skipped
every test and still required a working Docker daemon and still paid the
pull/start/readiness cost.

Parse the test flags and check `testing.Short()` before touching testcontainers,
exactly as `registrar/internal/replicator/replicator_test.go:29` already does.
`flag.Parse()` is required: `testing.Short()` reads a flag value that is not
populated until the test flags are parsed, and in `TestMain` that has not
happened yet.

The short path still runs the suite rather than exiting, because
`TestEtcdRegistry_CloseWithoutStart` deliberately has no short guard — it closes
a registry that was never started and needs no endpoint. #776's
`TestEtcdRegistry_CloseRacesWatchLoop` does carry the guard and is unaffected.

No production code and no test case changed.

Verification:
  # short: Docker untouched
  $ docker ps -aq | wc -l                       -> 2  (before)
  $ bazel test //registry/internal/etcd:etcd_test --nocache_test_results \
      --test_arg=-test.short --test_arg=-test.v
    PASSED in 0.1s      (was ~4.6s)
  $ docker ps -aq | wc -l                       -> 2  (after, no etcd container ever created)
    17 SKIP + 1 PASS (TestEtcdRegistry_CloseWithoutStart)

  # full: unchanged, 18/18 pass incl. #776's test
  $ bazel test //registry/internal/etcd:etcd_test --nocache_test_results --test_arg=-test.v
    PASSED in 4.4s, --- PASS: TestEtcdRegistry_CloseRacesWatchLoop

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…untRanksHigher (#772, C1)

This is the one sanctioned test deletion in C1 (the tests report's move #10).

`agent/internal/xds/proxy/edge_test.go:859` was named for
`sortRoutesBySpecificity`, but it never called it — it cannot: that function is
unexported and lives in a different package
(`agent/internal/xds/cache/edge.go:90`). What the body actually did was build
two routes with `BuildEdgeRoute` and assert that one ended up with two
`HeaderMatcher` entries and the other with one, then comment "the route with 2
headers must sort before the route with 1" without asserting any ordering. So
it tested header copying under a name that promised specificity ordering — the
worst failure mode for a test, because the name is what a reader trusts when
deciding whether a behaviour is covered.

Both halves are already covered, properly, elsewhere:

  - header copying: `TestBuildEdgeRoute_HeaderMatch`
    (`agent/internal/xds/proxy/edge_test.go:730`) asserts the exact and regex
    `HeaderMatcher` shapes this one only counted.
  - specificity ordering: `agent/internal/xds/cache/edge_test.go` calls the real
    `sortRoutesBySpecificity` directly at :1030, :1051, :1157, :1171, :1185 and
    :1213 and asserts the resulting order.

Deleting it rather than renaming it, because a rename would leave a third
BuildEdgeRoute header-count assertion with nothing to say that
`TestBuildEdgeRoute_HeaderMatch` does not already say more precisely.

Verification: `bazel test //agent/internal/xds/proxy:proxy_test
//agent/internal/xds/cache:cache_test` both pass.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…ep (#772, C1)

`registrar/internal/server/sync_test.go` was the one package in the tree that
consistently slept instead of waiting: 10 `time.Sleep` calls (30–200 ms) used as
synchronisation, ~930 ms of hard-coded wall time and the target's only flake
surface. A sleep that is long enough today is a flake on a loaded CI runner and
dead time on every other run.

Each one is replaced by the narrowest observable condition:

  - Waiting for the initial sync now uses `Syncer.Synced()`, the channel the
    production code already closes after the first successful cycle
    (`sync.go:184`) — exact, not approximate. `requireSynced` wraps it with a
    5 s deadline. Used by InitialSync, VersionAdvancesOnSync,
    EmptyRegistryPopulatesEmptySnapshot, MultipleEndpointsAcrossServices,
    NoEventsAfterInitialSync, RegistryErrorOnSubsequentSyncDoesNotCrash and
    StopsOnContextCancellation.
  - BroadcastsChangesOnSubsequentSync waits for the event to reach the watcher
    (`len(eventCh) > 0`) rather than for two poll intervals to elapse.
  - RegistryErrorDoesNotCrash has no observable effect to wait on — a failing
    cycle closes neither `Synced()` nor the snapshot — so `mockRegistry` gains
    an atomic `listCalls` counter and the test waits for the call itself.
  - RegistryErrorOnSubsequentSyncDoesNotCrash's cycle counter `httpCalls` became
    an `atomic.Int64` so the test goroutine can read it; the test waits for two
    failing periodic cycles instead of 200 ms.
  - NoEventsAfterInitialSync waits for `2*len(syncedProtocols)` further list
    calls, i.e. two real cycles, derived from the production protocol list
    instead of hard-coded.

The two remaining `time.After` calls are assertion deadlines (Start must return
within 500 ms of cancellation), not synchronisation, and stay. The poll
intervals of the two change-detecting tests drop 60 ms → 20 ms now that nothing
depends on a sleep lining up with them.

No production code changed and no test case was removed or renamed.

Verification:
  $ bazel test //registrar/internal/server:server_test --runs_per_test=10 --config=race
    PASSED in 2.8s, Stats over 10 runs: max = 2.8s, min = 2.8s, dev = 0.0s
  $ grep -c time.Sleep registrar/internal/server/sync_test.go   -> 0
  TestSyncer subset, uncached: 1.2s -> 0.4s

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
PR #773 changed one line of `proxy/README.md`. `proxy-release.yml`'s push
trigger filters on `paths: ["proxy/**"]`, so the merge compiled Envoy on both
RBE pools, pushed a new multi-arch image and opened chart-pin PR #786 — for a
comment. `proxy.yml` had the same hole at PR time: its `changes` job's
dorny/paths-filter pattern is also `proxy/**`, so a README-only PR ran the
heavy compile on both arches before anyone could review it.

Exclude Markdown under proxy/ from both.

proxy-release.yml (GitHub-native `paths`): GitHub rejects `paths` and
`paths-ignore` on the same event, so the exclusion has to be a negated pattern
inside `paths`. GitHub evaluates the list in order and a later negative wins,
so `"!proxy/**/*.md"` must follow `"proxy/**"`; the trailing workflow-self
entry is unaffected because the negation does not match it. `proxy/**/*.md`
covers `proxy/README.md` as well as nested files — in GitHub's filter patterns
`**/` matches zero directories (their own cheat sheet lists `docs/README.md`
under `docs/**/*.md`).

proxy.yml (dorny/paths-filter@v4): the same `!` spelling would NOT work under
the action's default quantifier. It ORs the compiled patterns, and picomatch
compiles a leading `!` into "matches everything the positive pattern does not",
so `'!proxy/**/*.md'` would match `.github/**`, `agent/**`, … and the filter
would be permanently true. v4 ships `predicate-quantifier: 'some-with-excludes'`
for exactly this: a file matches when at least one positive pattern matches it
and no negated pattern does. Set it, then add the same `'!proxy/**/*.md'`.
Verified against the action's own matching logic (filter.ts `isInclude` /
`isExclude`, the latter being `excludes.some(m => !m(path))`) with picomatch:

  proxy/README.md                 -> false      proxy/BUILD.bazel      -> true
  proxy/docs/a.md                 -> false      proxy/MODULE.bazel     -> true
  agent/main.go                   -> false      .github/workflows/proxy.yml -> true

Exclusion is per changed file, so a PR touching both `proxy/README.md` and a
real proxy source file still builds. The `proxy` gate job is `if: always()`
(proxy.yml:120), so a docs-only proxy PR still reports the required check —
same path a control-plane-only PR already takes.

Verification: both files parse under `python3 -c 'import yaml,sys;
yaml.safe_load(open(sys.argv[1]))'`; dorny behaviour simulated as above.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit 2fa24a8 into main Sep 16, 2026
21 checks passed
@bpalermo
bpalermo deleted the test/772-c1-hygiene branch September 16, 2026 01:10
bpalermo added a commit that referenced this pull request Sep 20, 2026
… what envoy_server_version really is (#837)

You could not tell which Envoy a running `aether-proxy` contained, from the
process or from the image. Two symptoms, one gap, and the first one is now
answered rather than guessed at.

## envoy_server_version reports the AETHER commit, not Envoy's

Established outright, not inferred — and not from a running pod.
`//test/envoy_validate:envoy_bin` is the Envoy binary extracted from the
*published* aether-proxy image at the digest the chart pins, so it can be asked
directly:

    envoy  version: cff8beb/1.40.0-dev/Clean/RELEASE/BoringSSL

`cff8beb87eb685a44e00cf70c1a534695039da1b` is an **aether** commit — it is that
image's own `tag:` in `charts/aether/values.yaml`. The Envoy component of the
string is bare `1.40.0-dev`, with no Envoy revision in it at all. The gauge for
that image is therefore `0xcff8be`.

The `0x2FA24A` = 3121738 in the issue decodes the same way: aether commit
`2fa24a8` ("test: drop duplicate integration targets … (#772) (#788)"). It is
simply an older image than the chart's current pin.

The chain that produces it:

  * `proxy/.bazelrc` sets `--workspace_status_command="bash
    bazel/get_workspace_status"`, and that script runs `git rev-parse HEAD`.
    `proxy/` is a nested workspace inside the aether repo, so BUILD_SCM_REVISION
    is the aether commit. Envoy is a bzlmod dep; nothing asks its git anything.
  * `envoy_cc_binary` defaults to `stamp = 1` — cc_binary's "stamp even under
    `--nostamp`" — so `//source/common/version:version_linkstamp` compiles that
    real sha in although no build here passes `--stamp`. Verified against a
    minimal cc_binary + linkstamp: `--nostamp` yields the redacted
    BUILD_SCM_REVISION `"0"`, and `stamp = 1` yields the workspace-status value.
  * `server.cc` does `atoull(revision().substr(0, 6), 16)`.

So the gauge is 24 bits of the aether commit. Useful, but it will never match
`13144f` and was never going to. `proxy/README.md` now says so, with both the
derivation and the one-command way to re-confirm it locally, so nobody
re-derives this.

## Provenance on the artifact

Verified against the published index rather than assumed: every image we publish
has `Labels: null`, and the only annotation on `aether-proxy` is
`org.opencontainers.image.source` **inherited from distroless/cc**, pointing at
GoogleContainerTools/distroless — a confident wrong answer, worse than absent.
The rules_img images carry only `org.opencontainers.image.base.*`.

Both arches were decoded this time (#837 asked): amd64 and arm64 are identical
in every provenance respect — same absent labels, same zero `created`, same
single inherited annotation. Only layer digests and `architecture` differ, so
the original arm64-only analysis was fully representative.

Now, on all nine images (agent, mesh-dns, proxy-supervisor, cni-install,
registrar, controller, prober, udsecho, and the proxy):

  * `org.opencontainers.image.source` — this repo, **overriding** the inherited
    distroless value (rules_oci merges with `.annotations += {...}`, ours wins);
  * `org.opencontainers.image.revision` — the aether commit;

and on `aether-proxy` alone, the fact recoverable no other way:

  * `dev.aethermesh.envoy.module-version`, `.revision`, `.bazel-registry`.

The registry commit is in there because the envoy bazel-registry keeps one
version directory per module and deletes the previous one, so the module version
alone does not resolve.

## Determinism did not regress — measured, not assumed

Zero timestamps stay: `created` is still unset and history entries are still
`bazel bu…`. `revision` is a fixed string, not a clock.

  * rules_img: `stamp = "force"` on image_manifest/image_index, so the label is
    correct in *every* configuration — plain `bazel build` included, where
    "auto" would have baked the literal `{{.STABLE_GIT_COMMIT}}` in. The
    ExpandTemplate action takes stable-status.txt as an input; volatile-status
    (BUILD_TIMESTAMP) is constant-metadata to Bazel and invalidates nothing.
    Proof: `bazel shutdown` then rebuild ⇒ **4556 action-cache hits, 0 actions
    re-executed, byte-identical index digest**
    (`sha256:ea16c042…`). The new STABLE_GIT_COMMIT key is stable on purpose:
    a volatile one would let a cached config blob re-publish the *previous*
    commit's sha, which is the failure mode this issue is about.
  * proxy: the metadata genrule is tagged `no-cache` for the same reason —
    BUILD_SCM_REVISION is volatile there. It is two `sed`s, and its output is
    byte-identical at a given commit, so `:image`/`:push` still cache-hit.

Between commits only the tiny config/manifest actions re-run. No layer, no
compile, no link.

Prerequisite for #830's next Envoy pin bump, which is exactly the shape of
change where "which Envoy is actually running?" must be answerable from the
artifact.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo added a commit that referenced this pull request Sep 20, 2026
…kill -TERM stop the soak churn driver (#835) (#845)

* fix(build): stamp OCI provenance on every published image, and record what envoy_server_version really is (#837)

You could not tell which Envoy a running `aether-proxy` contained, from the
process or from the image. Two symptoms, one gap, and the first one is now
answered rather than guessed at.

## envoy_server_version reports the AETHER commit, not Envoy's

Established outright, not inferred — and not from a running pod.
`//test/envoy_validate:envoy_bin` is the Envoy binary extracted from the
*published* aether-proxy image at the digest the chart pins, so it can be asked
directly:

    envoy  version: cff8beb/1.40.0-dev/Clean/RELEASE/BoringSSL

`cff8beb87eb685a44e00cf70c1a534695039da1b` is an **aether** commit — it is that
image's own `tag:` in `charts/aether/values.yaml`. The Envoy component of the
string is bare `1.40.0-dev`, with no Envoy revision in it at all. The gauge for
that image is therefore `0xcff8be`.

The `0x2FA24A` = 3121738 in the issue decodes the same way: aether commit
`2fa24a8` ("test: drop duplicate integration targets … (#772) (#788)"). It is
simply an older image than the chart's current pin.

The chain that produces it:

  * `proxy/.bazelrc` sets `--workspace_status_command="bash
    bazel/get_workspace_status"`, and that script runs `git rev-parse HEAD`.
    `proxy/` is a nested workspace inside the aether repo, so BUILD_SCM_REVISION
    is the aether commit. Envoy is a bzlmod dep; nothing asks its git anything.
  * `envoy_cc_binary` defaults to `stamp = 1` — cc_binary's "stamp even under
    `--nostamp`" — so `//source/common/version:version_linkstamp` compiles that
    real sha in although no build here passes `--stamp`. Verified against a
    minimal cc_binary + linkstamp: `--nostamp` yields the redacted
    BUILD_SCM_REVISION `"0"`, and `stamp = 1` yields the workspace-status value.
  * `server.cc` does `atoull(revision().substr(0, 6), 16)`.

So the gauge is 24 bits of the aether commit. Useful, but it will never match
`13144f` and was never going to. `proxy/README.md` now says so, with both the
derivation and the one-command way to re-confirm it locally, so nobody
re-derives this.

## Provenance on the artifact

Verified against the published index rather than assumed: every image we publish
has `Labels: null`, and the only annotation on `aether-proxy` is
`org.opencontainers.image.source` **inherited from distroless/cc**, pointing at
GoogleContainerTools/distroless — a confident wrong answer, worse than absent.
The rules_img images carry only `org.opencontainers.image.base.*`.

Both arches were decoded this time (#837 asked): amd64 and arm64 are identical
in every provenance respect — same absent labels, same zero `created`, same
single inherited annotation. Only layer digests and `architecture` differ, so
the original arm64-only analysis was fully representative.

Now, on all nine images (agent, mesh-dns, proxy-supervisor, cni-install,
registrar, controller, prober, udsecho, and the proxy):

  * `org.opencontainers.image.source` — this repo, **overriding** the inherited
    distroless value (rules_oci merges with `.annotations += {...}`, ours wins);
  * `org.opencontainers.image.revision` — the aether commit;

and on `aether-proxy` alone, the fact recoverable no other way:

  * `dev.aethermesh.envoy.module-version`, `.revision`, `.bazel-registry`.

The registry commit is in there because the envoy bazel-registry keeps one
version directory per module and deletes the previous one, so the module version
alone does not resolve.

## Determinism did not regress — measured, not assumed

Zero timestamps stay: `created` is still unset and history entries are still
`bazel bu…`. `revision` is a fixed string, not a clock.

  * rules_img: `stamp = "force"` on image_manifest/image_index, so the label is
    correct in *every* configuration — plain `bazel build` included, where
    "auto" would have baked the literal `{{.STABLE_GIT_COMMIT}}` in. The
    ExpandTemplate action takes stable-status.txt as an input; volatile-status
    (BUILD_TIMESTAMP) is constant-metadata to Bazel and invalidates nothing.
    Proof: `bazel shutdown` then rebuild ⇒ **4556 action-cache hits, 0 actions
    re-executed, byte-identical index digest**
    (`sha256:ea16c042…`). The new STABLE_GIT_COMMIT key is stable on purpose:
    a volatile one would let a cached config blob re-publish the *previous*
    commit's sha, which is the failure mode this issue is about.
  * proxy: the metadata genrule is tagged `no-cache` for the same reason —
    BUILD_SCM_REVISION is volatile there. It is two `sed`s, and its output is
    byte-identical at a given commit, so `:image`/`:push` still cache-hit.

Between commits only the tiny config/manifest actions re-run. No layer, no
compile, no link.

Prerequisite for #830's next Envoy pin bump, which is exactly the shape of
change where "which Envoy is actually running?" must be answerable from the
artifact.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

* fix(soak): make kill -TERM stop the churn driver instead of firing the next roll (#835)

`trap restore_shrink EXIT INT TERM` bundled the safety net with the stop
signals, and `restore_shrink` *returns* rather than exiting. So on TERM bash ran
the handler, the handler returned, the in-flight `sleep` inside `waituntil` had
already been interrupted, and control fell straight through to the next `roll`.
The signal sent to stop the driver made it fire early — an unscheduled
`ROLLED aether-test/deployment/svc-1` at 23:10:32Z on 2026-09-19, with the driver
still running afterwards. That reads in the log as "the tool ignored my signal",
which sends you debugging the wrong thing; the tool did the opposite, and the
two need different debugging.

Split the traps, keeping EXIT as the idempotent safety net:

    trap restore_shrink EXIT
    trap 'restore_shrink; exit 130' INT
    trap 'restore_shrink; exit 143' TERM

Reproduced and verified, with `kubectl` stubbed and no cluster involved:

  * pre-fix, TERM ⇒ driver STILL RUNNING, 1 unscheduled `ROLLED …/svc-1` —
    exactly the 2026-09-19 observation;
  * post-fix, TERM ⇒ exit 143, 0 rolls.

The idempotency claim was checked rather than taken on trust: a full-schedule
dry run (`sleep` stubbed, so all 452 minutes run in seconds) still logs 31
ROLLED and makes exactly **two** `kubectl scale` calls for the SHRINK — down to
0 and back to the replica count it read first. The EXIT trap firing again after
`shrink()`'s own `restore_shrink` is a no-op, because `restore_shrink` clears
SHRINK_PREV before it scales.

`e2e/soak/README.md` gains a "Stopping the churn driver" section for the whole
family, since these are cases where the safety action causes the harm:

  * stop it with `kill -9 <pid>`. Even with the traps fixed, a TERM to the
    driver's pid alone leaves its `sleep` child running and bash defers the
    handler until that `sleep` returns — measured: still parked twelve minutes
    later. Only a TERM that also reaches the child stops it promptly;
  * never `pkill -f "soak/churn.sh"`: the pattern appears in the command line of
    the shell issuing it, so it kills your own session too. `pgrep -cf` has the
    same flaw in the harmless direction — it reads one driver too high. Anchor
    on the absolute script path;
  * before launching, check for an existing driver by absolute path and refuse
    to start a second. Two share `/tmp/soak-churn.log` and interleave into ~62
    rolls, which does not fail a run, it silently invalidates it;
  * at grade time count ROLLED in `/tmp/soak-churn.log` only — older
    `/tmp/soak-churn-*.log` files match a naive glob and inflate the tally;
  * never patch `churn.sh` while a soak is running: bash reads scripts
    incrementally by byte offset, so editing an executing script can corrupt its
    control flow. Verified no driver was running before this edit.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

* docs(proxy): note that the pinned-Envoy target may move under #841

proxy/README.md points at //test/envoy_validate:envoy_bin as the one-command
way to re-confirm what envoy_server_version reports. #841 factors that target
out, so say the label may move rather than leave a reference that silently goes
stale.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

---------

Co-authored-by: Claude Opus 5 <[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