test: add regression coverage for account recovery without a name#11645
test: add regression coverage for account recovery without a name#11645abishekgiri wants to merge 3 commits intoappwrite:1.9.xfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds a new end-to-end test method that verifies account recovery for an account with an empty Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/e2e/Services/Account/AccountCustomClientTest.php (1)
1985-1985: Increase email entropy to reduce parallel-test collision risk.Line 1985 uses
uniqid()alone; in parallel execution this can still collide and cause intermittent 409s. Consider aligning with the stronger pattern already used in this file (for example around Line 90).♻️ Proposed refactor
- $email = uniqid() . 'recovery-null-name@localhost.test'; + $email = uniqid('', true) . getmypid() . bin2hex(random_bytes(4)) . 'recovery-null-name@localhost.test';🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/e2e/Services/Account/AccountCustomClientTest.php` at line 1985, The $email assignment using uniqid() (variable $email in AccountCustomClientTest) is too low-entropy for parallel runs; replace the uniqid() call with a stronger unique generator used elsewhere in this test (e.g., combine uniqid('', true) or, better, bin2hex(random_bytes(...)) or random_int-based entropy) so the email string is much less likely to collide; update the single-line assignment that builds the recovery email to use that stronger generator.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/e2e/Services/Account/AccountCustomClientTest.php`:
- Line 1981: Add a method-level PHPDoc block above the public test method
testCreateAccountRecoveryWithoutName describing that this is a regression test
which ensures account recovery creation fails or behaves correctly when the name
field is omitted; include a short summary, `@covers` or `@group` tag if used in the
repo, and `@return` void to match other tests' docblocks so the new test follows
the project's PHPDoc conventions.
---
Nitpick comments:
In `@tests/e2e/Services/Account/AccountCustomClientTest.php`:
- Line 1985: The $email assignment using uniqid() (variable $email in
AccountCustomClientTest) is too low-entropy for parallel runs; replace the
uniqid() call with a stronger unique generator used elsewhere in this test
(e.g., combine uniqid('', true) or, better, bin2hex(random_bytes(...)) or
random_int-based entropy) so the email string is much less likely to collide;
update the single-line assignment that builds the recovery email to use that
stronger generator.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 43ba3640-5548-4831-b395-2a5403227777
📒 Files selected for processing (1)
tests/e2e/Services/Account/AccountCustomClientTest.php
|
Hi! This PR adds regression coverage for the account recovery flow when the user has no name set, including cases where the account was upgraded from an anonymous session. I verified the behavior locally using the e2e tests listed above. Please let me know if there are any edge cases or improvements I should address. Thanks! |
Greptile SummaryThis PR adds a focused e2e regression test (
Confidence Score: 5/5Safe to merge — test-only change, all 4 tests pass, no production code modified. The change is purely additive (one new test method), follows the established patterns of the surrounding test class, and introduces no risk to production code. The single P2 suggestion (adding token extraction) is a coverage nicety, not a blocking concern. No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "Merge branch '1.9.x' into fix-7597-accou..." | Re-trigger Greptile |
Fixes #7597
Summary
The original issue reported that
account.createRecoverycould fail when the account had no name set.The current recovery flow already handles that case, but there was no regression coverage for accounts upgraded from anonymous sessions without an explicit name.
Changes
/account/recoveryreturns201and sends the recovery email successfully for that account stateTesting
docker compose exec appwrite test /usr/src/code/tests/e2e/Services/Account --filter='/(testCreateAccountRecovery|testCreateAccountRecoveryWithoutName|testConvertAnonymousAccount)/'All tests passed: