Skip to content

ENG-2129 Populate reference_content from CrossAppNode and roles from CrossAppNodeSchema - #1324

Open
maparent wants to merge 4 commits into
mainfrom
eng-2129-allow-to-populate-reference_content-from-crossappnode-and
Open

ENG-2129 Populate reference_content from CrossAppNode and roles from CrossAppNodeSchema#1324
maparent wants to merge 4 commits into
mainfrom
eng-2129-allow-to-populate-reference_content-from-crossappnode-and

Conversation

@maparent

@maparent maparent commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

@linear-code

linear-code Bot commented Aug 21, 2026

Copy link
Copy Markdown

ENG-2129

@vercel

vercel Bot commented Aug 21, 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 Aug 23, 2026 5:46pm

Request Review

@supabase

supabase Bot commented Aug 21, 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 ↗︎.

@maparent
maparent force-pushed the eng-2129-allow-to-populate-reference_content-from-crossappnode-and branch from a90808f to cca9575 Compare August 21, 2026 12:38
@maparent
maparent force-pushed the eng-2146-bulk-convert-some-db-structures-to-crossapp-structures-as branch 2 times, most recently from 34d0502 to dbd71ca Compare August 21, 2026 12:47
Base automatically changed from eng-2146-bulk-convert-some-db-structures-to-crossapp-structures-as to main August 21, 2026 12:52
@maparent
maparent force-pushed the eng-2129-allow-to-populate-reference_content-from-crossappnode-and branch from cca9575 to 2269c8c Compare August 21, 2026 12:55
@maparent
maparent force-pushed the eng-2129-allow-to-populate-reference_content-from-crossappnode-and branch from 2269c8c to 0684aad Compare August 21, 2026 13:06
@maparent
maparent force-pushed the eng-2129-allow-to-populate-reference_content-from-crossappnode-and branch 2 times, most recently from 388295f to 68b7d27 Compare August 21, 2026 20:40
@maparent
maparent marked this pull request as ready for review August 21, 2026 20:50

@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 2 potential issues.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment thread packages/database/src/lib/sharedNodes.ts Outdated
Comment thread packages/database/src/lib/crossAppConverters.ts Outdated
@maparent
maparent force-pushed the eng-2129-allow-to-populate-reference_content-from-crossappnode-and branch from 68b7d27 to b98a419 Compare August 22, 2026 00:46
@maparent
maparent requested review from mdroidian and sid597 August 22, 2026 00:47
Comment thread packages/database/src/lib/sharedNodes.ts
@maparent
maparent force-pushed the eng-2129-allow-to-populate-reference_content-from-crossappnode-and branch from b98a419 to a998dc7 Compare August 22, 2026 16:30
@maparent
maparent force-pushed the eng-2129-allow-to-populate-reference_content-from-crossappnode-and branch from a998dc7 to ab1b460 Compare August 22, 2026 16:40
@maparent
maparent force-pushed the eng-2129-allow-to-populate-reference_content-from-crossappnode-and branch from ab1b460 to 03486e7 Compare August 22, 2026 16:43
@maparent

Copy link
Copy Markdown
Collaborator Author

Got Claude to add tests, which led to a correction.

@maparent
maparent force-pushed the eng-2129-allow-to-populate-reference_content-from-crossappnode-and branch from 03486e7 to 1f3c80c Compare August 23, 2026 17:45
@graphite-app

graphite-app Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

PR size/scope check

This PR is over our review-size guideline.

  • Recommended: ~200 lines changed
  • Acceptable limit: up to 400 lines when well-scoped/self-contained
  • Preferred file count: fewer than 5 files

Please split this into smaller PRs unless there is a clear reason the changes need to land together.

If keeping it as one PR, please add a brief justification covering:

  • What single problem this PR solves
  • Why the files/changes are coupled

@mdroidian

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: 1f3c80ca3c

ℹ️ 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".

r,
asSimpleLocalId(schemaMap[referenceContent[r] ?? 0], spaceUrl),
])
.filter(([, s]) => s !== undefined) as [string, string][],

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 Preserve unconstrained roles in slot definitions

When a schema declares a role without a reference_content target, this filter removes the role entirely. That is a valid representation because CrossAppNodeSchema.slotDefinitions explicitly permits undefined values, and crossAppNodeSchemaToDbConcept reconstructs literal_content.roles from Object.keys(slotDefinitions); consequently, a database-to-CrossApp-to-database round trip silently erases unconstrained roles and changes the schema's arity. Retain each declared role with an undefined value when no target can be resolved.

Useful? React with 👍 / 👎.

Comment on lines +202 to +203
const space = spacesById.get(c.space_id || 0);
if (!space || !c.source_local_id || !c.id) return [c.id, undefined];

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 Load every referenced space before resolving slots

When a shared node's slot targets a concept outside the node's own space, this lookup can resolve the RID only if that referenced space is present in spacesById. Production callers do not guarantee that: getSharedNodeByRid passes only the source space to buildSharedNodes, while listGroupSharedNodes explicitly excludes the current space. Such cross-space slots are therefore silently dropped even though the added unit test succeeds by manually supplying otherSpace; fetch the spaces used by concepts_of_relation before building the node map.

Useful? React with 👍 / 👎.

@mdroidian mdroidian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Probably worth looking into the comments.

template_content: node.template,
roles: slots.length > 0 ? slots : undefined,
});
const referenceContent = slots.length ? node.slotDefinitions! : undefined;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Avoid ! whenever possible. If not possible, document why it is absolutely required.

Looks like it isn't required here so let's not leave ourselves a footgun.

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