Skip to content

feat(#756): discharge records no AWS response renders, through a third inventory - #1337

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/756-internal-bookkeeping-inventory
Oct 2, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/756-internal-bookkeeping-inventory

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

This adds the third inventory we agreed on for #756. It discharges records that no AWS response
renders
, where no raw-bytes test can say anything useful.

Why a third file

A line in wire-bookkeeping-projected.txt cites a test that walks every response answering the
record. A record that no AWS response answers has no such response. A test that some unrelated
response omits its members would pass whatever the record held, which is #1304's vacuous assertion
applied to a whole record. So these lines are reviewed decisions, not proofs, and the file says
so in its header.

scripts/wire-bookkeeping-internal.txt

Columns are file struct-type kind anchor, with three kinds:

Kind Meaning Anchor
request A request-body decode target, never written back the decoding function
state Persisted and read back by the plugin; the published response is built from other values the reader
substrate Rendered only by one of substrate's own /v1 endpoints, where the account and Region are the point the route

What the check enforces

check-wire-bookkeeping refuses a line:

  • whose type has no baseline entry (a stale claim);
  • whose kind is not one of the three;
  • whose record is also in the projected file, since a record either reaches an AWS response or
    it does not;
  • whose anchor no longer occurs in a non-test file under emulator/. A renamed reader or a
    removed route sends the line back for review.

Negative controls (each run, then restored)

Corruption Result
kind seed refused, naming the three kinds
anchor /v1/mails refused, "no non-test file under emulator/ contains it"; exit 1
type EventX refused as a stale claim
SNSTopic added (already projected) refused, "in both … A record either reaches an AWS response … or it does not"

The six records, read reader by reader

Record Kind Why no AWS response renders it
accountRegionOpt state Read only by loadRegionOpt; responses render its Status. UpdatedAt is documented "nothing reads it back"
accountRegionRequest request Decoded by regionInput
orgPendingAccountOutcome state Stored and read by pendingCreateOutcome; the response renders the published CreateAccountStatus
Event substrate The event log; rendered by the debug export. Cost Explorer reads it but only aggregates
debugEventSummary substrate GET /v1/debug/events
SESv2CapturedEmail substrate GET /v1/emails; SendEmail answers only MessageId

A correction to my own earlier claim

On #756 I listed the "substrate's own surface" subset as including cfn_deployer's records,
STSSessionCredentials and both stream cursors. Reading their renderers showed all five reach
AWS responses
:

  • STSSessionCredentials is rendered through xmlCreds by AssumeRole and GetSessionToken.
  • CFNStackState is rendered through cfnStackItem by DescribeStacks. Its CreatedAt feeds the
    published CreationTime.
  • CFNChangeSet's CreatedAt feeds CreationTime in DescribeChangeSet and ListChangeSets.
  • DynamoDBStreamCursor and kinesisIterator are base64-encoded into the ShardIterator that
    GetShardIterator/GetRecords answer.

They stay in the baseline and will each be projected with a raw-bytes test. For the cursors that
test is not vacuous: it fails the day a cursor is rendered as an object rather than a token. The
file's header names all five as examples of what does not belong in it, and the script's header
paragraph that described two of these records as "staying in the baseline" is rewritten to point at
the new file.

The figure

before: 319 declared, 219 projected across 89 records, 100 still reachable
after:  319 declared, 219 projected across 89 records, 9 internal across 6 records, 91 still reachable

Also

  • The CI comment on the wire-bookkeeping job now says it asserts three files.
  • The SES v2 docs point at the new file.
  • shellcheck is clean. The anchor search uses grep -r --include/--exclude, which behaves the
    same on BSD and GNU grep.

Verification

All of these pass:

  • make lint: 0 issues.
  • make test: race, -count=1.
  • docs-reference-check docs-versions version-check discarded-unmarshal-check wire-bookkeeping-check operation-catalog-check operation-docs-check.

#756 stays open (91 lines).

…d inventory

Some records declare a bookkeeping field but never reach an AWS response at all,
so no raw-bytes test can say anything about them: a test that an unrelated
response omits their members would pass whatever they held, #1304's vacuous
assertion applied to a whole record.

scripts/wire-bookkeeping-internal.txt records each as a reviewed decision: a
kind (request, state or substrate) and an anchor naming the decoder, the reader
or the /v1 route that keeps it off every AWS response. check-wire-bookkeeping
refuses a line whose type has no baseline entry, whose kind is unknown, whose
record the projected file also claims, or whose anchor no longer occurs in a
non-test file, and subtracts the rest from still-reachable.

Six records, read reader by reader: accountRegionOpt (read only by
loadRegionOpt; responses render its Status), accountRegionRequest (decoded by
regionInput), orgPendingAccountOutcome (stored and read by pendingCreateOutcome;
the response renders the published CreateAccountStatus), Event (rendered by the
debug export; Cost Explorer only aggregates it), debugEventSummary
(/v1/debug/events) and SESv2CapturedEmail (/v1/emails).

Five records that looked internal are not, and stay in the baseline for a
projected test: STSSessionCredentials (xmlCreds), CFNStackState (cfnStackItem),
CFNChangeSet (CreationTime in DescribeChangeSet and ListChangeSets), and the two
stream cursors base64-encoded into ShardIterator.

319 declared, 219 projected, 9 internal, 91 still reachable.

#756 stays open.
@codecov

codecov Bot commented Oct 2, 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 cfa867b into main Oct 2, 2026
18 checks passed
@scttfrdmn
scttfrdmn deleted the feat/756-internal-bookkeeping-inventory branch October 2, 2026 19:35
scttfrdmn added a commit that referenced this pull request Oct 3, 2026
…e zero still-reachable the floor (#1367)

These are the five records #1337 set aside as reaching an AWS body only through
a projection or a token, and each one was confirmed to:

- STSSessionCredentials' AccountId reaches none of AssumeRole,
  GetSessionToken or a session-signed GetCallerIdentity, which publishes the
  account as Account (emulator/sts_wire_test.go).
- CFNStackState and CFNChangeSet reach no response. emulator/cfn_wire_test.go
  reads the members back first, the account and Region being omitempty, and
  walks every routed stack and change-set operation.
- DynamoDBStreamCursor and kinesisIterator reach a body only base64-encoded in
  the opaque ShardIterator/NextShardIterator, which is faithful. Each test
  decodes the token first, requiring the account and Region inside it, and fails
  the day the cursor is rendered as an object.

check-wire-bookkeeping goes from 300 projected across 129 records to 310 across
134, and from 10 still reachable to 0. It now fails on any record that neither
file discharges, so zero is the floor and a new record cannot enter the baseline
by --write alone.

Writing the CloudFormation test found that stack and change-set state keys
carry no account or Region; that is #1366.

Part of #756. Its acceptance criteria are reviewed on the issue after merge.
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