Skip to content

Conversation

@fogelito
Copy link
Contributor

@fogelito fogelito commented Jan 13, 2026

Summary by CodeRabbit

  • Refactor
    • Improved the internal structure of database cleanup operations for better code organization and maintainability.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 13, 2026

Walkthrough

The cleanup deletion logic in the Database adapter was refactored to pre-construct a $queries array containing a select projection, a time-based filter using lessThan, and ordering directives before passing it to deleteDocuments. Previously, the time filter was passed inline. The looping mechanism that repeats the operation until no documents remain unchanged, as are error handling and exit conditions. No public entity signatures were modified.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'update cleanup queries' directly and specifically describes the main change: modifying the cleanup query structure in the Database.php file to use a pre-constructed queries array instead of inline filtering.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @src/Audit/Adapter/Database.php:
- Around line 387-395: The Query::orderAsc() call in the $queries array is
invalid because it requires an attribute; update the query list used before
deleteDocuments by either removing Query::orderAsc() if only ordering by time
descending is intended, or replace it with Query::orderAsc('time') to use a
secondary ascending sort on the same attribute; the change should be made where
the $queries array is built (the entries including Query::select(...),
Query::lessThan('time', $datetimeString), Query::orderDesc('time'),
Query::orderAsc()) so the composed queries comply with utopia-php/database v4
API.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 662244b and 0e86242.

📒 Files selected for processing (1)
  • src/Audit/Adapter/Database.php
🧰 Additional context used
🧬 Code graph analysis (1)
src/Audit/Adapter/Database.php (1)
src/Audit/Adapter/SQL.php (1)
  • getCollectionName (24-27)
🔇 Additional comments (1)
src/Audit/Adapter/Database.php (1)

388-389: LGTM on the select projection and time filter.

The select projection appropriately limits the fields to essential document metadata and the time field needed for the filter. This is a sensible optimization for batch deletion operations.

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.

2 participants