[chores:fix] Add ApiKey proxy model and permissions to sample users#228
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📜 Recent review details⏰ Context from checks skipped due to timeout. (14)
🧰 Additional context used📓 Path-based instructions (2)**/*.{py,html}📄 CodeRabbit inference engine (Custom checks)
Files:
**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (1)📚 Learning: 2026-06-01T21:59:25.519ZApplied to files:
🔇 Additional comments (3)
📝 WalkthroughWalkthroughTest migrations for the sample_users app were extended: one migration now runs a data migration to add API key permissions to admins, and another adds a Estimated code review effort: 1 (Trivial) | ~5 minutes Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (2 errors, 3 warnings)
✅ Passed checks (3 passed)
✨ 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
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@tests/openwisp2/sample_users/migrations/0003_user_expiration_date_user_user_active_expiry_idx.py`:
- Around line 24-35: Add the missing rest_framework.authtoken migration
dependency for the ApiKey proxy model. Update the dependencies list in the
migration that defines CreateModel(name="ApiKey") so it also depends on
rest_framework.authtoken 0001_initial, ensuring authtoken.Token exists before
this proxy model is applied.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 5a3983ec-540b-445a-9f51-4ece80ebe830
📒 Files selected for processing (3)
tests/openwisp2/sample_users/migrations/0002_default_groups_and_permissions.pytests/openwisp2/sample_users/migrations/0003_user_expiration_date_user_user_active_expiry_idx.pytests/openwisp2/sample_users/models.py
📜 Review details
⏰ Context from checks skipped due to timeout. (13)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (python)
- GitHub Check: Python==3.12 | django~=4.2.0
- GitHub Check: Python==3.12 | django~=5.1.0
- GitHub Check: Python==3.11 | django~=5.2.0
- GitHub Check: Python==3.12 | django~=5.2.0
- GitHub Check: Python==3.11 | django~=4.2.0
- GitHub Check: Python==3.10 | django~=5.2.0
- GitHub Check: Python==3.10 | django~=5.1.0
- GitHub Check: Python==3.13 | django~=5.1.0
- GitHub Check: Python==3.13 | django~=5.2.0
- GitHub Check: Python==3.10 | django~=4.2.0
- GitHub Check: Python==3.11 | django~=5.1.0
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{py,html}
📄 CodeRabbit inference engine (Custom checks)
For Django pull requests, ensure all user-facing strings are marked as translatable using the Django i18n framework
Files:
tests/openwisp2/sample_users/models.pytests/openwisp2/sample_users/migrations/0003_user_expiration_date_user_user_active_expiry_idx.pytests/openwisp2/sample_users/migrations/0002_default_groups_and_permissions.py
**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
**/*.py: Place imports at the top of the file. Only defer imports when necessary (e.g., Django model imports inside functions or methods where the app registry is not yet ready).
Avoid unnecessary blank lines inside function and method bodies.
Mark user-facing strings for translation with Django i18n helpers in Django code.
Write comments and docstrings only when they explain why code is shaped a certain way. Put comments before the relevant code block instead of scattering them inside it.
Files:
tests/openwisp2/sample_users/models.pytests/openwisp2/sample_users/migrations/0003_user_expiration_date_user_user_active_expiry_idx.pytests/openwisp2/sample_users/migrations/0002_default_groups_and_permissions.py
🧠 Learnings (1)
📚 Learning: 2026-06-01T21:59:25.519Z
Learnt from: nemesifier
Repo: openwisp/openwisp-ipam PR: 218
File: tests/openwisp2/sample_users/migrations/0003_user_expiration_date_user_user_active_expiry_idx.py:17-21
Timestamp: 2026-06-01T21:59:25.519Z
Learning: In openwisp-ipam test project migration files under tests/openwisp2/sample_users/migrations/, do not wrap model field `verbose_name` and `help_text` strings with Django’s i18n helpers (e.g., `gettext_lazy`). Keep these strings as plain literals in these migrations; reviewers should not suggest adding translation wrappers for these test migration strings.
Applied to files:
tests/openwisp2/sample_users/migrations/0003_user_expiration_date_user_user_active_expiry_idx.pytests/openwisp2/sample_users/migrations/0002_default_groups_and_permissions.py
🔇 Additional comments (2)
tests/openwisp2/sample_users/migrations/0002_default_groups_and_permissions.py (1)
6-6: LGTM!Also applies to: 34-36
tests/openwisp2/sample_users/models.py (1)
4-6: LGTM!
|
@coderabbitai review |
✅ Action performedReview finished.
|
Addressed in 9470119. CodeRabbit marked the inline comment addressed and its status check is passing.
|
@coderabbitai resolve |
✅ Action performedComments resolved and changes approved. |
9470119 to
f1032de
Compare
Checklist
Reference to Existing Issue
No existing issue. Replicates openwisp/openwisp-controller@9ca18cc for the IPAM sample app.
Description of Changes
Adds the
ApiKeyproxy model to the sample users test app migrations and model registration.Grants API key permissions to sample users admin groups during default group setup.
Adds the
authtokenmigration dependency required by theApiKeyproxy model.Screenshot
Not applicable. This is a test migration change.