Skip to content

fix(devx): make bin/test green + fast - root-relative builds, restore-on-green baselines - #424

Merged
pftg merged 4 commits into
masterfrom
emdash/funny-ends-beam-a7wgs
Jul 31, 2026
Merged

fix(devx): make bin/test green + fast - root-relative builds, restore-on-green baselines#424
pftg merged 4 commits into
masterfrom
emdash/funny-ends-beam-a7wgs

Conversation

@pftg

@pftg pftg commented Jul 31, 2026

Copy link
Copy Markdown
Member

Summary

Host bin/test failed 49/49 screenshots (~11 min per red run) while bin/dtest stayed green, and every passing run left the fixture tree dirty, blocking the next run. Two root causes, both fixed:

  1. Absolute baseURL vs random port: the R2 fast path built with BASE_URL=http://localhost:1314, but Capybara boots Puma on a random port on the host (TEST_SERVER_PORT is only pinned in Docker). Every external stylesheet and clicked link hit a dead port: all screenshots diffed (half-styled pages on a dark-mode UA background) and click-navigation tests landed on ERR_CONNECTION_REFUSED. Test builds now use baseURL "/" - the same convention CI (setup-hugo), bin/qtest, and Hugo#precompile already used.
  2. Dirty-baseline trap: snap_diff rewrites baseline PNGs in place on every run (working tree = candidate, HEAD = baseline), so each green run - including dtest's ~0.004%/run Rosetta drift - left the tree dirty and armed the dirty-fixture guard against the next run. Green runs of bin/test/bin/dtest/bin/qtest now auto-restore test/fixtures/screenshots; red runs keep candidates + diff artifacts; FORCE_SCREENSHOT_UPDATE re-records are exempt.

Commits

  • 88bfd59b fix(devx): root-relative test builds + restore-on-green baselines - the two fixes above, plus: bin/qtest --all escalation routes through bin/test (inherits build-skip + restore), and bin/dtest reuses a warm Hugo build via the same mtime staleness check as bin/test (~12s/rerun).
  • a7d58a40 chore: re-record 12 macos screenshot baselines - recorded with the fixed build (full test:system: 67 runs, 0 failures). Only pages with real content changes since the last macos recording (blog index/pagination with the Wave G posts, course landing/chapter, testimonials, special posts, mobile nav) - mirroring the linux re-record CI committed in 2edb94d9. Brightness-audited (an earlier record attempt under the port bug saved Chrome error pages as baselines; caught and discarded) and visually spot-checked: blog index, course landing, homepage services all render fully styled.
  • a33cc4d3 docs(okf): test-gates - both caveats captured in .okf/build/test-gates.md + log.

Verification

  • bin/dtest: 34 runs, 0 failures; tree clean afterwards (restore verified on two independent runs, including Paul's own).
  • bin/test (host): 34 runs, 0 failures, 53 screenshots matched, 5:01 warm; tree clean afterwards. Previously: 29 failures + 2 errors in ~11 min.
  • Negative path: injected a banner into the built 404 page - run went red, candidate + heatmap/diff artifacts preserved, no auto-restore.
  • Back-to-back bin/dtest then bin/test: no dirty-fixture guard trip.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Testing
    • Improved screenshot test reliability by using root-relative URLs.
    • Successful test runs now restore screenshot baselines automatically.
    • Failed runs preserve artifacts for troubleshooting.
    • Added an explicit option to retain updated screenshot baselines.
    • Added faster reuse of existing build output when sources are unchanged.
  • Documentation
    • Expanded testing guidance with baseline, artifact, URL, and concurrent-edit considerations.
    • Recorded recent fixes and testing workflow updates.

@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: 6735b474-f1b7-4646-ae53-8a6d57c85746

📥 Commits

Reviewing files that changed from the base of the PR and between a33cc4d and 7120006.

⛔ Files ignored due to path filters (12)
  • test/fixtures/screenshots/macos/desktop/blog/index.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/desktop/blog/index/_pagination.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/desktop/blog/special/youtube_post.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/desktop/clients/_testimonials.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/desktop/course/chapter.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/desktop/course/landing.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/mobile/blog/index.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/mobile/blog/index/_pagination.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/mobile/blog/special/code_highlight_post.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/mobile/course/chapter.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/mobile/nav/hamburger_menu.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/mobile/nav/hamburger_menu/services.png is excluded by !**/*.png
📒 Files selected for processing (6)
  • .okf/build/test-gates.md
  • .okf/log.md
  • bin/build-if-stale
  • bin/dtest
  • bin/qtest
  • bin/test
📝 Walkthrough

Walkthrough

Changes

Screenshot test flow

Layer / File(s) Summary
Build output and URL handling
bin/test, bin/dtest
Test builds use BASE_URL "/". bin/dtest reuses Hugo output when it is current and rebuilds stale or missing output.
Runner orchestration and fixture cleanup
bin/qtest, bin/test, bin/dtest
bin/qtest --all invokes bin/test. Successful runs restore screenshot fixtures unless FORCE_SCREENSHOT_UPDATE is enabled.
Testing contract and execution record
.okf/build/test-gates.md, .okf/log.md
The testing documentation and log describe URL requirements, fixture behavior, failure artifacts, and the corrected screenshot test flow.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant bin/qtest
  participant bin/test
  participant ScreenshotTests
  participant Git
  bin/qtest->>bin/test: run --all
  bin/test->>ScreenshotTests: execute tests
  ScreenshotTests-->>bin/test: success or failure
  bin/test->>Git: restore screenshot fixtures after success
Loading

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 summarizes the main changes: faster green bin/test runs, root-relative builds, and baseline restoration.
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 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch emdash/funny-ends-beam-a7wgs
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch emdash/funny-ends-beam-a7wgs

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.

pftg and others added 3 commits July 31, 2026 20:21
Two coupled workflow bugs made bin/test look wholesale broken:

- bin/test's R2 fast path baked BASE_URL=http://localhost:1314 into the
  built HTML while Capybara boots Puma on a RANDOM port (TEST_SERVER_PORT
  is only set in Docker). Every external stylesheet and every clicked
  link hit a dead port: 49/49 screenshots diffed (half-styled pages on a
  dark-mode UA background) and click-navigation tests landed on
  ERR_CONNECTION_REFUSED. Build with baseURL "/" instead - the same
  convention CI (.github/actions/setup-hugo), bin/qtest, and
  Hugo#precompile already use. Ports no longer matter.

- Every green run rewrites the baseline PNGs in place (snap_diff design),
  so dtest's sub-tolerance Rosetta drift (~0.004%/run) left ~54 linux
  PNGs dirty after every pass and the dirty-fixture guard then blocked
  every subsequent bin/test/bin/qtest until a manual reset. Green runs
  now restore test/fixtures/screenshots automatically (bin/test,
  bin/dtest, bin/qtest); red runs still keep candidates + diffs for
  inspection; FORCE_SCREENSHOT_UPDATE skips the restore so re-records
  survive. qtest's --all escalation now routes through bin/test to
  inherit the same behavior.

Also: bin/dtest reuses a warm build via the same mtime staleness check
as bin/test (~12s saved per rerun).

Co-Authored-By: Claude Fable 5 <[email protected]>
Recorded with the fixed root-relative build (full test:system, 67 runs,
0 failures). These are the pages whose content actually changed since
the last macos recording - blog index/pagination (Wave G posts), course
landing/chapter, testimonials, special posts, mobile nav - mirroring the
linux re-record CI committed in 2edb94d. Visually verified: blog index,
course landing, homepage services render fully styled.

Co-Authored-By: Claude Fable 5 <[email protected]>
@pftg
pftg force-pushed the emdash/funny-ends-beam-a7wgs branch from a33cc4d to e594b19 Compare July 31, 2026 18:22

@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: 2

🤖 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 @.okf/build/test-gates.md:
- Around line 50-68: In .okf/build/test-gates.md lines 50-68, add source links
for every factual assertion, including the test scripts, baseURL diagnosis,
observed failures, and retained verification output. In .okf/log.md lines
340-353, add citations for the verification output and baseline re-recording
evidence; ensure both artifacts contain no unsupported factual claims.

In `@bin/test`:
- Around line 59-67: Update the screenshot cleanup in bin/test (lines 59-67),
bin/dtest (lines 40-42), and bin/qtest (lines 192-194) to restore fixtures
explicitly from Git HEAD rather than the index, preserving intentionally staged
content. Ensure every runner guards cleanup on Git availability so Docker or
dtest environments without Git skip the restore safely.
🪄 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: 727d0f88-e957-4944-8479-2e15ff268e38

📥 Commits

Reviewing files that changed from the base of the PR and between 19eec53 and a33cc4d.

⛔ Files ignored due to path filters (12)
  • test/fixtures/screenshots/macos/desktop/blog/index.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/desktop/blog/index/_pagination.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/desktop/blog/special/youtube_post.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/desktop/clients/_testimonials.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/desktop/course/chapter.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/desktop/course/landing.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/mobile/blog/index.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/mobile/blog/index/_pagination.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/mobile/blog/special/code_highlight_post.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/mobile/course/chapter.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/mobile/nav/hamburger_menu.png is excluded by !**/*.png
  • test/fixtures/screenshots/macos/mobile/nav/hamburger_menu/services.png is excluded by !**/*.png
📒 Files selected for processing (5)
  • .okf/build/test-gates.md
  • .okf/log.md
  • bin/dtest
  • bin/qtest
  • bin/test

Comment thread .okf/build/test-gates.md Outdated
Comment thread bin/test
@pftg
pftg merged commit 569d291 into master Jul 31, 2026
4 checks passed
@pftg
pftg deleted the emdash/funny-ends-beam-a7wgs branch July 31, 2026 18:45
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.

1 participant