Skip to content

test(#756): pin the Step Functions projections and record them - #1322

Merged
scttfrdmn merged 2 commits into
mainfrom
test/756-stepfunctions-wire-projection
Oct 2, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
test/756-stepfunctions-wire-projection

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

What

Discharges the Step Functions block of #756's AC3: StateMachineState, ExecutionState and
ActivityState are recorded in scripts/wire-bookkeeping-projected.txt, citing one test each.

make wire-bookkeeping-check moves to 159 projected across 62 records, 160 still reachable of
the same 319 declared (from 151/59/168).

Why these eight lines are discharged by a citation rather than by a fix

All eighteen routed operations answer through statesJSONResponse with a hand-built
map[string]interface{}, one of the two named projections smToMap/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. Every json.Marshal of a record in the plugin is in a
save* helper writing to state.Put. The projection already existed in code — what was missing was
the citation the projected inventory requires before it will accept a record.

Deletion is not available: all three records are keyed by account and Region, and json:"-" or
retyping in place changes the format of every recorded run, because MemoryStateManager snapshots
those bytes and a replay reads them back (emulator/ecr_wire.go is the worked statement).

ever_tagged — the part that needed care

EverTagged carries ,omitempty and is set by TagResource alone, never by create-with-tags
(#938). An absence assertion against a never-tagged record would pass on a response that could not
have carried the member — the vacuous form #1304 shipped on EFS. 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
.

Why absence rather than exact membership

emulator/rds_wire_test.go's form — require a record's members to be exactly the published ones —
is not taken here. smToMap answers 7 of DescribeStateMachine's 14 published members and
describeActivity 3 of 5; an expectation keyed on that would have to be rewritten by the PR that
closes the gap. The absence walk is indifferent to it, and is 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. They are driven anyway, so the set reads as complete rather than as a sample.

Verification

  • make test (race, -count=1) and make lint clean; 21 subtests across the three tests.
  • make docs-reference-check docs-versions version-check discarded-unmarshal-check wire-bookkeeping-check operation-catalog-check operation-docs-check — only the ratchet line moved.
  • Negative controls. A leak injected at each of the twenty-one assertion sites — smToMap,
    execToMap, both create arms of each taggable record, the three list entry structs,
    StartSyncExecution's own map, GetExecutionHistory, UpdateStateMachine, StopExecution, both
    deletes, both tag writes and ListTagsForResource — fails exactly the subtest that drives that
    site, naming the $.a.b[0].c path, and no other. Removing taggingStampRecordEverTagged fails
    both taggable tests at the record anchor.
  • Control on the check script. Misspelling a cited test name is refused with "The citation is the
    only thing holding the projection", so the third column is load-bearing.

Scope

#756 stays open — AC3 continues with ec2_types.go's 30 lines, codedeploy_types.go and
backup_types.go at 6 each, and the long tail below. Two findings read out of this plugin are filed
separately rather than folded in: HistoryEvent.timestamp renders RFC3339 where the JSON protocol
publishes epoch seconds while every other date in the plugin goes through sfnEpoch, and
DescribeStateMachine/DescribeActivity ship a fraction of their published members.

Refs #756

`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.
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

Copy link
Copy Markdown
Owner Author

3eda3e9 corrects one count in this PR's prose. API_DescribeActivity publishes four response
members — activityArn, creationDate, encryptionConfiguration, name — not the five the first
reading recorded. The count is load-bearing twice: it is the stated reason
emulator/stepfunctions_wire_test.go asserts absence rather than exact membership, and it is the
figure the follow-up issue cites. DescribeStateMachine's fourteen is confirmed as published.

The two findings this block turned up are filed rather than fixed here, following #1319 → #1320:

Neither needs a change to the test this PR adds — it asserts member names, which is why the
absence form was chosen over exact membership.

@scttfrdmn
scttfrdmn merged commit 0fa82b5 into main Oct 2, 2026
17 checks passed
@scttfrdmn
scttfrdmn deleted the test/756-stepfunctions-wire-projection branch October 2, 2026 00:02
@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