testsAndMisc/docs/superpowers/contracts/artgate-harness-2026-08-15.json
Krzysztof kuhy Rudnicki da8ca6d827
Some checks are pending
Pre-commit checks / pre-commit (push) Waiting to run
Python tests / test (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
artgate: deterministic exit-code gates for generated game art
Adds the route-independent spine of the planned art-generation bake-off: a
harness that decides whether generated art is well-formed, so "non-sloppy"
becomes machine-checkable instead of a judgement call.

Findings that shaped the design, all measured rather than assumed:

- Integer-scale invariance separates true pixel art (impurity 0.0000) from
  interpolated fakes (1.0000) exactly -- but passes trivially at scale 1, so
  it must never be trusted alone on native-resolution output.
- Gate ORDER is load-bearing. A soft-alpha image has no fully-opaque pixels,
  so an opaque-only colour count returns 0 and silently passes. ALPHA_NOT_BINARY
  now runs first and COLOR_COUNT fails closed on an empty opaque set.
- Counting must be over opaque RGB only: transparent pixels retain arbitrary
  RGB and inflated a naive RGBA count, rejecting correct art at 18/16.
- Declaring a gate was not enough to run it. hand_painted.toml shipped
  declaring SILHOUETTE_LOW_CONTRAST with no implementation, so it parsed, ran
  nothing, and reported a pass. load_spec now fails closed on unimplemented
  gates, result-only codes, and gates missing their config.

Thresholds are calibrated against 250 genuine 32x32 CC0 icons, not guessed:
p50=7 p90=13 p99=26 opaque colours; cap 32 rejects 0.0% of real art while raw
generator output measured 34403 colours. An initial cap of 16 wrongly rejected
a real DCSS icon -- re-derived from the corpus rather than nudged.

Verified: 57 tests, 100% branch coverage, zero suppressions, all hooks pass.
58/60 (96.7%) of real CC0 icons pass the full stack; both failures confirmed
true positives.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T9rQ12yZ7sJxiPQTCS5dUF
2026-08-15 22:20:36 +02:00

22 lines
2.8 KiB
JSON

{
"title": "artgate: deterministic exit-code gates for generated game art",
"objective": "Make 'non-sloppy' a machine-checkable property of a generated art asset rather than a judgement call, by shipping a route-independent gate harness that takes an image plus a per-style spec and returns an exit code with machine-readable reason codes. This is the spine of a planned 4-route x 4-style generation bake-off: every route feeds the same harness, so the comparison yields a decision table instead of four incomparable portfolios. Adjudication is by exit code only - no model ever grades another model's art.",
"acceptance_criteria": [
"A CLI gates one image against one TOML spec and returns 0 (pass), 1 (gate failure) or 2 (harness/spec error); a malformed spec is never reported as an art verdict.",
"Gates implemented: ALPHA_NOT_BINARY, TOO_MANY_COLORS, OFF_PALETTE, CANVAS_SIZE, SCALE_NOT_INVARIANT, SILHOUETTE_LOW_CONTRAST, with NO_OPAQUE_PIXELS and EMPTY_CANVAS as fail-closed result codes.",
"Gate applicability is declared per style as data, so gates meaningless for a style (palette/colour/scale for hand-painted) are absent rather than manufacturing false failures.",
"Fail closed on spec faults: a gate that is declared but unimplemented, declared without its required config, or is a result-only code, raises at load time instead of silently not running.",
"Every numeric threshold is derived from calibration controls or a real-art corpus, never guessed.",
"Real hand-made CC0 art passes the full stack at a high rate; any failure is verifiable as a true positive.",
"100% branch coverage, zero lint suppressions, all pre-commit hooks pass."
],
"out_of_scope": [
"Generating any art. No route drivers, no diffusion code, no ComfyUI, no Blender - this change adds only the adjudicator.",
"Gates for tiling and animation (SEAM_ENERGY, LOOP_POPS, FRAME_DISTINCT). The maths exists in the seamless-tilesets and pixel-animation skills and will be lifted, not reinvented, when those cells run.",
"Licence gating (LICENSE_FLAG). Reserved for the sourced-CC0 route.",
"Committing any generated image. Binaries stay outside the repo by design; only the code lives here.",
"The human contact-sheet gate, which decides 'good' - the machine gates only establish 'not malformed'."
],
"verifier": "python -m pytest python_pkg/artgate/tests/ --cov=python_pkg.artgate --cov-branch --cov-fail-under=100 (57 tests, 100% branch); pre-commit run --files python_pkg/artgate/*.py python_pkg/artgate/tests/*.py (ruff select=ALL, mypy strict, pylint, bandit, codespell, no-noqa); plus an end-to-end batch over 60 genuine 32x32 CC0 icons from ~/opengameart-downloads, requiring a high pass rate with every failure confirmed a true positive (58/60 = 96.7% measured)."
}