Repository navigation
Omit relationship attributes from create and transaction commit event payloads - #14349
Conversation
Pass relationship attribute keys as sensitive on document create, bulk document events, and transaction commit so those paths match the existing update payload handling. Co-authored-by: Jake Barnby <[email protected]>
|
Review complete. No blocking issues — approved ✅; 1 nitpick below. 🧹 Nitpicks (1) — 🟢 1 low
The PR closes a realtime payload-leak gap where single-document creates, bulk creates, and transaction commits sent nested related documents to websocket subscribers while other paths already redacted them.
Reviewed commit: 2d71b89 |
🟢 Tier S · Ready to merge
Create, bulk-document, and transaction-commit events now omit relationship attributes from their payloads, consistent with document and row updates. Realtime e2e coverage checks create and transaction-commit payloads for related documents. Latest changes: The latest commit reads relationship keys from the fully loaded collection schema, since the metadata lookup used during commit omits attribute subqueries.
📂 Walkthrough · 4
Merged |
Security rulesNo new WARNING or ERROR findings from security rules. 19 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Transaction commit event payloads looked up relationship attributes on a metadata document that skips those subqueries. Use the collection already loaded during commit so create/update/upsert commit events match the update payload shape. Co-authored-by: Jake Barnby <[email protected]>
…tionship payloads appwrite#14349 filtered relationship attributes out of create and transaction commit event payloads by comparing against Database::VAR_RELATIONSHIP. utopia-php/database 8 removed the VAR_* constants in favour of the ColumnType enum, so every document create, bulk event trigger and transaction commit fataled with an undefined constant and returned 500, and PHPStan reported three classConstant.notFound errors. Compare against ColumnType::Relationship->value, the idiom the rest of the module already uses. Stored _metadata attributes, Appwrite attribute documents and the Collection returned by getCollection() all carry the type as the string 'relationship' (Attribute::storedType), so the filter matches in every path that reaches it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
What does this PR do?
Align create, bulk document events, and transaction commit event payloads with the existing update path.
Document and row update already pass relationship attribute keys as
sensitivewhen callingsetPayload, so related documents are not embedded in realtime/event payloads. Create never calledsetPayload(the shared shutdown hook copied the full response), and transaction commit re-read committed rows viagetDocumentthen calledsetPayloadwithout those keys.This change:
triggerBulkso bulk create/update/upsert stay consistent (those routes still reject collections with relationship attributes)TablesDB, DocumentsDB, and VectorsDB create/commit actions inherit these paths.
Test Plan
Added realtime e2e coverage in
RealtimeCustomClientTest:testCreateRelationshipPayloadAlignsWithUpdate— create a document that sets a relationship and assert the create event payload includes the document fields but not the relationship attributetestTransactionCommitRelationshipPayloadAlignsWithUpdate— commit a transaction that creates the same shape and assert the commit event payload matches updateRelated PRs and Issues
Checklist