Repository navigation
Description
Summary
DescribeStackEvents returns UnsupportedOperation (HTTP 400). The CloudFormation
wire plugin registered in v0.87.0 (#483) implements 15 operations and deliberately
scopes this one out, because there is no event model behind it to report from.
This issue records what a real model would need, so the refusal is a stated boundary
rather than an omission.
Why it was scoped out rather than answered
CFNStackState (emulator/betty_cfn.go) carries a single Status string, and
StackDeployer.Deploy sets it to "CREATE_COMPLETE" after every resource has been
deployed. UpdateStack overwrites it with "UPDATE_COMPLETE". Nothing records:
- when each individual resource started or finished deploying,
- the
CREATE_IN_PROGRESS→CREATE_COMPLETEtransition per resource, - a
ResourceStatusReasonfor a resource that failed, - the stack-level
CREATE_IN_PROGRESSevent that precedes the resources', - an event ID, or any ordering among events.
Answering DescribeStackEvents from what exists would mean synthesizing a plausible
two-events-per-resource sequence with invented timestamps and invented event IDs.
That is inventing observations, which is the opposite of the provenance discipline in
CLAUDE.md and docs/fidelity.md: a consumer asserting on an event they read out of
substrate would be asserting on something substrate made up. UnsupportedOperation
is at least a signal they can see. (It is substrate's own code, not a documented
CloudFormation one — real CloudFormation has no error for an operation it implements.)
What a real model needs
- A per-resource event record written as each resource deploys, carrying
EventId,StackId,StackName,LogicalResourceId,PhysicalResourceId,
ResourceType,Timestamp,ResourceStatus,ResourceStatusReasonand
ResourceProperties. Timestamps come from theTimeController, so they are
deterministic and replay identically. - Stack-level bracket events —
CREATE_IN_PROGRESSon the stack before the
first resource andCREATE_COMPLETEafter the last — which is what the CLI's
waitand most consumer polling loops key off. - A decision about the in-progress window.
CreateStackdeploys synchronously
and returns already complete, so a truthful event log has every event at the same
simulated instant unless the deployer advances the clock between resources.
Whether it should is a design question: advancing makes the log look like real
CloudFormation's, but it also means a stack deployment moves the shared clock,
which every other plugin observes. - Reverse-chronological ordering and
NextTokenpagination, which the operation
documents. - Failure events.
DeployedResource.Erroralready records a per-resource
failure, so aCREATE_FAILEDevent with the error as its
ResourceStatusReasonis the one part that has a real source today. - Retention. Real CloudFormation keeps events for 90 days; substrate would keep
them for the life of the stack record, and deleting a stack currently deletes its
state entirely.
Alternative worth considering
Substrate already records every API call in the event store. A stack deployment is a
sequence of dispatched requests through the registry, each of which is an event with
a real timestamp. DescribeStackEvents could be derived from the event log
filtered to the deployment's stream rather than from a second parallel record — which
would make the events genuinely observed rather than modelled, and would fit the
event-sourced design better than a hand-maintained event list.
That is the more interesting design and the reason this is filed as its own issue
rather than as a small follow-up.
Acceptance criteria
- A decision recorded on whether events are derived from the event store or
recorded separately. -
DescribeStackEventsreturns events for a created stack, newest first. - A resource that fails to deploy produces a
CREATE_FAILEDevent carrying its
error asResourceStatusReason. -
UpdateStackandDeleteStackproduce their own events. -
NextTokenpagination works. - Timestamps come from the
TimeControllerand a replayed run produces
byte-identical events. - The
DescribeStackEventsrefusal test in
emulator/cloudformation_plugin_test.gois replaced knowingly, and
docs/services.md's "DescribeStackEvents is not supported" section is removed.
Activity
feat(cloudformation): serve the stack operations over the wire (#483) (…
scttfrdmn commentedon Aug 3, 2026
Left unmilestoned deliberately while the rest of the CloudFormation cluster was swept into v0.88.0 (#521, #522, #526, #527) and v0.89.0 (#508, #518, #520). Recording that as a decision rather than an oversight.
Why it is not in either release. Point 3 of this issue's own "what a real model needs" is an unanswered design question, not implementation work:
CreateStackdeploys synchronously and returns already complete, so a truthful event log has every event at the same simulated instant unless the deployer advances the clock between resources — and if it does, a stack deployment moves the shared clock that every other plugin observes. That question is not CloudFormation's alone. #514 asks for the same thing from the other end (EC2 instance transitions are instantaneous, sopending/stopping/shutting-downare never observable), and both want the same answer: how does substrate make a multi-step operation's intermediate states observable on a deterministic clock without a completed operation having silently advanced time for everyone. Answering it once, in a release where it is the subject, gives both issues the same semantics. Answering it inside this issue makes CloudFormation's stack events the precedent for every other plugin's transitions by accident.There is also a sequencing reason. Point 6 says substrate would keep events for the life of the stack record and that deleting a stack currently deletes its state entirely — and #518 (v0.89.0) changes what stack deletion does. An event model built before the delete path exists gets its retention question answered twice.
What has not changed. The refusal is still
UnsupportedOperationand still a stated boundary. The alternative in the issue — deriving events from the event store, which already records every dispatched request with a realTimeControllertimestamp — remains the more promising route precisely because it invents nothing, and v0.87.1's #519 work strengthened it:dispatchnow derives a per-resource failure from either plugin error convention and records the plugin's own error code, so a derivedCREATE_FAILEDevent would carry a realResourceStatusReason(InvalidBucketName: The specified bucket is not valid.) rather than a bare status. Point 5's "the one part that has a real source today" now has a better source than when this was filed.It will be milestoned once the clock-visibility question has an answer, and #514 is the natural place to settle it.
scttfrdmn commentedon Aug 3, 2026
One update, since v0.89.0's plan settles a question this issue was waiting on.
v0.89.0 (#518) makes stack-record retention explicit: a fully successful
DeleteStackremoves thestack:<name>record and its name index, while a sweep thatfails any resource delete persists
DELETE_FAILEDand keeps the record — a stackthat reports
DELETE_FAILEDand then vanishes fromDescribeStacksis a worse lie thanthe resource leak it was reporting. So "is there still a stack to hang events off after a
delete?" now has an answer: yes for a failed delete, no for a successful one, and an
event model needs to store events under a key that outlives the stack record if
DescribeStackEventsis to answer for a completed deletion at all.That leaves the clock-visibility question shared with #514 as this issue's only
remaining blocker: whether
CREATE_IN_PROGRESS/DELETE_IN_PROGRESSare ever observablein substrate, or whether every transition is instantaneous and the event log therefore
records only terminal states. #514 is
status: needs-designon the same question for EC2instance states, and answering it once for both is better than twice differently.
Still unmilestoned, deliberately.
scttfrdmn commentedon Aug 5, 2026
#562 is now a second consumer for this issue, so its priority is no longer only its own.
#562 (stack service role, scheduled for v0.92.0) has an acceptance criterion requiring "a
StackEventwhoseResourceStatusReasonnames the authorization failure". That cannot be met whileDescribeStackEventsis refused, so v0.92.0 will ship the same observation throughDescribeStackResources' existingResourceStatusReason(emulator/cloudformation_plugin.go:555-568, which already derivesCREATE_FAILED+ reason fromDeployedResource.Error) and leave #562's event criterion open against this issue.Worth recording for whoever takes this: the authorization-denial case will already be a real, observed per-resource failure with an error code lifted from the dispatched response (
cfnDispatchError,emulator/cfn_deployer.go:3958), so it is another instance of item 5 in this issue's "what a real model needs" — a status and reason that have a genuine source rather than an invented one. It does not change the central design question here (derive events from the event store vs. keep a parallel record), which remains the reason this is filed separately.feat(cloudformation): authorize a stack's resource calls and model it…
docs: document testing IAM permissions and a stack's service role (#411…
scttfrdmn commentedon Aug 5, 2026
A second consumer for this. v0.92.0 shipped #562's CloudFormation service role and authorization of a stack's resource calls, and #562's remaining acceptance criterion — reporting a denied resource call as a
StackEvent— is blocked here. So this is no longer wanted only on its own merits; #562 cannot close without it, and it has moved to the v0.93.0 milestone for that reason.What v0.92.0 did instead, which bounds the gap: a refused resource call surfaces as
CREATE_FAILEDwithAccessDeniedException— naming the action and the resource ARN — as that resource'sResourceStatusReasoninDescribeStackResources. That is enough for a consumer to act on a refused deploy today, so this is not urgent for correctness; it is the difference between per-resource status and an ordered event history.Nothing in v0.92.0 pre-empts the design question here (derive from the event store vs. keep a parallel record), which is deliberate — building an event model to satisfy one checkbox would have decided this issue as a side effect. One new data point for it, though: the event log now records a stack's resource calls under their real operation names (#572) and includes the refused call as well as the ones that succeeded, so a derive-from-the-event-store approach has more to work with than it did when this was filed.
scttfrdmn commentedon Aug 9, 2026
The design decision this issue asks for
The first acceptance criterion is "a decision recorded on whether events are derived
from the event store or recorded separately". The answer is neither as filed: they
are derived at read time from the stack record. Two measurements ruled out the
event-store route this issue named as its preferred one.
A recorded
Eventcannot name a resource.EventStore.RecordRequest(
emulator/eventstore.go:310-319) builds an event from the request context and theoperation, and never copies
reqCtx.Metadataonto it. So the log knowss3:CreateBucket at Tbut not which logical resource that was — andLogicalResourceIdis what every usefulStackEventcarries. Deriving from the logwould mean guessing which recorded call belonged to which resource, which invents more
than reading the record does.
The event store is disabled for in-process callers.
RecordEventreturns earlywhen
!config.Enabled(eventstore.go:257), and the CFN plugin substitutesNewEventStore(EventStoreConfig{Enabled: false})when no store is passed(
cloudformation_plugin.go:114-117). Anemulator.Clienttest would therefore haveseen an empty list for a stack that plainly deployed.
TestCFNEvents_DerivesWithoutAnEventStoreis the regression guard on this: a plugininitialized with no event store still reports events.
The stack record carries the logical ID, physical ID, type and error for each resource,
so it can answer without guessing.
cfnResourceStatusis now shared withDescribeStackResources, so the two views cannot disagree about whether a resourcefailed.
The clock question was already settled in-repo
This issue (and #514) held that "does a deploy advance the shared clock" was open, and
waited on it. It is settled, and settled against the assumption it was filed under:
TimeController.Now()issimBaseline + (wall_now − wall_baseline) × scale, sosimulated time advances with real wall time.
emulator/sqs_control.go:20-27alreadydraws the conclusion explicitly — a duration-based window "would make 'still missing'
assertions wall-clock dependent — which no test here may be" — and uses counted
observations instead.
So no new clock semantics were needed, only application of that existing conclusion:
resource events are terminal only, all events in a deploy share the record's
instant, and ordering is carried by position (reverse deployment order) rather than by
manufactured timestamps. #514 is therefore not a blocker for this issue and stands
on its own EC2 merits.
What shipped
DescribeStackEventsanswers 200 for every stack, newest first, paginated at 100with a
NextToken. The operation has noMaxResultsparameter — the CLI's--max-itemsis client-side — so a token loop is the only way to page.CREATE_IN_PROGRESS/UPDATE_IN_PROGRESS/
DELETE_IN_PROGRESSand the terminal status); each resource gets its one terminalevent. No per-resource
CREATE_IN_PROGRESSis emitted, because substrate neverobserved one.
EventIdis deterministic:{LogicalId}-{ResourceStatus}-{Timestamp}for a resource,which is the form AWS's own sample response returns, and a UUID derived from the stack
ARN, status and timestamp for a stack event. A replayed stack reports byte-identical
events.
DescribeStackEventson itreports
ValidationError, matchingDescribeStacks(point 6 of this issue). A stackwhose delete failed remains, and its events name the resource holding it.
docs/services.md"DescribeStackEvents is not supported" section is deleted andreplaced with what the model is, per this issue's own criterion.
Mutation testing ran 12 mutants over the derivation: 11 caught. The one survivor was a
genuine defect rather than a test gap — a
sort.SliceStableby timestamp that couldnever reorder anything, since the list is already non-decreasing in time when built. It
was removed rather than covered by a test for an unreachable branch.
fix(authz): report the denial code the service's wire protocol uses (#…