Skip to content

Model v2 anchor#970

Draft
softmarshmallow wants to merge 31 commits into
mainfrom
model-v2-anchor
Draft

Model v2 anchor#970
softmarshmallow wants to merge 31 commits into
mainfrom
model-v2-anchor

Conversation

@softmarshmallow

@softmarshmallow softmarshmallow commented Jul 11, 2026

Copy link
Copy Markdown
Member

The full redesign workbench for node geometry/layout/transform, scoped to
the Rust engine (crates/grida) and the format spec (format/grida.fbs):

- phase 1-2 research corpus: problems, harnesses, peer study, candidate
  models (anchor / sheet / bake / wire) — anchor decided by survey
- the 114-test Rust lab (model-v2/a/lab): four-phase resolver (Taffy flex,
  oriented envelopes), typed ops incl. cross-zero flip resize (E-A14),
  canonical text IR, node-arena + SOA storage (11.5x resolver speedup)
- the decision register (a/DECISIONS.md) with DEC-0 LOCKED: visual-only
  rotation (the CSS framing), CSS-pure sizing (a/dec0-visual-only.md)
- peer-compat matrix (COMPAT), ship-readiness census (LIMITS), report
- demo pages (a/.preview): proof, model walkthrough, edge cases, DEC-0
  fork A/B, free editing
- E10: the native skia interactive spike (a/spike-canvas) — feel pass +
  TEXTBOOK.md, the reference for the legacy migration

Isolated: nothing outside model-v2/ is touched; no production code paths.
…nce the snapshot)

The lab's accumulated evolution on the anchor branch since the textbook
snapshot, across two threads — the seams anchor-engine consumes and the DEC-0
visual-only feel study — plus a crate-wide rustfmt pass. 121-test suite green.

Engine seams (additive; serde stays out of default deps):
- ops.rs: typed `Op` + pure-dispatch `apply` (journal/replay/dirty land on it;
  free fns kept, `apply ≡ free_fn` differential per variant) + `DirtyClass`
  parameterized on rotation-in-flow [ENG-1.2].
- model.rs: per-slot `generations` column + `gen_of` (semantic PartialEq
  ignores it — a storage artifact) [ENG-2.3].
- resolve.rs: non-panicking `box_opt`/`local_opt`/`aabb_opt`/`slot_count`.
- serde feature (default OFF) — the op-log wire; new tests accessors,
  generations, op_apply.

Visual-only exploration: rotation scenes added to the edge/fork probes (grow ×
rotation, rotated text/frame/group) and expanded edge_census + visual_only
corpora anchoring DEC-0.
…spike re-hosted

anchor-engine: document → resolve → drawlist → paint, plus the read tier
(query), time-as-data (journal/replay), and the sockets every future
optimization plugs into (damage, ident, oracle). It consumes anchor-lab as a
library — the relationship the crates/grida migration will have with the model
crate. Every ENG-0…ENG-5 contract has a code socket and a guarding test;
skia is confined to paint.rs so a later core/paint split is mechanical.

The spike is re-hosted onto it (proof, not just scaffolding): the scene painter
is deleted → drawlist::build + paint::execute (4 goldens byte-identical, incl.
the rotated and cross-zero-flip scenes); pick/hover via query; gesture ops via
apply, recorded in the journal (undo stays document snapshots — ENG-5.5);
`--record` writes .replay corpus. The scene-cache compositor (ENG-2) rasters
once into a backend-matched offscreen and blits camera pans O(1), re-rastering
only on doc-change / zoom / pan-beyond-margin. Live per-stage frame
instrumentation (a glFinish GPU-vs-vsync split) plus render-on-demand (draw only
on real input) land the felt-latency fix.

gate (ENG-0.2 oracle law): shots 4/4 IDENTICAL · replays deterministic ·
scene-cache differential MATCHES fresh (integer pan) · bench within budgets.

Docs: ENGINE.md SETUP ground contracts (S-1…S-7), engine README (contract →
module → guarding-test map), model-v2 + a/README phase-4 status.
Performance is not one question, so it is not one tool — it splits on a hard
line between what a machine can measure alone and what needs a human. This is
the doctrine that stops us measuring the wrong axis (as a session's detour did:
render *work* was green while the felt lag lived in the *present path*).

MEASURE.md — the four axes and which tool owns each:
- work + correctness are automated & headless (probe / probe_gpu / gate) — the
  default loop, no human.
- feel & pacing need a real window: the opt-in ANCHOR_FRAMELOG channel (human
  runs + interacts + kills; the reviewer reads the per-frame gap/stage log). An
  on-demand bridge, not the iteration loop.
- input→photon latency is NOT software-measurable — the lag accrues in the OS
  compositor/display after swap_buffers returns; measuring it needs a photodiode
  rig or a human glance. Named so a green gate is never mistaken for good feel.

The automated work axis it documents:
- bin/probe — deterministic CPU raster, per-stage distributions, JSON baselines,
  panicking audit-guards. The always-on regression detector.
- bin/probe_gpu — headless surfaceless-GL, real flush_and_submit timing, for the
  wins whose value is a persistent GPU texture (CPU raster reports the wrong
  sign there).

Worked example folded in: render-on-demand (idle frames 466 → 2, throughput
125fps median — the symptom was pacing/latency, not work).
…L doctrine

Two gate-verified data-layout moves aligned to browser prior art, plus the
decisions doc that grounds them:

- Color: fill `Option<String>` → `model::Color(u32)` (0xAARRGGBB), read
  straight by the drawlist. No per-node heap String, no per-build hex parse;
  text-IR/SVG convert at the boundary via from_hex/to_hex. Parse byte-identical
  to the old resolve_color (pixels unchanged, gate 4/4 IDENTICAL); build −31% at
  100k nodes.
- Resolve caches: HashMap<NodeId,_> → Vec<Option<_>> (union_cache, ops_cache).
  NodeId is a dense arena index — hashing it is the cc anti-pattern. Correctness
  preserved (gate PASS, 121 lab tests).
- spike-canvas: `pages` stress scene (realistic nested flex cards, ANCHOR_SCENE
  selected) + --bench rows; goldens still use starter().
- engine/DATA-MODEL.md: six data-layout details decided against cc/Blink/Stylo/
  Skia prior art, validity-tagged (ALIGNED/ADOPTED/SOCKET), with honesty
  corrections to the record.
@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jul 13, 2026 3:35pm
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
backgrounds Ignored Ignored Preview Jul 13, 2026 3:35pm
blog Ignored Ignored Preview Jul 13, 2026 3:35pm
code Ignored Ignored Jul 13, 2026 3:35pm
grida Ignored Ignored Preview Jul 13, 2026 3:35pm
viewer Ignored Ignored Preview Jul 13, 2026 3:35pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0fec667a-ae10-4eea-973c-5ea682b3a64d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch model-v2-anchor

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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