Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.
test(prompt): the freeze pins the measured diagonal words, not whatever the code says now
Soohong Kimbb1c45fdab30
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d421bf7..d9e9698 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,7 +5,7 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the## Unreleased- **Output change: a diagonal still turns its chest or back and its legs, not only its head** (`STILL_VIEW_TEXT["front_diagonal"]`, `["back_diagonal"]`, read by `still_view_text` and `gen --direction`; an app that draws its own still takes it too). The sentences said the turn, the head and the feet, and a still that turns only its head and shoes, the chest (back) and the legs standing as from the front (straight behind), meets those words. They now say what that angle shows: not a front (back) view with only the head turned, the middle of the chest (back) and of the waist about three quarters of the way across the body toward its far edge, the near shoulder and side seen broad, the far shoulder and arm partly hidden, the legs at the same angle with the far foot set a little higher and partly behind the near leg, and not to follow a reference picture's angle. `STILL_VIEW_TEXT` takes `{other}`, the side opposite `{facing}` (the near side of a front diagonal, the far side of a back one); facing left is the same sentence with the sides swapped. The clip's view sentences (`VIEW_TEXT`, `VIEW_MOTION_TEXT`, `GAIT_HOLD_TEXT`) and the body plan's (`STILL_VIEW_TEXT_ANY_BODY`) are unchanged. The words were chosen by a before-and-after comparison on the still model; its measurements are kept in private evidence and none is recorded here ([video-pipeline](docs/video-pipeline.md#2-clip--sprite-gen-video)).-- **`tests/video/test_video_pipeline.py`** holds both diagonal still sentences, facing right and left: the chest (back) and hips turn with the head, where the middle of the body sits, the near side broad, the far shoulder, arm and foot on the far side, the reference picture not followed, and facing left the same sentence with the sides swapped. **`tests/gen/test_prompt_freeze.py`** lists the two 2.22.0 sentences (`MEASURED`): the still prompts that hold them are compared with the new sentence in their place, and those prompts and no others differ from 2.22.0.+- **`tests/video/test_video_pipeline.py`** holds both diagonal still sentences, facing right and left: the chest (back) and hips turn with the head, where the middle of the body sits, the near side broad, the far shoulder, arm and foot on the far side, the reference picture not followed, and facing left the same sentence with the sides swapped. **`tests/gen/test_prompt_freeze.py`** lists the two 2.22.0 sentences and the words measured in their place (`MEASURED`): the still prompts that hold the old words are compared with the measured ones, those prompts and no others differ from 2.22.0, and a measured sentence reworded again fails as any other prompt would.- **Fix: `video-follow` replaces the loop's files only once all of them are written.** The strip, the GIF and the WebP were written over the loop's before the record was, so a run that failed on the record — `follow.follow_loop` given numpy numbers, an int64 of which has no JSON form (`TypeError`) — or on an animation's check left a moved strip beside a record that did not say so. Now the strip, GIF, WebP and record are written and checked in a scratch directory beside the loop (`.follow.*`), each under its own name, and moved over the loop's files after the record is written; a run that fails on the way leaves all four as they were (the strip as cut is still kept as `follow.source.png`, as on a refusal). `follow_loop` reads its regions, `gain`, `freq` and `zeta` as the floats the command line gives, so numpy numbers, or plain ints, write the strip and record that the same numbers as floats write, byte for byte (a caller that passed plain ints finds them recorded as floats, `80.0` where it was `80`). `loop.verify_animation` closes the file it checks. The command's output, its strip, GIF, WebP and record, and `--help` are as before, byte for byte. [docs/video-pipeline.md](docs/video-pipeline.md#6-follow-through--video-follow).- **`tests/video/test_follow.py`** moves a chest and a smaller head region given as int64, int32, float32, float64 and plain int coordinates, as the rows of an int64 array, and with a float32 `gain`: each writes the strip, GIF, WebP and record the float coordinates write, byte for byte (before this the int64 run failed on the record with the strip already moved). A run made to fail on its record or on its WebP's check, on a loop as cut and on one already followed, leaves the strip, GIF, WebP and record as they were, and nothing beside them but `follow.source.png`.diff --git a/docs/prompt-assembly.md b/docs/prompt-assembly.mdindex 5345b01..c7ee0cb 100644--- a/docs/prompt-assembly.md+++ b/docs/prompt-assembly.md@@ -17,8 +17,9 @@ with `tests/fixtures/prompts-v2.22.0.json.gz`, drawn from the 2.22.0 tag's sourc`tests/gen/prompt_freeze_table.py`. The notes and warnings printed beside a prompt are not part ofthat comparison. A change to these prompts is made only after a before-and-after comparison on theapp's default clip model shows it is better. Such a change is listed in the test (`MEASURED`) with the-words 2.22.0 sent, and every frozen prompt that holds them is compared with the new words in their-place: nothing else in it may move. So far: the two diagonal stills' view sentences+words 2.22.0 sent and the words measured in their place, and every frozen prompt that holds the old+words is compared with the measured ones: nothing else in it may move, and the measured words cannot+change again without a new comparison. So far: the two diagonal stills' view sentences(`STILL_VIEW_TEXT["front_diagonal"]`, `["back_diagonal"]`), compared on the still model([video-pipeline](video-pipeline.md#2-clip--sprite-gen-video)).diff --git a/tests/gen/test_prompt_freeze.py b/tests/gen/test_prompt_freeze.pyindex 2ef1336..77ae6ab 100644--- a/tests/gen/test_prompt_freeze.py+++ b/tests/gen/test_prompt_freeze.py@@ -12,8 +12,9 @@ stderr and `extra.prompt_notes`, `video-prompt` `warnings` and `notes`, `video-spart of the freeze and may differ.A sentence changed on purpose since, after a before-and-after comparison on the app's own model, is listed in-`MEASURED` with the words 2.22.0 sent: a frozen prompt that holds it is compared with the new sentence in its-place, and nothing else in that prompt, or in any other, may move.+`MEASURED` with the words 2.22.0 sent and the words that were measured in their place: a frozen prompt that holds+the old words is compared with the measured ones, and nothing else in that prompt, or in any other, may move. A+measured sentence changed again without a new comparison fails here like any other prompt."""from __future__ import annotations@@ -24,7 +25,6 @@ from pathlib import Pathimport pytestimport prompt_freeze_table as table-from sprite_gen.video import batchFIXTURE = Path(__file__).resolve().parents[1] / "fixtures" / "prompts-v2.22.0.json.gz"GROUPS = ("clip", "video-prompt", "start-still", "still", "video-side")@@ -43,8 +43,33 @@ DIAGONAL_STILLS_2_22_0 = {"shoulder, and the feet pointing diagonally up and to the {facing} so the backs of the shoes face the viewer at an angle"),}-MEASURED = tuple((was.format(facing=facing), batch.still_view_text(view, facing))- for view, was in DIAGONAL_STILLS_2_22_0.items() for facing in ("right", "left"))+# The words measured in their place: `{other}` is the side opposite `{facing}`.+DIAGONAL_STILLS_MEASURED = {+ "front_diagonal": (+ "seen from a three-quarter front angle: the whole body turned about 45 degrees to the {facing}, halfway between "+ "facing the viewer and facing {facing}, not a front view with only the head turned: the chest and hips turn as far "+ "as the head, so the middle of the chest and of the waist sits about three quarters of the way across the body "+ "toward its {facing} edge, the shoulder and the side of the chest on the {other} of the picture, nearer the "+ "viewer, are seen broad, the shoulder and arm on the {facing} of the picture are partly hidden behind the body and "+ "the chest looks narrower than from the front, and the legs stand at the same angle, the far foot on the {facing} "+ "of the picture set a little higher and partly behind the near leg, both toes pointing toward the lower {facing}, "+ "the face looking the same way as the chest, even when a reference picture shows the character from another angle"+ ),+ "back_diagonal": (+ "seen from a three-quarter back angle: the whole body turned about 45 degrees away from the viewer toward the upper "+ "{facing}, halfway between facing away and facing {facing}, not a back view with only the head turned: the back and "+ "hips turn as far as the head, so the middle of the back and of the waist sits about three quarters of the way "+ "across the body toward its {other} edge, the shoulder and the side of the body on the {facing} of the picture, "+ "nearer the viewer, are seen broad, the shoulder and arm on the {other} of the picture are partly hidden behind the "+ "body and the back looks narrower than from straight behind, and the legs stand at the same angle, the far foot on "+ "the {other} of the picture set a little higher and partly behind the near leg, the feet pointing diagonally up and "+ "to the {facing} so the backs of the shoes face the viewer at an angle, the face hidden and not looking back over "+ "the shoulder, even when a reference picture shows the character from another angle"+ ),+}+MEASURED = tuple((was.format(facing=facing), DIAGONAL_STILLS_MEASURED[view].format(facing=facing, other=other))+ for view, was in DIAGONAL_STILLS_2_22_0.items()+ for facing, other in (("right", "left"), ("left", "right")))def _as_measured(prompt: str) -> str: