feat: order lifecycle comply scenarios and tests#382
Merged
Conversation
Sync schemas for cancellation, revision tracking, valid_actions, and history on media buys. Add 6 new error codes and CanceledBy enum. Update governance middleware for upstream changes (governance_context now opaque string, buyer_campaign_ref removed from requests). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Regenerate types, keep governanceContext optional for backward compat. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Enrich response_preview with confirmed_at, revision, valid_actions - Add include_history to get_media_buys status check - Add revision concurrency test (stale revision -> CONFLICT) - Add comply observations for confirmed_at, revision, history support - Deduplicate observations to fire once per compliance run - Add Zod schema tests for lifecycle fields (canceled_by, history, etc.) - Add response validation tests for lifecycle and cancellation fields - Fix: use ?? instead of || for numeric revision extraction Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… preview Empty valid_actions array is semantically meaningful for terminal states. Using || would discard it and fall through to nested value. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Scenarios: - Add budget mutation step (update_budget with 20% increase, handle BUDGET_EXCEEDED) - Track revision numbers across steps for monotonicity validation - Use actual stale revision from earlier step instead of sentinel -1 - Add revision monotonicity check (revisions must increase across operations) - Test completed terminal state (not just canceled) in testTerminalStateEnforcement - Fall back to completed media buy test when NOT_CANCELLABLE - Enrich cancel response with canceled_by and canceled_at fields Observations: - Promote valid_actions to severity: warning (buyer agents need this) - Promote confirmed_at to severity: warning (order confirmation audit trail) - Add creative_deadline observation (buyers need material deadlines) - Add canceled_by validation (well-formed cancellation objects) - Validate history entry shape (timestamp + action required) - Add sandbox/dry_run confirmation observation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Adds compliance testing and schema validation for the order lifecycle management features from adcp#1611.
confirmed_at,revision,valid_actions,canceled_*,history,creative_deadline,include_history)INVALID_STATE,NOT_CANCELLABLE,MEDIA_BUY_NOT_FOUND,PACKAGE_NOT_FOUND,VALIDATION_ERROR,BUDGET_EXCEEDED)CanceledByenum: newbuyer | sellertype exportedinclude_historyin get_media_buysconfirmed_at,revision, or history entriescanceled_by,canceled_at,cancellation_reason,revision,valid_actions,history,creative_deadline)||->??for numericrevisionextraction (falsy-unsafe for value0)Test plan
🤖 Generated with Claude Code