fix(design): print and alternate stylesheets are not scanned as page CSS; no cross-run dump sweep; probe-state and design-system caveats in prose

- The dump inlined every linked sheet's rules as active CSS, so a print
  sheet's 12pt black text or an alternate theme produced tiny-text and
  palette findings the user never sees; disabled and alternate sheets are
  skipped and a media-scoped sheet is wrapped in its @media block.
- The cross-run dump sweep is gone: two same-day reviews shared REPORT_DIR
  and one run's sweep deleted the other's dumps mid-audit. Dumps stay per
  run, owner-only, deleted after Phase 9 unless --keep-dom (now defined in
  the prose), and an interrupted run's dumps wait for the user.
- Prose: design-system-* rows in DOM mode compare the page to THIS repo's
  DESIGN.md and apply only to the repo's own app; an empty scan JSON with
  exit 0 means the probe state changed since Setup (read stderr); the
  persist block names a missing dump instead of mislabeling it as a
  redaction block.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-09-08 18:55:37 +00:00
co-authored by Claude Fable 5.1
parent 69b0856d42
commit 3f207247a8
5 changed files with 30 additions and 10 deletions
+6
View File
@@ -41,10 +41,13 @@ describe.skipIf(!BROWSE || !POSIX || !OPTED_IN)('lib/dom-dump.js in a real DOM (
});
const big = 'data:image/png;base64,' + 'A'.repeat(1500);
fs.writeFileSync(path.join(site, 'styles.css'), '.hero { background: linear-gradient(135deg, #6366f1, #8b5cf6); } .x { background-image: url("' + big + '"); } .y { background: url("/y.png?token=SECRETCSS") }\n');
fs.writeFileSync(path.join(site, 'print.css'), '.p { font-size: 4px }\n');
fs.writeFileSync(path.join(site, 'alt.css'), '.alt { color: #ff00ff }\n');
fs.writeFileSync(path.join(site, 'index.html'), `<!DOCTYPE html><html><head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width"><meta name="description" content="SECRET DESCRIPTION">
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="http://127.0.0.1:1/cross-origin.css">
<link rel="stylesheet" media="print" href="print.css"><link rel="alternate stylesheet" href="alt.css" title="alt">
<script>window.__x = "SCRIPT BODY";</script></head><body>
<input value="SECRET INPUT"><textarea>SECRET TEXT</textarea>
<a href="/page?token=SECRET">link</a>
@@ -109,6 +112,9 @@ describe.skipIf(!BROWSE || !POSIX || !OPTED_IN)('lib/dom-dump.js in a real DOM (
expect(html).toContain('url("/y.png")');
expect(html).not.toContain('SECRETSRCDOC');
expect(html).not.toContain('SECRETXLINK');
expect(html).toMatch(/@media print \{[\s\S]*font-size: 4px[\s\S]*\}/); // a print sheet is scanned as print CSS, not as the page's styles
expect(html).not.toContain('#ff00ff'); // an alternate stylesheet is not active CSS
expect(html).not.toMatch(/<link[^>]*alt\.css/);
expect(html).toContain('srcset="/a.png 1x, /b.png 2x"');
expect(html).not.toContain('L'.repeat(40));
expect(html).toContain('data-short="ok"');