fix: preserve empty object attributes (DAT-2310) - #935
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe change preserves empty ChangesObject attribute preservation
Pinned build references
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant ObjectAttributeTests
participant Database
participant Mongo
ObjectAttributeTests->>Database: Create and read object attribute
Database->>Mongo: Encode and persist object value
Mongo-->>Database: Return object with empty stdClass values
Database-->>ObjectAttributeTests: Decode cached or uncached attribute
ObjectAttributeTests->>Database: Submit equivalent or changed update
Database-->>ObjectAttributeTests: Preserve timestamp or require authorization
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Greptile SummaryThe PR preserves empty-object identity across object validation, serialization, Mongo conversion, change detection, and cached reads.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains. No blocking failure remains. Important Files Changed
Reviews (4): Last reviewed commit: "chore: depend on released cache and mong..." | Re-trigger Greptile |
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 `@src/Database/Database.php`:
- Around line 711-741: Update the attribute comparison in updateDocument() to
normalize decoded empty stdClass values to the equivalent empty-array
representation for strict change detection only. Preserve the original decoded
value for persistence and keep non-empty objects and other types unchanged.
🪄 Autofix
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 Plus
Run ID: 9526eb6f-1de4-4b7d-9cc3-bb1bf6a98a0b
📒 Files selected for processing (5)
src/Database/Adapter/Mongo.phpsrc/Database/Database.phpsrc/Database/Validator/ObjectValidator.phptests/e2e/Adapter/Scopes/ObjectAttributeTests.phptests/unit/Validator/ObjectTest.php
|
@copilot update to the released cache/mongo versions |
Co-authored-by: abnegate <5857008+abnegate@users.noreply.github.com>
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 `@Dockerfile`:
- Around line 24-29: Update the Dockerfile source hydration commands to remove
each destination source directory under vendor before copying the pinned cache
and mongo sources, preventing stale files from persisting. After all pinned
sources are copied, run composer dump-autoload --optimize --no-scripts so the
optimized class map reflects them.
🪄 Autofix
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 Plus
Run ID: 54125718-d497-4158-a7a8-9699eb5d66a0
⛔ Files ignored due to path filters (1)
composer.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
.github/workflows/tests.ymlDockerfilesrc/Database/Database.phptests/e2e/Adapter/Scopes/ObjectAttributeTests.php
🚧 Files skipped from review as they are similar to previous changes (2)
- tests/e2e/Adapter/Scopes/ObjectAttributeTests.php
- src/Database/Database.php
The Dockerfile cloned utopia-php/monorepo and utopia-php/mongo at fixed
commits and copied their src/ over vendor/, driven by build args pinned in
the workflow:
UTOPIA_CACHE_REFERENCE=d7c0806f...
UTOPIA_MONGO_REFERENCE=daea8f82...
That was a vendor patch standing in for releases that did not exist yet.
Both now do, so the lock resolves them normally and the machinery goes.
utopia-php/cache 4.0.1 -> 4.0.2 source 92e02dab6
utopia-php/mongo 1.5.2 source 20f9a644a
Both lock references equal the Packagist source references exactly, and
each release contains the pinned commit: d7c0806f is an ancestor of the
cache/4.0.2 tag commit, and 1.5.2 contains daea8f82.
Constraints already admitted these (cache ^4.0.0, mongo 1.*), so only the
lock moved. Removing the build args also stops a Docker build fetching
arbitrary external git refs.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
What changed
Seen red
On current main:
Verification
With exact sources from utopia-php/mongo#48 and utopia-php/monorepo#125 mounted, without changing Composer constraints:
The current-main locked Pint 1.30.4 reports the same style failures in all five touched files before this patch; that baseline was reproduced from a detached clean ce4e14e worktree.
Blocked release chain
Do not merge or release this in isolation. Its Mongo path requires a stable mongo 1.x release containing utopia-php/mongo#48, and its cache-hit path requires a stable cache 4.0.x release containing utopia-php/monorepo#125. No temporary VCS pin is introduced.
The downstream server-ce public API and Cloud dependency updates remain blocked until those stable packages and this database release exist.
Related: utopia-php/monorepo#123.
Summary by CodeRabbit
{}(including nested empty objects) rather than being converted to empty arrays.stdClassvalues correctly, including safe handling of non-string vector inputs.