Repository navigation
test(contract): a promise that leaves or changes without a version bump fails a test, checked_by lists every test that holds an entry, and the names a chart passes are held to its render (#1541, #1547, #1548) - #1566
Merged
Conversation
…mp fails a test, checked_by lists every test that holds an entry, and the names a chart passes are held to its render (#1541, #1547, #1548) Three follow-ups to the external-harness contract (#1535). The contract's version stays 1: checks are added, no promise changes. #1541. external-harness.lock.yaml holds one line per promise of the current version: "<entry id> <key> [<member>]" and a digest. TestVersionBump compares it with the contract. A line that is gone or whose digest differs fails and asks for the bump, without printing a digest; with the version bumped by one the test prints the whole new lock; a promise the contract gains needs a line and no bump, and the test prints the line. Prose (notes, comments), checked_by and the order of a list are not promises. A key added to an entry type later is a promise by default. #1547. checked_by is one label or a list. Every test it names lists the entry among the ids it holds: Contract.Owns for a Go test, `ids` for a chart test, which is now told its own label. The contract does not load unless an entry a render refers to names that render's chart test, and an entry that names a chart test is referred to by one of its renders. #1548. Audit of the entries compared with a Go constant only. Tied to the render: the CSIDriver object's name (name_from: csi.driver), the prober chart's default --mesh-domain and --egress (the outbound port, through a pattern), and the prober's service.name, which the OpenTelemetry SDK lets the environment override: the rendered container must be given neither service.name in OTEL_RESOURCE_ATTRIBUTES nor OTEL_SERVICE_NAME. No chart file changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
There was a problem hiding this comment.
🟡 Changes recommended
Base-aware deletion enforcement and several chart-drift paths remain unresolved.
5 open findings
Tie webhook selectors to the managed-label contract · New Validate contract removals against the base revision · New Preserve valueFrom and fail closed for code-owned attributes · New Derive CSI socket paths from the contracted driver name · New Clarify the lock-line bypass requires coordinated file changes · New
What changed in this PR
Adds stronger test-only enforcement for the external-harness contract.
Changes:
- Adds a promise lock and version-bump checks.
- Supports multiple
checked_bytests per entry. - Extends chart checks for referenced names, arguments, and resource attributes.
| File | Description |
|---|---|
AGENTS.md |
Documents contract-lock workflow. |
docs/runbook.md |
Updates contract guidance. |
test/harnesscontract/BUILD.bazel |
Registers lock tests and chart ties. |
test/harnesscontract/README.md |
Documents promise and chart rules. |
test/harnesscontract/chart.go |
Extends rendered-chart validation. |
test/harnesscontract/chart_test.go |
Tests new chart ties. |
test/harnesscontract/contract.go |
Adds multi-test ownership. |
test/harnesscontract/contract_test.go |
Tests ownership validation. |
test/harnesscontract/defs.bzl |
Passes chart-test labels to checker. |
test/harnesscontract/external-harness.lock.yaml |
Records version-one promises. |
test/harnesscontract/external-harness.yaml |
Adds chart-backed contract ties. |
test/harnesscontract/promises.go |
Implements promise locking. |
test/harnesscontract/promises_test.go |
Tests lock semantics. |
test/harnesscontract/testing.go |
Handles shared ownership. |
test/harnesscontract/cmd/chartcheck/main.go |
Validates chart-test ownership. |
test/harnesscontract/cmd/chartcheck/main_test.go |
Tests checker ownership behavior. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…d the webhook selectors, the plugin directory and an unreadable environment are held too Review round 1. - scripts/check-harness-contract-bump.sh compares the lock with the one at the pull request's base (a step of the chart-version-bump job): a promise removed together with its lock line, or changed with its digest recomputed, passes the hermetic test and fails here unless the version is higher than at the base. Hermetic test with a fake `git show`; it also holds ci.yaml to running the script with the base sha. - pod.label.managed is held to the label the controller's two pod webhooks select by in the aether chart's render. The configuration has no name in the contract: it is the render's one object of its kind. - csi.driver is held to the kubelet plugin directory the uds-csi DaemonSet mounts from the host as well as to the CSIDriver object's name. - A container whose code sets a resource attribute fails closed when its environment cannot be read: OTEL_RESOURCE_ATTRIBUTES from valueFrom, or any envFrom. - README: which changes the hermetic test cannot see, said exactly. No chart file changes; the contract's version stays 1. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
… key, and the base comparison refuses a bump by more than one Review round 2. - A webhook selector on the mesh label with a value other than "true" matches nothing the mesh manages: the check compares key and value. - With the contract and the lock moved together, only the base can tell a bump by two from a bump by one: check-harness-contract-bump.sh refuses it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…t to either Review round 3. The namespace selector and the object selector of a webhook are not interchangeable: one selects the namespaces whose pods the webhook sees, the other the pods. `webhooks` now says which of the two selects by the entry, and the check reads that one. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
This was referenced Oct 9, 2026
…e plugin directory is held to its mount as well as its host path Review round 4. - Kubernetes requires everything a selector lists. A second matchLabels pair or any matchExpressions beside the mesh label narrows what a fail-open webhook sees, down to nothing: the selector the contract names must be the one pair and nothing else. - The uds-csi plugin writes its socket under the directory named after the driver, in its own filesystem. The hostPath volume that ends with that directory must be mounted by a container (not an init container) at a path that ends the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…se cannot be read Review round 5. `git show` failing for any reason read as "the base has no lock" and passed, so a base the checkout lacks (a shallow clone) switched the check off. The base must be a commit that is here; only a base that is here and has no lock at that path has nothing to compare; a lock that is there and cannot be read fails. README: one sentence completed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…s the form the base comparison reads Review round 12. The base comparison reads the lock one line at a time; the hermetic test parsed it as YAML. The same promises as an inline map, or indented otherwise, passed the test and would have read at a later pull request's base as no promise at all. TestVersionBump now also requires the file to be byte for byte the one Contract.Lock writes, and prints it when it is not. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…what the tie comes to, not by the entry it names Review round 13. The lock line of a host path was named by its pattern, and those of a container's resource attributes by the id of the entry: moving the tie to another entry that says the same removed a line and asked for a version bump, though nothing a harness reads had changed and TestTies already holds which entry a tie names. A host path is now named by the path it comes to and an attribute by its key, as names, arguments and webhook labels already were. The same tie coming to something else is still a bump. The lock is regenerated: four lines renamed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…E says who holds the charts' own mesh names main added `agent.xds_acked_tls_clusters_unknown` to the contract. A new entry needs no version bump and a line in the lock per promise: TestVersionBump failed on the merge and printed the four lines, which are added. That failure was also the first on a pull request's merge ref: `test` went red on the previous head for exactly this reason. main also holds the prober and udsecho charts' mesh names to the Go constants (helm_mesh_names_test, #1595), so the README no longer lists them as compared with nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
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.



Three follow-ups to the external-harness contract (#1535). Base:
26a90582.This pull request does not bump the contract's
version. It adds checks; no promise changes.mainmoved the contract to version 2 while this was open (#1508), so the lock here is the one for version 2: on mergingmain,TestVersionBumpfailed and printed it, as the README prescribes. Only its version line differs from the lock for version 1, because that bump was a change of meaning written innotes, which the lock cannot see; the README now says so plainly and the "Versions" table is the one place a bump is recorded. The contract file changes in three ways, none of them a change of meaning:checked_bybecomes a list where several tests hold an entry, the CSIDriver object takes its name from thecsi.driverentry instead of repeating the string, and a few things more are held (the prober container's arguments and environment, the uds-csi plugin directory, the selectors of the controller's pod webhooks): new promises, which need no bump.#1541: a promise that leaves or changes without a version bump fails a test
test/harnesscontract/external-harness.lock.yamlholds one line per promise of the current version:"<entry id> <key> [<member>]"and a digest of what is promised there.TestVersionBump(in//test/harnesscontract:harnesscontract_test) compares it with the contract.The rule it encodes (README, "The rule", which now states the cases it was silent on):
setpairs, release or namespaceversionbumped by oneversionbumped by more than one, or lowerednotes, a comment,checked_by, the order of a listHow the unit is chosen: every key of an entry is one promise, so adding to its value changes it (a closed set, a metric's labels, the
setpairs). Where the contract itself says a set is open (log fields, pod labels, containers, what a container is held to), each member is its own promise, so a new member is an addition. A key added to an entry type in the future is a promise unless it is added tonotPromised;TestEveryKeyIsAPromisefails otherwise.The base comparison. That test reads both files from one checkout, so it cannot see a change made to both: an entry removed together with its lock lines, or a promise changed with its digest recomputed.
scripts/check-harness-contract-bump.shcovers that. A new step of thechart-version-bumpjob runs it with the pull request's base sha: every promise line of the lock at the base is still there, unchanged, orversionis higher than at the base.//scripts:check_harness_contract_bump_testtests it with a fakegit showand fails ifci.yamlstops running it against the base. This is the one workflow edit, a step added to an existing job.What it does not do. A promise made only in prose (
notes, a comment) has no line. And on this pull request the base comparison has nothing to compare, because the base has no lock yet: its first real run is the next pull request that touches the contract.The lock's form, and ties.
TestVersionBumpalso requires the lock to be byte for byte the file the test prints (header, one promise to a line, sorted), because the base comparison reads it line by line: the same promises as an inline map would read there as none. A promise made through a tie to another entry (name_from,args,resource_attributes,code_resource_attributes,host_paths,webhooks) is named and digested in the lock by what the tie comes to, never by the entry's id, so moving a tie to another entry that says the same is no bump. Which entry a tie names is held separately:TestTiescompares the contract's ties with a list incontract_test.go, in both directions, soname_from: csi.drivercannot become the literal unnoticed (nothing else failed when it did).#1547:
checked_bylists every test that holds an entrychecked_byis one label or a list.review-onlycannot be combined with a test, and a test cannot be named twice.Contract.Ownsfor a Go test,idsfor a chart test.helm_contract_testnow passes the checker its own label, and the checker fails when a render of its chart does not name it, or an entry names it that its chart's renders give it nothing to compare.resource.nodenow lists its three tests;mesh.default_domain,csi.driver,port.outbound_httpandresource.service_name.proberlist the chart test that compares them with a render beside the test that compares them with the code.#1548: audit of the entries compared with a Go constant only
"Tied" means the entry is compared with
helm templateof the packaged chart at the chart's defaults, in both directions (seen red for the chart edited alone and for the contract edited alone). No file undercharts/changes.port.outbound_http(18081)probe.egress(default127.0.0.1:18081) decides which port a deployed prober dials--egressis127.0.0.1:<port.outbound_http>port.outbound_l4(18082)mesh.default_domainmeshDomainof the aether chart is--mesh-domainof the agent and the mesh-DNS daemon (tied by #1535), and of the controller, the registrar and the edge agent.probe.meshDomainof the prober chart is--mesh-domainof the probercsi.drivername_from: csi.driver, and the uds-csi DaemonSet must have a hostPath volume of the path<its --kubelet-root>/plugins/<csi.driver>(the kubelet plugin directory, a literal in the template) that the uds-csi container mounts at that same path. Not tied: the volume of the udsecho pods (below)resource.service_name.proberOTEL_SERVICE_NAMEis an explicit override.service.name=inOTEL_RESOURCE_ATTRIBUTESalso renamed the prober when this audit was made (measured innewResource); #1562 has since stopped that, so that half of the rule is now belt and bracescode_resource_attributes)pod.label.managedpod.annotation.upstreams,pod.annotation.endpoint_port,pod.annotation.endpoint_uds_socketpod.annotation.endpoint_ports,pod.annotation.endpoint_protocol,pod.annotation.capture_exclude_outbound_ports,service.label.mesh_servicelog_linescap_per_window,window_secondsenvoy_statsstat prefixmetricsEvidence
bazel test //test/harnesscontract/... //scripts/... //e2e/... //bazel/actionlint:all, the lint build over//test/harnesscontract/...and//scripts/...with--@aspect_rules_lint//lint:fail_on_violation,make actionlint,scripts/check-shell-lint.shandmake format-checkpass.Seen red on the real files, each change made alone and reverted:
versionbumped with the lock left behind; a lock line deleted; a lock digest edited. Seen green: anotesedit, a comment edit, a new entry with its lock line (red without the line, with the line printed).ids; an entry that names a chart test with nothing to compare; an entry that names a second Go test with no check for it; a render that names another chart's test.probe.egressport; its defaultprobe.meshDomain;service.name=added to the prober'sOTEL_RESOURCE_ATTRIBUTES;OTEL_SERVICE_NAMEadded to the prober; the CSIDriver object renamed in the aether chart; the selector of each pod webhook; the uds-csi plugin directory; the prober'sOTEL_RESOURCE_ATTRIBUTEStaken fromvalueFrom; anenvFromon the prober; and from the other side, the contract'scsi.driver,port.outbound_httpandpod.label.managededited alone.ci.yamlno longer running the script, or passing it another ref.Mutation check: 132 single-line mutations of the new code (118 in Go, 14 in the script), plus the digest redaction seen red before its fix, each run alone and reverted; each fails a named test. Two of them first failed to compile, which is no kill; they were rewritten and then failed a test.
Not done
helm_mesh_names_testtargets hold them to the Go constants, so nothing is left to do here.--mesh-domainof the controller, the registrar and the edge agent. Tying them means listing those containers in the contract, which is a new promise about names no harness addresses.Closes #1541
Closes #1547
Closes #1548
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr