Skip to content

ENG-1611 Add provisional status to imported relation schemas#948

Open
trangdoan982 wants to merge 4 commits intomainfrom
eng-1611-add-provisional-property-to-imported-relation-schemas
Open

ENG-1611 Add provisional status to imported relation schemas#948
trangdoan982 wants to merge 4 commits intomainfrom
eng-1611-add-provisional-property-to-imported-relation-schemas

Conversation

@trangdoan982
Copy link
Copy Markdown
Member

@trangdoan982 trangdoan982 commented Apr 8, 2026

Summary

  • Newly imported relation types and triplets are marked provisional and hidden from all creation UIs until the user explicitly accepts them
  • Adds ImportStatus type and status? field to DiscourseRelationType and DiscourseRelation; backward-compatible (imported schemas with no status field are treated as provisional)
  • Settings UI shows a Provisional badge with Accept + Delete buttons for unreviewed imported schemas; accepting a triplet cascades to also accept its relation type
  • Guards publishNewRelation and the Supabase sync from sending provisional schemas

Test plan

  • Import nodes from a remote space → relation types and triplets appear in Settings with "Provisional" badge and no Accept button shown yet for accepted ones
  • Provisional types/triplets absent from canvas relation tool, RelationshipSection, and RelationPanel dropdowns
  • Accept a triplet → triplet and its relation type both flip to accepted; both now appear in creation panels
  • Accept a relation type directly → type accepted, triplets remain provisional
  • Delete an imported provisional type/triplet → removed correctly
  • Sync to Supabase → provisional schemas not included in upsert_concepts payload
  • publishNewRelation returns false for provisional triple/type/instance
  • Existing imported schemas without a status field treated as provisional (not accepted)

🤖 Generated with Claude Code


Open with Devin

Mark newly imported relation types and triplets as provisional so they
don't appear in creation UIs until explicitly accepted by the user.

- Add ImportStatus type and status? field to DiscourseRelationType and DiscourseRelation
- Add isAcceptedSchema / isProvisionalSchema helpers (imported + no status = provisional)
- Set status: "provisional" on all newly imported relation types and triplets
- Fix provisional: true on imported relation instances (was incorrectly false)
- Settings UI: show Provisional badge + Accept/Delete buttons for provisional imported schemas
- Accepting a triplet cascades to also accept its relation type
- Filter provisional schemas from all creation panels (canvas tool, RelationshipSection, RelationPanel)
- Guard publishNewRelation and sync against provisional schemas
- Prevent status from leaking into literal_content.source_data in conceptConversion

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear bot commented Apr 8, 2026

@supabase
Copy link
Copy Markdown

supabase bot commented Apr 8, 2026

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 ↗︎.

trangdoan982 and others added 2 commits April 8, 2026 19:12
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
devin-ai-integration[bot]

This comment was marked as resolved.

- tentative: false = unreviewed (not tentative: true); fix importRelations,
  publishNode guard, and syncDgNodesToSupabase filter accordingly
- Add isAcceptedSchema to compatible node types useEffect in RelationshipSection

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 7 additional findings in Devin Review.

Open in Devin Review

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.

🔴 publishNodeRelations missing isAcceptedSchema filter allows publishing provisional schema data

publishNodeRelations at line 190 reads all discourse relations without filtering by isAcceptedSchema: const relationTriples = plugin.settings.discourseRelations ?? [];. This is inconsistent with the sibling function publishNewRelation (same file), which was updated in this PR to check isProvisionalSchema(triple) at apps/obsidian/src/utils/publishNode.ts:131. The same isAcceptedSchema filtering was applied in DiscourseRelationTool.ts, RelationPanel.tsx, RelationshipSection.tsx, and syncDgNodesToSupabase.ts, but publishNodeRelations was missed.

When a node is published via publishNodeToGroup (apps/obsidian/src/utils/publishNode.ts:453), publishNodeRelations could match a provisional discourse relation triple at lines 213-218 and publish its resource IDs (relation instance, relation type, triple) to the group via ResourceAccess, leaking provisional schema data that the user has not yet accepted.

(Refers to line 190)

Prompt for agents
In publishNodeRelations (publishNode.ts around line 190), the discourse relations list needs to be filtered by isAcceptedSchema, matching the pattern used in publishNewRelation and other functions in this PR.

Additionally, the relation instances loop at lines 211-223 should skip relations where relation.tentative === false, consistent with publishNewRelation line 136. The function also does not check whether the matched relation type itself is provisional (publishNewRelation checks this at line 135).

Specifically:
1. At line 190, filter discourseRelations: import isAcceptedSchema from ~/utils/typeUtils and apply .filter(isAcceptedSchema) to plugin.settings.discourseRelations.
2. At line 211 in the relations.map callback, add a check: if relation.tentative === false, return early (skip publishing tentative/unaccepted imported relations).
3. Optionally, also check that the matched relation type (relation.type) is not provisional, matching the pattern in publishNewRelation lines 132-135.
Open in Devin Review

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

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