Skip to content

feat(visual): add layout:screenshot-one CLI - #3104

Merged
caio-pizzol merged 3 commits into
mainfrom
caio/SD-2900-layout-screenshot-one
May 4, 2026
Merged

feat(visual): add layout:screenshot-one CLI#3104
caio-pizzol merged 3 commits into
mainfrom
caio/SD-2900-layout-screenshot-one

Conversation

@caio-pizzol

@caio-pizzol caio-pizzol commented May 4, 2026

Copy link
Copy Markdown
Contributor

One-shot Playwright capture for a single .docx, mirroring layout:export-one. Boots the visual harness vite server, drives chromium directly without the test runner, writes one PNG per rendered page plus a metadata.json alongside.

A generic primitive intended for downstream evaluation tooling that compares SuperDoc page images against external references.

  • Output: <dir>/page-001.png, page-002.png, ..., metadata.json (capturedAt, docxSha256, pipeline, pageCount, viewport).
  • Pipeline flag mirrors layout:export-one (headless | presentation, default presentation).
  • Pre-flight: fails fast with an actionable error if packages/superdoc/dist is missing, instead of an opaque vite 500 from the harness.
  • One AIDEV-NOTE: on the harness superdocReady re-init coupling - harness/main.ts resets the flag on every file-input change, so we reset it ourselves before setInputFiles to avoid waiting on the stale empty-doc ready state.

Verified: smoke on evals/fixtures/docs/basic-list.docx (1 page) and employment-offer.docx (2 pages); PNGs 816x1056 (US Letter @ 96dpi), metadata correct.

One-shot Playwright capture for a single .docx mirroring layout:export-one.
Boots the visual harness vite server, drives chromium directly (no test
runner), writes one PNG per rendered page plus metadata.json. Used by the
render-parity artifact bundle to pair Word and SuperDoc renders.

The pre-flight checks that packages/superdoc/dist exists so callers see an
actionable error rather than an opaque vite 500 when the build is missing.
@caio-pizzol
caio-pizzol requested a review from a team as a code owner May 4, 2026 00:40
@linear

linear Bot commented May 4, 2026

Copy link
Copy Markdown

@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: 3f3f27f207

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread tests/visual/scripts/screenshot-one.ts
Comment thread tests/visual/scripts/screenshot-one.ts

@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: 3f3f27f207

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread tests/visual/scripts/screenshot-one.ts
Comment thread tests/visual/scripts/screenshot-one.ts
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@caio-pizzol caio-pizzol changed the title feat(visual): add layout:screenshot-one CLI (SD-2900) feat(visual): add layout:screenshot-one CLI May 4, 2026
@caio-pizzol caio-pizzol reopened this May 4, 2026
Address Codex review on #3104.

Partial capture (P1): replace `break` on scrollIntoView failure with a
throw, plus a post-loop captured != pageCount guard. The prior pattern
was lifted from the visual-test fixture where a soft skip is fine for
trailing blank pages, but for an artifact bundle a partial set silently
corrupts downstream pairing.

Stale images (P2): clear page-NNN.png from the output directory before
capture so reusing a directory across runs cannot leak old pages into
the current bundle. metadata.json continues to be overwritten.

Drop `pageCountReported` since pageCount and pageCountReported are now
invariantly equal under the throw-on-partial rule.
@caio-pizzol
caio-pizzol merged commit 43ac5e3 into main May 4, 2026
51 checks passed
@caio-pizzol
caio-pizzol deleted the caio/SD-2900-layout-screenshot-one branch May 4, 2026 10:12
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