Skip to content

fix: complete skipped onboarding stages when the action is performed - #13951

Merged
eldadfux merged 1 commit into
mainfrom
fix-onboarding-skipped-to-completed
Sep 28, 2026
Merged

eldadfux merged 1 commit into
mainfrom
fix-onboarding-skipped-to-completed

Conversation

@eldadfux

Copy link
Copy Markdown
Member

What does this PR do?

If a user skipped an onboarding stage (for example "Create a server API key") and later performed that action, the stage stayed skipped forever. The API shutdown hook ignored stages that were already completed or skipped, so the real action never got recorded.

The hook now ignores only completed stages. A skipped stage upgrades to completed the first time the matching SDK method succeeds. updateStage still refuses to downgrade completed to skipped, so the transition is one-way: pending / skipped -> completed.

Test Plan

  • Added testSkippedStageUpgradesToCompleted to tests/e2e/Services/Project/StagesBase.php: skips teams.create, creates a team with the project API key, and asserts the stage is completed.

Related PRs and Issues

  • Console shows a skipped (dashed) API key step even when the project has API keys.

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

Made with Cursor

@ghost

ghost commented Sep 28, 2026

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The change matches the intended stage transition, and the new test exercises it through a scoped project API key.

The API shutdown hook now marks a skipped onboarding stage as completed when its matching SDK action succeeds, while leaving completed stages unchanged. An end-to-end test covers skipping teams.create, creating a team, and checking the resulting stage status.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 2
File Change
app/controllers/shared/api.php Allows skipped onboarding stages to transition to completed in the API shutdown hook.
tests/e2e/Services/Project/StagesBase.php Adds an end-to-end test for completing a previously skipped team-creation stage.

Reviewed ccefd52 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

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

🟢 Tier S · Looks good to merge. Summary

@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Changes onboarding stage completion logic.

The PR should not merge until concurrent stage updates preserve a completed transition.

Fix All in Claude CodeFindings

  1. P1 Completed stage can revert ▶
Fix with agent prompt
### Issue 1
app/controllers/shared/api.php:1306
If someone skips a stage while another request completes its matching action, the skip request can read the old stage data and write it after this hook writes `completed`. Both paths replace the entire onboarding array, but the skip path does not use this hook’s lock. The stage can therefore remain `skipped` even though the action succeeded, breaking the intended one-way transition.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR lets a successful matching API action upgrade a skipped onboarding stage to completed and adds an end-to-end test for that transition.

  • Concurrent skip and completion requests can still leave the stage skipped.

Reviews (1) · Last reviewed commit: "fix: complete skipped onboarding stages ..."

$status = \is_array($row) ? ($row['status'] ?? null) : null;
if ($status === ONBOARDING_STATUS_COMPLETED || $status === ONBOARDING_STATUS_SKIPPED) {
// Skipped stages still upgrade to completed once the user actually performs the action.
if ($status === ONBOARDING_STATUS_COMPLETED) {

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.

P1 Completed stage can revert If someone skips a stage while another request completes its matching action, the skip request can read the old stage data and write it after this hook writes completed. Both paths replace the entire onboarding array, but the skip path does not use this hook’s lock. The stage can therefore remain skipped even though the action succeeded, breaking the intended one-way transition.

Knowledge Base Used: Project administration

Prompt To Fix With AI
This is a comment left during a code review.
Path: app/controllers/shared/api.php
Line: 1306

Comment:
**Completed stage can revert** If someone skips a stage while another request completes its matching action, the skip request can read the old stage data and write it after this hook writes `completed`. Both paths replace the entire onboarding array, but the skip path does not use this hook’s lock. The stage can therefore remain `skipped` even though the action succeeded, breaking the intended one-way transition.

**Knowledge Base Used:** [Project administration](https://app.greptile.com/appwrite/-/custom-context/knowledge-base/appwrite/appwrite/-/docs/project-administration.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

@github-actions

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix-onboarding-skipped-to-completed (after).

Metric Before After Change
🚀 Requests/sec 187.95 188.07 ⚪ +0.1%
⏱️ Latency P50 90.78 ms 91.17 ms ⚪ +0.4%
⏱️ Latency P95 223.92 ms 220.53 ms ⚪ -1.5%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 91.17 220.53 11,742 188.07 -3.4
Account 171.58 328.62 618 10.22 -1.92
TablesDB 87.77 173.9 6,386 104.3 +8.34
Storage 83.01 187.4 3,090 52.39 -11.79
Functions 131.03 268.06 1,648 28.6 -27.99

Top API waits (after)

API request Max wait (ms)
functions.create 493.6
account.name.update 441.49
account.prefs.update 428.75
functions.delete 422.35
functions.variables.update 398.7

@eldadfux
eldadfux merged commit 1bc79bd into main Sep 28, 2026
53 checks passed
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