Skip to content

feat(#756): count the leaks, not the declarations - #1303

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/756-wire-projection-category
Sep 30, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/756-wire-projection-category

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Why

#756's remaining criteria are AC2 (an approach chosen per plugin, with the reason recorded) and AC3 (no unpublished member reaches a response body). Neither can be measured against the ratchet as it stands, because the ratchet counts the wrong thing.

scripts/wire-bookkeeping-baseline.txt holds 330 lines and its header says each is "expected to be deleted as its service is fixed." ECR is the file's own named precedent for a fix — and all four ECR lines are still in it, two releases after #1090 rendered ECR's responses from ecrRepositoryOut. They have to be. emulator/ecr_wire.go states the reason:

Do not "fix" a leak here by adding json:"-" to a state field. That works for the one field and leaves the next one to be remembered rather than prevented, and it changes the format of every recorded run, because MemoryStateManager snapshots those bytes and a replay reads them back. For the same reason CreatedAt stays a time.Time in the record and is converted on projection rather than being retyped in place.

A fix removes the field from the response, not from the record. So the two things that would shrink the baseline are both ruled out, and a file whose number never moves is not a ratchet.

What changed

  • New scripts/wire-bookkeeping-projected.txt — file, struct-type, Test-that-proves-it. One line per persisted record rendered through a wire struct. It is deliberately the opposite posture to the baseline: an entry there is a defect owed a fix and the reason is stated once for all of them; an entry here is a site that should stay, so it argues for itself in the third column. Seeded with ECRRepository, citing the test that already exists — TestECR_RepositoryResponsesCarryNoBookkeepingMember (emulator/ecr_wire_shape_test.go:119), which asserts on the raw bodies of all three sites that answer a repository, with a presence anchor so the absences cannot pass vacuously.
  • scripts/check-wire-bookkeeping.sh refuses a projected entry whose type has no baseline line (a projection for a record with no bookkeeping field is a stale claim), and one whose cited test emulator/ does not define (so the citation cannot decay into a comment as tests are renamed). Both are grep, so the CI job still needs no Go toolchain — its comment now says so.
  • The run reports three numbers instead of one: 330 declared, 4 projected across 1 record, 326 still reachable (#756). 326 is the number AC3 drives to zero.
  • Both file headers corrected, and the If you ADDED a field advice no longer offers json:"-" as a co-equal option for a field already written to state — citing the replay reasoning above. It stays fine for a field that has never been persisted.

The baseline itself and its --write are untouched: still purely lexical, still awk-regenerable, which is why the category could not live in it.

Verification

  • ./scripts/check-wire-bookkeeping.sh → 330 declared, 4 projected across 1 record, 326 still reachable. No baseline line added or removed.
  • Both new refusals exercised by hand: an entry citing a nonexistent test, and an entry naming ECRImage (no baseline line). Each fails with exit 1 and names what is wrong. The baseline advice block no longer prints for a projected-file failure, since it is about something else.
  • shellcheck clean; bash -n clean. make version-check discarded-unmarshal-check green. make test green (no Go file changed in this PR).

Deviation from plan

The plan called for writing emulator/ecr_wire_test.go. It already exists as emulator/ecr_wire_shape_test.go and is better than the one drafted — it also checks the tag and policies are still readable through the operations that publish them. So this PR adds no test and cites that one instead, which is the first evidence the citation design fits what the tree already does.

Refs #756 — the issue stays open. EFS is next (nine lines, and the sharp case the script's own header names: substrate declares CreatedAt where AWS publishes CreationTime).

The wire-bookkeeping ratchet was written expecting each of its 330 lines to be
deleted as its service was fixed. That is not how the fix works, and ECR is the
proof: #1090 fixed ECR by the route the script itself recommends, and all four
ECR lines are still in the baseline. They have to be — emulator/ecr_wire.go says
why in as many words. `json:"-"` and retyping a field in place both change the
format of every recorded run, because MemoryStateManager snapshots those bytes
and a replay reads them back. A fix removes the field from the response, not from
the record.

So the baseline is the declaration surface and the upper bound, and a fixed
record records itself in the new scripts/wire-bookkeeping-projected.txt: one line
per record, citing by name the test that asserts on the raw response bytes that
no unpublished member appears. That file is the opposite of the baseline — an
entry there argues for itself — and the check refuses one whose type has no
baseline line, or whose cited test emulator/ does not define. Pure grep, so the
CI job still needs no Go toolchain.

The run now reports `330 declared, 4 projected across 1 record, 326 still
reachable`. The last number is what #756's third criterion drives to zero.

Both file headers and the failure advice are corrected to match; the advice no
longer offers `json:"-"` as a co-equal fix for a field already persisted.

Refs #756
@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 7d2624f into main Sep 30, 2026
15 checks passed
@scttfrdmn
scttfrdmn deleted the feat/756-wire-projection-category branch September 30, 2026 20:46
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