Skip to content

feat(components): wire visual repetition into geometry report - #408

Open
wibus-wee wants to merge 4 commits into
geometry-geometric-row-discoveryfrom
feat/capture-mobile-viewports
Open

feat(components): wire visual repetition into geometry report#408
wibus-wee wants to merge 4 commits into
geometry-geometric-row-discoveryfrom
feat/capture-mobile-viewports

Conversation

@wibus-wee

@wibus-wee wibus-wee commented Sep 5, 2026

Copy link
Copy Markdown
Member

Related issue

Problem / pressure

Visual repetition mining existed as an algorithm prototype, but the real geometry capture plan did not run it and the report did not expose its evidence. That made it impossible to review what the heuristic finds on real Lody surfaces.

Summary

  • Project each persisted GeometryCapture into capture-local VisualAtom values.
  • Run visual repetition mining independently for every capture and persist visual-repetition.json.
  • Add ranked untriaged candidates, witness support, Fiber source evidence, capture filtering, and screenshot overlays to the geometry report.
  • Keep visual candidates outside GeometryFinding, the ledger, and the gate.
  • Exclude CSS-clipped content such as sr-only from visual measurement while retaining visible aria-hidden decorations.

Before / after

Before After
Visual repetition was covered by synthetic algorithm tests and a capture dump only. The existing 21-capture browser plan feeds visual mining and the report.
Reviewers could not see visual candidates beside existing geometry discovery. The report shows ranked candidates with dominant/peer witnesses and overlays.
CSS-clipped accessibility labels could pollute visual ranking. clip and clip-path content is excluded at the browser measurement boundary.

Test plan

  • corepack pnpm --filter @lody/components exec vitest run tests/geometry-discovery-visual-capture.test.ts
  • corepack pnpm --filter @lody/components exec playwright test tests/e2e/geometry-visual-capture.spec.ts --workers=1 --retries=0
  • corepack pnpm --filter @lody/components typecheck
  • corepack pnpm --filter @lody/components geometry:report /tmp/lody-geometry-report-pr-check-after
  • The full geometry report passed with 21 captures, 1,131 atoms, 1,122 candidates, and 78/80 screenshots.
  • A full components unit run was attempted but the checkout environment has unrelated React test failures (act is not a function) and an avatar-cache revalidation failure.

Context handoff

Instructions for reviewing agents

  • Review focus: Check the capture-to-report boundary in visual-capture.ts, the browser measurement exclusion in chat-workspace-geometry.ts, and the report's witness/overlay rendering.
  • Decisions to challenge: Validate capture-local atom identity, visual rather than structural grouping, and keeping candidates outside findings, ledger, and gate.
  • Plausible failures / evidence gaps: The heuristic remains recall-first and may rank legitimate cross-region SVG patterns highly; cross-capture corroboration and candidate promotion are intentionally deferred.

Authoring context

  • User goal / directives: Connect visual repetition mining to the existing geometry capture matrix and make its real discoveries reviewable.
  • Constraints / non-goals: Preserve the existing capture plan and geometry pipeline; do not promote visual candidates into findings, ledger, or gate in this change.
  • Risk-bearing decisions: Atom ids and dominant/peer witnesses are capture-local evidence only; no durable finding identity is derived from them.
  • Destructive or irreversible behavior: None. The change writes report artifacts and screenshots during the existing local report workflow.
  • Deliberately not done or tested: No cross-capture aggregation or candidate-to-finding promotion; full package tests remain affected by unrelated environment failures described above.
  • Unknowns / confidence: Real report generation is verified; ranking quality beyond the observed report still needs human review, especially for cross-region visual series.

The authored contracts only find what a reviewer already wrote down, and
they name their members by DOM shape — row family, role, accessible name.
That hides the defects worth finding: a layout bug comes from two code
paths rendering one visual thing differently, so it correlates with the
structural difference, and a structural key files the two paths into
different groups and never compares them.

So group by what renders alike and mine the expected edge from what the
run's best-supported level actually does. Nobody writes down that the
indent step is 26px; it is counted. Bias is recall — candidates are
ranked, never filtered — so a legitimate indent ladder comes back too and
sorts below the stray, whose level has no company.

Not wired to the capture run or the gate: a recall-first pass that blocks
CI has one natural remedy, raising its thresholds, which destroys the
recall it exists for.

Model: claude-opus-5[1m]

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-05T12:43:52.992819Z 0715aa2 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 545e26de06

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +258 to +259
const axis = seriesAxis(group);
for (const run of splitIntoSeries(group, axis, seriesBreakRatio, minimumSeriesLength)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Infer orientation after isolating each visual series

When one signature occurs in multiple side-by-side vertical lists, seriesAxis(group) measures the entire page-wide group before those lists are separated; if their horizontal separation exceeds their vertical span, it classifies them as one horizontal series. splitIntoSeries then orders by X (often producing zero gaps for same-column atoms), emits false Y/pitch deviations for an otherwise regular grid, and never checks either list's X alignment. Partition local series before selecting an orientation for each one.

AGENTS.md reference: packages/components/src/lib/geometry-discovery/AGENTS.md:L46-L48

Useful? React with 👍 / 👎.

@wibus-wee
wibus-wee marked this pull request as draft September 5, 2026 03:12
@wibus-wee wibus-wee changed the title feat(components): mine layout deviations from visual repetition feat(components): wire visual repetition into geometry report Sep 5, 2026
@wibus-wee
wibus-wee marked this pull request as ready for review September 5, 2026 10:39

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e9e90b2cca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

blockedRequests,
});
await writeFile(
'/tmp/geom-run/capture-one.json',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove the undeclared scratch-dump directory dependency

When pnpm --filter @lody/components test:e2e collects this new spec on a clean machine, nothing creates /tmp/geom-run, so writeFile throws ENOENT after the capture completes and fails the full E2E suite. Keep this debugging dump out of the suite or write through a test-managed output path/create the directory first.

AGENTS.md reference: AGENTS.md:L127-L130

Useful? React with 👍 / 👎.

Comment on lines +718 to +719
(style.clip === 'auto' || style.clip === '') &&
style.clipPath === 'none' &&

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Check primitive ancestors for clipping

When a visually hidden wrapper carries clip or clip-path but its child owns the text, SVG, or image primitive, the child's computed values remain auto/none; isRendered therefore admits the child even though the ancestor clips all its pixels, allowing its nonzero layout/range bounds to pollute visual-repetition candidates. Check the ancestor chain up to the capture boundary rather than only the primitive itself.

AGENTS.md reference: packages/components/tests/e2e/support/AGENTS.md:L23-L26

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0715aa24df

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

*/
function visualSignature(atom: VisualAtom, heightTolerance: number): string {
const height = atom.yEnd - atom.yStart;
const bucket = heightTolerance > 0 ? Math.round(height / heightTolerance) : height;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Group nearby heights without hard bucket boundaries

When visually identical primitives have fractional heights on opposite sides of a rounding boundary—for example, 15.49px and 15.51px with the default 1px tolerance—this assigns them different signatures despite their 0.02px difference. Either subgroup can then fall below minimumSeriesLength, so genuine alignment deviations are never compared or reported. Form height groups by distance to a representative anchor, as the coordinate-level grouping already does, rather than by Math.round.

AGENTS.md reference: packages/components/src/lib/geometry-discovery/AGENTS.md:L25-L28

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant