Skip to content

ENG-2067 Refactor publishNodesToGroups to avoid database access in loops - #1248

Open
maparent wants to merge 2 commits into
mainfrom
eng-2067-refactor-publishnodestogroups-to-avoid-database-access-in
Open

ENG-2067 Refactor publishNodesToGroups to avoid database access in loops#1248
maparent wants to merge 2 commits into
mainfrom
eng-2067-refactor-publishnodestogroups-to-avoid-database-access-in

Conversation

@maparent

@maparent maparent commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

@linear-code

linear-code Bot commented Jul 26, 2026

Copy link
Copy Markdown

ENG-2067

@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
discourse-graph Ready Ready Preview, Comment Jul 27, 2026 3:33pm

Request Review

@supabase

supabase Bot commented Jul 26, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Comment thread apps/roam/src/utils/publishNodesToGroups.ts
Comment thread packages/database/src/lib/groups.ts

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 4 potential issues.

View 2 additional findings in Devin Review.

Open in Devin Review

Comment thread apps/roam/src/utils/publishNodesToGroups.ts
Comment thread apps/roam/src/utils/publishNodesToGroups.ts
Comment thread apps/roam/src/utils/publishNodesToGroups.ts Outdated
Comment thread packages/database/src/lib/groups.ts
@maparent
maparent force-pushed the eng-2067-refactor-publishnodestogroups-to-avoid-database-access-in branch from ab026af to 05ce8da Compare July 27, 2026 01:27
@maparent
maparent requested review from mdroidian and sid597 July 27, 2026 10:36
@maparent
maparent force-pushed the eng-2067-refactor-publishnodestogroups-to-avoid-database-access-in branch from 4e8d0a4 to 9792f5d Compare July 27, 2026 15:32

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +93 to 97
...nodeUids.map((sourceLocalId) => ({
account_uid: groupId,
source_local_id: sourceLocalId,
space_id: spaceId,
})),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +104 to +106
if (!isIgnorableUpsertError(grantRes.error)) {
internalError({ error: grantRes.error });
return result;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants