blender-worktree-test-hardening

Recover and harden digitalmodel Blender automation work in isolated worktrees when uv/editable dependency paths break and local machines lack a Blender executable.

5 stars

Best use case

blender-worktree-test-hardening is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Recover and harden digitalmodel Blender automation work in isolated worktrees when uv/editable dependency paths break and local machines lack a Blender executable.

Teams using blender-worktree-test-hardening should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/blender-worktree-test-hardening/SKILL.md --create-dirs "https://raw.githubusercontent.com/vamseeachanta/workspace-hub/main/.claude/skills/digitalmodel/blender-worktree-test-hardening/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/blender-worktree-test-hardening/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How blender-worktree-test-hardening Compares

Feature / Agentblender-worktree-test-hardeningStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Recover and harden digitalmodel Blender automation work in isolated worktrees when uv/editable dependency paths break and local machines lack a Blender executable.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Blender worktree test hardening for digitalmodel

> Paths below use `$WORKROOT` = the directory holding your sibling repo checkouts and worktrees
> (`/mnt/local-analysis` on Linux dev machines; adjust for your platform). `digitalmodel`,
> `assetutilities`, `workspace-hub`, and `worktrees/` are all siblings under `$WORKROOT`.

Use this when all of the following are true:
- you are working in an isolated `digitalmodel` git worktree under `$WORKROOT/worktrees/...`
- Blender automation tests fail locally
- the machine may not have `blender` on PATH
- `uv run` may fail because digitalmodel's editable `assetutilities` dependency resolves relative to `../assetutilities`

## Symptoms

1. `uv run` fails in the worktree with an editable dependency error like:
- `Failed to generate package metadata for assetutilities==0.1.0 @ editable+../assetutilities`
- `Distribution not found at: file://$WORKROOT/worktrees/assetutilities`

2. Blender wrapper tests fail during fixture construction with:
- `RuntimeError: Blender not found or not accessible: [Errno 2] No such file or directory: 'blender'`

3. Interactive Claude/Codex may get distracted by package-import theories even though the real failing boundary is missing external binary availability.

## Fast recovery sequence

### A. Fix the test environment first

Preferred path for targeted test execution in a digitalmodel worktree:

```bash
PYTHONPATH=src $WORKROOT/digitalmodel/.venv/bin/python -m pytest tests/solvers/blender_automation/test_blender_wrapper.py -q
```

Why:
- this avoids rebuilding a fresh worktree-local `uv` environment
- it bypasses the broken `editable+../assetutilities` worktree-relative path
- it uses the already-working main-checkout virtualenv

### B. If you really need `uv run` inside the worktree

Create the missing sibling path expected by digitalmodel's editable dependency:

```bash
ln -s $WORKROOT/assetutilities $WORKROOT/worktrees/assetutilities
```

After the session, remove the temporary symlink if you don't want to keep it:

```bash
rm -f $WORKROOT/worktrees/assetutilities
```

## Real root cause triage

Before changing code, confirm whether the problem is actually:
- missing Blender executable on PATH
- not an import-path bug
- not an internal Blender automation logic bug

Run the narrow failing slice first with the exact interpreter above.

If failures all originate from wrapper construction calling `subprocess.run(["blender", "--version"])`, treat this as an availability-hardening task, not a new feature task.

## Recommended TDD pattern for external executable wrappers

### 1. Red: rewrite tests around availability-aware behavior

For unit tests:
- mock `subprocess.run`
- keep wrapper construction deterministic
- verify command assembly and error handling without needing the real binary

For integration tests:
- use a skip marker gated on real binary availability
- do not let absence of Blender fail the whole unit test slice

In the Blender automation area, create a shared `conftest.py` with:
- `mock_blender_run`
- `mock_blender_run_error`
- `requires_blender`

### 2. Green: harden the wrapper minimally

For wrapper classes like `BlenderWrapper`, prefer this behavior:
- constructor does not raise if Blender is unavailable
- store availability explicitly, e.g. `self._available`
- expose a property like `is_available`
- `run_script()` returns a structured failure dict when Blender is unavailable instead of crashing

Good pattern:
- `version = None` when unavailable
- `is_available == False`
- methods return `{success: False, error: ...}`

### 3. Broaden only after the first slice is green

Run first:

```bash
PYTHONPATH=src $WORKROOT/digitalmodel/.venv/bin/python -m pytest tests/solvers/blender_automation/test_blender_wrapper.py -q
```

Then run the nearby regression slice:

```bash
PYTHONPATH=src $WORKROOT/digitalmodel/.venv/bin/python -m pytest tests/solvers/blender_automation/ -q
```

## Interactive Claude guidance

When using tmux/interactive Claude Code for this class of problem:
- give Claude the exact test command up front
- explicitly tell it to focus on the actual failing boundary
- steer it away from import-path rabbit holes unless imports are actually failing
- keep owned paths narrow:
  - `src/digitalmodel/solvers/blender_automation/**`
  - `tests/solvers/blender_automation/**`

Useful steering sentence:
- `Focus only on the actual failing boundary. Ignore import-path theory unless an import is actually failing. Harden wrapper/tests for deterministic behavior when Blender is absent on PATH.`

## Verification checklist

Before closing the issue, verify all of:
- targeted wrapper test slice passes
- broader `tests/solvers/blender_automation/` slice passes
- changes are confined to Blender automation source/tests
- any temporary prompt file or helper symlink is cleaned up
- pushed commit actually landed on `origin/main`

## What this solved in live use

This pattern successfully closed a digitalmodel Blender configuration issue by:
- using the main-checkout `.venv` to avoid worktree `uv` dependency breakage
- converting Blender wrapper behavior from constructor-crash to availability-aware degradation
- rewriting Blender unit tests to use mocked subprocess execution plus skip-gated real-Blender integration tests
- turning a machine-specific missing-binary failure into a deterministic, portable test suite

Related Skills

test-oversized-skill

5
from vamseeachanta/workspace-hub

A test fixture skill that exceeds 200 lines with multiple H2/H3 sections for split testing.

solidworks-to-blender-pipeline

5
from vamseeachanta/workspace-hub

Use when converting SolidWorks .sldprt/.sldasm geometry to Blender for rendering, animation, or visualization, including questions about STEP export settings, FreeCAD as a bridge, or which mesh format (STL/OBJ/GLTF) to choose.

digitalmodel-worktree-test-execution-with-shared-venv

5
from vamseeachanta/workspace-hub

Run digitalmodel tests from isolated worktrees without uv editable-dependency failures by using the main repo's existing virtualenv and PYTHONPATH.

worktree-pre-push-bypass-for-tier1-checks

5
from vamseeachanta/workspace-hub

Handle workspace-hub integration-branch pushes from isolated git worktrees when the pre-push hook incorrectly assumes sibling tier-1 repos exist under the worktree path.

worktree-branch-sync-hygiene

5
from vamseeachanta/workspace-hub

Class-level branch, worktree, dirty-main, stash, sync, and hook hygiene for workspace-hub style multi-repo work.

work-around-merge-conflicts-in-test-execution

5
from vamseeachanta/workspace-hub

Run tests when repo has unresolved merge conflicts in config files by bypassing broken configs and executing tests directly

test-driven-hook-debugging

5
from vamseeachanta/workspace-hub

Debugging and fixing shell hooks by writing isolated test suites first, then using test failures to pinpoint logic bugs

git-worktree-cleanup-at-scale

5
from vamseeachanta/workspace-hub

Identify and remove stale git worktrees blocking branch deletion in multi-repo environments

git-worktree-cleanup-and-branch-reconciliation

5
from vamseeachanta/workspace-hub

Systematic process for cleaning up stale git worktrees, resolving merge conflicts in diverged branches, and reconciling branch state across multiple repositories.

git-worktree-cleanup-and-branch-hygiene

5
from vamseeachanta/workspace-hub

Systematic approach to cleaning up stale git worktrees, orphan branches, and branch hygiene at scale across multiple repos

learned-git-worktree-hook-path-and-real-hook-shape-review

5
from vamseeachanta/workspace-hub

Catch hook-installation and governance bugs that only appear in linked git worktrees or against the real generated hook shape, not simplified test fixtures.

clean-worktree-integration-from-dirty-main

5
from vamseeachanta/workspace-hub

Land validated issue work from isolated worktrees when the main checkout is dirty by creating a fresh integration worktree, cherry-picking only implementation commits, re-running combined validation, and preparing push/closeout artifacts.