ENG-2067 Refactor publishNodesToGroups to avoid database access in loops - #1248
ENG-2067 Refactor publishNodesToGroups to avoid database access in loops#1248maparent wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
ab026af to
05ce8da
Compare
4e8d0a4 to
9792f5d
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9792f5d5bc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ...nodeUids.map((sourceLocalId) => ({ | ||
| account_uid: groupId, | ||
| source_local_id: sourceLocalId, | ||
| space_id: spaceId, | ||
| })), |
There was a problem hiding this comment.
Include node-type schemas in the batched grants
When publishing to a group with only partial space access, this batch grants each node UID but omits the corresponding node.nodeType schema IDs that the previous implementation explicitly included. The my_concepts view filters partial readers by ResourceAccess, so schema_of_concept cannot return those ungranted schemas and every newly published node can appear without its required type information. Collect the synced node-type IDs and include them in resourceAccesses.
Useful? React with 👍 / 👎.
| if (!isIgnorableUpsertError(grantRes.error)) { | ||
| internalError({ error: grantRes.error }); | ||
| return result; |
There was a problem hiding this comment.
Report all target groups when the bulk grant fails
When the single ResourceAccess upsert returns an error, this branch exits without adding the current groupIds to failedGroupIds. Export.tsx uses that array for both telemetry and the user-facing failure count, so an RLS, network, or request-size error affecting the whole batch is reported as zero group failures even though none of the groups received the grants. Mark the target groups as failed or rethrow the error.
Useful? React with 👍 / 👎.
https://linear.app/discourse-graphs/issue/ENG-2067/refactor-publishnodestogroups-to-avoid-database-access-in-loops
https://www.loom.com/share/77efaa71a3c5462d855c2e52816e397c