Skip to content

eng-1863 Relation cross-app contract#1197

Open
maparent wants to merge 1 commit into
eng-1984-define-cross-app-schema-contractsfrom
eng-1863-define-cross-app-relation-contract-and-fixture
Open

eng-1863 Relation cross-app contract#1197
maparent wants to merge 1 commit into
eng-1984-define-cross-app-schema-contractsfrom
eng-1863-define-cross-app-relation-contract-and-fixture

Conversation

@maparent

@maparent maparent commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

@linear-code

linear-code Bot commented Jul 6, 2026

Copy link
Copy Markdown

ENG-1863

@vercel

vercel Bot commented Jul 6, 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 6, 2026 3:19pm

Request Review

@supabase

supabase Bot commented Jul 6, 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 ↗︎.

@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 1 potential issue.

Open in Devin Review

Comment on lines +26 to +36

type SpaceRef = DbRef | { url: string; sourceApp: Enums<"Platform"> };

export type LocalOrRemoteRef =
| LocalRef
| {
localId: string;
// infer space from context if absent.
space?: SpaceRef;
}
| {

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.

🔍 Structurally redundant union variants in LocalOrRemoteRef

The LocalOrRemoteRef type at packages/database/src/crossAppContracts.ts:26-36 defines three union variants, but the first two are structurally indistinguishable in TypeScript. Variant 1 is LocalRef = { localId: string }, and variant 2 is { localId: string; space?: SpaceRef }. Since space is optional, every value matching variant 1 also matches variant 2 — TypeScript's structural type system cannot discriminate between them. This means runtime type-narrowing code (e.g., checking for the presence of space) will never isolate variant 1 from variant 2. If future consumers need to distinguish 'definitely local' from 'possibly remote with space inferred from context', they won't be able to do so with this type as written. This may be intentional for readability (showing that a plain LocalRef is accepted), but it's worth confirming the design intent before downstream code is built against it.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@maparent maparent force-pushed the eng-1984-define-cross-app-schema-contracts branch from 562c561 to f1e49e1 Compare July 6, 2026 14:56
@maparent maparent force-pushed the eng-1863-define-cross-app-relation-contract-and-fixture branch from 4eb544e to a4c65c3 Compare July 6, 2026 15:17
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.

1 participant