Skip to content

Add Control Plane GitHub flow#12

Open
justin808 wants to merge 13 commits into
mainfrom
add-cpflow-github-flow
Open

Add Control Plane GitHub flow#12
justin808 wants to merge 13 commits into
mainfrom
add-cpflow-github-flow

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Apr 15, 2026

Summary

  • add Control Plane review app, staging deploy, production promotion, and cleanup workflows
  • configure Control Plane app templates for rails plus a separate renderer workload
  • harden the node renderer entrypoint and test harness for containerized split-workload SSR

Validation

  • pnpm exec tsc --noEmit
  • bin/rubocop
  • DATABASE_URL=postgres://postgres:postgres@127.0.0.1:54329/react_on_rails_hacker_news_app_development bin/rails db:prepare
  • bin/rails react_on_rails:generate_packs
  • bin/shakapacker
  • RAILS_ENV=test DATABASE_URL=postgres://postgres:postgres@127.0.0.1:54329/react_on_rails_hacker_news_app_test bin/rails db:test:prepare test
  • RAILS_ENV=test DATABASE_URL=postgres://postgres:postgres@127.0.0.1:54329/react_on_rails_hacker_news_app_test bin/rails test:system
  • docker build -t react-on-rails-hacker-news-app-control-plane .
  • split-container production smoke test with separate rails and renderer containers

Note

Medium Risk
Adds new CI/CD automation (Control Plane review apps, staging deploys, production promotion) and changes the production Docker image build to include Node/pnpm, which can affect deployment behavior and image size. Also patches the Node renderer startup/test harness, which could impact SSR/runtime if misconfigured.

Overview
Adds Control Plane cpflow scaffolding for opt-in review apps, automatic staging deploys, and manual staging→production promotion, including app/workload templates (rails public + internal renderer workload), a release_script.sh to run bin/rails db:prepare, and docs under .controlplane/.

Introduces composite GitHub Actions and new cpflow-* workflows to build/deploy images, post PR comments/deployments, restrict review-app deploys to non-fork PRs, clean up stale review apps, and safely delete review apps.

Updates the production Dockerfile to include a Node runtime and run pnpm install during build, tightens RSC manifest scanning to ./app/javascript in Webpack configs, hardens client/node-renderer.js for configurable host/workers/cache path (including a Fastify listen patch), and stabilizes tests by ensuring packs are generated and the renderer test server uses an available port.

Reviewed by Cursor Bugbot for commit 64a5491. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

Warning

Rate limit exceeded

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

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 23 minutes and 2 seconds.

⌛ 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: df9765cd-409a-4ccb-92b7-32cb50e467e6

📥 Commits

Reviewing files that changed from the base of the PR and between 79f9b81 and 64a5491.

⛔ Files ignored due to path filters (1)
  • Gemfile.lock is excluded by !**/*.lock
📒 Files selected for processing (27)
  • .controlplane/controlplane.yml
  • .controlplane/readme.md
  • .controlplane/release_script.sh
  • .controlplane/templates/app.yml
  • .controlplane/templates/rails.yml
  • .controlplane/templates/renderer.yml
  • .github/actions/cpflow-build-docker-image/action.yml
  • .github/actions/cpflow-delete-control-plane-app/action.yml
  • .github/actions/cpflow-delete-control-plane-app/delete-app.sh
  • .github/actions/cpflow-setup-environment/action.yml
  • .github/workflows/ci.yml
  • .github/workflows/cpflow-cleanup-stale-review-apps.yml
  • .github/workflows/cpflow-delete-review-app.yml
  • .github/workflows/cpflow-deploy-review-app.yml
  • .github/workflows/cpflow-deploy-staging.yml
  • .github/workflows/cpflow-help-command.yml
  • .github/workflows/cpflow-promote-staging-to-production.yml
  • .github/workflows/cpflow-review-app-help.yml
  • .ruby-version
  • Dockerfile
  • README.md
  • client/node-renderer.js
  • config/webpack/clientWebpackConfig.js
  • config/webpack/serverWebpackConfig.js
  • db/schema.rb
  • test/support/node_renderer_test_server.rb
  • test/test_helper.rb
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-cpflow-github-flow

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 and usage tips.

@github-actions
Copy link
Copy Markdown

Control Plane review app commands

/deploy-review-app
Create the review app or redeploy the PR branch to it.

/delete-review-app
Delete the review app and its temporary resources.

/help
Show the required GitHub variables, secrets, and workflow behavior.

Comment thread .github/actions/cpflow-setup-environment/action.yml Outdated
Comment thread .github/workflows/cpflow-deploy-staging.yml
Comment thread .github/workflows/cpflow-promote-staging-to-production.yml Outdated
Comment thread .github/workflows/cpflow-deploy-review-app.yml
Comment thread test/test_helper.rb
FakeHackerNewsAPI.start!
ENV["HN_API_BASE_URL"] = FakeHackerNewsAPI.base_url
FileUtils.rm_rf(Rails.root.join(".node-renderer-bundles"))
generated_server_bundle_path = Rails.root.join("app/javascript/generated/server-bundle-generated.js")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bundle cache cleanup targets old path after default changed

Low Severity

The serverBundleCachePath default in node-renderer.js moved from .node-renderer-bundles (at repo root) to tmp/.node-renderer-bundles, but the FileUtils.rm_rf in test_helper.rb still targets the old .node-renderer-bundles path. The pre-test cleanup is now a no-op, so stale cached server bundles at the new location can persist across local test runs, potentially causing tests to use outdated renderer output after JavaScript changes.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 82f8152. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because on-demand usage is turned off. To enable Bugbot Autofix, turn on on-demand usage and set a spend limit in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d217c2a. Configure here.

Comment thread client/node-renderer.js
const config = {
serverBundleCachePath: path.resolve(__dirname, '../.node-renderer-bundles'),
serverBundleCachePath:
env.RENDERER_SERVER_BUNDLE_CACHE_PATH || path.resolve(__dirname, '../tmp/.node-renderer-bundles'),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Test cleanup targets old bundle cache path

Low Severity

The default serverBundleCachePath changed from ../.node-renderer-bundles to ../tmp/.node-renderer-bundles, but test_helper.rb still runs FileUtils.rm_rf(Rails.root.join(".node-renderer-bundles")) — cleaning the old location. Since tests don't set RENDERER_SERVER_BUNDLE_CACHE_PATH, the renderer uses the new tmp/.node-renderer-bundles path, meaning stale caches there are never cleaned between test runs.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d217c2a. Configure here.

@justin808 justin808 marked this pull request as ready for review April 15, 2026 14:28
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: d217c2a101

ℹ️ 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".

cpflow_version:
description: cpflow gem version
required: false
default: "__CPFLOW_VERSION__"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Replace cpflow version placeholder before installation

The composite action defaults cpflow_version to "__CPFLOW_VERSION__", but every workflow that uses this action relies on the default and does not pass an override. That makes gem install cpflow -v ${{ inputs.cpflow_version }} resolve to an invalid/nonexistent version string, so environment setup fails before any deploy/cleanup job can run.

Useful? React with 👍 / 👎.

Comment thread client/node-renderer.js
Comment on lines +61 to +62
serverBundleCachePath:
env.RENDERER_SERVER_BUNDLE_CACHE_PATH || path.resolve(__dirname, '../tmp/.node-renderer-bundles'),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep renderer cache path consistent with test cache cleanup

The default renderer cache path was changed to tmp/.node-renderer-bundles, but test bootstrapping still deletes the old .node-renderer-bundles directory, so cached server bundles can survive between test runs and serve stale SSR code. This mismatch is introduced by changing the runtime default here without updating the test cleanup path.

Useful? React with 👍 / 👎.

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