Skip to content

websem: close the shared SVG offset attribute row - #118

Merged
softmarshmallow merged 1 commit into
mainfrom
rung/svg-offset
Aug 30, 2026
Merged

websem: close the shared SVG offset attribute row#118
softmarshmallow merged 1 commit into
mainfrom
rung/svg-offset

Conversation

@softmarshmallow

Copy link
Copy Markdown
Member

Verdict

CLOSE the shared SVG offset attribute row across both static consumer
families: gradient <stop> and <feFuncR>/G/B/A. The CSS motion
offset shorthand, <feOffset>, and animation remain separate open work.

The audit found and repaired a shipped silent wrong pixel in the stop route:
raw Rust f32 parsing selected a different adjacent value from Chromium's
ordered SVG-number evaluation. Component-transfer offset already used the
ordered evaluator; its distinct number-only grammar is now independently
celled.

What landed

  • Add a strict scalar SVG-number parser that shares the existing ordered
    evaluator without inheriting number-list separator recovery.
  • Route <stop offset> through it before binary32 percentage normalization.
    Stops accept one number or percentage, use initial zero for invalid text,
    clamp to [0, 1], then clamp to the running maximum; equal offsets preserve
    a hard transition.
  • Pin <feFunc*> offset as number-only with initial zero, Chromium's measured
    lone-trailing-comma prefix, gamma-only use, and invalid percentage fallback.
  • Add contract laws for both source-number witnesses and the scalar/list comma
    split.
  • Add four new Chromium cells through just add: stop grammar, stop number
    order, function grammar, and function number order.
  • Update the checklist, engine-of-record addendum, CLI statement of record,
    fixture catalog, generated status, manifests, and every current count.

Measured boundary

Chromium 149.0.7827.55 and both actual n0 admissions agree exactly on all four
committed cells. Every scratch candidate was captured twice through the shared
hash-pinned module and rendered through strict and best-effort n0; a clean
process exit was not treated as pixel proof.

The former stop route chose the wrong neighbour for two source classes:

  • 0.502541578243925989 is Chromium-identical to 0.50254154, not the raw
    parser's 0.5025416 neighbour.
  • 86.591846437450251439% is Chromium-identical to 86.59185%, not the raw
    route's 86.59184% neighbour.

The combined committed witness moves 48 pixels at maximum channel delta 202
under the old raw parser. The separate function witness makes
57384.267578125007 select 57384.265625, not 57384.26953125, and amplifies
that source choice through a second transfer.

The wider parser matrix established the consumer split: stops accept numbers
and percentages but reject a lone trailing comma; transfer functions accept
numbers only and retain that comma prefix. Units, trailing dots, calculations,
variables, CSS-wide keywords, comments, non-ASCII whitespace, extra members,
malformed exponents, finite extremes, and overflow all reach the measured
initial or clamped behavior. After the repair, no second silent mismatch class
remained. No refusal row was added because every valid class in this rung is
represented exactly.

Gate sensitivity

  • Restoring raw lexical f32 parsing made svg-stop-offset-grammar fail by
    144 pixels at maximum delta 202 and svg-stop-offset-number-order fail by
    48 pixels at the same maximum delta.
  • Ignoring gamma offset made twenty filter and pattern cells fail, including
    svg-filter-component-transfer-offset-grammar by 1,152 pixels at delta 191
    and the number-order cell by 1,344 pixels at delta 255.

Restoring each semantic branch returned the complete 1,047-cell gate to exact
green. No tolerance was added.

Checklist and counts

  • SVG attribute offset: [ ][x].
  • CSS motion offset: remains [ ].
  • Chromium-baked primitive cells: 1,043 → 1,047.
  • Filter estate: 451 → 453 cells.
  • Sampled frames: unchanged at 16.
  • Named refusal rows: unchanged at 198.
  • No conformance score was produced or inspected. FLIP's record, rule, and
    baseline are untouched.

Independent rung review

No Workflow runner is exposed in this environment, so
.agents/workflows/verify-rung.js could not be invoked through its
scriptPath. I reproduced its two independent roles by hand from the ignored
svg-offset.plan.md brief:

  • TICK/LAW: re-read the checklist rules and SVG attribute section, audited
    both complete applicabilities and their distinct grammars, verified that
    only the SVG attribute row ticks, traced the silent defect through its API
    contract, and checked the no-matcher, no-silent-pixel, no-score, and FLIP
    laws.
  • REPRO: reran the twice-deterministic Chromium/parser matrices and both n0
    admissions, checked that all four oracles are additions, verified both
    1,047-entry ledgers are unique and hash-current, proved sensitivity in both
    consumer paths, rebaked every oracle, and reran exact gate/status checks.

The skeptical pass caught and corrected an initial documentation edit that
would have ticked the unrelated CSS motion property; the final diff changes
exactly one checklist status, the SVG attribute row.

Verification

  • cargo test -p websem -p n0_cli -p rframe -p n0
  • focused ordered-number, gradient-offset, and component-transfer contracts
  • cargo fmt --all and cargo fmt --all -- --check
  • cargo clippy --no-deps
  • cargo clippy --no-deps --workspace --exclude grida-canvas-wasm -- -D warnings
  • just bake (Chromium 149.0.7827.55; 1,047 oracles)
  • just gate
  • just status
  • local relative Markdown-link validation (26 targets)
  • pnpm fmt:check
  • pnpm exec oxlint --deny-warnings
  • pnpm --filter www types:check
  • pnpm --filter www build
  • pnpm --filter @grida/reftest typecheck
  • pnpm --filter @grida/reftest build
  • pnpm --filter @grida/reftest test (51 passed, 1 skipped)
  • pre-PR OSS diff audit and git diff --check

@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
nothing Ready Ready Preview Aug 30, 2026 12:46pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5ecb0d21-ed27-4dbc-96f4-d47300e78942

📥 Commits

Reviewing files that changed from the base of the PR and between 71e4e23 and b13804a.

⛔ Files ignored due to path filters (8)
  • fixtures/web-first/chromium/svg-filter-component-transfer-offset-grammar.png is excluded by !**/*.png
  • fixtures/web-first/chromium/svg-filter-component-transfer-offset-number-order.png is excluded by !**/*.png
  • fixtures/web-first/chromium/svg-stop-offset-grammar.png is excluded by !**/*.png
  • fixtures/web-first/chromium/svg-stop-offset-number-order.png is excluded by !**/*.png
  • fixtures/web-first/svg-filter-component-transfer-offset-grammar.svg is excluded by !**/*.svg
  • fixtures/web-first/svg-filter-component-transfer-offset-number-order.svg is excluded by !**/*.svg
  • fixtures/web-first/svg-stop-offset-grammar.svg is excluded by !**/*.svg
  • fixtures/web-first/svg-stop-offset-number-order.svg is excluded by !**/*.svg
📒 Files selected for processing (11)
  • crates/n0_cli/README.md
  • crates/websem/src/svg_number_list.rs
  • crates/websem/src/svg_paint_server.rs
  • crates/websem/tests/filter_contract.rs
  • crates/websem/tests/gradients_contract.rs
  • docs/wg/consolidation/svg-engine-of-record.md
  • docs/wg/consolidation/web-checklist.md
  • fixtures/web-first/README.md
  • fixtures/web-first/STATUS.md
  • fixtures/web-first/oracle-bake.json
  • fixtures/web-first/primitives.json

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The change adds scalar SVG number parsing, updates gradient-stop and component-transfer offset handling, and adds four Chromium-backed contract fixtures. Documentation and corpus counts now record the completed offset coverage.

Changes

SVG offset closure

Layer / File(s) Summary
Scalar number parsing
crates/websem/src/svg_number_list.rs
Adds parse_one for complete scalar SVG numbers. Tests cover whitespace, precision, list syntax, units, incomplete values, and non-ASCII whitespace.
Offset consumer behavior
crates/websem/src/svg_paint_server.rs, crates/websem/tests/filter_contract.rs, crates/websem/tests/gradients_contract.rs, crates/n0_cli/README.md, docs/wg/consolidation/*
Stop offsets use scalar parsing, percentage normalization, and invalid-value fallback. Transfer-function offsets retain measured comma behavior and apply only to gamma functions. Contract tests cover ordered evaluation and grammar differences.
Fixture and capability records
fixtures/web-first/README.md, fixtures/web-first/STATUS.md, fixtures/web-first/oracle-bake.json, fixtures/web-first/primitives.json
Adds four Chromium-baked cells and updates fixture metadata, status listings, corpus counts, and audit records.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to b1380

The PR aligns existing SVG offset parsing with browser behavior while preserving bounded fallback and clamping, with focused tests and fixtures covering the changed cases. No actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant SVGInput
  participant stop_offset
  participant parse_one
  participant GradientRenderer
  participant ComponentTransfer
  participant GammaTable
  SVGInput->>stop_offset: stop offset text
  stop_offset->>parse_one: parse one SVG number
  parse_one-->>stop_offset: ordered scalar or None
  stop_offset->>GradientRenderer: normalized stop offset
  SVGInput->>ComponentTransfer: feFunc* offset
  ComponentTransfer->>GammaTable: gamma offset value
  GammaTable-->>ComponentTransfer: transfer table
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely states that the shared SVG offset attribute row is being closed, which matches the primary change.
Description check ✅ Passed The description is directly related to the changeset and explains the parser updates, consumer-specific offset behavior, tests, fixtures, documentation, and verification results.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 4 files. (7 skipped: 7 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 4 files. (7 skipped: 7 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rung/svg-offset

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.

@softmarshmallow
softmarshmallow merged commit 4af778b into main Aug 30, 2026
15 checks passed
@softmarshmallow
softmarshmallow deleted the rung/svg-offset branch August 30, 2026 13:14
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