Repository navigation
fix(service): keep derived editors out of the stored page json - #33793
Conversation
owners is stripped from the storage json for every entity -- EntityRepository.FIELDS_STORED_AS_RELATIONSHIPS carries it alongside href, children, tags, domains, dataProducts, dataContract, followers, experts, reviewers and certification -- so it is always rebuilt from the OWNS relationship. editors, which KnowledgePageRepository derives the same way from EDITED_BY, had no such protection: it is absent from that list and this repository overrode nothing. Nothing persists it today, but only because editors is missing from KNOWLEDGE_PATCH_FIELDS, so the update path leaves it null at store time. That is a property of a field list rather than a guarantee -- adding editors there would silently start writing a snapshot of the relationship into the json, and setFields hands the stored value back to any caller that does not request the field. A sweep of every jsonb column in a populated database backs this up: no entity table stores owners except nine table_entity rows holding an empty array, and entity_extension, which is version history and keeps the whole entity on purpose. The test fails without the override and covers owners too, so the base list cannot quietly lose it either. (cherry picked from commit 731c1c4)
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ Approved🟡 Medium risk · Changes page persistence serialization for derived editors; bounded internal behavior change. Prevents OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
✅ Playwright Results — workflow succeededValidated commit ✅ 4555 passed · ❌ 0 failed · 🟡 3 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 37m 43s ⏱️ Max setup 4m 33s · max shard execution 21m 51s · max shard-job elapsed before upload 25m 11s · reporting 16s 🌐 224.69 requests/attempt · 2.22 app boots/UI scenario · 33.10% common-shard skew Optimization targets still in progress:
🟡 3 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
Describe your changes:
ownersis stripped from the storage json for every entity viaEntityRepository.FIELDS_STORED_AS_RELATIONSHIPS(alongsidehref,children,tags,domains,dataProducts,dataContract,followers,experts,reviewers,certification), so it is always rebuilt from the OWNS relationship.editors— whichKnowledgePageRepositoryderives the same way fromEDITED_BY— had no such protection: it was absent from that list and this repository overrode nothing.Nothing persists it today, but only because
editorsis missing fromKNOWLEDGE_PATCH_FIELDS, so the update path leaves it null at store time. That is a property of a field list rather than a guarantee — addingeditorsthere would silently start writing a snapshot of the relationship into the json, andsetFieldshands the stored value back to any caller that does not request the field.A sweep of every jsonb column in a populated database confirms
editorsis not stored today. This change makes that invariant explicit so a future addition toKNOWLEDGE_PATCH_FIELDScannot regress it.Type of change:
Tests:
KnowledgePageStorageJsonTest— new unit test that verifieseditorsis stripped from the stored page json before persistence.Notes:
Cherry-picked from #33088 (commit 731c1c4) to land as a small, independently-mergeable PR. Original commit authored by @harshach. #33088 has been marked draft while the remaining changes are split out into targeted PRs.
🤖 Generated with Claude Code
The PR appears safe to merge; no actionable correctness, security, or repository-rule issues were identified.
Summary
This PR explicitly keeps the relationship-derived
editorsfield out of stored Knowledge Page JSON and adds focused regression coverage.editors.editorsand the sharedownersrelationship field are omitted.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR P[Page entity] --> S[storageJsonNode] S --> C[Strip shared relationship fields] C --> E[Strip editors] E --> J[Persist attribute-only JSON] R[EDITED_BY relationship] --> H[Hydrate editors on requested reads]Reviews (1) · Last reviewed commit: "fix(service): keep derived editors out o..."