Skip to main content
This recipe creates a tiny failing repository, saves it as a checkpoint, tries two fixes independently, and continues only from the branch whose tests pass.

Prerequisites

Complete Set up access. In a fresh project, run uv init --python 3.12 and uv add "contree-sdk==0.3.6". The example imports docker.io/library/python:3.12-alpine; an existing immutable image UUID can be substituted.

Complete source

Save as branch_fixes.py and run uv run python branch_fixes.py. The output reports outcomes={'multiply': 1, 'add': 0} along with the baseline and chosen image UUIDs. The multiplication patch fails; the addition patch passes. The final operation starts from the selected image; it does not merge branches or resume a previous process. Both patch runs retain filesystem state because comparison includes the changed source. Selection uses the passing branch only and does not depend on failure-state persistence. If the API operation itself fails, retry from the recorded baseline UUID after classifying the platform error. All retained branch images follow the current image-retention policy. See Branch, compare, and recover.