fix(cli): offer CI secret upload only after a successful first build#2310
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughBoth onboarding flows (Android and iOS) are updated to defer CI-secret uploading until after a successful build is queued. Credential saving now consistently advances to the build request step; build success conditionally enters CI-secret detection only when entries exist, otherwise skipping to completion. All CI-secret UI skip paths and detection dead-ends now end the wizard rather than return to the build prompt; retry paths after CI failures re-enter secret checking instead. ChangesCI-secret uploading deferral in onboarding flows
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Following review of PR #2306, the build onboarding wizard now defers GitHub Actions / GitLab CI secret upload until AFTER a build has been successfully queued — rather than before. This prevents users from ending up with orphan secrets in a repo whose build was never proven to work. New ordering on both iOS and Android tracks: save credentials → ask-build ├─ user skips build → exit (no secrets pushed) ├─ build request OK → detecting-ci-secrets (if entries) → … → exit └─ build request err → exit (no secrets pushed) All ci-secrets-* state transitions that previously fell back to ask-build on skip / failure now route to build-complete instead, because by the time those paths fire the build has already been dispatched. bun.lock: workspace version bump from 7.104.0 → 7.108.2, picked up mechanically by bun install (was stale on main).
Merging this PR will not alter performance
Comparing Footnotes
|
871a9f3 to
a7fe3e0
Compare
|
❌ The last analysis has failed. |
Summary
Defers GitHub Actions / GitLab CI secret upload in the
build onboardingwizard until after a build has been successfully queued, instead of before. Resolves the UX issue surfaced after #2306 merged.Original concern: pushing repository secrets before any build has been validated leaves orphan secrets in the user's repo if the credentials turn out to be wrong, and gates user trust on an unproven setup. Discussed with @riderx — agreed to move the step to post-build-success.
What changed
Touches the two onboarding state machines:
cli/src/build/onboarding/ui/app.tsx(iOS)cli/src/build/onboarding/android/ui/app.tsx(Android)New ordering on both tracks:
Concretely:
saving-credentialshandler no longer branches todetecting-ci-secrets. It always proceeds toask-build, just stashes the CI secret entries in state for later.requesting-build, after a successful build dispatch (result.success), the wizard now routes todetecting-ci-secretsif there are entries to push; otherwise straight tobuild-complete.elsebranch or the outercatch), the wizard goes directly tobuild-complete— secrets are never offered for a failed build.ask-build. They now fall back tobuild-complete, because by the time those paths fire the build has already been dispatched.The
ciSecretUploadSummarywas already rendered inside thebuild-completeJSX, so users still see the "Uploaded N env vars to …" confirmation after the post-build path runs.Why this is a strict UX improvement
ask-build→ "no") now correctly skips the secrets step too — credentials still get saved locally, exactly as before.What this PR is not
Out of scope by design (each could be its own follow-up):
gh auth status+ repo write-access check before collecting credentialsgh secret setsilently clobbers today).github/workflows/capgo-build.ymlgeneratorcapgo ci setupcommandTest plan
bun run cli:check(lint + typecheck + build + test) green locallybun test/test-ci-secrets.mjs— all 8 existing helpers tests still pass; this PR doesn't touchci-secrets.tsitselfcapgo build init --platform ioson a fresh repo with no Capgo credentials — confirm wizard goes save credentials → ask-build, and only offers secret upload after the build is queuedask-build— confirm wizard exits cleanly without offering secretsbuild-completeand does NOT offer secretsbuild-completeafter the empty discovery, not back into the (no-longer-reachable from this path)ask-buildcc @riderx
Summary by CodeRabbit