Skip to content

chore(kit): close two CI gaps that let kit.openiap.dev ship broken#121

Merged
hyochan merged 4 commits into
mainfrom
chore/kit-ci-prevent-broken-deploys
Apr 30, 2026
Merged

chore(kit): close two CI gaps that let kit.openiap.dev ship broken#121
hyochan merged 4 commits into
mainfrom
chore/kit-ci-prevent-broken-deploys

Conversation

@hyochan
Copy link
Copy Markdown
Member

@hyochan hyochan commented Apr 29, 2026

Summary

This week's outage chain (PR #119 fix-up + PR #120 runtime crash) shipped through green PR CI because the verify job didn't catch either failure mode. Two targeted additions:

1. PR-level Docker build (catches Dockerfile bugs before merge)

  • Add a Docker build step to the verify job that builds packages/kit/Dockerfile against the workspace context, with GHA layer caching.
  • Would have caught PR chore(deps): bump oven/bun from 1.3.0-slim to 1.3.13-slim in /packages/kit #109's Bun 1.3.13 --filter hoisting incompatibility — currently the Docker image only builds in the Deploy job which runs on push-to-main, so the bug only surfaced 5 minutes after merge.

2. Headless-browser smoke (catches SPA runtime crashes)

  • Add packages/kit/scripts/smoke-browser.ts: load the SPA in headless Chromium, listen for pageerror + console.error, assert #root mounts non-empty content.
  • Wire it into smoke-server.sh after the existing HTTP probes (gated on SKIP_BROWSER_SMOKE=1 for dev iteration).
  • Would have caught PR hotfix(kit): bundle React with antd to fix vendor chunk cycle crashing kit.openiap.dev #120's manualChunks cross-chunk cycle ("Cannot set properties of undefined (setting 'Activity')") — HTTP probes returned 200 because the server still served a blank index.html, but the bundle crashed at boot in the browser.
  • CI installs Chromium via bunx playwright install --with-deps chromium; @playwright/test was already a dev dep.

Test plan

  • Local pre-commit gate (lint + 225 tests + smoke-server + smoke-browser) passes.
  • Verified smoke-browser.ts correctly reports mounted cleanly ✓ against the current bundle.
  • CI verify job stays green; the new Docker build + browser smoke produce sub-2-min added latency.

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Tests

    • Enhanced PR verification pipeline with headless browser smoke testing to validate application functionality
    • Added Docker image build validation during PR checks to catch incompatibilities before merge
    • Improved error reporting during automated testing
  • Chores

    • Strengthened CI/CD infrastructure with extended verification steps for better quality assurance

This week shipped two production-breaking PRs (#119 fix-up and #120
runtime crash) that PR CI didn't catch. Both classes were addressable:

1. Docker build only ran on push-to-main, so the Dockerfile bug from
   PR #109 (Bun 1.3.13 --filter hoisting) only surfaced after merge.
   → Add a PR-level Docker build step in the verify job, with GHA
     layer caching so cold builds aren't paid every PR.

2. The smoke test only HTTP-probed /, /health, /api/v1, which all
   returned 200 even when the SPA bundle crashed at boot. PR #120's
   manualChunks cycle ("Cannot set properties of undefined (setting
   'Activity')") shipped to kit.openiap.dev as a blank page through
   green CI.
   → Add scripts/smoke-browser.ts: load the SPA in headless Chromium,
     listen for pageerror + console.error, and assert #root mounts
     non-empty content. Wire it into smoke-server.sh after HTTP probes.

The browser smoke is gated on SKIP_BROWSER_SMOKE=1 for dev iteration,
and CI installs chromium via `bunx playwright install`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hyochan hyochan added kit IAPKit (receipt-validation SaaS) 💨 ci Cloud integration 🧪 test Issue or pr related to testing labels Apr 29, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a headless browser smoke test for the kit SPA to detect runtime bundle crashes that standard HTTP probes might miss. The implementation includes a new Playwright-based script and its integration into the existing server smoke test. Feedback was provided to improve error reporting by catching navigation failures and to prevent resource leaks by ensuring the browser is closed before the process exits.

Comment thread packages/kit/scripts/smoke-browser.ts Outdated
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 29, 2026

Warning

Rate limit exceeded

@hyochan has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 26 minutes and 24 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dcc4dc33-56d5-4686-af7b-13c003d979d6

📥 Commits

Reviewing files that changed from the base of the PR and between ce8259e and 159592f.

📒 Files selected for processing (1)
  • packages/kit/scripts/smoke-browser.ts
📝 Walkthrough

Walkthrough

This PR enhances the CI/verification pipeline by adding browser-based smoke testing and Docker image validation. It introduces a new headless Playwright test that validates SPA mounting and runtime behavior, updates placeholder Convex URLs, and implements PR-time Docker Buildx image building to catch Dockerfile/runtime incompatibilities before merge.

Changes

Cohort / File(s) Summary
CI/Workflow Updates
.github/workflows/deploy-kit.yml
Updates placeholder Convex URL, adds Playwright Chromium installation, integrates headless-browser smoke test, introduces PR-time Docker Buildx setup with cached layers and VITE_KIT_CONVEX_URL build-arg for early Dockerfile validation.
Browser Smoke Testing
packages/kit/scripts/smoke-browser.ts, packages/kit/scripts/smoke-server.sh
Adds new headless Playwright script to validate SPA mounting and runtime errors; extends smoke server flow with conditional browser test invocation that captures page errors, console errors (filtered for placeholder environment), and verifies React #root target contains content.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through smoke with care,
Building browsers everywhere!
Docker images stack so high,
Convex URLs reach the sky,
React roots verified with glee! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main objective: closing CI gaps to prevent broken deploys of kit.openiap.dev, which matches the core changes (Docker build verification and browser smoke tests).
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/kit-ci-prevent-broken-deploys

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
Review rate limit: 0/1 reviews remaining, refill in 26 minutes and 24 seconds.

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

… ignored errors

The browser smoke caught a real failure mode it wasn't designed for:
the Convex client throws synchronously during module init when
VITE_KIT_CONVEX_URL doesn't match the Convex deployment-name format,
which blocks React from mounting #root and short-circuits the smoke
even though the bundle itself is fine.

Two-part fix:

1. Switch placeholder URL to a valid deployment-name format
   (`placeholder-build-1.convex.cloud`) in deploy-kit.yml + smoke
   script so Convex's parser accepts it without throwing.

2. Add an allow-list in smoke-browser.ts for known-OK
   placeholder-environment errors (Convex deployment-name parse,
   Sentry invalid DSN). Defense-in-depth in case other deps grow
   similar synchronous-init checks against placeholder env.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/kit/scripts/smoke-browser.ts (1)

22-29: ⚡ Quick win

Rename constant to camelCase to match repo convention.

IGNORED_ERROR_PATTERNS violates the project naming rule for TS/JS variables. Please rename to camelCase (for example ignoredErrorPatterns) and update references.

Suggested patch
-const IGNORED_ERROR_PATTERNS: RegExp[] = [
+const ignoredErrorPatterns: RegExp[] = [
   /CONVEX FATAL ERROR.*Couldn't parse deployment name/i,
   /Sentry.*Invalid DSN/i,
 ];
 
 function isIgnored(message: string): boolean {
-  return IGNORED_ERROR_PATTERNS.some((re) => re.test(message));
+  return ignoredErrorPatterns.some((re) => re.test(message));
 }

As per coding guidelines "Use camelCase for variable and function names".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/kit/scripts/smoke-browser.ts` around lines 22 - 29, The constant
name IGNORED_ERROR_PATTERNS violates the project's camelCase convention; rename
it to ignoredErrorPatterns (keeping the RegExp[] type and same patterns) and
update every reference, including the isIgnored function which currently uses
IGNORED_ERROR_PATTERNS, to use ignoredErrorPatterns instead so the code compiles
and follows naming rules.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/kit/scripts/smoke-browser.ts`:
- Around line 22-29: The constant name IGNORED_ERROR_PATTERNS violates the
project's camelCase convention; rename it to ignoredErrorPatterns (keeping the
RegExp[] type and same patterns) and update every reference, including the
isIgnored function which currently uses IGNORED_ERROR_PATTERNS, to use
ignoredErrorPatterns instead so the code compiles and follows naming rules.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9465500a-812b-4add-a633-6face363f0ca

📥 Commits

Reviewing files that changed from the base of the PR and between 24b305f and ce8259e.

📒 Files selected for processing (3)
  • .github/workflows/deploy-kit.yml
  • packages/kit/scripts/smoke-browser.ts
  • packages/kit/scripts/smoke-server.sh

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves packages/kit PR verification so CI can catch (1) Docker build breakages and (2) SPA runtime crashes that still return HTTP 200, preventing broken kit.openiap.dev deploys from slipping through green PR CI.

Changes:

  • Add a headless Chromium smoke test that loads the SPA, watches for runtime errors, and asserts #root mounts content.
  • Wire the browser smoke into smoke-server.sh (skippable via SKIP_BROWSER_SMOKE=1).
  • Extend the kit verify workflow to install Playwright Chromium and to perform a PR-level Docker build of packages/kit/Dockerfile with GHA layer caching.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/kit/scripts/smoke-server.sh Runs the new browser smoke after existing HTTP probes (optional via env).
packages/kit/scripts/smoke-browser.ts New Playwright-based headless SPA smoke to catch runtime boot/hydration failures.
.github/workflows/deploy-kit.yml Adds Playwright Chromium install + PR-level Docker build check in the verify job.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/kit/scripts/smoke-browser.ts Outdated
Per Gemini + Copilot review: process.exit() inside the try block
short-circuits the finally block, leaving the headless chromium
process running and suppressing any errors collected via the
pageerror/console.error listeners.

Restructure:
- Wrap goto + assertion in an inner try/catch so navigation
  timeouts surface in the errors array instead of jumping out.
- Move the failure report and exit decision out of the outer try
  so finally runs first.
- main() now returns the exit code; the caller sets process.exitCode
  instead of calling process.exit, letting Node/Bun finish flushing
  before exit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hyochan
Copy link
Copy Markdown
Member Author

hyochan commented Apr 30, 2026

/gemini review

@hyochan
Copy link
Copy Markdown
Member Author

hyochan commented Apr 30, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a headless browser smoke test for the kit SPA to detect runtime bundle crashes that standard HTTP probes might miss. It adds a Playwright-based script (smoke-browser.ts) and integrates it into the existing smoke-server.sh workflow. Feedback was provided regarding the use of "networkidle" in the browser script, which may cause flakiness due to persistent WebSocket connections; using a more specific selector wait is recommended instead.

Comment thread packages/kit/scripts/smoke-browser.ts Outdated
Per Gemini review: networkidle hangs in apps with persistent sockets
(Convex uses WebSockets, Sentry posts beacons). Switch the smoke
navigation to waitUntil: domcontentloaded and explicitly wait for
#root to gain children. Mounted-children is the actual signal we
care about; if the bundle crashes the wait surfaces as a clean
TimeoutError that the existing inner try/catch reports.

Keep the post-mount innerHTML emptiness check as a tripwire so a
future refactor can't silently weaken the assertion.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hyochan hyochan merged commit 09059d6 into main Apr 30, 2026
9 checks passed
@hyochan hyochan deleted the chore/kit-ci-prevent-broken-deploys branch April 30, 2026 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💨 ci Cloud integration kit IAPKit (receipt-validation SaaS) 🧪 test Issue or pr related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants