feat(8.0): visibility field (public/internal/system) on nouns + verbs
Adds a reserved, top-level `visibility` field (mirrors the subtype rollout): 'public' (default, surfaced) | 'internal' (developer app-internal — hidden from default find/count/stats, opt-in via includeInternal) | 'system' (Brainy plumbing, library-set only). Fixes a real leak: the VFS root entity counted in getNounCount() and appeared in find() (a fresh brain reported 1 entity). It is now visibility:'system' → excluded from every user-facing surface. Developers also get a first-class hidden-unless-asked tier (e.g. learned internals vs user-exposed data). - Reserved (RESERVED_ENTITY_FIELDS / RESERVED_RELATION_FIELDS) — spoof-proof from metadata. - Threaded through add/relate/update/transact; surfaced top-level on reads. - Default exclusion in counts (baseStorage), find()/related() (hard candidate filter via excludeVisibility — keeps topK/limit correct), and stats; includeInternal/includeSystem opt-ins. - VFS root marked 'system'. Tests: visibility.test.ts 17/17 (fresh-brain getNounCount()===0, internal hidden + opt-in, verb symmetry, top-level surfacing, metadata-spoof rejection). Unit 1431 green; count-synchronization integration now passes (off-by-one fixed).
This commit is contained in:
parent
0ca0e5c6cc
commit
f4dea80176
10 changed files with 777 additions and 41 deletions
|
|
@ -35,6 +35,7 @@
|
|||
* |-----|----------------------|
|
||||
* | `noun` | the `type` param of `add()` / `update()` (stored under the key `noun`) |
|
||||
* | `subtype` | the `subtype` param |
|
||||
* | `visibility` | the `visibility` param (`'public'` \| `'internal'`; `'system'` is Brainy-only) |
|
||||
* | `createdAt` | system-managed — set once at `add()` time |
|
||||
* | `updatedAt` | system-managed — set on every write |
|
||||
* | `confidence` | the `confidence` param |
|
||||
|
|
@ -52,6 +53,7 @@
|
|||
export const RESERVED_ENTITY_FIELDS = [
|
||||
'noun',
|
||||
'subtype',
|
||||
'visibility',
|
||||
'createdAt',
|
||||
'updatedAt',
|
||||
'confidence',
|
||||
|
|
@ -78,6 +80,7 @@ export type ReservedEntityField = (typeof RESERVED_ENTITY_FIELDS)[number]
|
|||
* |-----|----------------------|
|
||||
* | `verb` | the `type` param of `relate()` / `updateRelation()` (stored under the key `verb`) |
|
||||
* | `subtype` | the `subtype` param |
|
||||
* | `visibility` | the `visibility` param (`'public'` \| `'internal'`; `'system'` is Brainy-only) |
|
||||
* | `createdAt` | system-managed — set once at `relate()` time |
|
||||
* | `updatedAt` | system-managed — set on every write |
|
||||
* | `confidence` | the `confidence` param |
|
||||
|
|
@ -90,6 +93,7 @@ export type ReservedEntityField = (typeof RESERVED_ENTITY_FIELDS)[number]
|
|||
export const RESERVED_RELATION_FIELDS = [
|
||||
'verb',
|
||||
'subtype',
|
||||
'visibility',
|
||||
'createdAt',
|
||||
'updatedAt',
|
||||
'confidence',
|
||||
|
|
|
|||
Reference in a new issue