Skip to content

Commit 83f88d7

Browse files
committed
fix(art): put the repo-wide verify in the vendored renderers
`make art-verify` and its backing script live in concord, and `make sync` vendors only .ai/skills and .ai/commands — so the repo-wide check was unreachable from the member repos whose art it exists to hold, and the migration issues pointed members at a target they do not have. The walk moves into the renderers themselves as `glyph.py --verify-all` and `sfx.py --verify-all`, which propagate with the skills, default to art/glyphs and art/audio, and exit non-zero on drift. scripts/check-art-repeatability.py becomes a thin multi-repo driver over those two rather than a second implementation, so a member running the vendored renderer gets exactly the answer concord does. The skill docs and slash commands now name the command members actually have. Verified by building a tree containing only what sync vendors and running the documented command in it.
1 parent 753846e commit 83f88d7

11 files changed

Lines changed: 304 additions & 123 deletions

File tree

‎.ai/commands/glyph.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ python3 .ai/skills/mc-textures/scripts/glyph.py art/glyphs/<name>.glyph --verify
226226

227227
`--verify` re-renders the spec and compares it against the shipped master pixel
228228
for pixel (and the `.mcmeta` for an animated strip), which is what makes the
229-
`.glyph` the source of truth in practice rather than by convention — `make
230-
art-verify` runs the same check over every spec in the repo. A spec without a
229+
`.glyph` the source of truth in practice rather than by convention —
230+
`glyph.py --verify-all` runs the same check over every spec in `art/glyphs/`. A spec without a
231231
`ships:` line is reported as unlinked and nothing holds it to its asset, so add
232232
it whenever a glyph ships.
233233

‎.ai/commands/sfx.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ python3 .ai/skills/mc-audio/scripts/sfx.py art/audio/<cue>.sfx --verify
109109
`--verify` re-synthesizes the spec, decodes the shipped `.ogg`, and compares
110110
them — so the check measures what the game plays rather than the pre-encode
111111
buffer. That is what makes the `.sfx` the source of truth in practice rather
112-
than by convention; `make art-verify` runs the same check over every spec in the
113-
repo. A spec without a `"ships"` field is reported as unlinked, so add it
112+
than by convention; `sfx.py --verify-all` runs the same check over every cue in
113+
`art/audio/`. A spec without a `"ships"` field is reported as unlinked, so add it
114114
whenever a cue ships.
115115

116116
Then wire the Minecraft side (see the `mc-audio` and `mc-registration` skills):

‎.ai/skills/mc-audio/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ the `.sfx` and re-rendering.
103103
Every spec carries a **`ships`** field naming that shipped path, which is what holds the
104104
rule up: `sfx.py CUE.sfx --verify` re-synthesizes the spec, decodes the `.ogg` that
105105
shipped, and compares duration, peak, loudness, and spectral centroid — so what gets
106-
measured is what the game actually plays, not the pre-encode buffer. `make art-verify`
107-
runs that across the whole repo. A spec with no `ships` field is reported as unlinked —
106+
measured is what the game actually plays, not the pre-encode buffer. `sfx.py --verify-all`
107+
runs that across every cue in `art/audio/` (exit non-zero on drift, so it belongs in CI). A spec with no `ships` field is reported as unlinked —
108108
it has no declared deliverable, so nothing holds it to anything.
109109

110110
## Quick checklist

‎.ai/skills/mc-audio/scripts/sfx.py‎

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
python3 .ai/skills/mc-audio/scripts/sfx.py - < SPEC.sfx # spec on stdin
8181
python3 .ai/skills/mc-audio/scripts/sfx.py SPEC.sfx --no-report # skip the PNG
8282
python3 .ai/skills/mc-audio/scripts/sfx.py SPEC.sfx --verify # shipped cue still matches the spec? (uses ships)
83+
python3 .ai/skills/mc-audio/scripts/sfx.py --verify-all # ... same check over every cue in art/audio/
8384
python3 .ai/skills/mc-audio/scripts/sfx.py --list-waveforms # available oscillators
8485
8586
Exits non-zero when it could not write the `.ogg` — that file is the
@@ -533,6 +534,60 @@ def decode_audio(path, sr):
533534
}
534535

535536

537+
def spec_ships(path):
538+
"""The `ships` target a .sfx declares, or None."""
539+
try:
540+
return json.loads(Path(path).read_text()).get("ships")
541+
except (json.JSONDecodeError, OSError):
542+
return None
543+
544+
545+
def verify_tree(root, verbose=False):
546+
"""Verify every cue under `root` that declares where it ships.
547+
548+
This lives in the synth rather than in a separate tool because the synth is
549+
what gets vendored into each member repo — a checker that only exists in
550+
concord could not be run by the repos whose audio it holds.
551+
552+
Returns (checked, drifted, unlinked).
553+
"""
554+
root = Path(root)
555+
if not root.exists():
556+
print(f" {root}: no such directory — nothing to verify")
557+
return 0, 0, 0
558+
checked = drifted = 0
559+
unlinked = []
560+
for spec_path in sorted(root.glob("*.sfx")):
561+
shipped = spec_ships(spec_path)
562+
if not shipped:
563+
unlinked.append(spec_path)
564+
continue
565+
checked += 1
566+
try:
567+
spec = parse_spec(spec_path.read_text())
568+
samples, sr = synthesize(spec)
569+
target = spec["loudness_lufs"]
570+
if target is None:
571+
samples, _ = normalize(samples, spec["peak_dbfs"])
572+
else:
573+
samples, _, _, _ = normalize_loudness(
574+
samples, sr, target, spec["peak_dbfs"])
575+
problems = verify_render(shipped, samples, sr,
576+
compute_stats(samples, sr))
577+
except SpecError as e:
578+
problems = [f"{spec_path}: {e}"]
579+
if problems:
580+
drifted += 1
581+
print(f" DRIFT {spec_path}")
582+
for p in problems:
583+
print(f" {p}")
584+
elif verbose:
585+
print(f" ok {spec_path} -> {shipped}")
586+
for spec_path in unlinked:
587+
print(f" unlinked {spec_path} — no 'ships' target, so nothing verifies it")
588+
return checked, drifted, len(unlinked)
589+
590+
536591
def verify_render(shipped, samples, sr, stats):
537592
"""Compare a shipped cue against what the spec synthesizes right now.
538593
@@ -910,13 +965,25 @@ def main(argv=None):
910965
"decoding that file so what is measured is what ships. "
911966
"Exits non-zero on drift — the CI form of the "
912967
"repeatability rule")
968+
ap.add_argument("--verify-all", nargs="?", const="art/audio", metavar="DIR",
969+
help="verify every cue in DIR (default art/audio) against "
970+
"the .ogg it declares with 'ships', and report the ones "
971+
"that declare none. Exits non-zero on drift — run it in "
972+
"CI to hold the whole repo's audio to its specs")
973+
ap.add_argument("-v", "--verbose", action="store_true",
974+
help="with --verify-all, also list the cues that verified clean")
913975
ap.add_argument("--list-waveforms", action="store_true", help="print the oscillators and exit")
914976
args = ap.parse_args(argv)
915977

916978
if args.list_waveforms:
917979
for w in WAVEFORMS:
918980
print(w)
919981
return 0
982+
983+
if args.verify_all:
984+
checked, drifted, unlinked = verify_tree(args.verify_all, args.verbose)
985+
print(f" {checked} verified, {drifted} drifted, {unlinked} unlinked")
986+
return 1 if drifted else 0
920987
if not args.spec:
921988
ap.error("a spec path (or -) is required")
922989

‎.ai/skills/mc-textures/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ re-rendering — never hand-patching pixels.
198198
Every spec carries a **`ships:`** line naming that shipped path — one per shipped file,
199199
so a size ladder declares each tier (`ships: docs/img/icon-128.png 128`) — and that is
200200
what holds the rule up: `glyph.py SPEC.glyph --verify` re-renders the spec and compares
201-
it pixel for pixel against the assets that shipped, and `make art-verify` runs that
202-
across the whole repo. A hand-patched PNG, a stale asset behind an edited spec, or a `.mcmeta` whose
201+
it pixel for pixel against the assets that shipped, and `glyph.py --verify-all` runs
202+
that across every spec in `art/glyphs/` (exit non-zero on drift, so it belongs in CI). A hand-patched PNG, a stale asset behind an edited spec, or a `.mcmeta` whose
203203
frametime no longer matches all fail the check. A spec with no `ships:` line is reported
204204
as unlinked — it has no declared deliverable, so nothing holds it to anything.
205205

‎.ai/skills/mc-textures/scripts/glyph.py‎

Lines changed: 94 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
python3 .ai/skills/mc-textures/scripts/glyph.py SPEC.glyph --preview-scale 24 --no-preview
9292
python3 .ai/skills/mc-textures/scripts/glyph.py SPEC.glyph --tile-preview # + 2×2 tiled seam check (block textures)
9393
python3 .ai/skills/mc-textures/scripts/glyph.py SPEC.glyph --verify # shipped master still matches the spec? (uses ships:)
94+
python3 .ai/skills/mc-textures/scripts/glyph.py --verify-all # ... same check over every spec in art/glyphs/
9495
python3 .ai/skills/mc-textures/scripts/glyph.py --ramp emerald # tonal ramp as paste-ready legend lines
9596
python3 .ai/skills/mc-textures/scripts/glyph.py SPEC.glyph --snap-palette # nearest token for each raw-hex entry
9697
python3 .ai/skills/mc-textures/scripts/glyph.py --list-kinds # texture kinds and the checks each earns
@@ -925,6 +926,83 @@ def master_artifacts(frames_px, size, meta, out, split_frames=False, scale_to=No
925926
return ([(out, strip_px, sw, sh)], (out.with_name(out.name + ".mcmeta"), mcmeta))
926927

927928

929+
def spec_ships(path):
930+
"""The `ships:` targets a spec declares, in order (empty when it has none).
931+
932+
Reads the header only: past the legend or the first grid, a line that looks
933+
like `ships:` is content, not a directive.
934+
"""
935+
out = []
936+
for line in Path(path).read_text().splitlines():
937+
stripped = line.strip()
938+
if stripped.lower().startswith("ships:"):
939+
parts = _directive_value(stripped).split()
940+
if parts:
941+
out.append(parts[0])
942+
elif stripped.lower() in ("legend:", "frame:", "grid:"):
943+
break
944+
return out
945+
946+
947+
def verify_spec(spec_path, targets=None, split_frames=False):
948+
"""Check one spec against the masters it ships. Returns (checked, problems).
949+
950+
`targets` overrides the spec's own `ships:` lines with [(path, tier), …].
951+
"""
952+
legend, frames_rows, declared_size, meta, _used = parse_spec(
953+
Path(spec_path).read_text())
954+
frames_px, size = build_frames(legend, frames_rows, declared_size)
955+
if targets is None:
956+
targets = [(Path(p), tier) for p, tier in meta.get("ships", [])]
957+
problems, checked = [], []
958+
for path, tier in targets:
959+
try:
960+
artifacts, mcmeta = master_artifacts(
961+
frames_px, size, meta, Path(path), split_frames, tier)
962+
except SpecError as e:
963+
problems.append(f"{path}: {e}")
964+
continue
965+
problems += verify_artifacts(artifacts, mcmeta)
966+
checked += [str(a[0]) for a in artifacts]
967+
return checked, problems
968+
969+
970+
def verify_tree(root, verbose=False):
971+
"""Verify every spec under `root` that declares where it ships.
972+
973+
This lives in the renderer rather than in a separate tool because the
974+
renderer is what gets vendored into each member repo — a checker that only
975+
exists in concord could not be run by the repos whose art it holds.
976+
977+
Returns (checked, drifted, unlinked).
978+
"""
979+
root = Path(root)
980+
if not root.exists():
981+
print(f" {root}: no such directory — nothing to verify")
982+
return 0, 0, 0
983+
checked = drifted = 0
984+
unlinked = []
985+
for spec_path in sorted(root.glob("*.glyph")):
986+
if not spec_ships(spec_path):
987+
unlinked.append(spec_path)
988+
continue
989+
checked += 1
990+
try:
991+
shipped, problems = verify_spec(spec_path)
992+
except SpecError as e:
993+
shipped, problems = [], [f"{spec_path}: {e}"]
994+
if problems:
995+
drifted += 1
996+
print(f" DRIFT {spec_path}")
997+
for p in problems:
998+
print(f" {p}")
999+
elif verbose:
1000+
print(f" ok {spec_path} -> {', '.join(shipped)}")
1001+
for spec_path in unlinked:
1002+
print(f" unlinked {spec_path} — no 'ships:' target, so nothing verifies it")
1003+
return checked, drifted, len(unlinked)
1004+
1005+
9281006
def verify_artifacts(artifacts, mcmeta):
9291007
"""Compare shipped files against what the spec renders. Returns a list of
9301008
human-readable mismatches — empty means the shipped copy is reproducible.
@@ -1411,6 +1489,12 @@ def main(argv=None):
14111489
"the shipped master(s) already at the output path, "
14121490
"reporting any pixel that drifted. Exits non-zero on "
14131491
"drift — the CI form of the repeatability rule")
1492+
ap.add_argument("--verify-all", nargs="?", const="art/glyphs", metavar="DIR",
1493+
help="verify every spec in DIR (default art/glyphs) against "
1494+
"the masters it declares with 'ships:', and report the "
1495+
"ones that declare none. Exits non-zero on drift — run "
1496+
"it in CI to hold the whole repo's textures to their "
1497+
"specs")
14141498
ap.add_argument("--ramp", metavar="TOKEN",
14151499
help="print a tonal ramp off a named token as paste-ready "
14161500
"legend lines, and exit. A legend can name any step of "
@@ -1424,6 +1508,8 @@ def main(argv=None):
14241508
"design-system token or ramp step and how far off it "
14251509
"is — the migration path for a legend written before "
14261510
"ramp steps existed. Suggests; never rewrites")
1511+
ap.add_argument("-v", "--verbose", action="store_true",
1512+
help="with --verify-all, also list the specs that verified clean")
14271513
ap.add_argument("--no-preview", action="store_true", help="skip the scaled preview PNG")
14281514
ap.add_argument("--list-colors", action="store_true", help="print the named palette and exit")
14291515
ap.add_argument("--list-kinds", action="store_true",
@@ -1449,6 +1535,11 @@ def main(argv=None):
14491535
f"{RAMP_MAX_STEP}). Run --ramp <token> for a ready-made ramp.")
14501536
return 0
14511537

1538+
if args.verify_all:
1539+
checked, drifted, unlinked = verify_tree(args.verify_all, args.verbose)
1540+
print(f" {checked} verified, {drifted} drifted, {unlinked} unlinked")
1541+
return 1 if drifted else 0
1542+
14521543
if args.ramp:
14531544
try:
14541545
for line in format_ramp(args.ramp.strip().lower(), args.ramp_steps):
@@ -1507,22 +1598,12 @@ def main(argv=None):
15071598
if args.verify:
15081599
# An explicit -o wins; otherwise the spec's own `ships:` lines say what
15091600
# to check, so a size ladder verifies every tier it declares in one run.
1510-
targets = [(out, args.scale_to)] if args.out else [
1511-
(Path(p), tier) for p, tier in meta.get("ships", [])]
1512-
if not targets:
1601+
targets = [(out, args.scale_to)] if args.out else None
1602+
if targets is None and not meta.get("ships"):
15131603
print(f"glyph: {args.spec} declares no 'ships:' target and no -o was "
15141604
f"given — nothing to verify against", file=sys.stderr)
15151605
return 1
1516-
problems, checked = [], []
1517-
for path, tier in targets:
1518-
try:
1519-
artifacts, mcmeta = master_artifacts(
1520-
frames_px, size, meta, path, args.split_frames, tier)
1521-
except SpecError as e:
1522-
problems.append(f"{path}: {e}")
1523-
continue
1524-
problems += verify_artifacts(artifacts, mcmeta)
1525-
checked += [str(a[0]) for a in artifacts]
1606+
checked, problems = verify_spec(args.spec, targets, args.split_frames)
15261607
for p in problems:
15271608
print(f"glyph: drift: {p}", file=sys.stderr)
15281609
if problems:

‎Makefile‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ help:
1919
@echo "toolchain-test run the toolchain-drift checker's unit tests"
2020
@echo "art-test run the glyph + sfx renderer unit tests"
2121
@echo "art-verify re-render this repo's art specs and fail if a shipped asset drifted"
22-
@echo "art-verify-all run art-verify across every sibling member repo"
22+
@echo "art-verify-all run art-verify across every sibling member repo (members run"
23+
@echo " the vendored 'glyph.py --verify-all' / 'sfx.py --verify-all')"
2324
@echo "status regenerate site/status.json + the status page from the public APIs"
2425
@echo "status-test run the status generator's unit tests"
2526
@echo "sync-test run the concord-sync PR script's integration tests"
@@ -99,6 +100,9 @@ art-test:
99100
# Hold the art pipeline to its own repeatability rule: every art/ spec that
100101
# declares a `ships:` target is re-rendered and diffed against the asset that
101102
# shipped, so a hand-patched PNG or a stale .ogg fails instead of blending in.
103+
# The walk itself lives in the vendored renderers (`--verify-all`), so a member
104+
# repo can run the identical check without needing anything from concord; this
105+
# target is only the multi-repo driver.
102106
art-verify:
103107
@$(PY) scripts/check-art-repeatability.py --root .
104108

0 commit comments

Comments
 (0)