ENG-1611 Add provisional status to imported relation schemas#948
ENG-1611 Add provisional status to imported relation schemas#948trangdoan982 wants to merge 4 commits intomainfrom
Conversation
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>
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- 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>
There was a problem hiding this comment.
🔴 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
provisionaland hidden from all creation UIs until the user explicitly accepts themImportStatustype andstatus?field toDiscourseRelationTypeandDiscourseRelation; backward-compatible (imported schemas with nostatusfield are treated as provisional)publishNewRelationand the Supabase sync from sending provisional schemasTest plan
upsert_conceptspayloadpublishNewRelationreturns false for provisional triple/type/instancestatusfield treated as provisional (not accepted)🤖 Generated with Claude Code