You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: complete skipped onboarding stages when the action is performed - #13951
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.
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.
### 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.
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
skippedforever. The API shutdown hook ignored stages that were alreadycompletedorskipped, so the real action never got recorded.The hook now ignores only
completedstages. Askippedstage upgrades tocompletedthe first time the matching SDK method succeeds.updateStagestill refuses to downgradecompletedtoskipped, so the transition is one-way:pending/skipped->completed.Test Plan
testSkippedStageUpgradesToCompletedtotests/e2e/Services/Project/StagesBase.php: skipsteams.create, creates a team with the project API key, and asserts the stage iscompleted.Related PRs and Issues
Checklist
Made with Cursor