Skip to content

fix(skills): correct driver autoexec, handler args, active-vs-selected, bake target and migration claims - #476

Merged
TMHSDigital merged 1 commit into
mainfrom
fix/skill-accuracy-458-464
Oct 7, 2026
Merged

TMHSDigital merged 1 commit into
mainfrom
fix/skill-accuracy-458-464

Conversation

@TMHSDigital

Copy link
Copy Markdown
Owner

Closes #458
Closes #459
Closes #460
Closes #461
Closes #464

Fixes skill, rule and snippet claims that live Blender contradicts. Three existing examples gain checks, each with a catalog falsifier.

Binaries used (versions as the binaries report them): .scratch/blender-5.2.1-windows-x64/blender.exe (5.2.1 LTS, hash 9e2066aef7ef) and .scratch/blender-4.5.11-windows-x64/blender.exe (4.5.11 LTS, hash 4db51e9d1e1e). The bake-selection boundary was also probed on 5.0.1 and 5.1.2.

Per issue

#458 Drivers: autoexec and is_simple_expression

  • Skill: the security section is rewritten in drivers-and-app-handlers.
    • Simple expressions always run.
    • Every driver_namespace call needs Auto Run Python Scripts, Trusted Source, or -y. This cites the manual's Drivers > Troubleshooting page.
    • Prefer driver variables and simple expressions in shared files.
    • Use driver.is_simple_expression to tell which kind you wrote. A measured table is included.
  • Snippet: driver-with-custom-function.py header now carries the same caveat.
  • Example: driver-wave asserts that every column's custom-function driver reports is_simple_expression == False (exit 5). Falsifier: --simple-expr writes the same profile inline as 1.4 + sin(i*0.6). The heights still match, but the run exits 5.

#459 Handler signatures

  • Table: frame_change_pre and depsgraph_update_pre now read (scene, None), with a note on what to do instead. exit_pre is documented as (interactive: bool); a *args handler gets (bool, None).
  • Example: driver-wave asserts the argument types of all four handlers (exit 7). This went into driver-wave rather than exit-pre-sidecar to avoid conflicting with the exit-code renumbering. Falsifier: --swap-handlers hangs each probe on the opposite list and exits 7.

#460 Active vs selected

  • Skill and rule: operators and rules/type-annotate-props-and-defend-context.mdc now say:
    • active_object is None only when there is no active object: an empty scene, a deleted active object, or an override that sets it to None.
    • Active and selected are independent. Check select_get(), visible_get() and library is None.
    • Both guard examples gain a select_get() check.
  • Regenerated: claude/blender-rules.md.
  • Example: an assertion was added to temp-override-join, which is cheaper than a new check-only example. After select_all(DESELECT) the target stays active, select_get() is False, and selected_objects is empty (exit 13). Falsifier: --clear-active-on-deselect.

#461 Bake target must be a selected Image Texture node

  • Correction to the issue's own reading: the bake uses the tree's active-texture node and, on 5.0 and later, requires that node to be selected. It is not true that only selection matters.
    • Case E: two image nodes, the selected one is not the active texture, and the bake is CANCELLED.
    • Case D/C: the only image node is selected while Principled is nodes.active, and the bake FINISHES, because that node is still the active texture.
  • 4.5.11 ignores selection entirely. An active, unselected node still bakes (FINISHED).
  • Skill, snippet and failure table now state this.
  • Example: falsifier --unselect-target added to bake-normal-high-to-low. It exits 4 on 5.x and exits 0 on 4.5, so the catalog row carries "min_version": "5.0" and the README says so.

#464

  1. bl-info-migration: new Step 4 replaces hard-coded add-on names and submodule __name__ with __package__, and cross-links custom-properties. Measured with an installed test extension on 5.2.1:
    • addons["bare_id"] raises KeyError.
    • In a submodule, __name__ is bl_ext.user_default.<id>.prefs.
    • bl_idname = __name__ registers silently, and addons[pkg].preferences is then None.
  2. depsgraph / mesh-editing: both now say "one temporary mesh per evaluated object until to_mesh_clear() or re-evaluation; many objects hold one each".
    • Measured on 4.5.11 and 5.2.1: a second to_mesh() on the same object frees the previous mesh. The old Python handle then raises ReferenceError.
    • This also corrects the old "returns that same mesh" claim. The pointer matches on 5.2 but not on 4.5, and the first handle is dead on both.
  3. ui-panels: the specific fallback tab name is dropped, because it could not be verified headless.

Proven by live run vs inspection

Live, headless (--background --factory-startup) on 5.2.1 and 4.5.11:

  • use_scripts_auto_execute is False on factory settings.
  • is_simple_expression values for 7 expressions.
  • Handler argument types for the four handlers.
  • active_object after deselect-all, after deleting the active object, and in an empty scene. object.delete on an active but unselected object returns CANCELLED.
  • Bake cases A–H. The unselected-active case was also run on 5.0.1 and 5.1.2 (both CANCELLED).
  • to_mesh lifetime.
  • exit_pre passes False in background on 5.2.1.

Live, other:

  • On 5.2.1, one windowed run (non-background, quit by a timer) showed exit_pre receiving True.
  • The extension __package__ / addons / AddonPreferences facts come from a 5.2.1 run with an installed test extension in a temporary BLENDER_USER_RESOURCES.

Inspection only:

Falsifier probes (measured exits)

Example Args 5.2.1 LTS 4.5.11 LTS
driver-wave (none) 0 0
driver-wave --flat-expr 3 3
driver-wave --simple-expr 5 (16/16 drivers report is_simple_expression=True) 5
driver-wave --swap-handlers 7 (pre got Depsgraph, post got NoneType) 7
temp-override-join (none) 0 0
temp-override-join --no-override 3 (unchanged) 3
temp-override-join --clear-active-on-deselect 13 (active=None) 13
bake-normal-high-to-low (none) 0 0
bake-normal-high-to-low --unselect-target 4 ({'CANCELLED'}, active=True selected=False) 0 (expected; min_version 5.0, SKIP below)

python tests/run_all.py: 31 passed, 0 failed. Gallery pages were regenerated with scripts/build_gallery.py; the diff covers only the README-derived text of the three example pages, and I read it in the generated HTML. No renders changed.

🤖 Generated with Claude Code

…d, bake target and migration claims

Several skills taught behavior that live Blender contradicts, so agents
following them shipped dead drivers in shared files, AttributeErrors in pre
handlers, None guards that miss an unselected active object, and bake
setups that cancel on 5.x once a "redundant" tex.select line is removed.

- drivers-and-app-handlers: driver_namespace calls are not simple
  expressions and need Python auto-execution (off by default); pre
  handlers receive (scene, None); exit_pre receives one bool.
- operators + type-annotate-props-and-defend-context rule: active_object
  survives deselect-all and headless startup; active and selected are
  independent.
- bake-high-to-low + snippet: on 5.0+ the active-texture node must also be
  selected; 4.5 LTS ignores selection.
- bl-info-migration: replace hard-coded add-on names and submodule
  __name__ with __package__.
- depsgraph / mesh-editing: one temporary mesh per evaluated object, not
  per to_mesh() call. ui-panels: drop the unverified fallback tab name.

Examples gain checks with falsifiers: driver-wave (exit 5
is_simple_expression, exit 7 handler arg types), temp-override-join
(exit 13 active survives deselect), bake-normal-high-to-low
(--unselect-target, exit 4 on 5.0+).

Signed-off-by: TMHSDigital <tmhospitalitystrategies@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added skills rules snippets examples Runnable smoke-gated examples under examples/ documentation Improvements or additions to documentation labels Oct 7, 2026
@TMHSDigital
TMHSDigital merged commit 4636c25 into main Oct 7, 2026
13 checks passed
@TMHSDigital
TMHSDigital deleted the fix/skill-accuracy-458-464 branch October 7, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment