feat(iac): ActionStatus compensation enums + mapping fix (#698 Phase 2.3)#700
Merged
Conversation
…_FAILED + SKIPPED (#698 Phase 2.3)
…pPBActionStatusToInterface (#698 Phase 2.3)
…spatch/post-hook (#698 Phase 2.3) Replaces single mapDispatchErrToStatus with 3 phase-specific helpers (statusForPreDispatchSkip / statusForDispatchError / statusForPostHookFailure). Each error-setter site now assigns iterStatus directly based on the phase that raised iterErr, eliminating the late-mapping conflation where the deferred closure couldn't distinguish phases. 6 call sites updated: - ctx-cancel → SKIPPED - JIT-substitution-fail → SKIPPED - driver-resolve-fail → SKIPPED - dispatch hookDispatchError → CompensationFailed - dispatch generic error → Error / DeleteFailed (unchanged) - post-delete-hook → CompensationFailed - post-apply-hook → CompensationFailed Resolves Phase 2 + 2.5 deferred Copilot/code-reviewer findings about apply.go:235 (ctx-cancel), apply.go:354 (JIT-fail-on-delete), apply.go:313 + 316 (post-hook conflation). Pre-existing TestApplyPlanWithHooks_PopulatesActions_PreDispatchDriverError updated: driver-resolve now expects SKIPPED (was Error) — locks in the Phase 2.3 corrected mapping. Added TestStatusHelpers_Phase23 pinning all 3 helper return values (including statusForDispatchError(create/update/delete) branches). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Phase 2.3 ActionStatus values to the IaC proto/Go interface boundary and refines engine-side status assignment so wfctl can distinguish pre-dispatch skips, dispatch failures, and post-hook failures.
Changes:
- Extended
ActionStatuswithCOMPENSATED=4,COMPENSATION_FAILED=5, andSKIPPED=6(proto + regenerated Go). - Updated Go
interfaces.ActionStatusconstants/docs and added a lockstep-values test. - Refactored engine apply status mapping into phase-specific helpers and fixed call sites to assign the correct status at each error site; updated/added tests accordingly.
- Extended wfctl proto→interface status mapping and test coverage for the new enum values.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| plugin/external/proto/iac.proto | Defines the new Phase 2.3 ActionStatus enum values and documents their intended semantics. |
| plugin/external/proto/iac.pb.go | Regenerated protobuf output reflecting the new enum values. |
| interfaces/iac_state.go | Adds the new ActionStatus constants (0–6 lockstep) and updates consumer-facing guidance. |
| interfaces/iac_state_phase23_test.go | Verifies Go ActionStatus iota values match proto tag numbers (0–6). |
| iac/wfctlhelpers/apply.go | Replaces late-mapping with explicit per-site status assignment (pre-dispatch SKIPPED, dispatch Error/DeleteFailed, post-hook CompensationFailed). |
| iac/wfctlhelpers/apply_hooks_test.go | Updates expectations for pre-dispatch driver resolve failures and pins the new helper mappings. |
| cmd/wfctl/iac_typed_adapter.go | Maps new proto ActionStatus values to interfaces.ActionStatus (fail-closed remains). |
| cmd/wfctl/iac_typed_adapter_test.go | Extends actionable-value test cases to include the new Phase 2.3 statuses. |
Files not reviewed (1)
- plugin/external/proto/iac.pb.go: Language not supported
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
⏱ Benchmark Results✅ No significant performance regressions detected. benchstat comparison (baseline → PR)
|
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.
Summary
Phase 2.3 of workflow#640 series. Defines the 3 ActionStatus enum values Phase 2 reserved (tags 4+5) + Phase 2.5 deferred (tag 6 SKIPPED). Refactors engine apply.go mapping from single mapDispatchErrToStatus to 3 phase-specific helpers + fixes 6 call sites that were misclassifying pre-dispatch failures as Error/DeleteFailed and post-hook failures as Error/DeleteFailed.
Resolves Phase 2 + 2.5 deferred Copilot/code-reviewer findings about apply.go:235 (ctx-cancel), apply.go:354 (JIT-fail-on-delete), apply.go:313 + 316 (post-hook conflation).
Changes (4 commits)
feat(proto)— extend ActionStatus enum with COMPENSATED=4 + COMPENSATION_FAILED=5 + SKIPPED=6; regen iac.pb.go (iac_grpc.pb.go no-op).feat(interfaces)— extend ActionStatus Go iota constants matching proto tag numbers + godoc update with Phase 2.3 consumer-update note.feat(wfctl)— extend mapPBActionStatusToInterface switch (fail-closed default unchanged).feat(engine)— refactor mapDispatchErrToStatus into 3 phase-specific helpers; update 6 call sites to assign iterStatus directly at each error site.ADR alignment
Test plan
GOWORK=off go build ./...)GOWORK=off go test ./... -race -count=1)Cascade context
Workflow-only — NO plugin cascade required. Plugins continue emitting Success/Error/DeleteFailed (engine populates new statuses server-side from misclassified paths). Plugins may opt to emit COMPENSATED in v_next if they implement own compensation.
After merge → tag v0.56.0 → memory update + #698 close.
Rollback
Revert PR. ActionStatus enum loses 3 new values; mapPBActionStatusToInterface switch loses 3 cases; engine mapping reverts to mapDispatchErrToStatus single-function. Cut v0.56.1 reverting whichever commit broke. Per ADR 0024 matched-pair rollback. No downstream consumer recompile required.
Plan: `docs/plans/2026-05-17-phase2.3-compensation-enums.md` (LOCKED sha256 2753ca0e2a14)
Design: `docs/plans/2026-05-17-phase2.3-compensation-enums-design.md`
🤖 Generated with Claude Code