Skip to content

scripts: measure_hero_drift.py exits 0 on size mismatch or unknown --only, and crashes on bad input #296

Description

@TMHSDigital

Why it matters

scripts/measure_hero_drift.py is how the repo proves that committed hero stills match what the code renders now (#200). Several of its paths report success when nothing was measured, which is the kind of assertion that "witnesses nothing" by the repo's own falsification standard.

Evidence

  • scripts/measure_hero_drift.py:163-165: when the rendered and committed images differ in size, the row lacks mean_abs. The loop prints a message and continues. The row counts as neither drifted nor failed, so the script exits 0. A size mismatch is itself drift.
  • An unknown --only NAME matches nothing, measures zero heroes, and exits 0.
  • :131: …stdout.splitlines()[0] raises IndexError if blender --version fails or prints nothing, which surfaces as a traceback instead of a clear error.
  • :78-79: args.index("--output") / args[i + 1] raises IndexError when a README command ends in a bare --output.

Suggested approach

  • Treat a size mismatch as a failure and include it in the non-zero exit.
  • Exit non-zero with a clear message when --only names match no example or showcase piece, or when zero heroes were measured.
  • Guard the version probe and argument parsing with explicit error messages and a documented exit code.
  • Add unit tests for these paths. Today tests/smoke/test_harness.py is the only unit test, and the scripts/ tooling has none.

Done when

  • Each of the four cases above exits non-zero with a readable message.
  • Each case is covered by a test that was seen failing against the current code.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: lowNice to have

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions