Repository navigation
test: the e2e assertions name the namespace they are about - #121
Conversation
checkOptOutRemovesTheRecord has been failing, and the agent was not the
reason. The suite reuses one kind cluster, a run killed before its cleanup
leaves its namespace behind, and its sample workload keeps running the same
image under the same names. findSampleRecord matched on module path alone,
so it kept finding a pod from an abandoned run three days old that nobody
had annotated.
Measured against the failing cluster: the opt-out works. The annotation
landed at 09:24:27 and the controller logged "go inventory forgot departed
workloads records=1" at 09:25:08, with go_inventory_records falling 3 -> 2
on the next pass. The retention pass of ADR 0018 does what it promises.
Every sample assertion is now scoped by namespace — go_inventory, peaks,
counters, ports and workload metadata. go_build stays keyed by digest
alone, which is correct: a build is a property of an image, not of a
namespace.
Two things kept from the diagnosis, because they are what made it possible:
the payload's captured_at travels with the record, so a negative reading
can be told from a file that was never rewritten; and the timeout prints
the annotation time, the write time and whether the retention pass ever
evicted anything.
make inventory-e2e — PASS (363s), with both abandoned namespaces
still present in the cluster and named in the run's own log
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeZECJXTDHL6Nts95eKMJA
|
Note on the red lint runs above — they were a CI cache artifact, not this branch. Two runs reported six What ruled the code out:
The last two lines are the point: without the The difference was the restored cache. Two keys existed: The findings were false in any case: all three sites call Worth its own slice: the linter cache can turn a clean tree red, and nothing in the workflow guards against it. |
checkOptOutRemovesTheRecordhas been failing, and the agent was not the reason.What was actually happening
The suite reuses one kind cluster. A run killed before its cleanup leaves its namespace behind, and the sample workload in it keeps running — same image, same workload name, same module path, and nobody annotated it.
findSampleRecordmatched onmodule_pathalone, so it kept finding a pod from an abandoned run three days old and reporting that the opt-out had failed.This also corrects a conclusion recorded in #118. The control experiment there found the test failing on both the branch and
mainand read that as evidence about the agent. It was evidence about the cluster: the abandoned namespace was already present for both runs.The opt-out works
Measured directly against the cluster the killed run left in its failed state — the controller, the node and the annotated pod were all still up, so no rerun was needed:
The retention pass of ADR 0018 evicted the record 41 seconds after the annotation. The surviving
goworkloadrecord in the payload carriednamespace: runtime-agent-inv-e2e-51873— the abandoned one.The fix
The gap was in five payloads, not one. Every assertion about the sample workload is now scoped by the namespace under test:
go_inventory,process_peaks,process_counters,listening_ports, andworkload_metadata.go_buildstays keyed by image digest alone, which is correct — a build is a property of an image, not of a namespace.Kept from the diagnosis
Two things, because they are what made the diagnosis possible at all:
captured_attravels with the record. The kind supersedes in place under one file name, so a reader that does not date the payload cannot tell a record that left from a file that was never rewritten.workload_metadata(built from the same pod index the retention pass reads) and whether the controller ever logged an eviction.Plus a line at the start of the run naming abandoned namespaces from earlier runs. It paid for itself immediately.
Verification
The passing run was made with both abandoned namespaces still in the cluster — the exact condition that broke the test — and the run's own log names them:
Not fixed here
countExcludedis called from the informer'sAddFuncbut not fromUpdateFunc, so a pod that opts out mid-flight is dropped from collection without being counted infilter.excluded_pod_annotation— the live cluster showed0there while the pod was excluded. The count corrects itself when the controller restarts andAddFuncreplays the cache. That is a change to agent behaviour and wants its own slice.🤖 Generated with Claude Code
https://claude.ai/code/session_01KeZECJXTDHL6Nts95eKMJA