Repository navigation
fix: strip internal $collection from commit and bulk event payloads - #14216
Conversation
Security rulesNo new WARNING or ERROR findings from security rules. 32 existing findings tracked in
|
|
@hansi-codes review |
🔵 Tier A · Mergeable after minor fixes
Removes internal
Fix with agent prompt### Issue 1
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.php:491-492
**Add coverage for bulk event payloads**
The new E2E assertion covers transaction commits, but this removal also changes `triggerBulk()`, used by bulk update, upsert, and delete; those event payloads are not asserted in the E2E suite. A regression in this path could reintroduce either internal field without failing the new test, so please add an observable payload assertion for a bulk operation, including `$tenant`.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.📂 Walkthrough · 3
Reviewed |
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Create events for TablesDB were still carrying the legacy collection shape. Publish the row or document model so the payload has $databaseId and only the container id for the API that was called.
1aed62b to
257eda5
Compare
|
@hansi-codes review |
The response model already strips $tenant, and a stored document never carries the other API's container id: writing one is rejected as an unknown attribute.
Bulk update, upsert and delete never ran processDocument(), so their event payloads carried the internal $collection table name, and $tenant on shared tables. Remove both the same way processDocument() removes $collection.
Committed rows and documents carried the internal $collection table name, and $tenant on shared tables. Remove both before the payload is built, keeping the hand-built $databaseId and surface id as before.
Single and bulk create payloads already carry $databaseId and the surface id, and both tests pass without the fix, so they guard nothing.
|
Review complete. No blocking issues — 1 nitpick below. 🧹 Nitpicks (1) — 🟢 1 low
The change removes leaked internal database metadata (
Reviewed commit: 82d1ee7 |
ghost
left a comment
There was a problem hiding this comment.
🔵 Tier A · See the inline comments. Summary
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.php:491-492
Add coverage for bulk event payloads
The new E2E assertion covers transaction commits, but this removal also changes triggerBulk(), used by bulk update, upsert, and delete; those event payloads are not asserted in the E2E suite. A regression in this path could reintroduce either internal field without failing the new test, so please add an observable payload assertion for a bulk operation, including $tenant.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.php
Line: 491-492
Comment:
**Add coverage for bulk event payloads**
The new E2E assertion covers transaction commits, but this removal also changes `triggerBulk()`, used by bulk update, upsert, and delete; those event payloads are not asserted in the E2E suite. A regression in this path could reintroduce either internal field without failing the new test, so please add an observable payload assertion for a bulk operation, including `$tenant`.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.🟡 Minor · testing · Reply if this doesn't apply.
What does this PR do?
Row and document event payloads from bulk update, upsert, delete and transaction commit carried the internal
$collectiontable name (for exampledatabase_1_collection_1), and$tenanton shared tables. Those paths never runprocessDocument(), so nothing removed them.Both are now removed before the payload is queued for functions, webhooks and realtime, the same way
processDocument()already removes$collectionfor single and bulk create.$databaseIdand the surface id ($tableIdor$collectionId) were already present on every path, including commit since #13535.Test Plan
testCommitEventPayloadCarriesSurfaceIdsnow also asserts$collectionis absent. It fails onmainand passes here (TablesDB and Legacy).$collectionis present; after, the keys are$id, the columns,$sequence,$createdAt,$updatedAt,$permissions,$databaseIdand the surface id.Related PRs and Issues
Checklist