[Canon] Source-bounded concept visibility (derived-content origin gate)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- sql, typescript
- Ambito
- backend-api-design, databases, security
Direzione di ricerca
Read packages/MJCoreEntities/src/graph/GraphEngine.ts and packages/MJCoreEntities/src/engines/CanonGraphEngine.ts, then compare the origin check in packages/SearchEngine/src/generic/SearchEnricher.ts with concept filtering and visibility checks. The issue calls for a batched, fail-closed source visibility gate across graph and direct reads, plus policy decisions for concepts without sources; done means concepts and suggestions cannot expose text unless the caller and all audience readers share a readable backing source.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What should Canon do that it does not do today?
Ensure every MJ: Graph Concepts record is no more visible than the source records (SourcedFrom targets: MJ: Content Item Chunks, MJ: Content Items, MJ: Content Sources, or referenced entities) from which it was derived, mirroring SearchEngine's origin-record gate on derived content (PromotedFromContentItemID).
Who needs it, and what goes wrong without it?
Today MJ: Graph Concepts carries derived text synthesized from underlying documents (Name, Synonyms, Description, Specification), while GraphEngine.FilterNodesForUser (packages/MJCoreEntities/src/graph/GraphEngine.ts) only checks whether the caller can read the MJ: Graph Concepts entity row itself — not whether the caller (or every AudienceReader) can read the underlying content items, chunks, or sources linked by SourcedFrom edges.
Concrete failure mode (seen in multi-entitlement apps like Betty):
- An internal SOP (
Staff-onlyContentSource) defines a confidential escalation process or internal code name. - Graph synthesis (
GraphStage/EntityGraphOverlayStore) extracts aConcept(Name,Synonyms,Description,Specification) linked viaSourcedFrom->MJ: Content Item Chunks/MJ: Content Items. - A
PublicorMemberuser (who has no read entitlement on thatStaffcontent item) queries Canon viaFindConcepts,ResolveConcepts,ExplainConcept,CanonContext, or aRunViewoverMJ: Graph Conceptsand receives the derived concept name, synonyms, and specification verbatim — leaking restricted source content even though direct search onMJ: Content Itemswould deny it. - Conversely, until this ships, multi-entitlement apps cannot use Canon concept text in user/LLM prompts at all (they must strip concept text and pass only chunk/item IDs through their own hydration gates).
Which layer does it touch?
- Governed data slices (alternate base views, queries)
- Concepts and authority (graph concepts, edges, tiers)
- Agent guardrails (canonical notes)
- Executable procedures (skills, actions, workflows)
- Schema (a new type, status, tier, edge type or column)
What existing work is it related to?
plans/canon-master-plan.md— Workstream 5 (5c)packages/SearchEngine/src/generic/SearchEnricher.ts(ExcludeEntitySourcedContentItems/PromotedFromContentItemIDorigin-record gate — reference pattern inSearchEngine)packages/MJCoreEntities/src/engines/CanonGraphEngine.ts(FindConcepts,CanonContext,ExplainConcept,scoreConcepts)packages/MJCoreEntities/src/graph/GraphEngine.ts(FilterNodesForUser,Subgraph)
Rough size
Medium–Large (1–2 sprints: edge/origin index, server enforcement hook, audience-aware CanonGraphEngine + GraphEngine integration, unanchored-concept policy, tests).
Design Sketch
1. Mirror SearchEngine's Derived-Content Origin Gate
In SearchEngine, a derived document promoted to an origin record (PromotedFromContentItemID in packages/SearchEngine/src/generic/SearchEnricher.ts:242-245) cannot rely on the index provider's read check; the engine verifies the origin entity record directly as the caller. Apply the exact same rule to MJ: Graph Concepts:
- A synthesized
MJ: Graph Conceptsrow is derived content whenever it has one or moreSourcedFromedges (GraphEdgeType.Name = 'SourcedFrom',SourceEntityID = 'MJ: Graph Concepts'). - A concept with backing sources is readable to principal set
P = [caller, ...AudienceReaders]if and only ifPhas at least one shared readable backing source (everyuinPpassesCanRead/ RLS on the same backing source record). Requiring a shared readable source prevents intersection leaks in rooms (e.g., if Concept C came from Doc A readable only by Alice and Doc B readable only by Bob, neither alone proves both may discuss Doc A's text).
2. Resolution Pipeline (Batched, Fail-Closed)
Add a server-side/engine origin verifier (e.g., ConceptSourceVisibilityGate invoked inside GraphEngine.FilterNodesForUser for 'MJ: Graph Concepts' and any CanonGraphEngine concept lookup):
- Batch-load
SourcedFromedges (SourceEntityID = 'MJ: Graph Concepts',SourceRecordID IN (...),Status IN ('Approved', ...proposedWhenRequested)). Never loadSourcedFromrow-by-row inside a loop. - Normalize backing targets by entity type:
'MJ: Content Item Chunks': optionally verify chunk read directly AND resolveContentItemID/ContentSourceID(important when RLS lives onMJ: Content Itemsor a host ISA view likebetty.vwContentItems, or when chunks are deleted/re-created on re-ingest).'MJ: Content Items','MJ: Content Sources', or any other entity (e.g.,MJ: Entities,MJ: Conversations,MJ: AI Agent Notes): group target IDs byTargetEntityIDand verify via one batchedRunViewscall per entity (passing each principaluinP, honoring entity RLS and serverPreRunViewmiddleware such as tenant/entitlement hooks).
- Evaluate visibility:
- If the concept has >= 1
SourcedFromtarget: keep the concept only if at least one target ID survives across every principal inP. Cache the check per(conceptID, UserScopedCacheKey(user))or compute per traversal step cleanly; fail closed on any query failure or unknown target entity. - What if a concept has 0
SourcedFromedges? (Human-authored canonical term vs orphaned synthesized concept):- Add explicit graph configuration on
MJ: Graphs(orGraphType):UnanchoredConceptPolicy = 'GraphReaders' | 'StewardsOnly' | 'Deny':'GraphReaders'(reasonable default for"MJ Canon"metadata/business glossary graphs authored directly by stewards without chunks);'StewardsOnly'(recommended default forContentSource-fed multi-entitlement graphs so a synthesized concept whose chunks were purged/unlinked never silently opens up to everyone).
- Add explicit graph configuration on
- If the concept has >= 1
- Also gate direct CRUD /
RunViewreads onMJ: Graph Concepts:- Going only through
CanonGraphEngine/GraphEnginewould leaveRunView({ EntityName: 'MJ: Graph Concepts' })ormj_GraphConceptGraphQL queries open (noteUIcurrently hasCanRead = 1). Pair with5b+ a server-sidePostRunView/PreRunViewsecurity hook or entity-server read filter for multi-entitlement graphs so unentitled callers cannot read derived concept fields over raw GraphQLRunVieweither.
- Going only through
3. Lexical Matching & Cache Safety (CanonGraphEngine)
Notice CanonGraphEngine.scoreConcepts (CanonGraphEngine.ts:285-320) currently scores candidate Name / Synonyms in memory before calling FilterNodesForUser:
- Keep checking
IsFieldReadableByAll(conceptEntity, 'Name' | 'Synonyms', principals)first (FLS), AND runFilterNodesForUser(including the5corigin gate) before surfacing any concept name, synonym, description, specification,"Did you mean..."suggestion, or ambiguity list (AMBIGUOUS_CONCEPTmust not enumerate concepts from hidden sources —NO_MATCHvsAMBIGUOUSmust leak zero names the caller cannot read!).
4. Re-ingest / Chunk Churn Resilience
As noted in MJ#6675 review, MJ: Content Item Chunks rows can be marked DeleteStatus = 'Pending'/'Deleted' or recreated during re-ingest. Encourage anchoring durable SourcedFrom / Supersedes edges on MJ: Content Items or MJ: Content Sources (or having the pipeline maintain/re-link SourcedFrom onto parent ContentItem in addition to chunk IDs) so source visibility stays stable across chunk re-embedding.
5. Open Questions for Dec 3 Canon Review
- Should
EntityGraphOverlayStoreautomatically write a companionSourcedFromedge to the parentMJ: Content Items(and/orMJ: Content Sources) alongside chunk-levelSourcedFrom, so re-chunking never temporarily unlinks a concept from its source entitlement? - For concepts grounded in two documents (
Doc APublicandDoc BStaff), is "readable if the caller can read at least one backing source" sufficient (assuming concept text should summarize the shared concept, not verbatimStaffsecrets), or should synthesis carry aRequiredAllSources/ ceiling sensitivity mode? - What
UnanchoredConceptPolicydefault should"MJ Canon"vs new tenant Canon graphs use?
- Lingua principale
- TSQL
- Stelle
- 32
- Fork
- 7
- Merge medio
- 1g 16h
- PR unite (30g)
- 504
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di MemberJunction/MJ
-
DBAutoDoc: export --state-file writes SQL Server SQL for a PostgreSQL database, ignoring --providerAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
MemberJunction/MJ#7094 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
MemberJunction/MJ#6971 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
MemberJunction/MJ#6947 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
MemberJunction/MJ#6800 ·
I maintainer di solito rispondono entro 1 giorno
-
Convention: saved-query discoverability follows Status — Approved is canon, Pending is a draftAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
MemberJunction/MJ#6746 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di MemberJunction/MJ
Issue simili
-
HXsetdir strdup leakAperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
-
funding: failure logs print `<nil>` error and zero channel IDForse già presa @litbot-9000 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
lightningnetwork/lnd#11676 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
Fei2411/DeepSeek-Bot#2891 ·
-
factory:subtask
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno