Skip to content

Commit 1ba459a

Browse files
xuanruliclaude
andcommitted
style: collapse multi-line comments to single lines
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 5f11160 commit 1ba459a

8 files changed

Lines changed: 16 additions & 96 deletions

File tree

packages/cli/src/capture/captureCompositionFrame.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,7 @@ describe("installPageFunctionGuard", () => {
379379

380380
describe("DENSE_GEOMETRY_SEEK_OPTIONS", () => {
381381
it("is genuinely geometry-only — no post-seek settle waits at the 600-sample cap", () => {
382-
// Regression for the dense content_overlap grid: geometry (getBoundingClientRect)
383-
// is valid synchronously after setTime, so the dense pass must NOT inherit AUDIT's
384-
// rAF settle / font wait / paint sleep — those multiply by sample count into tens of
385-
// seconds. Any future edit that reintroduces a wait here must fail this test.
382+
// Dense pass must not inherit AUDIT's post-seek waits — geometry is valid synchronously after setTime, and waits multiply by sample count.
386383
expect(DENSE_GEOMETRY_SEEK_OPTIONS.animationFrameSettle).toBe("none");
387384
expect(DENSE_GEOMETRY_SEEK_OPTIONS.waitForFontsMs).toBe(0);
388385
expect(DENSE_GEOMETRY_SEEK_OPTIONS.settleMs).toBe(0);

packages/cli/src/capture/captureCompositionFrame.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,7 @@ export const AUDIT_SEEK_OPTIONS = {
1818
settleMs: 120,
1919
} as const;
2020

21-
// Genuinely geometry-only variant for the dense content_overlap re-sampling
22-
// grid. It keeps only the timeline setTime + preferred-target seek cascade and
23-
// drops EVERY post-seek wait — no rAF settle, no font wait, no paint-settle
24-
// sleep — because getBoundingClientRect geometry is valid synchronously once
25-
// GSAP has written the inline transforms at setTime; a geometry-only reader
26-
// never paints, so it needs none of the visual-stability waits. At up to
27-
// OVERLAP_MAX_SAMPLES seeks the full AUDIT settle (double rAF + up to 500ms
28-
// font wait + 120ms sleep) is ~30s of frame waits + ~72s of sleep with no DOM
29-
// work; this variant eliminates all of it.
21+
// Geometry-only seek for the dense content_overlap grid: getBoundingClientRect is valid synchronously after setTime, so drop all post-seek waits (rAF/font/sleep) that would multiply across the dense grid.
3022
export const DENSE_GEOMETRY_SEEK_OPTIONS = {
3123
...AUDIT_SEEK_OPTIONS,
3224
animationFrameSettle: "none",

packages/cli/src/commands/check.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,9 +1347,7 @@ describe("contrast candidate round-trip", () => {
13471347
});
13481348

13491349
describe("dense motion-overlap re-sampling", () => {
1350-
// The default grid is 9 base samples at index+0.5 (0.5,1.5,...,8.5) over a 9s
1351-
// composition; the collision below lives entirely inside (3.5, 4.5), a gap
1352-
// the sparse grid seeks straight past. Only the 8fps dense pass observes it.
1350+
// Collision lives inside (3.5, 4.5), a gap the sparse base grid seeks past; only the 8fps dense pass observes it.
13531351
const inBetweenGridWindow = (time: number): boolean => time >= 3.6 && time <= 4.4;
13541352

13551353
it("detects a content_overlap that occurs ONLY between two sparse grid samples", async () => {
@@ -1371,9 +1369,7 @@ describe("dense motion-overlap re-sampling", () => {
13711369
});
13721370

13731371
it("runs the dense pass even when sparse fingerprints are identical (aliased motion)", async () => {
1374-
// A constant geometry fingerprint no longer suppresses the pass: an
1375-
// animation aliased to the sparse grid has identical fingerprints yet still
1376-
// collides between samples — the false-negative the removed gate caused.
1372+
// Aliased motion has identical fingerprints yet still collides between samples — the false-negative the removed gate caused.
13771373
const driver = fakeDriver({
13781374
collectLayoutGeometry: vi.fn(async () => "static"),
13791375
collectLayout: vi.fn(async (_time: number) => []),

packages/cli/src/commands/layout-audit.browser.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,11 +1425,7 @@
14251425
return issues;
14261426
};
14271427

1428-
// content_overlap only, for the dense motion re-sampling grid (checkPipeline
1429-
// collectMotionOverlapSamples). Two free-positioned text blocks crossing mid-orbit
1430-
// collide for a fraction of a second the sparse layout grid seeks straight
1431-
// past; this reruns just the overlap detector — same collectSolidTextBlocks /
1432-
// overlapIssue 0.2-area threshold, no new detection surface — on a fine grid.
1428+
// Reruns only the overlap detector (same threshold, no new surface) on a fine grid for the dense motion re-sampling pass.
14331429
window.__hyperframesOverlapAudit = function auditOverlap(options) {
14341430
const time = options && typeof options.time === "number" ? options.time : 0;
14351431
const root =

packages/cli/src/utils/checkPipeline.ts

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -421,19 +421,9 @@ async function collectGridSamples(
421421
return collected;
422422
}
423423

424-
// content_overlap sampling density for the dense motion re-pass. The sparse
425-
// layout grid (default 9 points over multiple seconds) seeks straight past a
426-
// mid-orbit text-on-text crossing that only overlaps for a fraction of a
427-
// second: an in-corpus orbit (samples/fuzz016) collides at 28% area for ~0.4s,
428-
// entirely between two adjacent base samples. 8fps (~0.125s spacing) lands
429-
// enough samples inside a window that narrow to observe it. Overlap collection
430-
// is text-only (collectSolidTextBlocks), far cheaper than a full layout audit,
431-
// so a fine grid here is affordable where densifying every detector would not.
424+
// Dense grid catches mid-motion text collisions the sparse layout grid seeks past; text-only overlap collection is cheap enough to afford it.
432425
const OVERLAP_SAMPLE_FPS = 8;
433-
// Absolute ceiling on dense seeks so the pass stays bounded. This holds a true
434-
// 8fps grid for compositions up to OVERLAP_MAX_SAMPLES / OVERLAP_SAMPLE_FPS
435-
// (~75s); longer compositions degrade below 8fps rather than growing the seek
436-
// budget without limit. (Corpus compositions run 7-8s, well inside 8fps.)
426+
// Ceiling that bounds dense seeks; past ~75s the grid degrades below 8fps rather than growing the seek budget without limit.
437427
const OVERLAP_MAX_SAMPLES = 600;
438428

439429
function buildOverlapSampleTimes(duration: number): number[] {
@@ -448,23 +438,7 @@ function buildOverlapSampleTimes(duration: number): number[] {
448438
);
449439
}
450440

451-
/**
452-
* Dense motion-overlap re-sampling. Reruns ONLY content_overlap on a fine time
453-
* grid so transient text collisions during continuous motion are observed at
454-
* all — the detector itself is unchanged (same 0.2-area threshold), only the
455-
* sampling density is.
456-
*
457-
* This runs UNCONDITIONALLY (bounded + text-only), NOT gated on sparse-grid
458-
* geometry fingerprints changing. That gate was the motivating false-negative:
459-
* an animation aliased to the sparse grid (the same pose sampled at every base
460-
* point) has identical fingerprints yet still collides *between* those samples,
461-
* so gating on fingerprint change skipped the exact transient this pass exists
462-
* to catch. A static composition simply yields no overlaps at the extra times,
463-
* so the only cost of running always is a bounded set of cheap text-only seeks.
464-
* Findings feed the existing collapse/persistence tiering (a graze stays info,
465-
* a held collision re-promotes to error). Skips times already in the base grid
466-
* to avoid double-collecting overlaps collectLayout already found.
467-
*/
441+
/** Reruns content_overlap on a fine grid, unconditionally rather than gated on fingerprint change, since an animation aliased to the sparse grid collides between identical-fingerprint samples. */
468442
async function collectMotionOverlapSamples(
469443
driver: CheckAuditDriver,
470444
grid: SampleGrid,
@@ -473,12 +447,7 @@ async function collectMotionOverlapSamples(
473447
const baseTimes = new Set(grid.layoutSamples);
474448
for (const time of buildOverlapSampleTimes(grid.duration)) {
475449
if (baseTimes.has(time)) continue;
476-
// Settle-free seek: collectOverlap reads getBoundingClientRect geometry
477-
// only, which is valid synchronously after the timeline setTime (GSAP
478-
// writes inline transforms synchronously). The dense pass makes up to
479-
// OVERLAP_MAX_SAMPLES seeks, so skipping the 120ms per-seek paint settle
480-
// here (vs. the full-settle driver.seek the base grid uses to feed
481-
// contrast/rotation/frame checks) removes ~72s of pure sleep at the ceiling.
450+
// Settle-free seek: collectOverlap reads getBoundingClientRect geometry, valid synchronously after setTime, so the dense pass skips the per-seek paint settle.
482451
await driver.seekGeometry(time);
483452
collected.layoutIssues.push(...(await driver.collectOverlap(time)));
484453
}

packages/cli/src/utils/checkTypes.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,10 @@ export interface CheckAuditDriver {
173173
getCanvas(): Promise<Canvas>;
174174
findAmbiguousSelectors(selectors: string[]): Promise<AnchoredLayoutIssue[]>;
175175
seek(time: number): Promise<void>;
176-
/** Cheap settle-free seek for the geometry-only dense content_overlap pass:
177-
* setTime + timeline seek with no paint-settle sleep. Only collectOverlap
178-
* (getBoundingClientRect geometry) consumes the result, which is valid
179-
* synchronously after setTime — see checkPipeline collectMotionOverlapSamples. */
176+
/** Settle-free seek for the geometry-only dense content_overlap pass; only collectOverlap consumes it, and getBoundingClientRect is valid synchronously after setTime. */
180177
seekGeometry(time: number): Promise<void>;
181178
collectLayout(time: number, tolerance: number): Promise<AnchoredLayoutIssue[]>;
182-
/** content_overlap only, for the dense motion re-sampling grid — catches
183-
* transient text-on-text collisions the sparse layout grid seeks past. See
184-
* checkPipeline detectMotionTextOverlap. */
179+
/** content_overlap only, for the dense re-sampling grid — catches transient text collisions the sparse grid seeks past. */
185180
collectOverlap(time: number): Promise<AnchoredLayoutIssue[]>;
186181
/** Frozen-sweep guard (#U10): an opaque per-sample geometry+opacity
187182
* fingerprint of the current seeked state, for detecting a timeline that

packages/cli/src/utils/layoutAudit.test.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ describe("persistence-tiered severity (#U10)", () => {
228228
});
229229

230230
it("keeps a content_overlap that spans under the 500ms floor as a warning, even with 2 occurrences", () => {
231-
// Two occurrences from the dense 8fps re-pass span only ~125ms — under the
232-
// held-duration floor, so occurrences>=2 alone must NOT promote to error.
231+
// Two dense-pass occurrences ~125ms apart are under the held-duration floor, so occurrences>=2 alone must not promote to error.
233232
const collapsed = collapseStaticLayoutIssues(
234233
[
235234
{ ...issue("content_overlap", "warning"), time: 4.0 },
@@ -243,9 +242,7 @@ describe("persistence-tiered severity (#U10)", () => {
243242
});
244243

245244
it("does NOT promote content_overlap whose two occurrences span exactly 499ms (under the floor)", () => {
246-
// Boundary: a two-occurrence span one millisecond short of the 500ms floor
247-
// stays a warning. Guards the AND-tighten for sparse callers (--samples 20,
248-
// --at, short comps) whose two samples can land <500ms apart.
245+
// Boundary: a span one millisecond short of the 500ms floor stays a warning — guards the AND-tighten for sparse callers.
249246
const collapsed = collapseStaticLayoutIssues(
250247
[
251248
{ ...issue("content_overlap", "warning"), time: 4.0 },

packages/cli/src/utils/layoutAudit.ts

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -181,25 +181,7 @@ export function dedupeLayoutIssues(issues: LayoutIssue[]): LayoutIssue[] {
181181
return result;
182182
}
183183

184-
// Persistence-tier thresholds (#U10, adapted from Adam Rosler's visual-linter
185-
// design). The approach doc frames these as held-duration floors — ignore
186-
// under ~250ms, re-promote content_overlap at >= ~500ms — measured against the
187-
// SAME firstSeen/lastSeen span this collapse step already tracks. `occurrences`
188-
// is a NECESSARY guard (one sample can't span any duration), but it is NOT a
189-
// sufficient proxy for the 500ms floor: the dense content_overlap re-pass
190-
// (checkPipeline collectMotionOverlapSamples) samples at 8fps, so two adjacent
191-
// occurrences there span only ~125ms — the old "occurrences >= 2 => held >=
192-
// 500ms" shortcut held only for the coarse ~1s-spaced base grid and breaks
193-
// under dense sampling. content_overlap promotion therefore requires BOTH
194-
// occurrences >= 2 AND a literal firstSeen..lastSeen span >= 500ms, so the
195-
// wall-clock floor is honored regardless of sampling density. The ~250ms
196-
// ignore floor needs no separate constant — see the occurrences <= 1 branch.
197-
//
198-
// SEMANTICS CHANGE (intentional): this is stricter than the prior
199-
// occurrences >= 2 => error rule for SPARSE callers too, not only the dense
200-
// pass. Under `--samples 20`, `--at`, or a short composition, two adjacent
201-
// samples can land < 500ms apart; such a pair now stays a warning instead of
202-
// auto-promoting to error. Only a genuinely held (>= 500ms) collision promotes.
184+
// Persistence-tier thresholds (#U10): occurrences>=2 alone can't imply the 500ms floor under dense 8fps sampling, so content_overlap promotion requires a literal firstSeen..lastSeen span >= 500ms — stricter for sparse callers too.
203185
const CONTENT_OVERLAP_HELD_ERROR_MS = 500;
204186
const HELD_ACROSS_SAMPLES_MIN_OCCURRENCES = 2;
205187

@@ -321,13 +303,9 @@ function isCanvasBreachHeldLarge(issue: LayoutIssue, occurrences: number): boole
321303
return overlapX > 0 && overlapY > 0;
322304
}
323305

324-
// Split out of applyPersistenceTier so the compound "held long enough" test
325-
// (>= 2 samples AND wall-clock span >= the ms floor) reads as one boolean
326-
// question instead of adding a compound branch to the tiering ladder above.
306+
// Split out of applyPersistenceTier so the compound "held long enough" test reads as one boolean question.
327307
function isContentOverlapHeldLongEnough(issue: LayoutIssue, occurrences: number): boolean {
328-
// Need at least two samples to measure a span at all, AND that span must
329-
// clear the wall-clock floor — dense 8fps re-sampling makes occurrences>=2
330-
// alone (potentially ~125ms) too weak to imply a genuinely held collision.
308+
// Two samples measure a span, but under dense 8fps sampling that span must still clear the wall-clock floor.
331309
if (occurrences < HELD_ACROSS_SAMPLES_MIN_OCCURRENCES) return false;
332310
const firstSeen = issue.firstSeen ?? issue.time;
333311
const lastSeen = issue.lastSeen ?? issue.time;

0 commit comments

Comments
 (0)