Skip to content

feat(disruption): executor invocation router — inject vs revert (ADR-031) [#1419] - #1643

Closed
susumutomita wants to merge 1 commit into
feat/1419-executor-schedule-revertfrom
feat/1419-executor-route
Closed

susumutomita wants to merge 1 commit into
feat/1419-executor-schedule-revertfrom
feat/1419-executor-route

Conversation

@susumutomita

Copy link
Copy Markdown
Owner

Summary

The last piece of executor logic: routeDisruptionInvocation distinguishes the two ways the single executor Lambda is invoked and dispatches each.

Stacked on #1642 → #1641 → #1640 → #1639. Base feat/1419-executor-schedule-revert.

  • EventBridge *DisruptionFired envelope → parseDisruptionFiredDetail → executeDisruptionAction (inject path).
  • aws-scheduler one-shot { mode:"revert", dispatch, target } → reuse the sendDispatch dep directly (the wired dep re-AssumeRoles from target, so inject-time credentials are never persisted; the pre-built revert dispatch just gets sent).
  • malformed envelope → invalid_event (the handler logs/metrics; no crash).

parseDisruptionFiredDetail narrows the EventBridge detail (all required strings present; parameters defaults to {} for absent/non-object). Pure module with DI — index.ts (the real-client + AssumeRole wiring) is the deploy step.

Test plan

  • 9 new tests (disruption-route.test.ts): parse (valid / default-params / missing-field), route (inject → execute, revert → sendDispatch only, malformed → invalid_event, revert-missing-fields → invalid_event).
  • tsc --noEmit, biome, make harness (no findings), check-no-conflicts: clean. Infra suite green.

Executor logic — now complete

With this PR the executor's entire logic is built + tested (≈39 tests), all pure / DI, no deploy:

module PR
dispatch builders #1640
orchestration (executeDisruptionAction) #1640
DDB store (claimExecution / resolveDeployment) #1640
sendDispatch (SSM/Lambda/CFn) #1641
scheduleRevert (aws-scheduler) #1642
invocation router this PR

Regression analysis

Net-new, zero production call sites (the index.ts real-deps wiring + CDK construct are the owner-reviewed deploy step). No Lambda/IAM/event/existing-file change. Pure functions over injected deps; the invalid_event / not-called branches are asserted.

Physical impact

NO-OP on CloudFormation / deployed artifacts. A TypeScript module + tests. Nothing invocable until index.ts + the construct land.

Remaining for #1419 (deploy boundary, owner)

  • index.ts — construct the real clients + assumeCompetitorRole (describe-stack pattern) + wire sendDispatch/scheduleRevert/store deps, export the Lambda handler over routeDisruptionInvocation.
  • CDK construct — Lambda + EventBridge rule (*DisruptionFired) + scoped sts:AssumeRole IAM + the scheduler execution role + env (table names, catalog, scheduler role ARN, self ARN).

These deploy real fault injection into competitor accounts on the AdministratorAccess role — your review/deploy decision.

Relates #1419

The last piece of executor *logic*: routeDisruptionInvocation distinguishes the
two ways the executor Lambda is invoked and dispatches each:
- EventBridge *DisruptionFired envelope → parse detail → executeDisruptionAction (inject)
- aws-scheduler one-shot { mode:"revert", dispatch, target } → reuse the sendDispatch
  dep directly (the wired dep re-AssumeRoles from target; inject-time creds aren't kept)
- malformed envelope → invalid_event (handler logs/metrics, no crash)

parseDisruptionFiredDetail narrows the EventBridge detail (required strings;
parameters defaults to {}). Pure module, DI — index.ts wires real clients +
AssumeRole (deploy step). 9 new tests (parse 3 + route 4 + ...); infra suite green.

With this, the executor's full logic is built and tested: builders, orchestration,
DDB store, sendDispatch, scheduleRevert, and routing — across #1640/#1641/#1642 and
this PR. Only the real-deps index.ts wiring + the CDK construct (Lambda + EventBridge
rule + scoped sts:AssumeRole + scheduler role IAM) remain — they deploy real fault
injection, owner review/deploy.

Relates #1419

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 09edaea3-5b31-4205-80c8-0b8ebd790610

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/1419-executor-route

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.39%. Comparing base (f1cb38b) to head (587763b).

Additional details and impacted files
@@                          Coverage Diff                           @@
##           feat/1419-executor-schedule-revert    #1643      +/-   ##
======================================================================
+ Coverage                               93.37%   93.39%   +0.01%     
======================================================================
  Files                                     396      397       +1     
  Lines                                   10844    10867      +23     
  Branches                                 3327     3335       +8     
======================================================================
+ Hits                                    10126    10149      +23     
  Misses                                    222      222              
  Partials                                  496      496              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@susumutomita

Copy link
Copy Markdown
Owner Author

Superseded by #1646 — the executor stack got tangled when #1640's base branch was deleted during merge; #1646 is the same code (+ #1644's shared auth) rebased clean onto main as one reviewable PR.

@susumutomita
susumutomita deleted the feat/1419-executor-route branch June 2, 2026 05:09
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