Skip to content

Renderer check: rounded edges drawn over what fills their corners (pk-frame) - #189

Merged
agorischek merged 7 commits into
mainfrom
agorischek/frame-check
Nov 22, 2026
Merged

agorischek merged 7 commits into
mainfrom
agorischek/frame-check

Conversation

@agorischek

@agorischek agorischek commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

This is step (b) of the polish plan. #185's frame rule becomes a renderer check that every renderer meets, custom ones included, and a class any container can opt into.

The check: frame-edges

A box with rounded corners and a visible edge (a border, or an outline inside it) whose painted contents reach a corner must draw its edge over them, in one of four ways:

  • a pseudo-element overlay on its own box: the kit's frame;
  • an overlay on an ancestor that shares that corner, such as a data table's frame;
  • an outline its contents sit under;
  • a fill that is itself the edge there, as a data table's rows are.

The rule is structural because renderer checks run in-page and can't read pixels. The harness's frames spec (#185) still measures the pixels for built-in renderers.

pk-frame

The kit's frame now works for any bordered, rounded container; Group is one user of it. It draws its border again over its contents, gives way to rings, clips to its outer edge, and takes its radius from --pk-frame-radius. The rules moved from .pk-group to .pk :is(.pk-group, .pk-frame).

A real violation, fixed

Gallery's scenario stage is a rounded, bordered box whose note and nested drawing fill it to its edge, over its border. Run against main's gallery, the check fails on gallery/fixture-change with p.gl-stage-note fills a rounded corner of div.gl-stage over its edge. The stage is now a pk-frame, and the check passes on all 77 scenarios.

gallery stage corner

Database cards pass: their changed rows draw their own edge at the card's curve, by design. Their WebKit-only thinning from the card's clip (0.91 of the sides, found in #185) is a pixel-level issue this structural rule doesn't express, and stays a follow-up.

Tests

  • A unit test covers the check's reporting: findings in light and dark appear once, with a count.
  • In frames.spec, the probe finds the gallery stage restored to main's construction (its own border, clipping its contents) and finds nothing once the stage is a kit frame.
  • Full renderer checks pass on chromium-desktop, webkit-desktop and chromium-mobile.
  • The frames, corners, rings, ring-pixels and edges specs pass, along with the code-statistics, gallery and kit browser specs.
  • Unit tests, tools check --fast and docs:check pass.
  • Docs: the testing README and the renderer guide list the new check.

Follow-up (1e43cd7): projections check of the self-authoring-sdk projection found a second violation. The api renderer's panel notice ("Showing 500 of N declarations") filled the panel's top corners over its border. .api-panel is a pk-frame now, and a synthetic api/large-surface scenario (600 declarations) shows the notice, so the harness sweep covers it (it fails without the fix). All five self-projections pass projections check --trust locally.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved frame-detection issues can miss unprotected corner fills or report false positives because radius fitting, paint transparency, overlay stacking, and iframe content are handled incorrectly.

5 open issues
What changed in this PR

Extends the rounded-frame work from #185 with a structural renderer check for built-in and custom renderers, and makes the kit’s frame styling reusable beyond Group.

Changes:

  • Adds frame-edges checks in light and dark modes.
  • Introduces reusable pk-frame styling and applies it to gallery stages.
  • Adds reporting and browser regression tests, plus documentation.
File Description
packages/​renderers/​testing/​test/​helpers.test.mjs Tests check results and grouped reporting.
packages/​renderers/​testing/​src/​types.ts Adds frame measurement and check types.
packages/​renderers/​testing/​src/​probe.ts Registers the frame measurement call.
packages/​renderers/​testing/​src/​measure/​frames/​overlays.ts Detects pseudo-element overlays at corners.
packages/​renderers/​testing/​src/​measure/​frames.ts Detects fills covering rounded edges.
packages/​renderers/​testing/​src/​measure.ts Exports the frame measurement.
packages/​renderers/​testing/​src/​checks/​runner.ts Registers the new check implementation.
packages/​renderers/​testing/​src/​checks/​edges.ts Runs frame checks across both color modes.
packages/​renderers/​testing/​src/​checks/​catalog.ts Adds the check’s title and description.
packages/​renderers/​testing/​README.md Documents the frame-edge contract.
packages/​renderers/​kit/​styles/​layout.css Shares frame styling between Group and pk-frame.
packages/​renderers/​harness/​browser/​frames.spec.ts Adds a gallery-stage probe regression test.
packages/​renderers/​gallery/​src/​styles.css Uses the shared frame radius and clipping.
packages/​renderers/​gallery/​src/​stage.tsx Applies pk-frame to gallery stages.
docs/​guides/​develop-a-renderer.md Adds rounded-edge guidance for renderer authors.

Review effort: Balanced

agorischek and others added 4 commits November 22, 2026 13:28
…-frame)

pixels for built-in renderers. This makes it a renderer check every renderer
meets, custom ones included, and a class any container can take.

- frame-edges (renderer check, probe call `frames`): a box with rounded
  corners and a visible edge (a border, or an outline inside it) whose
  painted contents reach a corner must draw its edge over them. That is a
  pseudo-element overlay on its box (the kit's frame) or on an ancestor
  sharing that corner (a data table's frame), an outline its contents sit
  under, or a fill that is the edge there itself (a data table's rows).
  Renderer checks can't read pixels, so the rule is structural; the harness
  frames spec still measures the pixels.
- `pk-frame`: the kit's frame, for any bordered, rounded container; Group is
  one. Its radius is `--pk-frame-radius`.
- Gallery's scenario stage, the one violation the check finds: its note and
  nested drawing filled it over its border. It is a `pk-frame` now.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
`projections check` of self-authoring-sdk (1894 entities) found the new
frame-edges violation: past 500 declarations the panel's notice fills its
top corners over its border. The panel is a `pk-frame` now, and a
synthetic large-surface scenario (600 declarations) shows the notice, so
the harness sweep covers it.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…g there

Since #185 a kit frame (Group, pk-frame) draws its edge in its ::after with
a rule that outweighs a renderer's own there, so a badge or label drawn in
it silently never shows, or moves the edge. frame-edges now reads the
stylesheets too: a rule whose ::after lands on a kit frame may recolor the
edge (border color, opacity, custom properties), and anything else fails.
The renderer kit guide, develop-a-renderer and the kit's CSS say so. No
built-in renderer draws there.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@agorischek
agorischek force-pushed the agorischek/frame-check branch from 1e1ba66 to 5924fd9 Compare November 22, 2026 21:33
agorischek and others added 2 commits November 22, 2026 14:06
…itted radii, nested frames and overlay stacking

Review follow-ups:
- Transparency is read with colorAlpha, so color(srgb 0 0 0 / 0) is clear.
- An inset shadow exempts a fill only where it draws a sharp, visible edge
  along that corner's side (offset toward it, or spread), not any inset shadow.
- Corner radii are resolved and fitted as CSS draws them (percentages,
  ellipses, a pill's 9999px), shared with the ring measure (fittedRadii).
- Replaced content (a nested renderer's iframe, an image) is a fill.
- An overlay draws the edge only when visible (opacity, border color) and
  stacked after the fill: a higher z-index, or the same as an ::after.
A harness test builds each case.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
agorischek added a commit that referenced this pull request Nov 22, 2026
…s what CI's would (#191)

With --fast or --affected, the format gate checked only changed files whose
extension matched a list that left out Markdown, so a misformatted guide passed
locally and failed CI's `oxfmt --check` (#189). It now runs `npm run
format:check`, CI's own command, in every mode: the whole tree takes under a
second, and a scoped list can only drift from what CI checks. A test asserts
the gate plans that command for a Markdown or .mjs change, scoped or not.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@agorischek
agorischek merged commit 81f497a into main Nov 22, 2026
51 checks passed
@agorischek
agorischek deleted the agorischek/frame-check branch November 22, 2026 23:48
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.

2 participants