Skip to content

fix(#756): render EFS responses from the published shape - #1304

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

scttfrdmn merged 1 commit into
mainfrom
fix/756-efs-wire-projection

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Refs #756 — the first service projected after #1090's ECR, on the measurement PR #1303 just
landed.

The defect

All three EFS records — EFSFileSystem, EFSAccessPoint, EFSMountTarget — were handed to
efsJSONResponse directly at each of the ten sites that answer a resource. Every one of those
bodies carried AccountID and Region unconditionally (neither has omitempty), ever_tagged on
a record that had been tagged, and, on a file system, CreatedAt as an RFC3339 string. AWS
publishes none of the four.

EFS is taken first because its leak is not merely an extra member but a near-miss of a real
one
. API_FileSystemDescription publishes CreationTime, "the time that the file system was
created, in seconds (since 1970-01-01T00:00:00Z)", Required: Yes. A consumer reading CreationTime
off a substrate response got nothing, while a member one letter-group away held the value under the
wrong name and the wrong type.

What the projection closes

emulator/efs_wire.go renders the three published shapes from the persisted records, on
ecr_wire.go's pattern. That also fills in three members substrate reported nowhere, each named by
the reference:

Member Authority
CreationTime, as epoch seconds API_FileSystemDescription, Required: Yes
SizeInBytes API_FileSystemSize: Value Long, minimum 0, Required: Yes
OwnerId on the access point and the mount target API_AccessPointDescription, API_MountTargetDescription

SizeInBytes.Value is 0 — substrate stores no file data, so that is the metered size of a file
system nothing has written to, within the published range and inventing nothing — with the file
system's own creation time as its Timestamp, because that is when the 0 was determined. An
advancing timestamp would claim a re-measurement that never happened. ValueInIA,
ValueInStandard and ValueInArchive stay absent rather than present and zero, per #1013: no
storage class is modelled, so a zero there would read as a measurement. Tags is always an array,
never null, since it is Required: Yes.

OwnerId is where the leaked AccountID goes. Same value, published name — the same fix rather
than a second one.

What stays, and why

AccountID, Region and EverTagged stay on the records in emulator/efs_types.go, untouched.
ecr_wire.go states the rule: removing a persisted member, or retyping one in place, changes the
format of every recorded run, because MemoryStateManager snapshots those bytes and a replay reads
them back. EverTagged crosses a service boundary besides —
TaggingPlugin.scanEFSFileSystems reports it on GetResources.

So EFS keeps its nine lines in scripts/wire-bookkeeping-baseline.txt and earns three entries in
scripts/wire-bookkeeping-projected.txt:

check-wire-bookkeeping: ok — 330 declared, 13 projected across 4 records, 317 still reachable (#756)

No baseline line added or removed, which is the whole point of splitting the two files.

A provenance note worth keeping

AWS's own API_CreateFileSystem page disagrees with itself. Its Response Syntax publishes
"OwnerId", "FileSystemId", "NumberOfMountTargets" and "CreationTime": number; both of its
sample responses render "ownerId", "fileSystemId", "numberOfMountTargets" and
"CreationTime":"1403301078" — lower camel, and the timestamp quoted. The Response Syntax is what
the SDK decoder follows, so it is what these types match. Recorded in the file's preamble so
someone comparing substrate against the example does not read the match as the defect.

Tests

emulator/efs_wire_test.go, on a frozen clock (Freeze then SetTime, in that order —
TimeController.Freeze says why; an unfrozen controller advances with real elapsed time and
EpochSeconds renders three decimals, so half a millisecond on a loaded machine would move the
asserted value).

  • TestEFS_ResourceResponsesCarryNoBookkeepingMember — the test the projected file cites, over all
    ten sites, each with a presence anchor so an absence assertion cannot pass vacuously. The file
    system and access point are tagged through the API before being described, because only
    TagResource sets EverTagged — creating with tags does not — and ever_tagged carries
    omitempty, so without that the assertion would have passed for free.
  • TestEFS_FileSystemPublishesCreationTimeAndSizeInBytes — CreationTime is the bare number
    1709251200.000 and not a quoted string; SizeInBytes.Value is 0; the three breakdowns are nil.
  • TestEFS_AccessPointAndMountTargetPublishOwnerId.
  • TestEFS_UntaggedFileSystemReportsAnEmptyTagArray — [] and not null, standing in for the
    three nil-slice guards the projection replaced.
  • TestEFS_ProjectionLeavesTheRecordIntact — the other half of the claim: the record read back out
    of state still carries AccountID, Region, a time.Time CreatedAt and a true EverTagged.

100% coverage on every function in emulator/efs_wire.go.

Verification

make lint (0 issues), make test (race, -count=1) green, and
docs-reference-check docs-versions version-check discarded-unmarshal-check wire-bookkeeping-check operation-catalog-check operation-docs-check all pass.

Deviations from the plan

  • The plan said the projection's SizeInBytes.Timestamp would come from the simulated clock. It
    comes from the record's own CreatedAt instead: truthful for the reason above, and it keeps the
    clock out of the projection.
  • The plan counted nine efsJSONResponse sites. There are ten — the single-resource filtered arms
    of DescribeAccessPoints and DescribeMountTargets are separate returns. All ten project and all
    ten are asserted.

#756 stays open: 24 services remain, and the per-service decision table is AC2.

All three EFS records were handed to the JSON writer directly at each of
the ten sites that answer a resource, so every one of those bodies
carried AccountID and Region unconditionally, ever_tagged on a tagged
record, and CreatedAt as an RFC3339 string on a file system. AWS
publishes none of the four.

EFS is taken first because its leak is not merely an extra member but a
near-miss of a real one: API_FileSystemDescription publishes
CreationTime, in epoch seconds, Required: Yes. emulator/efs_wire.go
projects the records onto the published shapes, which also closes
CreationTime and SizeInBytes on a file system and OwnerId on an access
point and a mount target — the last two from the AccountID that was
leaking, so the value reaches the caller under its published name
rather than being deleted.

The records keep AccountID, Region and EverTagged: removing a persisted
member changes the format of every recorded run, and
TaggingPlugin.scanEFSFileSystems reads EverTagged besides. EFS therefore
keeps its nine baseline lines and earns three entries in
scripts/wire-bookkeeping-projected.txt — 330 declared, 13 projected,
317 still reachable.

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 ac6473e into main Sep 30, 2026
18 checks passed
@scttfrdmn
scttfrdmn deleted the fix/756-efs-wire-projection branch September 30, 2026 20:56
scttfrdmn added a commit that referenced this pull request Sep 30, 2026
API Gateway v1 (#529), API Gateway v2, DynamoDB (#1013) and AppSync (#1121) each
render every persisted record they answer through a wire struct. None of them had
a line in scripts/wire-bookkeeping-projected.txt, so 34 declared fields across 17
records were still counted as reachable. Verified site by site rather than by the
presence of a *_wire.go: every response helper call in all four plugins goes
through a projection, and the two API Gateway v1 sites that do not — PutMethodResponse
and PutIntegrationResponse — echo the caller's own request body and answer no record.

The reachability inventory on #756 lists appsync as leaking accountId and region.
It predates #1121 and is stale.

Two assertions had to be written before the records could be cited, because an
,omitempty member is absent from a body whenever its value is the zero one:

- DynamoDBTable.EverTagged. #1013's subset assertion covers all four description
  sites but never has the flag set, because CreateTable with a Tags list does not
  set it — taggingEverTagged is reached from TagResource and UntagResource alone.
- RestAPIState.EverTagged, the same shape.

That is the vacuous assertion #1304 shipped on EFS before it was caught. Both new
tests set the flag, anchor on a response proving it is set, and were checked against
a deliberately reintroduced leak on every site they cover.

The API Gateway one seeds the flag through state rather than through TagResources,
because TagResources cannot currently find an API a caller created: the resolver
builds the state key from the ARN's account field, and a REST API ARN's account
segment is empty by specification. That is #1307, and the test says so.

DynamoDBStreamCursor.AccountID and .Region are named in the script header as a
third leak-impossible kind. They are marshalled into a response and still cannot
leak: the JSON is base64-encoded into the opaque ShardIterator string, which is
what a real shard iterator is too.

319 declared, 47 projected across 21 records, 272 still reachable.

Refs #756
Refs #1307
scttfrdmn added a commit that referenced this pull request Oct 1, 2026
All six Glue records were answered to the caller as stored, so each of the
twelve operations that reports a database, table, connection, crawler, job or
job run carried AccountID and Region unconditionally and ever_tagged once the
resource had been tagged. API_Database, API_Table, API_Connection, API_Crawler,
API_Job and API_JobRun publish none of the three.

emulator/glue_wire.go projects each record onto its published shape, on the
pattern ecr_wire.go established (#1090). Twenty-one baseline lines discharged:
260 still reachable to 239.

Glue is where the leak is worst, because it is not merely an extra member.
Substrate stores one creation timestamp field on every record, and Glue
publishes that timestamp under four different names — CreateTime on
API_Database and API_Table, CreationTime on API_Connection and API_Crawler,
CreatedOn on API_Job — so on five records out of six the stored name was a
near-miss of a real member, and a caller reading CreateTime found nothing while
the value sat beside it. Only API_JobRun's StartedOn/CompletedOn were already
spelled right.

The same five rendered as RFC3339 strings where Glue's JSON protocol publishes
an epoch-seconds number; API_GetDatabase's Response Syntax is literally
"CreateTime": number. That closes Glue's instance of #1305, which still stands
for ACM, Redshift Data and Firehose. Every member is Required: No and is a
*EpochSeconds rather than a bare one, since `,omitempty` is inert on a struct
type and a zero EpochSeconds marshals as null.

Deciding a response's membership surfaced two members AWS publishes on no Glue
shape at all: Arn, on five of the six records, and Tags, on four. Glue's tag
surface is GetTags/TagResource/UntagResource, and an ARN is built from the
account, the Region and the name, which is what the real API requires of a
consumer. Where the leaked account legitimately goes is CatalogId, which
API_Database and API_Table publish and the other four shapes do not — the move
#1304 made for EFS's OwnerId.

The twenty-one fields stay on the records: a projection changes the response and
leaves the state a replay reads back alone. A new test reads all six records out
of state to pin that, since scanGlueDatabases reads Arn, Tags and EverTagged
across the service boundary. No per-site exclusion is needed in
check-wire-bookkeeping.sh — every projected timestamp is renamed to its
published name, so no wire field collides with the five names the awk matches.

docs/services.md also corrects the GetJobRun row, which claimed a transition to
SUCCEEDED after describe. StartJobRun stores the run SUCCEEDED with both
timestamps set, and getJobRun mutates nothing, so a wait loop passes on its
first observation.

Refs #756
scttfrdmn added a commit that referenced this pull request Oct 2, 2026
* test(#756): pin the Step Functions projections and record them

`StateMachineState`, `ExecutionState` and `ActivityState` declare `AccountID` and
`Region` under wire-visible `json` tags, and the two taggable ones also declare
`EverTagged` as `ever_tagged` — eight of the wire-bookkeeping inventory's lines.
None of the eight can reach a body. All eighteen routed operations answer through
`statesJSONResponse` with a hand-built map, one of the two named projections
`smToMap` and `execToMap`, or a list entry struct declared inside its own handler;
`listTagsForResource` decodes the stored record into a one-member struct and
answers only its tags; and every `json.Marshal` of a record in the plugin is in a
`save*` helper writing to state. So the projection already existed in code and
what was missing was the citation the projected inventory requires.

`emulator/stepfunctions_wire_test.go` holds one test per record, each driving
every operation that answers it and walking the decoded document for a member
named for any of the three at any depth. The comparison is case-insensitive: the
records spell their tags with the Go identifier while every published member of
every shape here is lowerCamelCase, so nothing in a correct body folds to any of
them. It is on the member *name* because the account and the Region appear
legitimately in every body as segments of a `states` ARN.

`ever_tagged` is the part that needed care. It carries `,omitempty` and is set by
`TagResource` alone — never by create-with-tags (#938) — so the state-machine and
activity tests tag the resource and require the flag on the stored record before
requiring its absence from a response. Without that step the absence would hold of
a record that never carried the member, which is the vacuous form #1304 shipped on
EFS. A control confirms it: removing the stamp fails both tests at the record
anchor rather than at an assertion on a body.

Deliberately not the stronger form `emulator/rds_wire_test.go` uses, which
requires a record's members to be exactly the published ones. `smToMap` answers
seven of `DescribeStateMachine`'s fourteen published members and `describeActivity`
three of five; an expectation keyed on that would have to be rewritten by the PR
that closes the gap, and the absence walk is indifferent to it. That is also the
form Config, Glue, EFS and Redshift already use.

Six of the eighteen carry nothing a projection could leak — `UpdateStateMachine`
answers only `updateDate`, `StopExecution` only `stopDate`, and the two deletes
and the two tag writes an empty object — and are driven anyway, so the set reads
as complete rather than as a sample. A control injecting a leak at each of the
twenty-one assertion sites confirms every subtest fails at its own site and at no
other, so none of them is decoration.

`make wire-bookkeeping-check` moves to 159 projected across 62 records, 160 still
reachable of the same 319 declared.

* test(#756): correct DescribeActivity's published member count to four

API_DescribeActivity publishes activityArn, creationDate, encryptionConfiguration
and name — four members, not the five the first reading recorded. The claim is
load-bearing twice over: it is the stated reason this file asserts absence rather
than exact membership, and it is the count the follow-up issue on the member gap
will cite.
scttfrdmn added a commit that referenced this pull request Oct 2, 2026
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 added a commit that referenced this pull request Oct 2, 2026
Three records — CodeDeployApp, CodeDeployGroup and CodeDeployDeployment — each
declare AccountID and Region under wire-visible json tags, six of the inventory's
lines. #1327 projected all three through emulator/codedeploy_wire.go; this records
that the projection holds, which is what scripts/wire-bookkeeping-projected.txt
asks for before it will discharge a line.

emulator/codedeploy_wire_test.go holds one test per record, together driving all
nine routed operations and walking each decoded document for a member named for
either at any depth, reporting the $.a.b[0].c path. Absence rather than exact
membership, because GetApplication answers 4 of 6 published members,
GetDeploymentGroup 4 of 23 and GetDeployment 6 of 31 (#1199), so an exact
expectation would pin that gap and have to be rewritten by the PR closing it.

The comparison folds case, so one entry covers both the record's spelling and the
AccountID a projection in the house style of the other services might introduce,
and it is an equality rather than a substring test, so the account inside a
serviceRoleArn value is not a collision. Each case asserts a published member is
present before asserting a bookkeeping one is absent, and the stored record is read
back as raw JSON, so neither half can pass vacuously. Neither member carries
,omitempty on any of the three records and CodeDeploy routes none of the three tag
operations, so no record declares EverTagged and #1304's trap does not arise.

check-wire-bookkeeping goes from 165 projected across 65 records to 171 across 68,
and from 154 still reachable to 148, of the same 319 declared.

#756 stays open: EC2's 30 lines and a long tail remain in AC3.
scttfrdmn added a commit that referenced this pull request Oct 2, 2026
EC2Instance, EC2KeyPair, EC2LaunchTemplate and EC2PlacementGroup are the last
four EC2 records, ten of the inventory's lines. Four tests extend
emulator/ec2_wire_test.go and drive twenty-four routed operations, CreateFleet
among them since a fleet's instances are EC2Instance records too.

Two of the four carry a third bookkeeping member under omitempty, and each is
read back from the record before any absence is asserted. EverTagged is set only
by a tag write (#938), so the instance test calls CreateTags first; a control
without it fails at the read-back rather than passing vacuously, which is the
trap #1304 fell into on EFS. CreatedAt is written on both key-pair create paths
and DescribeKeyPairs is anchored on the published createTime it feeds.

check-wire-bookkeeping goes from 191 projected across 78 records to 201 across
82, and from 128 still reachable to 118, of the same 319 declared. All thirty of
EC2's baseline lines are now cited.

#756 stays open: 118 lines remain in AC3's tail.
scttfrdmn added a commit that referenced this pull request Oct 2, 2026
…d inventory (#1337)

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.
scttfrdmn added a commit that referenced this pull request Oct 3, 2026
…ord them (#1359)

LambdaFunction and SQSQueue declare only ever_tagged, and Route53HostedZone only
its AccountID; none reaches a response. Lambda and SQS answer configurations and
maps built member by member, and Route 53 answers XML structs declared per
operation. Three new tests walk every operation that answers the record. The
Lambda and SQS tests tag first and read the flag back, since an unset omitempty
member is absent for free (#1304). Lambda's TagResource answers 204 with no body,
so it has nothing to walk.

wireRecordByPrefix joins emulator/wire_members_test.go for SQS, which keys a
queue by its URL. check-wire-bookkeeping goes from 281 projected across 118
records to 284 across 121, and from 29 still reachable to 26.

#756 stays open.
scttfrdmn added a commit that referenced this pull request Oct 3, 2026
…cords' bookkeeping and record them (#1361)

EC2CapacityReservation and EC2Fleet declare an account and a Region, and
CloudFrontDistribution its AccountID and ever_tagged. None reaches a response:
each is rendered through XML structs declared per operation. Two tests join
emulator/ec2_wire_test.go. The new emulator/cloudfront_wire_test.go tags the
distribution first and reads the flag back, since an unset omitempty member is
absent for free (#1304).

Writing the CloudFront test found that CreateInvalidation answers an
Invalidation without its required InvalidationBatch. That is filed as #1360, and
the test anchors on what does render.

check-wire-bookkeeping goes from 284 projected across 121 records to 290 across
124, and from 26 still reachable to 20.

#756 stays open.
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