[Canon] Source-bounded concept visibility (derived-content origin gate)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 20/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- sql, typescript
- Área
- backend-api-design, databases, security
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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?
- Lenguaje dominante
- TSQL
- Estrellas
- 32
- Forks
- 7
- Merge medio
- 1 d 16 h
- PR fusionados (30 d)
- 504
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de MemberJunction/MJ
-
DBAutoDoc: export --state-file writes SQL Server SQL for a PostgreSQL database, ignoring --providerAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
MemberJunction/MJ#7094 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 85/100
MemberJunction/MJ#6971 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
MemberJunction/MJ#6947 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
MemberJunction/MJ#6800 ·
Los mantenedores suelen responder en 1 día
-
Convention: saved-query discoverability follows Status — Approved is canon, Pending is a draftAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
MemberJunction/MJ#6746 ·
Los mantenedores suelen responder en 1 día
Todos los issues de MemberJunction/MJ
Issues similares
-
Fish Audio Live calls fail to start: `Unknown callback "onNotice"` from @fishaudio/agent-clientPosiblemente ocupada @NEAL3K la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
milind-soni/OpenMausBot#8345 ·
Los mantenedores suelen responder en 1 día
-
Feed validator crashes with "Memory error" when validating https://www.tidyverse.org/index.xmlAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
w3c/feedvalidator#204 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
open-mmlab/mmcv#3352 ·
-
Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100