Skip to content

fix(ci): make the visual harness truthful - build drafts, allow first baselines - #417

Merged
pftg merged 3 commits into
masterfrom
claude/devx-visual-gate-truth
Jul 31, 2026
Merged

pftg merged 3 commits into
masterfrom
claude/devx-visual-gate-truth

Conversation

@pftg

@pftg pftg commented Jul 31, 2026 •

Copy link
Copy Markdown
Member

Summary

The next DevX improvement per the approved plan (YAGNI-scoped: 3 files): make the new CI visual harness tell the truth. The first baseline-record dispatch (run 30629929407) failed — 104 screenshots compared clean, but 4 test failures blocked the commit step. Both root causes diagnosed from the job log and fixed:

1. CI test builds had no draft fixtures

test_codeblock_language_styles (desktop+mobile) failed with found 1 match: "File not found: /blog/codeblock-styles-fixture/" — the fixture is a draft post. Local runs build with --buildDrafts; bin/hugo-build only passes it when BUILD_DRAFTS is set, and nothing in CI set it. This made the new PR report-only gate noisy-by-construction (would fail on every PR). test.yml's setup-hugo step now sets BUILD_DRAFTS: '1'.

2. Record mode couldn't create first baselines

test_vibe_code_rescue (desktop+mobile) failed with No existing screenshot found for .../linux/desktop/vibe_code_rescue.base.png — snap_diff's fail_if_new hard-errors under ENV["CI"], and record mode only disabled fail_on_difference. Pages added after the last recording could never get a first CI-recorded baseline. setup_snap_diff.rb's record-mode block now disables fail_if_new too.

Both gotchas are recorded in .okf/build/ci-gates.md so nobody re-diagnoses them.

Verification

  • This PR touches test.yml → the paths filter fires the visual PR job on this very PR; it coming back green proves fix 1 end-to-end (fixture found, codeblock tests pass) with compare-mode semantics unchanged.
  • ruby -c + YAML parse clean.
  • After merge: dispatch Screenshot Tests with update-baselines: true — expected: green run + a chore: update screenshot baselines [ci skip] commit with the pinned-stack linux/ PNGs including NEW vibe_code_rescue baselines. That closes the last open re-baseline item.

Deferred (YAGNI, per plan): CI artifact-sharing, parallelization, blocking-mode flip (stays report-only until a clean soak week on real PRs).


🤖 Generated with Claude Code

https://claude.ai/code/session_01PXHeUErqoiyH9xN1mjC8cH


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved screenshot testing by including draft content in automated builds.
    • New screenshots can now be recorded as initial visual baselines without causing test failures.
  • Documentation

    • Added guidance for configuring screenshot tests when validating draft pages and recording new visual baselines.
    • Documented the related CI corrections for improved troubleshooting and consistency.

… baselines

The first CI baseline-record run (30629929407) failed with 4 test
failures and never committed baselines. Two root causes:

1. CI test builds lacked --buildDrafts: the codeblock-styles fixture is
   a draft post, so every CI visual run (including the new PR gate)
   404'd it and failed both codeblock tests - noisy-by-construction.
   test.yml now sets BUILD_DRAFTS='1' on its setup-hugo step
   (bin/hugo-build already reads it; matches local test builds).

2. snap_diff fail_if_new hard-errors on missing baselines under
   ENV["CI"], so record mode could never create a FIRST baseline for
   pages added since the last recording (vibe_code_rescue had no linux/
   baseline). Record mode (FORCE_SCREENSHOT_UPDATE=true) now disables
   fail_if_new alongside fail_on_difference.

Both gotchas recorded in .okf/build/ci-gates.md. After merge:
re-dispatch Screenshot Tests with update-baselines=true to land the
pinned-stack linux/ baselines (closes the pending re-baseline).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXHeUErqoiyH9xN1mjC8cH
@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@pftg, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 49 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b1f96f15-8fef-49fb-bd34-006467c32c96

📥 Commits

Reviewing files that changed from the base of the PR and between 699b458 and e275dae.

📒 Files selected for processing (3)
  • .github/workflows/test.yml
  • .okf/build/ci-gates.md
  • .okf/log.md
📝 Walkthrough

Walkthrough

The screenshot workflow now includes Hugo drafts. Forced screenshot updates now allow missing baselines. CI gate documentation and the visual-gate log record both changes.

Changes

Screenshot CI gate corrections

Layer / File(s) Summary
Configure screenshot gates
.github/workflows/test.yml, test/support/setup_snap_diff.rb, .okf/build/ci-gates.md, .okf/log.md
The workflow sets BUILD_DRAFTS: '1'. Forced screenshot updates disable fail_if_new, allowing initial baselines. CI documentation and the visual-gate log describe these requirements.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the CI visual harness changes for draft builds and first-time screenshot baselines.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/devx-visual-gate-truth

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/test.yml:
- Around line 64-67: Replace or supplement the unsupported incident assertions
with durable citations: in .github/workflows/test.yml lines 64-67, cite the
draft-fixture 404; in .okf/build/ci-gates.md lines 52-55, cite both root causes;
and in .okf/log.md lines 5-12, cite the failures and Linux re-record. Use one
shared CI run, issue, or verification artifact where it supports all claims.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a63136cc-3de2-4ed5-b7ea-0982e41b220a

📥 Commits

Reviewing files that changed from the base of the PR and between d0154ee and 699b458.

📒 Files selected for processing (4)
  • .github/workflows/test.yml
  • .okf/build/ci-gates.md
  • .okf/log.md
  • test/support/setup_snap_diff.rb

Comment thread .github/workflows/test.yml Outdated
claude added 2 commits July 31, 2026 12:46
…eedback)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXHeUErqoiyH9xN1mjC8cH
The paths filter missed test/support/** (snap_diff/capybara config) and
the workflow file itself, so this PR's harness changes never triggered
the visual job - the gate could not test itself.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXHeUErqoiyH9xN1mjC8cH
@github-actions

Copy link
Copy Markdown
Contributor

@pftg
pftg merged commit 9963355 into master Jul 31, 2026
3 of 4 checks passed
@pftg
pftg deleted the claude/devx-visual-gate-truth branch July 31, 2026 13:01
pftg pushed a commit that referenced this pull request Jul 31, 2026
bin/README.md listed four scripts that do not exist (debug,
benchmark-dev, bunx, generate-cover-image) and omitted eleven that do
(qtest, dtest-all, setup-test-env, build-if-stale, hugo-build, ...).
Rewritten to match the actual directory contents.

.okf test-gates: drop the stale 'CI does NOT run screenshot diffs'
claim (superseded by #413/#417), record the shared build-if-stale
warm-tree flow, qtest untracked-file detection, and the .gitignore
dot-path gotcha that had kept the pre-push hook out of the repo.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXHeUErqoiyH9xN1mjC8cH
pftg added a commit that referenced this pull request Jul 31, 2026
* fix(devx): R3-1 - one truthful build path for every test runner

All four runners (test/qtest/dtest/dtest-all) now build through a shared
bin/build-if-stale helper that routes via bin/hugo-build (PurgeCSS
cold-start warm-up guard) and skips the rebuild on a warm tree:

- bin/test: DEST honors a caller-preset HUGO_DEFAULT_PATH and the build
  is skipped entirely under PRECOMPILED_ASSETS - un-breaks bin/dtest,
  whose container has no hugo and points at _dest/public-dtest
- bin/qtest: shares bin/test's _dest/public-test tree (warm reruns skip
  the ~26s rebuild it previously paid on every micro-commit), and
  --changed now counts untracked files (a brand-new pages/foo.css no
  longer exits 0 green with 'nothing to run')
- staleness list gains assets/ static/ package.json bun.lockb
- .githooks/pre-push: run each unit-test file in its own ruby
  invocation (ruby file1 file2 executes only file1) - and commit the
  hook itself: the .* gitignore rule had kept it out of the repo, so
  fresh clones got a hooksPath pointing at nothing (added !.githooks)
- bin_scripts_test: 3 new guards - no bare 'hugo --environment
  production' outside hugo-build/build-if-stale, pre-push multi-file
  ruby anti-pattern, bin/test HUGO_DEFAULT_PATH contract

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXHeUErqoiyH9xN1mjC8cH

* docs(devx): R3-1 - truthful bin/README, test-gates concept + log entry

bin/README.md listed four scripts that do not exist (debug,
benchmark-dev, bunx, generate-cover-image) and omitted eleven that do
(qtest, dtest-all, setup-test-env, build-if-stale, hugo-build, ...).
Rewritten to match the actual directory contents.

.okf test-gates: drop the stale 'CI does NOT run screenshot diffs'
claim (superseded by #413/#417), record the shared build-if-stale
warm-tree flow, qtest untracked-file detection, and the .gitignore
dot-path gotcha that had kept the pre-push hook out of the repo.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXHeUErqoiyH9xN1mjC8cH

* fix(devx): address review - rake guards entrypoint + deletion staleness

- New `rake test:guards` task (toolchain pins + bin scripts, ~2s) is the
  pre-push hook's single test entrypoint - repo-provided command instead
  of direct ruby file invocations, and structurally immune to the
  multi-file-ruby trap
- bin/build-if-stale staleness probe now includes directory mtimes:
  deleting a source file leaves nothing to be -newer, but bumps its
  parent dir - verified warm tree goes stale on a removed content file
- pre-push guard test asserts the rake entrypoint is present (no longer
  passes vacuously if the hook drops its test invocation)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXHeUErqoiyH9xN1mjC8cH

---------

Co-authored-by: Claude <noreply@anthropic.com>
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