FISCFED9/CLI / .agents/skills/plugins/antigravity-awesome-skills-claude/skills/dbos-python
dbos-python
VerifiedGuide for building reliable, fault-tolerant Python applications with DBOS durable workflows. Use when adding DBOS to existing Python code, creating workflows and steps, or using queues for concurrency control.
references/advanced-patching.md
View on GitHub---
title: Use Patching for Safe Workflow Upgrades
impact: LOW
impactDescription: Deploy breaking changes without disrupting in-progress workflows
tags: patching, upgrade, versioning, migration
---
## Use Patching for Safe Workflow Upgrades
Use `DBOS.patch()` to safely deploy breaking workflow changes. Breaking changes alter what steps run or their order.
**Incorrect (breaking change without patch):**
```python
# Original
@DBOS.workflow()
def workflow():
foo()
bar()
# Updated - breaks in-progress workflows!
@DBOS.workflow()
def workflow():
baz() # Replaced foo() - checkpoints don't match
bar()
```
**Correct (using patch):**
```python
# Enable patching in config
config: DBOSConfig = {
"name": "my-app",
"enable_patching": True,
}
DBOS(config=config)
@DBOS.workflow()
def workflow():
if DBOS.patch("use-baz"):
baz() # New workflows use baz
else:
foo() # Old workflows continue with foo
bar()
```
Deprecating patches after all old workflows complete:
```python
# Step 1: Deprecate (runs all workflows, stops inserting marker)
@DBOS.workflow()
def workflow():
DBOS.deprecate_patch("use-baz")
baz()
bar()
# Step 2: Remove entirely (after all deprecated workflows complete)
@DBOS.workflow()
def workflow():
baz()
bar()
```
`DBOS.patch(name)` returns:
- `True` for new workflows (started after patch deployed)
- `False` for old workflows (started before patch deployed)
Reference: [Patching](https://docs.dbos.dev/python/tutorials/upgrading-workflows#patching)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 318k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 318k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 318k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 318k | Updated | Claude CodeCodex | Verified | Install |