Repository navigation
feat(ssm): seedable SendCommand/GetCommandInvocation outcomes (#345) - #354
Merged
Merged
Conversation
Substrate does not execute the shell command (workload-internal, out of scope); instead a test can seed the observable result GetCommandInvocation returns — Status, stdout, stderr, ResponseCode — rather than always getting Success/empty. - New control-plane endpoints POST/DELETE /v1/ssm/command-invocation, keyed by document name (default '*') with an optional command-parameter substring match (paramMatch), following the Athena/SageMaker/Bedrock seed pattern. - SendCommand resolves the seed at request time and bakes the outcome into the per-instance invocation records; unseeded → nominal Success/empty (unchanged). - Added ResponseCode to SSMCommandInvocation and the GetCommandInvocation response. This keeps the API-surface-scope boundary: input command captured as recorded intent, outcome deterministic and seedable — no real execution. Regression test TestSSM_SeededCommandInvocation. make test (race) + lint clean. Closes #345
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Add TestSSM_SeedCommandInvocation_WildcardAndClear covering the '*' wildcard seed, targeted + clear-all DELETE, and seed validation — raising patch coverage on the new control-plane handlers.
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #345 within substrate's scope boundary — models the observable Run Command result, without executing the command.
Scope note
#345's title says "execute the shell command." Substrate deliberately does not run workloads (executing user commands is workload-internal, non-deterministic, and would break replay — the container/data-plane tier we don't do). Instead this models what a caller observes via the API:
GetCommandInvocation'sStatus/ stdout / stderr /ResponseCode. That's what a consumer's poll loop reads, and it stays fully deterministic.What's added
POST/DELETE /v1/ssm/command-invocation— seed the outcome for commands matching a document name (default*wildcard) with an optional command-parameter substring (paramMatch), e.g.{"documentName":"AWS-RunShellScript","paramMatch":"systemctl status spored","status":"Failed","stderr":"...","exitCode":4}. Mirrors the Athena/SageMaker/Bedrock seed pattern.SendCommandresolves the seed at request time and bakes the outcome into the per-instance invocation records. Unseeded → nominalSuccess/empty (unchanged), so existing behavior is preserved.GetCommandInvocationnow also returnsResponseCode(exit code).Verification
TestSSM_SeededCommandInvocation: seed aFailed/stderr/exit-4 outcome for a matching command →GetCommandInvocationreturns it; a non-matching command falls back toSuccess.make test(race) +make lintclean.Closes #345