Skip to content

ANIM-b1 3b part 1: the runtime animator as a translated root, with its animator suite - #133

Merged
thejackshelton merged 4 commits into
masterfrom
anim-b1-native
Oct 4, 2026
Merged

thejackshelton merged 4 commits into
masterfrom
anim-b1-native

Conversation

@thejackshelton

Copy link
Copy Markdown
Contributor

T065a ANIM-b1, PR 3b part 1 of 2: the runtime animator as one translated implementation (binding spec docs/goals/milestone-2-proof/notes/T065-anim-b-spec.md §2 R2, R4, R7, R9, R10, R16, §6.1 b1-3). Based on master; landable alone. It changes no row, no native output and no static case. Part 2 (the device runtime: tables in the state program sources, the display and virtual drivers, the state.ts hunks, the device-anim lane and the native animation rows) follows once this is on master (no-stacks rule).

Why a translated root

The spec's b1-3 lists "Animator (TS, Swift, Kotlin)" in emit/runtime/anim.ts. This PR writes the animator once, in the translator subset, as a new engine root (packages/layout/src/rt-animator.ts), so:

  • the Swift and Kotlin animators are generated, not hand-written twice;
  • the frame lanes against Chrome judge the very code the devices run, because the parity reference now wraps this root;
  • a new p1 suite checks the translations bit for bit against it, on the host (native:swift, native:kotlin) and on every device through device-vectors.

The device glue in part 2 becomes thin: it converts the compiled tables to literals, applies colour writes to views and lays out the patched input.

What changed

  • packages/layout/src/rt-animator.ts (new, translated root, subset-clean):
    • the tables as plain data: EasingCode, ValueCode, slots, animation lists, @keyframes, rendered, bases and closure;
    • animatorStart / animatorEvent / animatorAdvance: R4, R7 and R2, on rt-transition and rt-animations;
    • animatorFrame, closureFrame (R9) and frameColors: colours as Chrome draws them;
    • patchInput / patchRoot: lengths back into the engine input as px, % or a calc() sum (R16);
    • lengthBase: endpoints from each assignment's resolved input (R14);
    • animatorBusy: the display driver runs only while true (R3);
    • the four runtime plants as AnimatorFaults;
    • a node missing from the rendered table now throws, where the old reference treated it as hidden.
  • rt-interpolate.ts: an additive colorRgba8, built from the same rounding helpers as serializeColor.
  • lower/anim-program.ts: animTablesOf, the compiled tables as the root's plain data (layout types only, so the core boundary holds).
  • Parity reference (anim-cases.ts): Animator, closureFrame and applyFrame now wrap the root. Their API is unchanged.
  • Animator suite:
    • pnpm run parity:anim-vectors writes packages/layout/rt-vectors/animator/cases.json: per frame case, its tables, every assignment's resolved engine input and its frame script as animator steps;
    • harness op rt-animator, with exact-key decoders;
    • corpus suite animator after hit, whose expected results are the TypeScript harness's answers; a line it throws on or refuses fails the build;
    • generate.ts root list; targets.ts device-vectors declaration;
    • regen step anim-vectors and its .gitattributes line.

Changed tests and pins, and why

  • translate.test.ts: the corpus size pin gains animator: 18; the other suites keep their sizes.
  • device-vectors.test.ts: the animator suite is declared with one case per frame case.
  • p1-floor.json: animator appended with DRAGON_FLOOR_WRITE=1; additions only.
  • New: packages/layout/test/rt-animator.test.ts (4 tests) and packages/translate/test/rt-animator.test.ts (3 tests).
  • No tolerance, check or test is loosened, skipped or removed.

Outside the spec

  • packages/layout/src/rt-animator.ts: the spec put the animator in emit/runtime/anim.ts, hand-written per language. Here it is one translated root.
  • packages/translate/harness/harness.ts, src/corpus.ts, src/generate.ts and test/rt-animator.test.ts: the animator suite.
  • packages/parity/src/cli/anim-vectors.ts and the parity:anim-vectors script.

North-star delta

None in this part: no row changes. Part 2's device-anim rows bring the −8 on ios and android.

Deferred (device step)

The device run of p1/animator through device-vectors is the landing driver's.

What passed

  • pnpm typecheck passes, and pnpm run layout:subset reports 0 violations.
  • pnpm run parity:anim-report against the committed Chrome captures, now through the translated root: 18 cases, 2328 samples (4880 values, 11704 boxes, 582 chrome-dual samples, 18 settles), failed 0.
  • anim-frames.test.ts: 21/21, and every runtime and rt plant still fails its own fixture.
  • /tmp/heavy-lease.sh pnpm run native:swift and native:kotlin: status pass, animator 18/18 on both.
  • Targeted runs pass: rt-animator (layout and translate), rt-vectors, rt-harness, translate, anim-frames, device-vectors, regen, ua, anim-program and chrome-ports (122 passed, 2 skipped).
  • Step-3 audit:
    • the rendered-table lookup now throws on a missing node, with a test that fails on the old silent false;
    • colorRgba8 agrees with serializeColor on rounding and alpha edge cases;
    • the advance step refuses negative, NaN and infinite steps;
    • an event to an assignment the tables lack is refused, and the suite treats a refusal as a build failure, not a computed result.
  • /tmp/heavy-lease.sh pnpm regen: fixed point, outputs in their own commit (Regenerate: pnpm regen).
  • /tmp/heavy-lease.sh pnpm test: Tests 15 failed | 4760 passed | 2 skipped (4777). Every failure is device step pending (lanes, lanes-records, device-failures, p6a-promotion, lanes-concurrent, land.test evidence:stamp), except planted-swift.test.ts, which timed out under machine load and passes when rerun alone.

🤖 Generated with Claude Code

…ator.ts) and its animator suite

The parity reference animator now wraps the translated root, so the Chrome frame lanes judge the code the generated Swift and
Kotlin run; the animator suite (rt-vectors/animator, harness op rt-animator, p1 suite after hit) checks the translations bit for
bit against it on the host and, through device-vectors, on device. No native runtime or row changes.
Commands: pnpm regen; pnpm run parity:devices; pnpm regen
@thejackshelton
thejackshelton merged commit 085f94a into master Oct 4, 2026
5 checks passed
@thejackshelton
thejackshelton deleted the anim-b1-native branch October 4, 2026 22:52
thejackshelton added a commit that referenced this pull request Oct 4, 2026
…itattributes keeps master's animator line in sorted order
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant