ENG-2131 Review and accept imported relation types and triples in Roam - #1383
ENG-2131 Review and accept imported relation types and triples in Roam#1383sid597 wants to merge 7 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
PR size/scope checkThis PR is over our review-size guideline.
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:
|
sid597
left a comment
There was a problem hiding this comment.
Inline notes on the non-obvious decisions in this diff.
|
|
||
| type ImportStatus = "provisional" | "accepted"; | ||
|
|
||
| export const RELATION_SCHEMA_STATUS_PROP_KEY = "status"; |
There was a problem hiding this comment.
The prop key is status to match Obsidian's field (ImportStatus in apps/obsidian/src/types.ts), and provisional is derived the same way as Obsidian's isProvisionalSchema: has importedFrom and status is not accepted. ENG-1611 is the precedent. Schemas imported before this PR carry no status and therefore read as provisional, so no migration is needed.
| }); | ||
| }); | ||
| }; | ||
| const handleDeleteImported = (rel: Relation) => { |
There was a problem hiding this comment.
Imported instances arrive together with the schema (ENG-1867 creates them as tentative) and they count as in use here, so a schema that came with instances cannot be deleted until its instances are removed. That is deliberate: deleting the schema would orphan the tentative instances that ENG-1869's instance review still needs. ENG-1869 unblocks deletion by letting users remove those instances.
| </HTMLTable> | ||
| {importedRelations.length > 0 && ( | ||
| <> | ||
| <h4 className="mb-1 mt-6">Imported relations</h4> |
There was a problem hiding this comment.
Imported relations get their own table rather than a badge in the local table because the ticket asks for imported schemas shown separately from local ones. The section is gated on data presence rather than a feature flag: these rows already exist in the graph, and hiding them while they stay excluded from creation would leave no way to accept or delete them. On main today they render as editable local rows, which is the bug this replaces.
| }; | ||
| type ImportedRelation = Relation & { importMeta: RelationSchemaImportMeta }; | ||
|
|
||
| const formatImportedSource = (sourceNodeRid: string): string => { |
There was a problem hiding this comment.
Obsidian formats source spaces with formatImportSource plus a spaceNames map (apps/obsidian/src/utils/typeUtils.ts). This version stays app-local and shows the raw space URI for non-Roam sources. A shared formatter next to the rid helpers is a follow-up candidate once Roam resolves space names.
| @@ -778,7 +791,9 @@ const TldrawCanvasShared = ({ | |||
| return Object.keys(allRelationsById); | |||
| }, [allRelationsById]); | |||
| const allRelationNames = useMemo(() => { | |||
There was a problem hiding this comment.
A label drops out of the canvas toolbar only when every relation carrying it is provisional. A label with one local and one imported relation keeps its tool, and the endpoint-matching step picks from the accepted list only.
|
Re the size guideline: 251 of the changed lines are non-test. The hunks are coupled to one problem: the accept UI is only safe to ship together with the creation and publishing exclusions, otherwise imported schemas are either usable with no way to accept them (exclusions alone) or unusable with no way to enable them (UI alone). Splitting would leave one of those intermediate states on main. |
There was a problem hiding this comment.
Devin Review found 3 potential issues.
2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
Reviewer brief
discourse-graph.status: "accepted") next to ENG-1867'simportedFrom, not in the settings record. Provisional is derived as "hasimportedFromand not accepted", which also covers schemas imported before this PR. IngatherCorrespondingRelations, filtering the schema list is sufficient to also drop instances of provisional schemas (the existing schema-existence filter removes them).discourseContext.relationsand in shape-util registration so existing arrows render and stay re-bindable (isValidNodeConnectionpassesincludeProvisional); only creation paths filter them. Accepting updates mounted canvases live viaprovisionalRelationIds; the toolbar gains a new tool on remount when the accepted label previously had no accepted relation.importSharedRelations.matchImportedRelationSchemasalready dedupes by imported rid, then by localId, then by label + source + destination. An accepted schema keepsimportedFrom, so a re-import maps onto it and does not reset its status. Deleting an imported schema and re-importing recreates it as provisional; there is no rejected state in v0.Export.tsx,getExportTypes,registerDiscourseDatalogTranslators,getDiscourseContextResults, discourse context overlay, relation bindings) still see provisional schemas. The ticket scopes exclusion to creation and publishing.Verification
pnpm install --frozen-lockfileandpnpm ci:validatepass from the repo root.relationSchemaAcceptance.test.ts, 5 passing).eslint,prettier, andtsc --noEmitclean on touched files; remaining eslint warnings are pre-existing on untouched lines.getCreatableRelationsrename, shared constants).Loom video
eng-2131-aligned-20260907.mp4
Scope check
$scope-checkagainst ENG-2131 and the final diff.Done When: None.Local delegated full review