Skip to content

test(#756): pin the Backup projections and record them - #1326

Merged
scttfrdmn merged 1 commit into
mainfrom
test/756-backup-wire-projections
Oct 2, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
test/756-backup-wire-projections

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Part of #756 (AC3). Does not close it — see the figures below.

What this discharges

Six baseline lines, two per record: BackupVault, BackupPlan and BackupSelection each declare
AccountID and Region under wire-visible json tags. None reaches a response — the vault answers
through backupVaultOut since #1325, and every plan and selection response is a
map[string]interface{} built member by member — but scripts/wire-bookkeeping-projected.txt refuses
a record until a named test asserts that on the raw bytes.

319 declared, 159 projected across 62 records, 160 still reachable   (main)
319 declared, 165 projected across 65 records, 154 still reachable   (here)

The test

emulator/backup_wire_test.go — three t.Parallel() tests, one per record, driving all twelve
routed operations and walking each decoded document for a member named for either at any depth,
reporting the $.a.b[0].c path.

The walk covers the whole document rather than a record's subtree, which matters for Backup
specifically: GetBackupPlan and GetBackupSelection nest the record's published members under
BackupPlan and BackupSelection while answering others flat, so "the record's subtree" is not one
place, and a member rendered on the envelope would pass a subtree walk.

Absence rather than exact membership, which is the weaker of the two forms in the suite and is
chosen deliberately: DescribeBackupVault answers 5 of API_DescribeBackupVault's 17 published
members and ListBackupVaults 5 of API_BackupVaultListMember's 13, so an exact expectation would pin
that gap (#1199, now with two Backup rows) and have to be rewritten by the PR closing it.

Nothing is vacuous for free. Neither member carries ,omitempty on any of the three records, and
Backup routes no tag operation at all, so no record declares EverTagged and the trap #1304 fell into
on EFS cannot arise here. The records are still read back as raw JSON for the presence anchor rather
than taking that on trust. Each case also asserts a published member is present before asserting a
bookkeeping one is absent, so a body that failed to render the record fails as a missing anchor rather
than passing as an absence.

The three deletes answer {} and read nothing off the record. They are driven anyway, so the set of
twelve reads as complete rather than as a sample.

Negative controls, all five run and restored

Control Expected Observed
AccountID added back to backupVaultOut only the vault test fails DescribeBackupVault + ListBackupVaults, nothing else
Region added to getBackupPlan's map only the plan test fails GetBackupPlan, nothing else
AccountID added to getBackupSelection's map only the selection test fails GetBackupSelection, nothing else
"Region" added to all three empty {} deletes all three delete subtests fail all three, and only those
a cited test name misspelt wire-bookkeeping-check refuses "emulator/ defines no such test … the citation is the only thing holding the projection", exit 1

So the delete subtests are regression guards rather than decoration, and each projected line is held
by a test that is non-vacuous for both of its record's members.

Verification

  • make lint — 0 issues (misspell caught one British spelling in a Go comment; fixed).
  • make test (race, -count=1) — all packages pass.
  • make docs-reference-check docs-versions version-check discarded-unmarshal-check wire-bookkeeping-check operation-catalog-check operation-docs-check — all pass; the two operation
    checks report no change, since no operation is added or renamed.
  • No assertion equates a timestamp. TimeController.Now advances from its baseline by elapsed wall
    time, so this file only walks member names; pinning a Backup date's rendering is
    emulator/backup_dates_test.go's job (backup: nine date members are RFC3339 strings where every page publishes a Timestamp in Unix form #1324), which freezes the clock for exactly that reason.

Note on the projected file's ordering

The plan expected backup to sort to the top of the file. It does not — emulator/apigateway_types.go
and emulator/appsync_types.go precede it — so the three lines are inserted between AppSync and
Cognito. The check does not enforce ordering, but the file is sorted by path and should stay that way.

Six baseline lines, two per record: BackupVault, BackupPlan and BackupSelection
each declare AccountID and Region under wire-visible json tags. None reaches a
response — the vault answers through backupVaultOut since #1325, and every plan
and selection response is a map built member by member — but the projected
inventory refuses a record until a named test asserts it on the raw bytes.

emulator/backup_wire_test.go drives all twelve routed operations across three
parallel tests and walks each decoded document, failing on a member named for
either at any depth and reporting the $.a.b[0].c path. The walk covers the whole
document rather than a record's subtree, which matters here: GetBackupPlan and
GetBackupSelection nest the record's published members under BackupPlan and
BackupSelection while answering others flat, so "the record's subtree" is not one
place, and a member rendered on the envelope would pass a subtree walk.

Absence rather than exact membership, which is the weaker of the two forms in the
suite: DescribeBackupVault answers 5 of API_DescribeBackupVault's 17 published
members and ListBackupVaults 5 of API_BackupVaultListMember's 13, so an exact
expectation would pin that gap (#1199) and have to be rewritten by the PR closing
it.

Nothing here is vacuous for free. Neither member carries ,omitempty on any of the
three records, and Backup routes no tag operation, so no record declares
EverTagged and #1304's trap cannot arise; the records are read back as raw JSON
as the presence anchor regardless. Each case also asserts a published member is
present before asserting a bookkeeping one is absent, so a body that failed to
render the record fails as a missing anchor rather than passing as an absence.

The three deletes answer {} and read nothing off the record. They are driven
anyway, so the set of twelve reads as complete rather than as a sample, and a
control confirms all three subtests fail if a member is added to the empty
object. Four more controls were run: a leak reintroduced on backupVaultOut, on
one plan map and on one selection map each failed exactly the one test citing
that record and no other, and a misspelt citation was refused by
check-wire-bookkeeping.

159 projected across 62 records to 165 across 65; 160 still reachable to 154.
No assertion equates a timestamp — TimeController.Now advances from its baseline
by elapsed wall time, and pinning a Backup date's rendering is
emulator/backup_dates_test.go's job (#1324).
@scttfrdmn
scttfrdmn merged commit bbcf6b8 into main Oct 2, 2026
17 checks passed
@scttfrdmn
scttfrdmn deleted the test/756-backup-wire-projections branch October 2, 2026 01:45
@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!

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