Skip to content

[codex] Update cpflow review app guidance#764

Draft
justin808 wants to merge 5 commits into
masterfrom
jg-codex/cpflow-5-1-shared-secret-rollout
Draft

[codex] Update cpflow review app guidance#764
justin808 wants to merge 5 commits into
masterfrom
jg-codex/cpflow-5-1-shared-secret-rollout

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Jun 4, 2026

Summary

  • update legacy cpflow setup defaults/docs to 5.1.1
  • keep the existing local GitHub Actions wrapper model and refresh shared grant terminology
  • update React on Rails package references to 17.0.0-rc.1

Validation

  • ruby -S cpflow --version
  • YAML parse for .github/workflows/cpflow-*.yml and .controlplane/controlplane.yml
  • git diff --check
  • actionlint .github/workflows/cpflow-*.yml was run and only reported existing shellcheck style/info findings

Notes

  • Draft PR for CI/human review.
  • Autoreview completed clean before the final generated-wrapper fixes in the other repos; this legacy PR was not changed afterward.

Note

Medium Risk
Touches production Docker precompile, CI deploy/delete paths, and a major React on Rails RC upgrade; misordered or failed pack generation would break deploys and SSR/RSC.

Overview
Aligns the tutorial with cpflow 5.1.1 and React on Rails 17.0.0.rc.1 by adding reusable GitHub composite actions (setup, Docker build with optional SSH, guarded review-app delete) and refreshing Control Plane secret-template comments.

Build and deploy: The production Dockerfile now runs react_on_rails:generate_packs before ReScript and assets:precompile. Rails initializer and yarn build:test / build:dev scripts run locale generation (and test generate_packs) ahead of Shakapacker so direct bundler invocations match v17 expectations. Webpack resolves client/app and aliases react-on-rails to Pro to avoid mixing core and Pro at runtime.

App surface: Gems and npm lock to RoR 17 / react-on-rails-rsc 19.0.5-rc.5; README documents the new Control Plane Actions flow and versions. Small client updates add 'use client' where needed and formatting-only RSC/demo tweaks. entrypoint logging uses $* instead of $@.

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

🚀 Quick Review App Commands

Welcome! Here are the commands you can use in this PR:
They require the repository to have cpflow review apps configured, including the CPLN_TOKEN_STAGING secret.

+review-app-deploy

Deploy your PR branch for testing.

+review-app-delete

Remove the review app when done.

+review-app-help

Show detailed instructions, environment setup, and configuration options.

Comment +review-app-help for full setup details.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 87fd223b-521f-4ba6-8bbb-6b13aa961ffc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jg-codex/cpflow-5-1-shared-secret-rollout

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.

Comment thread .controlplane/entrypoint.sh Outdated
@justin808
Copy link
Copy Markdown
Member Author

+review-app-deploy

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

❌ Review App Deployment Failed

Deployment failed for PR #764, commit 8b4be0c

🎮 Control Plane Console
📋 View Failed Action Build and Deploy Logs

@github-actions github-actions Bot had a problem deploying to review/qa-react-webpack-rails-tutorial-764 June 4, 2026 07:46 Failure
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

@github-actions github-actions Bot temporarily deployed to review/qa-react-webpack-rails-tutorial-764 June 4, 2026 07:48 Inactive
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

🎉 Deploy Complete!

Open Review App

Deployment successful for PR #764, commit 7a11703

🎮 Control Plane Console
📋 View Completed Action Build and Deploy Logs

@github-actions github-actions Bot temporarily deployed to review/qa-react-webpack-rails-tutorial-764 June 4, 2026 19:45 Inactive
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 3 potential issues.

Fix All in Cursor

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issues.

Reviewed by Cursor Bugbot for commit 7a11703. Configure here.

"yarn res:build && RAILS_ENV=test bin/rails react_on_rails:locale && RAILS_ENV=test bin/shakapacker"
config.build_production_command =
"yarn res:build && RAILS_ENV=production NODE_ENV=production bin/rails react_on_rails:locale && " \
"RAILS_ENV=production NODE_ENV=production bin/shakapacker"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Production build omits packs

Medium Severity

build_production_command still runs ReScript, locale, and Shakapacker but never react_on_rails:generate_packs, even though the same upgrade adds that task to the Docker image build and test asset scripts. Any production precompile that relies only on this configured command can miss generated pack entrypoints.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7a11703. Configure here.

fi

echo "⚠️ Application does not exist: $APP_NAME"
exit 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Exists errors skip deletion

Medium Severity

When cpflow exists exits non-zero, the script treats any output that does not match a short list of substrings as “application does not exist” and exits successfully without calling delete. Transient API, auth, or network failures can therefore be misread as a missing app and leave review apps undeleted.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7a11703. Configure here.

Comment thread package.json
"build:test": "rm -rf public/packs-test && RAILS_ENV=test NODE_ENV=test bin/shakapacker",
"build:dev": "rm -rf public/packs && RAILS_ENV=development NODE_ENV=development bin/shakapacker",
"build:test": "rm -rf public/packs-test && yarn res:build && RAILS_ENV=test NODE_ENV=test bundle exec rails react_on_rails:locale && RAILS_ENV=test NODE_ENV=test bundle exec rake react_on_rails:generate_packs && RAILS_ENV=test NODE_ENV=test bin/shakapacker",
"build:dev": "rm -rf public/packs && yarn res:build && RAILS_ENV=development NODE_ENV=development bundle exec rails react_on_rails:locale && RAILS_ENV=development NODE_ENV=development bin/shakapacker",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Dev build skips pack generation

Low Severity

build:test runs react_on_rails:generate_packs before Shakapacker, but build:dev in the same edit does not. Local development builds that use only yarn build:dev can diverge from CI and fail or serve stale packs after v17 pack generation changes.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7a11703. Configure here.

Comment thread package.json
"build:test": "rm -rf public/packs-test && RAILS_ENV=test NODE_ENV=test bin/shakapacker",
"build:dev": "rm -rf public/packs && RAILS_ENV=development NODE_ENV=development bin/shakapacker",
"build:test": "rm -rf public/packs-test && yarn res:build && RAILS_ENV=test NODE_ENV=test bundle exec rails react_on_rails:locale && RAILS_ENV=test NODE_ENV=test bundle exec rake react_on_rails:generate_packs && RAILS_ENV=test NODE_ENV=test bin/shakapacker",
"build:dev": "rm -rf public/packs && yarn res:build && RAILS_ENV=development NODE_ENV=development bundle exec rails react_on_rails:locale && RAILS_ENV=development NODE_ENV=development bin/shakapacker",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

build:dev is missing react_on_rails:generate_packs

build:test (line above) now runs react_on_rails:generate_packs before shakapacker, and the Dockerfile was updated the same way. But build:dev only adds react_on_rails:locale. If v17 requires generate_packs before webpack (which the other changes imply), direct yarn build:dev calls will produce a broken dev bundle.

Suggested change
"build:dev": "rm -rf public/packs && yarn res:build && RAILS_ENV=development NODE_ENV=development bundle exec rails react_on_rails:locale && RAILS_ENV=development NODE_ENV=development bin/shakapacker",
"build:dev": "rm -rf public/packs && yarn res:build && RAILS_ENV=development NODE_ENV=development bundle exec rails react_on_rails:locale && RAILS_ENV=development NODE_ENV=development bundle exec rake react_on_rails:generate_packs && RAILS_ENV=development NODE_ENV=development bin/shakapacker",

Comment on lines +13 to +15
config.build_production_command =
"yarn res:build && RAILS_ENV=production NODE_ENV=production bin/rails react_on_rails:locale && " \
"RAILS_ENV=production NODE_ENV=production bin/shakapacker"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

build_production_command is missing react_on_rails:generate_packs

The Dockerfile was updated to run bundle exec rake react_on_rails:generate_packs before assets:precompile, and build:test in package.json also runs it. But this production command only adds react_on_rails:localegenerate_packs is absent. All three build paths should be consistent.

Also note that build_test_command (line 11–12) has the same omission compared to the build:test yarn script, which does include generate_packs. Consider whether the initializer's test command should also include it.

Suggested change
config.build_production_command =
"yarn res:build && RAILS_ENV=production NODE_ENV=production bin/rails react_on_rails:locale && " \
"RAILS_ENV=production NODE_ENV=production bin/shakapacker"
config.build_production_command =
"yarn res:build && RAILS_ENV=production NODE_ENV=production bin/rails react_on_rails:locale && " \
"RAILS_ENV=production NODE_ENV=production bin/rails react_on_rails:generate_packs && " \
"RAILS_ENV=production NODE_ENV=production bin/shakapacker"

Comment on lines +48 to +60
if [[ -n "${{ inputs.docker_build_extra_args }}" ]]; then
while IFS= read -r arg; do
arg="${arg%$'\r'}"
[[ -n "${arg}" ]] || continue

if [[ "${arg}" =~ [[:space:]] ]]; then
echo "docker_build_extra_args entries must be single docker-build tokens. " \
"Use key=value forms like --build-arg=FOO=bar." >&2
exit 1
fi

docker_build_args+=("${arg}")
done <<< "${{ inputs.docker_build_extra_args }}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shell injection risk: template expressions in inline script

${{ inputs.docker_build_extra_args }} is rendered into the script before the shell runs it. GitHub Actions does not shell-escape template values, so a crafted input like "; malicious_command; echo " could escape the here-string context. The same issue applies to ${{ inputs.docker_build_ssh_key }} on line 83.

The GitHub hardening guide recommends routing such values through env: variables instead:

      env:
        DOCKER_BUILD_EXTRA_ARGS: ${{ inputs.docker_build_extra_args }}
      run: |
        ...
        if [[ -n "$DOCKER_BUILD_EXTRA_ARGS" ]]; then
          while IFS= read -r arg; do
            ...
          done <<< "$DOCKER_BUILD_EXTRA_ARGS"
        fi

Since this action is only called from controlled workflows today the practical risk is low, but this pattern prevents future misuse if the action is ever invoked with PR-derived inputs.

wait_for_service $(echo $REDIS_URL | sed -e 's|redis://||' -e 's|/.*$||')

echo " -- Finishing entrypoint.sh, executing '$@'"
echo " -- Finishing entrypoint.sh, executing '$*'"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Minor: $* vs $@ in the display message

The actual exec "$@" below is correct. But in a double-quoted string, $* joins all positional parameters with the first character of IFS (usually a space), while $@ expands them as separate words. For a display message they behave identically in normal cases, but $@ is the more precise choice and consistent with the exec below.

Suggested change
echo " -- Finishing entrypoint.sh, executing '$*'"
echo " -- Finishing entrypoint.sh, executing '$@'"

Comment on lines +51 to +60
if [[ -z "$TOKEN" ]]; then
echo "Error: Control Plane token not provided" >&2
exit 1
fi

if [[ -z "$ORG" ]]; then
echo "Error: Control Plane organization not provided" >&2
exit 1
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Dead code: both token and org inputs are declared required: true at lines 4 and 8, so GitHub Actions will fail the job before the shell script ever runs if they are absent. These runtime checks add noise without providing any additional safety. They can be removed.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

🎉 Deploy Complete!

Open Review App

Deployment successful for PR #764, commit 7a11703

🎮 Control Plane Console
📋 View Completed Action Build and Deploy Logs

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