Skip to content

Improve checkout screenshot fixtures - #1868

Merged
stefan-burke merged 11 commits into
mainfrom
screenshot-followups
Jul 19, 2026
Merged

stefan-burke merged 11 commits into
mainfrom
screenshot-followups

Conversation

@stefan-burke

@stefan-burke stefan-burke commented Jul 19, 2026

Copy link
Copy Markdown
Member

What changed

  • configure a fake Stripe account in each temporary screenshot database
  • start a local Stripe mock for screenshot runs and pass its address to the app
  • clean up the Stripe mock, temporary database, and app process on startup failure or shutdown
  • show normal itemised totals in paid checkout screenshots instead of offline-payment messages
  • keep child quantity selectors the same compact width as parent quantity selectors

Why

The screenshot fixtures disabled online payments for every scenario. This made most paid checkout examples look like offline bookings, and child add-on quantity boxes stretched wider than the main ticket quantity box on mobile.

Checks

  • deno task precommit
  • screenshot startup failure, cleanup ordering, cleanup failure, and successful ownership tests
  • regenerated paid checkout scenarios for parent and child listings, groups, packages, modifiers, equipment hire, school events, custom questions, terms, and dark mode
  • browser scenario assertion confirms parent and child quantity controls have equal rendered widths
  • paid screenshot submission received a Stripe Checkout redirect through the local mock

Risk

The fake Stripe settings and Stripe mock exist only for each throwaway screenshot run. They are not used by production or test databases.

Summary by CodeRabbit

  • Bug Fixes

    • Improved the sizing of quantity selectors, including both standard quantity and child-quantity controls, so they display consistently with other quantity UI elements.
  • Tests

    • Updated screenshot test setup to centralize mock billing and temporary database activation for more reliable automated scenario captures.
    • Added/expanded test coverage to verify startup cleanup ownership and correct failure behavior, including reverse-order cleanup, error rethrow, and cleanup error aggregation.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7310b05a-6bf2-4b57-b5a3-617be3f28e0c

📥 Commits

Reviewing files that changed from the base of the PR and between f3cf318 and a912079.

📒 Files selected for processing (3)
  • scripts/screenshots.ts
  • scripts/screenshots/server.ts
  • test/scripts/screenshots-server.test.ts

📝 Walkthrough

Walkthrough

Screenshot automation now centralizes temporary database and Stripe setup in AppServer, adds failure cleanup for Stripe mock startup, and updates capture flows to use the server contract. Child quantity selectors also receive shared label sizing constraints.

Changes

Screenshot automation

Layer / File(s) Summary
Server database, Stripe, and cleanup setup
scripts/screenshots.ts, scripts/screenshots/server.ts, test/scripts/screenshots-server.test.ts
AppServer manages temporary database and Stripe configuration, startup failures clean up acquired resources, and tests cover cleanup ordering, ownership, and aggregated failures.
Capture flow integration
scripts/screenshots.ts
setupApp(), captureScenario(), and main() use the AppServer instance for URL resolution and Stripe setup.

Quantity selector styling

Layer / File(s) Summary
Child quantity selector sizing
src/ui/static/style.scss
The shared label-contained select sizing rule now matches names beginning with child_qty_ in addition to quantity_.

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

Sequence Diagram(s)

sequenceDiagram
  participant ScreenshotRunner
  participant StripeMock
  participant AppServer
  ScreenshotRunner->>StripeMock: Start mock
  ScreenshotRunner->>AppServer: Start with database and Stripe environment
  AppServer->>StripeMock: Activate mock Stripe settings
  ScreenshotRunner->>StripeMock: Stop mock on failed startup
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 matches the main theme of the changes: screenshot fixture improvements for checkout.
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 screenshot-followups

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

@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: 409cb5372e

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/screenshots.ts

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/screenshots.ts (1)

123-139: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Clean up the Stripe mock when startup throws.

startStripeMock() acquires a process before temporary-directory creation, child spawning, and health polling. If any of those operations throws, the existing cleanup paths are bypassed and the mock process remains running. Wrap pre-return startup in cleanup handling and add a regression test for startup failure.

🤖 Prompt for 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.

In `@scripts/screenshots.ts` around lines 123 - 139, Wrap the startup sequence in
scripts/screenshots.ts, beginning with startStripeMock() and covering
temporary-directory creation, child spawning, and health polling, in cleanup
handling that stops the Stripe mock whenever startup throws. Preserve the
existing cleanup behavior for successful startup and add a regression test that
simulates startup failure and verifies the mock process is terminated.

Source: Coding guidelines

🤖 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.

Outside diff comments:
In `@scripts/screenshots.ts`:
- Around line 123-139: Wrap the startup sequence in scripts/screenshots.ts,
beginning with startStripeMock() and covering temporary-directory creation,
child spawning, and health polling, in cleanup handling that stops the Stripe
mock whenever startup throws. Preserve the existing cleanup behavior for
successful startup and add a regression test that simulates startup failure and
verifies the mock process is terminated.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b9d7d113-efab-402f-86ef-41654aebb2b2

📥 Commits

Reviewing files that changed from the base of the PR and between 409cb53 and 32de332.

📒 Files selected for processing (1)
  • scripts/screenshots.ts

@stefan-burke

Copy link
Copy Markdown
Member Author

Addressed CodeRabbit’s startup-cleanup review in f3cf318. Screenshot startup now runs behind startWithFailureCleanup, so any temporary-directory, child-spawn, or health-check failure stops the acquired Stripe mock without hiding the original error. test/scripts/screenshots-server.test.ts covers failure cleanup and successful ownership transfer; the paid-submit scenario and deno task precommit pass.

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/screenshots.ts (1)

123-136: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Make startup and shutdown cleanup failure-safe.

Once the temporary directory and child process are acquired, exceptions from process startup or health checking can bypass the cleanup branch; the wrapper at Line 183 through Line 186 only stops Stripe, so app resources can leak. Also, if removeTree at Line 167 rejects, stripeMock.stop() at Line 168 is skipped. Compose all cleanup tasks with nested finally/failAfterCleanups while preserving the original error.

Also applies to: 162-186

🤖 Prompt for 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.

In `@scripts/screenshots.ts` around lines 123 - 136, The startAppServer lifecycle
must clean up the temporary directory and child process when startup or health
checks fail, and must still stop Stripe if removeTree fails. Update the cleanup
flow around startAppServer and its wrapper to use nested finally blocks or
failAfterCleanups, ensuring every acquired resource is released while the
original startup or shutdown error is preserved.
🤖 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.

Outside diff comments:
In `@scripts/screenshots.ts`:
- Around line 123-136: The startAppServer lifecycle must clean up the temporary
directory and child process when startup or health checks fail, and must still
stop Stripe if removeTree fails. Update the cleanup flow around startAppServer
and its wrapper to use nested finally blocks or failAfterCleanups, ensuring
every acquired resource is released while the original startup or shutdown error
is preserved.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a300f934-6dad-4c3c-a08d-b57cb5e9bb47

📥 Commits

Reviewing files that changed from the base of the PR and between 32de332 and f3cf318.

📒 Files selected for processing (3)
  • scripts/screenshots.ts
  • scripts/screenshots/server.ts
  • test/scripts/screenshots-server.test.ts

@stefan-burke

Copy link
Copy Markdown
Member Author

Addressed CodeRabbit’s follow-up lifecycle review in a912079. Startup now registers Stripe mock, temporary directory, and app child cleanup in acquisition order; failures run every cleanup in reverse order while preserving the startup error, and normal shutdown takes ownership of the same cleanup stack. Tests cover reverse-order failure cleanup, ownership transfer on success, and continuing after one cleanup fails. A paid mock checkout and deno task precommit both pass.

@stefan-burke
stefan-burke added this pull request to the merge queue Jul 19, 2026
Merged via the queue into main with commit 43bfa10 Jul 19, 2026
3 checks passed
@stefan-burke
stefan-burke deleted the screenshot-followups branch July 19, 2026 19:26
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