Phased Store Deployment and Checkout Safety Rollback Engine
Develop a Python deployment controller that manages staged store releases and triggers progressive halts if transaction metrics drop.
Use this prompt when managing phased app rollouts across consumer retail user bases during major sales events. It produces an automated release controller script that steps through rollout stages and aborts staged rollouts upon elevated checkout failure rates.
Role: Staff Mobile DevOps Engineer for Omni-Channel Consumer Retail.
Context
- Store package identifier: {{app_package_name}}
- Defined rollout percentages: {{staged_rollout_tiers}}
- Retail commerce health metric endpoint: {{health_check_endpoint}}
- Maximum acceptable transaction error percentage: {{error_budget_percentage}}
- API auth token environment variable: {{api_token_variable}}
- Alert notification channel: {{notification_channel}}
Task
Author a Python 3 CLI release orchestration script that manages staged rollout progressions for {{app_package_name}} according to {{staged_rollout_tiers}}, queries {{health_check_endpoint}} between progression intervals, and automatically pauses or rolls back release tracks if error rates exceed {{error_budget_percentage}}.
Method
- Define staged rollout tier state transitions based on the input list from {{staged_rollout_tiers}}.
- Authenticate against app store release tracks using tokens stored in {{api_token_variable}}.
- Query current phased release status for {{app_package_name}} and confirm current active rollout percentage.
- Execute health evaluation polling against {{health_check_endpoint}} to calculate real-time commerce order failure rates.
- Evaluate error metrics against {{error_budget_percentage}} threshold over a configured observation window.
- Trigger automatic phased rollout advance to the next configured tier if health checks stay within budget.
- Execute emergency phased release halt or percentage freeze if health metrics breach {{error_budget_percentage}}.
- Send status notifications summarizing stage transitions or abort actions to {{notification_channel}}.
Constraints
- MUST use standard library modules where possible, with minimal dependencies (e.g.,
urlliborrequests). - MUST NOT proceed to the next rollout tier without at least one successful health poll cycle.
- Rollback and halt actions MUST execute immediately upon a single breached health evaluation cycle.
- All critical state changes MUST be logged with ISO 8601 timestamps and unambiguous exit codes.
Output format
- Architecture Overview and Flow Diagram (ASCII)
- Executable Controller Script (
phased_release_controller.py) - Configuration Schema & Health Check Endpoint Specification
- Rollback & Recovery Runbook CLI Commands
Self-review
- Does the script cleanly handle network timeouts when contacting {{health_check_endpoint}}?
- Are all rollout tiers from {{staged_rollout_tiers}} parsed and validated sequentially?
- Does the halt logic prevent accidental full release advancement when API tokens in {{api_token_variable}} expire?
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.