-
Notifications
You must be signed in to change notification settings - Fork 55
Allow modifying createdAt and updatedAt #642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughValidation logic was added to prevent empty string values for Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Database
participant Validator
participant Document
Client->>Database: createDocument(collection, document)
Database->>Document: Check if $createdAt, $updatedAt === null or preservation disabled
alt $createdAt or $updatedAt is empty string
Database->>Validator: Validate document (required dates)
Validator-->>Database: throw StructureException
Database-->>Client: throw StructureException
else valid or null
Database->>Document: Set or preserve $createdAt, $updatedAt
Database->>Document: encode() converts empty string dates to null
Database-->>Client: Return created document
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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
🧹 Nitpick comments (3)
src/Database/Database.php (2)
3604-3611: Improve error messages for better clarity.The error messages mention "Invalid type" but the actual issue is that empty strings are not allowed. Consider making the messages more descriptive:
- throw new StructureException('Invalid type for the $createdAt'); + throw new StructureException('Empty string is not allowed for $createdAt field'); - throw new StructureException('Invalid type for the $updatedAt'); + throw new StructureException('Empty string is not allowed for $updatedAt field');
3710-3716: Improve error messages and consider extracting validation logic.Same issue with error messages as in the
createDocumentmethod. Additionally, consider extracting this validation into a private helper method to reduce code duplication:- if(is_string($createdAt) && empty($createdAt)){ - throw new StructureException('Invalid type for the $createdAt'); - } - - if(is_string($updatedAt) && empty($updatedAt)){ - throw new StructureException('Invalid type for the $updatedAt'); - } + $this->validateTimestampFields($createdAt, $updatedAt);Then add a helper method:
private function validateTimestampFields($createdAt, $updatedAt): void { if (is_string($createdAt) && empty($createdAt)) { throw new StructureException('Empty string is not allowed for $createdAt field'); } if (is_string($updatedAt) && empty($updatedAt)) { throw new StructureException('Empty string is not allowed for $updatedAt field'); } }tests/e2e/Adapter/Scopes/GeneralTests.php (1)
181-182: Consider uncommenting or removing the commented assertion lines.The commented assertion lines suggest uncertainty about the exact error message format. Either uncomment them with the correct expected message or remove them entirely to keep the code clean.
Apply this diff to clean up the commented assertions:
- // $this->assertEquals('Invalid document structure: Missing required attribute "$createdAt"', $e->getMessage());- // $this->assertEquals('Invalid document structure: Missing required attribute "$createdAt"', $e->getMessage());Also applies to: 202-203
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/Database/Database.php(2 hunks)tests/e2e/Adapter/Scopes/DocumentTests.php(1 hunks)tests/e2e/Adapter/Scopes/GeneralTests.php(2 hunks)
🔇 Additional comments (4)
tests/e2e/Adapter/Scopes/GeneralTests.php (4)
169-183: Well-structured validation test for empty string$createdAt.The test correctly validates that empty strings for
$createdAtthrow aStructureException. The exception handling and assertion are properly implemented.
184-203: Comprehensive batch document creation validation.Good test coverage for batch document creation with empty string
$createdAtvalues. The test properly validates that the exception is thrown during batch operations.
227-233: Excellent addition of null value test case.Adding a document with
$createdAtset tonullprovides comprehensive test coverage for the auto-generation behavior when no explicit date is provided.
238-243: Robust assertions for null$createdAthandling.The assertions correctly verify that:
- A
$createdAtvalue is auto-generated whennullis provided- The auto-generated date is different from the explicitly set date
This ensures the date preservation logic works correctly for both explicit and auto-generated scenarios.
…s in Structure validator
f8c2589 to
b81f27a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
tests/e2e/Adapter/Scopes/DocumentTests.php (1)
4654-4654: Empty string forVAR_DATETIMEattribute violates validation rulesThis line uses an empty string for the
datetimeattribute, which conflicts with the recent validation hardening that treats empty strings as invalid for datetime fields. This will cause aStructureException.Apply this fix:
- 'datetime' => '' + 'datetime' => null
🧹 Nitpick comments (1)
tests/e2e/Adapter/Scopes/DocumentTests.php (1)
4735-4735: Remove unused variableThe variable
$resultDocsis assigned but never used.Apply this fix:
- $resultDocs = $database->createDocuments($collection, $documents, batchSize: 2); + $database->createDocuments($collection, $documents, batchSize: 2);
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/Database/Database.php(4 hunks)src/Database/Validator/Structure.php(2 hunks)tests/e2e/Adapter/Scopes/DocumentTests.php(1 hunks)tests/e2e/Adapter/Scopes/GeneralTests.php(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- tests/e2e/Adapter/Scopes/GeneralTests.php
- src/Database/Database.php
🧰 Additional context used
🪛 PHPMD (2.15.0)
tests/e2e/Adapter/Scopes/DocumentTests.php
4735-4735: Avoid unused local variables such as '$resultDocs'. (Unused Code Rules)
(UnusedLocalVariable)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: Adapter Tests (MySQL)
- GitHub Check: Adapter Tests (SharedTables/MySQL)
- GitHub Check: Adapter Tests (SQLite)
- GitHub Check: Adapter Tests (SharedTables/Postgres)
- GitHub Check: Adapter Tests (SharedTables/SQLite)
- GitHub Check: Adapter Tests (Mirror)
- GitHub Check: Adapter Tests (SharedTables/MariaDB)
- GitHub Check: Adapter Tests (Postgres)
- GitHub Check: Adapter Tests (Pool)
- GitHub Check: Adapter Tests (MariaDB)
- GitHub Check: Unit Test
🔇 Additional comments (4)
src/Database/Validator/Structure.php (2)
71-78: Database layer correctly auto-populates $createdAt and $updatedAtThe validator now requires both
$createdAtand$updatedAt, and the database layer guarantees those attributes are always set:
- In src/Database/Database.php
•->setAttribute('$createdAt', ($createdAt === null || !$this->preserveDates) ? $time : $createdAt)
•->setAttribute('$updatedAt', ($updatedAt === null || !$this->preserveDates) ? $time : $updatedAt)- E2E tests in tests/e2e/Adapter/Scopes/GeneralTests.php confirm:
• Empty string for$createdAt/$updatedAtthrows aStructureException
• Non‐empty ISO dates are preserved whenpreserveDatesis enabled
• Null or missing dates auto‐populate with the current timestamp- Batch create/modify flows and query operations (ordering, filtering by these attributes) are covered across multiple adapter tests.
No further changes required.
79-87: Database layer auto-populates$updatedAt, no action neededThe Database class always sets
$updatedAtduring create and update flows—using the current timestamp or preserving user-supplied dates—so the validator’srequired: trueconstraint will never fail.tests/e2e/Adapter/Scopes/DocumentTests.php (2)
4665-4683: LGTM! Date preservation logic is well tested.The test correctly verifies that when
setPreserveDates(true)is enabled, explicitly provided$createdAtvalues are preserved while$updatedAtis still auto-generated with a different timestamp.
4737-4751: Excellent test coverage for bulk document date preservationThe test comprehensively validates different scenarios:
- Documents with explicit
$createdAtpreserve the specified date- Documents with explicit
$updatedAtpreserve the specified date- Documents with null or omitted dates get auto-generated timestamps
- Proper verification for each document ID scenario
…d update documents
There was a problem hiding this 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
🧹 Nitpick comments (1)
src/Database/Validator/PartialStructure.php (1)
16-16: Improve parameter documentation.The parameter documentation could be more descriptive about what the array contains and how it's used.
- * @param array<string, string> $requiredAttributes optional list of required attributes to check + * @param array<string> $requiredAttributes optional list of attribute IDs to validate as required
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/Database/Database.php(7 hunks)src/Database/Validator/PartialStructure.php(2 hunks)tests/e2e/Adapter/Scopes/DocumentTests.php(1 hunks)tests/e2e/Adapter/Scopes/GeneralTests.php(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- tests/e2e/Adapter/Scopes/DocumentTests.php
- src/Database/Database.php
- tests/e2e/Adapter/Scopes/GeneralTests.php
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/Database/Validator/PartialStructure.php (1)
src/Database/Validator/Structure.php (2)
isValid(206-240)checkForAllRequiredValues(251-266)
🔇 Additional comments (2)
src/Database/Validator/PartialStructure.php (2)
20-20: Method signature enhancement looks good.The addition of the optional
$requiredAttributesparameter maintains backward compatibility while enabling selective required attribute validation.
47-49: Validation logic implementation is correct.The call to
checkForAllRequiredValueswith the filtered required attributes map properly enforces selective validation while maintaining the existing validation flow.
…t attributes in DocumentTests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
tests/e2e/Adapter/Scopes/DocumentTests.php (3)
4638-4685: Enhance test documentation and assertions for better clarity.The test logic is sound, but could be improved for better maintainability and clarity:
Document intentional behavior testing: Add comments explaining that the empty string test for
datetimeattribute is intentional to document current system behavior.Add missing assertion: Verify what happens to the empty
datetimefield to fully document the behavior.Consider test organization: This test covers multiple scenarios - consider splitting into focused test methods.
public function testDateTimeDocument(): void { /** * @var Database $database */ $database = static::getDatabase(); $collection = 'create_modify_dates'; $database->createCollection($collection); $this->assertEquals(true, $database->createAttribute($collection, 'string', Database::VAR_STRING, 128, false)); $this->assertEquals(true, $database->createAttribute($collection, 'datetime', Database::VAR_DATETIME, 0, false, null, true, false, null, [], ['datetime'])); $date = '2000-01-01T10:00:00.000+00:00'; - // test - default behaviour of external datetime attribute not changed + // Test: Document current behavior when datetime attribute is set to empty string + // This is intentional to verify existing system behavior with empty datetime values $doc = $database->createDocument($collection, new Document([ '$id' => 'doc1', '$permissions' => [Permission::read(Role::any()),Permission::write(Role::any()),Permission::update(Role::any())], - 'datetime' => '' + 'datetime' => '' // Intentionally testing empty string behavior ])); $this->assertNotEmpty($doc->getAttribute('datetime')); + $this->assertNotEmpty($doc->getAttribute('datetime'), 'Empty datetime should be populated with current timestamp'); $this->assertNotEmpty($doc->getAttribute('$createdAt')); $this->assertNotEmpty($doc->getAttribute('$updatedAt'));
4687-4935: Consider refactoring for better maintainability while preserving excellent test coverage.This is a comprehensive and well-structured test that thoroughly covers date operations scenarios. The test logic is sound and covers important edge cases.
However, the function is quite long (247 lines) which could impact maintainability:
Consider splitting into focused test methods:
testCreateDocumentWithCustomDates()testUpdateDocumentWithCustomDates()testUpsertDocumentWithCustomDates()testDateOperationsWithPreserveDatesDisabled()You could also extract common setup into helper methods:
private function createTestDocument(string $id, array $attributes = []): Document { return new Document(array_merge([ '$id' => $id, '$permissions' => [Permission::read(Role::any()), Permission::write(Role::any()), Permission::update(Role::any())], 'string' => 'test_value' ], $attributes)); }This would make individual test failures easier to debug while maintaining the comprehensive coverage.
4937-5191: Excellent bulk operations test coverage - consider refactoring for maintainability.This is a thorough and well-organized test that comprehensively covers bulk document operations with date handling. The test scenarios are well thought out and cover important edge cases.
Similar to the previous function, the main concern is the length (254 lines) which could impact maintainability:
Consider splitting into focused test methods:
testBulkCreateDocumentsWithCustomDates()testBulkUpdateDocumentsWithCustomDates()testBulkUpsertDocumentsWithCustomDates()testBulkOperationsWithPreserveDatesDisabled()Helper methods could reduce code duplication:
private function createBulkTestDocuments(array $configs): array { $permissions = [Permission::read(Role::any()), Permission::write(Role::any()), Permission::update(Role::any())]; return array_map(function ($config) use ($permissions) { return new Document(array_merge([ '$permissions' => $permissions, ], $config)); }, $configs); } private function assertDateValues(array $expectedDates, string $collection): void { foreach ($expectedDates as $id => $dates) { $doc = $this->getDatabase()->getDocument($collection, $id); if (isset($dates['$createdAt'])) { $this->assertEquals($dates['$createdAt'], $doc->getAttribute('$createdAt')); } if (isset($dates['$updatedAt'])) { $this->assertEquals($dates['$updatedAt'], $doc->getAttribute('$updatedAt')); } } }This would make the tests more modular and easier to debug while maintaining the excellent coverage.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/Database/Adapter/SQL.php(1 hunks)src/Database/Database.php(8 hunks)tests/e2e/Adapter/Scopes/DocumentTests.php(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/Database/Database.php
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: ArnabChatterjee20k
PR: utopia-php/database#642
File: src/Database/Validator/PartialStructure.php:43-52
Timestamp: 2025-07-30T19:17:53.598Z
Learning: In PartialStructure validator, when filtering for required attributes validation using the $requiredAttributes parameter, $this->attributes should be used instead of the merged $attributes array because this validation is specifically for internal attributes like $createdAt and $updatedAt that are defined in the base Structure class, not collection-specific attributes.
src/Database/Adapter/SQL.php (1)
Learnt from: ArnabChatterjee20k
PR: #642
File: src/Database/Validator/PartialStructure.php:43-52
Timestamp: 2025-07-30T19:17:53.598Z
Learning: In PartialStructure validator, when filtering for required attributes validation using the $requiredAttributes parameter, $this->attributes should be used instead of the merged $attributes array because this validation is specifically for internal attributes like $createdAt and $updatedAt that are defined in the base Structure class, not collection-specific attributes.
tests/e2e/Adapter/Scopes/DocumentTests.php (1)
Learnt from: ArnabChatterjee20k
PR: #642
File: src/Database/Validator/PartialStructure.php:43-52
Timestamp: 2025-07-30T19:17:53.598Z
Learning: In PartialStructure validator, when filtering for required attributes validation using the $requiredAttributes parameter, $this->attributes should be used instead of the merged $attributes array because this validation is specifically for internal attributes like $createdAt and $updatedAt that are defined in the base Structure class, not collection-specific attributes.
🧬 Code Graph Analysis (1)
src/Database/Adapter/SQL.php (1)
src/Database/Document.php (1)
getCreatedAt(156-159)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Adapter Tests (SharedTables/Postgres)
- GitHub Check: Adapter Tests (SharedTables/MySQL)
- GitHub Check: Adapter Tests (SharedTables/MariaDB)
- GitHub Check: Adapter Tests (Mirror)
- GitHub Check: Adapter Tests (MySQL)
- GitHub Check: Adapter Tests (Pool)
- GitHub Check: Adapter Tests (MariaDB)
- GitHub Check: Adapter Tests (Postgres)
🔇 Additional comments (1)
src/Database/Adapter/SQL.php (1)
425-427: LGTM! Consistent implementation following established patterns.The addition of
$createdAtattribute handling follows the same pattern as the existing$updatedAtlogic. The use of!empty()is appropriate here to filter out both null values and empty strings, ensuring only valid timestamps are included in the SQL update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/e2e/Adapter/Scopes/DocumentTests.php (1)
4972-5236: Remove unused variables to improve code clarity.The test provides excellent coverage of upsert operations with date preservation. However, there are unused variables that should be removed:
- Line 4989:
$date1is defined but never used- Line 4990:
$date2is defined but never usedThese appear to be duplicates of
$createDateand$updateDate. Consider removing them or using them consistently throughout the test.- $createDate = '2000-01-01T10:00:00.000+00:00'; - $updateDate = '2000-02-01T15:30:00.000+00:00'; - $date1 = '2000-01-01T10:00:00.000+00:00'; - $date2 = '2000-02-01T15:30:00.000+00:00'; - $date3 = '2000-03-01T20:45:00.000+00:00'; + $date1 = '2000-01-01T10:00:00.000+00:00'; + $date2 = '2000-02-01T15:30:00.000+00:00'; + $date3 = '2000-03-01T20:45:00.000+00:00';Then update the test to use
$date1instead of$createDateand$date2instead of$updateDatethroughout.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/e2e/Adapter/Scopes/DocumentTests.php(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ArnabChatterjee20k
PR: utopia-php/database#642
File: src/Database/Validator/PartialStructure.php:43-52
Timestamp: 2025-07-30T19:17:53.598Z
Learning: In PartialStructure validator, when filtering for required attributes validation using the $requiredAttributes parameter, $this->attributes should be used instead of the merged $attributes array because this validation is specifically for internal attributes like $createdAt and $updatedAt that are defined in the base Structure class, not collection-specific attributes.
tests/e2e/Adapter/Scopes/DocumentTests.php (1)
Learnt from: ArnabChatterjee20k
PR: #642
File: src/Database/Validator/PartialStructure.php:43-52
Timestamp: 2025-07-30T19:17:53.598Z
Learning: In PartialStructure validator, when filtering for required attributes validation using the $requiredAttributes parameter, $this->attributes should be used instead of the merged $attributes array because this validation is specifically for internal attributes like $createdAt and $updatedAt that are defined in the base Structure class, not collection-specific attributes.
🧬 Code Graph Analysis (1)
tests/e2e/Adapter/Scopes/DocumentTests.php (8)
tests/e2e/Adapter/Base.php (1)
getDatabase(34-34)src/Database/Database.php (12)
getDatabase(673-676)createCollection(1206-1324)createAttribute(1554-1605)Database(36-6858)createDocument(3572-3658)getDocument(3187-3308)setPreserveDates(984-989)deleteCollection(1485-1528)updateDocument(4097-4294)createDocuments(3673-3760)updateDocuments(4317-4480)createOrUpdateDocuments(4885-4898)src/Database/Adapter.php (11)
getDatabase(155-158)createCollection(505-505)createAttribute(537-537)createDocument(680-680)getDocument(670-670)deleteCollection(514-514)updateDocument(704-704)createDocuments(692-692)updateDocuments(719-719)getSupportForUpserts(995-995)createOrUpdateDocuments(731-735)src/Database/Adapter/Pool.php (10)
createCollection(153-156)createAttribute(168-171)createDocument(228-231)getDocument(223-226)deleteCollection(158-161)updateDocument(238-241)createDocuments(233-236)updateDocuments(243-246)getSupportForUpserts(403-406)createOrUpdateDocuments(248-251)src/Database/Document.php (1)
Document(12-464)src/Database/Helpers/Permission.php (4)
Permission(9-264)read(186-195)write(254-263)update(220-229)src/Database/Helpers/Role.php (2)
Role(5-178)any(159-162)src/Database/Query.php (2)
Query(8-730)equal(355-358)
🪛 PHPMD (2.15.0)
tests/e2e/Adapter/Scopes/DocumentTests.php
4989-4989: Avoid unused local variables such as '$date1'. (Unused Code Rules)
(UnusedLocalVariable)
4990-4990: Avoid unused local variables such as '$date2'. (Unused Code Rules)
(UnusedLocalVariable)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: Adapter Tests (SharedTables/SQLite)
- GitHub Check: Adapter Tests (SharedTables/MariaDB)
- GitHub Check: Adapter Tests (Mirror)
- GitHub Check: Adapter Tests (Postgres)
- GitHub Check: Adapter Tests (SharedTables/Postgres)
- GitHub Check: Adapter Tests (SharedTables/MySQL)
- GitHub Check: Adapter Tests (MariaDB)
- GitHub Check: Adapter Tests (SQLite)
- GitHub Check: Adapter Tests (Pool)
- GitHub Check: Adapter Tests (MySQL)
🔇 Additional comments (3)
tests/e2e/Adapter/Scopes/DocumentTests.php (3)
4638-4685: LGTM! Test covers datetime attribute behavior comprehensively.The test properly validates:
- Default behavior when empty string is passed to datetime attributes
- Preservation of custom
$createdAtvalues whenpreserveDatesis enabled- Automatic population of
$updatedAtwhen not provided
4687-4839: Excellent test coverage for single document date operations.The test thoroughly validates all date preservation scenarios including:
- Custom date preservation during create and update operations
- Null value handling for date fields
- Behavior differences when
preserveDatesis enabled vs disabled- Edge cases like updating only one date field
4841-4970: Comprehensive bulk operations test with date preservation.The test effectively validates:
- Bulk document creation with various date configurations
- Bulk updates respecting custom date values
- Proper behavior when toggling
preserveDatesflag- Null value handling in bulk operations
f02b0e8 to
e15bf27
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/e2e/Adapter/Scopes/DocumentTests.php (1)
4989-4990: Remove unused variables $date1 and $date2These variables are defined but never used in the test method.
- $date1 = '2000-01-01T10:00:00.000+00:00'; - $date2 = '2000-02-01T15:30:00.000+00:00'; $date3 = '2000-03-01T20:45:00.000+00:00';
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/Database/Database.php(8 hunks)tests/e2e/Adapter/Scopes/DocumentTests.php(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/Database/Database.php
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ArnabChatterjee20k
PR: utopia-php/database#642
File: src/Database/Validator/PartialStructure.php:43-52
Timestamp: 2025-07-30T19:17:53.598Z
Learning: In PartialStructure validator, when filtering for required attributes validation using the $requiredAttributes parameter, $this->attributes should be used instead of the merged $attributes array because this validation is specifically for internal attributes like $createdAt and $updatedAt that are defined in the base Structure class, not collection-specific attributes.
tests/e2e/Adapter/Scopes/DocumentTests.php (1)
Learnt from: ArnabChatterjee20k
PR: #642
File: src/Database/Validator/PartialStructure.php:43-52
Timestamp: 2025-07-30T19:17:53.598Z
Learning: In PartialStructure validator, when filtering for required attributes validation using the $requiredAttributes parameter, $this->attributes should be used instead of the merged $attributes array because this validation is specifically for internal attributes like $createdAt and $updatedAt that are defined in the base Structure class, not collection-specific attributes.
🪛 PHPMD (2.15.0)
tests/e2e/Adapter/Scopes/DocumentTests.php
4989-4989: Avoid unused local variables such as '$date1'. (Unused Code Rules)
(UnusedLocalVariable)
4990-4990: Avoid unused local variables such as '$date2'. (Unused Code Rules)
(UnusedLocalVariable)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: Adapter Tests (SharedTables/Postgres)
- GitHub Check: Adapter Tests (SharedTables/MariaDB)
- GitHub Check: Adapter Tests (SharedTables/MySQL)
- GitHub Check: Adapter Tests (Postgres)
- GitHub Check: Adapter Tests (Mirror)
- GitHub Check: Adapter Tests (Pool)
- GitHub Check: Adapter Tests (SharedTables/SQLite)
- GitHub Check: Adapter Tests (SQLite)
- GitHub Check: Adapter Tests (MariaDB)
- GitHub Check: Adapter Tests (MySQL)
Summary by CodeRabbit
Bug Fixes
Tests