Skip to content

feat(ssm): seedable SendCommand/GetCommandInvocation outcomes (#345) - #354

Merged
scttfrdmn merged 2 commits into
mainfrom
feat/345-ssm-seedable-output
Jul 21, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
feat/345-ssm-seedable-output

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

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's Status / 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.
  • SendCommand resolves the seed at request time and bakes the outcome into the per-instance invocation records. Unseeded → nominal Success/empty (unchanged), so existing behavior is preserved.
  • GetCommandInvocation now also returns ResponseCode (exit code).

Verification

TestSSM_SeededCommandInvocation: seed a Failed/stderr/exit-4 outcome for a matching command → GetCommandInvocation returns it; a non-matching command falls back to Success. make test (race) + make lint clean.

Closes #345

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

codecov Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.42105% with 24 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
emulator/ssm_control.go 62.71% 14 Missing and 8 partials ⚠️
emulator/ssm_plugin.go 86.66% 1 Missing and 1 partial ⚠️

📢 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.
@scttfrdmn
scttfrdmn merged commit c9833ac into main Jul 21, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the feat/345-ssm-seedable-output branch July 21, 2026 01:32
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.

SSM: SendCommand should (optionally) execute the shell command, not always return empty Success

1 participant