Repository navigation
Description
Summary
Reword the docs of core's data model and local identity that cite the Pro RLS layer, Supabase identity binding, tenant roles, the Postgres schema, server-side RBAC or "the cloud walk".
- Rewrite the
collectionschema'srestrictedToMemberscomment, and themember_ofpermissioncomment in the same block, as the storage-contract statements ADR-083 (proposed) §4 prescribes. - Replace two strings in the free app that assume invited teammates or cloud sync:
- the seeded
personschema's email description; - the AI-chat plugin doc, whose claims are also wrong.
- the seeded
This PR changes comments, one schema description string and test fixtures. It adds one small assertion and changes no behaviour.
Context
-
ADR-081 (proposed) keeps collections,
member_ofand the local PersonNode in core because they have local value (§2c). ADR-083 (proposed) §4 keepsrestrictedToMembersand themember_ofpermissionlevels in core as a deliberate exception (its question 6). Their docs should give their local meaning, plus the storage contract, and name no consumer. -
core_schemas.rs, the comment above thecollectionschema'sfields(525-529 at af8ddb6). Today it says:- "the Pro RLS layer reads
properties->>'restrictedToMembers'to gate access"; - the
member_ofpermissionis "a free-form edge property the RLS reads directly".
ADR-083 §4 gives the replacement text for both. It is a storage contract without a consumer's name:
restrictedToMembersis stored atproperties.collection.restrictedToMembersas a JSON boolean;permissionis stored atproperties.permissionon a person'smember_ofedge, as one ofadmin,modifyorreadOnly.
Core reads both locally:
sqlite_store/embedding_roots.rs(restricted_collection_sql) reads the flag;seed_personal_ai_chat_collection_if_neededwrites and reads theadminpermission.
- "the Pro RLS layer reads
-
core_schemas.rs, thepersonschema'semailfield description (line 1312) says "required in practice for invited teammates". This text is seeded into every new database'spersonschema, so users and agents see it (nodespace schema get person). -
AiChatNodeBehavior's doc (behaviors/mod.rs1733-1735) says chats are nodes "for Stamped ACL permissions, cloud sync". TheaiChatNodePlugindoc incore-plugins.ts(581-587) says the same and adds "semantic search". The next line of the Rust doc says chats are deliberately not embedded, so both claims are wrong. -
The local person's docs.
seed_local_person_if_needed,get_local_person,PersonNodeBehaviorandperson_seed_testexplain the local person through "On Pro upgrade this node is bound to a Supabase identity via a singleauth_identitiesrow" and "tenant roles". -
sqlite_store/conflicts.rs. The merge doc (357-363) explains a local rule through "is_deleted/deleted_atin the Postgres schema". -
sqlite_store/embedding_roots.rs.- It sizes a local walk by "the cloud walk's cycle backstop (
user_can_access_nodeincloud-sync.md)" (16-17), and compares with the cloud walk's text comparison (23-25). - The
access_candidate_sqldoc (34-38) says a person'smember_ofedges are "RBAC membership, gated server-side".
- It sizes a local walk by "the cloud walk's cycle backstop (
-
Seeded schemas are never updated in place.
seed_core_schemas_if_neededcreates only missing core schemas. Existing databases keep the old email description; new databases get the new one. Per CLAUDE.md there is no migration. That is acceptable, because nothing reads this text programmatically. -
Follow the parent's wording guide.
Scope
Line numbers are hints at af8ddb6. Locate each item by the symbol named.
-
packages/core/src/models/core_schemas.rs- The comment above the
collectionschema'sfields(525-529). Replace it with ADR-083 §4's text. Keep the ADR-037 opening:If the merged ADR-083 words either statement differently, use the merged text.// ADR-037: opt-in restriction, a Core-protected boolean. Default/absent = // false = open (organizational). Stored at // `properties.collection.restrictedToMembers` as a JSON boolean. This path // and type are a storage contract: access-control layers outside core read // this exact path and treat any value whose text form is not `true` as // unrestricted. Do not rename the field, move it out of the `collection` // bucket, or store a non-boolean. // // A person's `member_of` edge to a collection carries // `properties.permission`, one of `admin`, `modify` or `readOnly`. It is a // free-form edge property, so no schema field declares it. This path and // these values are a storage contract: access-control layers outside core // read them directly and treat an absent value as `modify`.
- The
personschema'semailfield description (1312)."Email address (optional)".
- The comment above the
-
packages/core/src/behaviors/mod.rs- The
AiChatNodeBehaviordoc (1733-1735). "Conversations are stored as nodes, so they share the node model's identity, collection membership and development traceability. They are deliberately NOT embedded (see below)." - The
PersonNodeBehaviordoc (2265-2269). "Person nodes are pure identity —name(optional) andemail(optional, format-validated when present). A person's role in this database is not a PersonNode property: it lives on thehas_roleedge from the person to theDatabaseSettingsNodesingleton."- Drop the
auth_statussentence. ADR-083 makesauth_statusPro-owned, and Replace DatabaseSettingsNode's Pro fields and accessors with a generic settings accessor #3340 removes core's declaration of it.
- Drop the
- Not here: the
DatabaseSettingsNodeBehaviordoc (Replace DatabaseSettingsNode's Pro fields and accessors with a generic settings accessor #3340).
- The
-
packages/desktop-app/src/lib/plugins/core-plugins.ts, theaiChatNodePlugindoc (581-587). "AI chat conversations stored as first-class knowledge graph nodes. Messages are nested properties (ADR-028), so a chat can be linked and grouped into collections like any other node. Chats are not embedded." -
packages/core/src/services/node_service/mod.rs- The
seed_local_person_if_neededdoc (1627-1635).- Keep the ADR-037 sentence, the idempotency sentence, and "Name/email stay absent until the user fills them in".
- Drop "On Pro upgrade …
auth_identitiesrow — not recreated" and theauth_statusnote.
- The
get_local_persondoc (1978-1985). "The DatabaseSettingsNode can hold more than onehas_roleedge, so this filters onrole == \"owner\"…" instead of "is documented to hold tenant roles (plural) for upcoming RBAC work". - The comment in the multiple-
has_roletest (9772-9775). "(a non-owner role edge alongside the owner's)" instead of "multiple tenant roles on one node". - Not here:
- the
seed_database_settings_if_neededdoc (Replace DatabaseSettingsNode's Pro fields and accessors with a generic settings accessor #3340); - the personal AI-chat collection docs (Reword the AI-chat privacy Play description without tenant wording #3344, then Sweep the Pro and sync wording C7 leaves around replicated writes and AI-chat privacy #3367).
- the
- The
-
packages/core/tests/it/person_seed_test.rs, module doc lines 3-5. "ADR-037 mandates that every install seeds exactly one local PersonNode (the local user). These tests verify:". Drop "— free included —" and the Pro/Supabase sentence.- Line 7 and the
auth_statusassertion at 31-38 belong to Replace DatabaseSettingsNode's Pro fields and accessors with a generic settings accessor #3340. Leave them.
- Line 7 and the
-
packages/core/src/db/sqlite_store/conflicts.rs, the archive-the-loser step of the merge doc (357-363).- Keep "NOT a literal ADR-068 "deleted" tombstone: this codebase has no such lifecycle value (…)" and "introducing a new local state would invent a fourth concept…".
- Drop the clause "ADR-042's "tombstone" turns out to be a cloud/sync-layer concept (
is_deleted/deleted_atin the Postgres schema)".
-
packages/core/src/db/sqlite_store/embedding_roots.rsMAX_ACCESS_WALK_DEPTHdoc (16-17). "Upper bound on the upward access walk: a backstop against amember_ofcycle."restricted_collection_sqldoc (23-25). "JSONtrueand the string\"true\"both count, so a flag stored as text by any writer still restricts the collection."access_candidate_sqldoc (34-38). Replace "Aperson'smember_ofedges are RBAC membership, gated server-side rather than by the reachability walk, so they do not classify the person node" with: "Aperson'smember_ofedges grant access to the collection (theirpermission); they are not content membership, so they do not classify the person node."
-
Frontend fixtures that quote the old description. They test that a field description never renders as a column header or label:
packages/desktop-app/src/tests/components/table-view-headers.test.ts, lines 62 and 75;packages/desktop-app/src/tests/utils/schema-field-label.test.ts, line 30.
Change the fixture text to a neutral description such as
'Email address (optional)'. Change thequeryByTextregex at line 75 to match the new text, so the test still proves the description is not rendered.
Out of scope
- Adding, removing or renaming any schema field or behaviour rule.
DatabaseSettingsNodefields,auth_status, thebound_tenant_*fields, and their docs and tests (Replace DatabaseSettingsNode's Pro fields and accessors with a generic settings accessor #3340).- A migration of existing databases'
personschema description. There is none, per CLAUDE.md. - If ADR-083 question 6 moves restriction out of core instead, Move Pro-owned data out of core's data model (ADR-083) #3345 owns the
core_schemas.rsblock. Skip that bullet and say so in the PR.
Steps
- Follow CLAUDE.md's startup sequence:
- pull
main; EnterWorktree({name: "issue-<N>-model-docs"});bun install, then thebun run testbaseline;- self-assign at pickup and set In Progress.
- pull
- Confirm ADR-083 has merged:
git -C <docs> fetch origin main && git -C <docs> ls-tree --name-only origin/main decisions/ | grep '^decisions/083-'. Read §4 for the final storage-contract wording and question 6's outcome. - Make the edits under Scope.
- For
table-view-headers.test.ts, check that the test still fails if the component rendered the description: temporarily render it in the header, run the test, then revert. - Run
bun run scripts/check-pro-boundary.tsand paste the printedBASELINES. Expected at af8ddb6, but use the real output:proWording−3,cloudWording−4,tenantWording−3,cloudBindState−2. - Verify, then finish:
bun run quality:fix, and commit;git push origin HEAD:issue-<N>-model-docs;gh pr create --head issue-<N>-model-docs;- merge only with
bun run merge <PR#>once approved.
Acceptance criteria
- None of these contains
Pro,RLS,Supabase,auth_identities,tenant,Postgres,cloud,server-sideorinvited teammates:- the
collectionschema comment and thepersonemailfield incore_schemas.rs; - the
AiChatNodeBehaviorandPersonNodeBehaviordocs; - the
seed_local_person_if_neededandget_local_persondocs, and the multiple-has_roletest comment; person_seed_test.rslines 1-5;- the archive-the-loser step in
conflicts.rs; - the
embedding_roots.rsdocs ofMAX_ACCESS_WALK_DEPTH,restricted_collection_sqlandaccess_candidate_sql; - the
aiChatNodePlugindoc.
- the
- The
core_schemas.rscomment states both storage contracts from ADR-083 §4: therestrictedToMemberspath, type and fail-open reading, and thepermissionpath, values and absent-means-modifyreading. - A new database's
personschema reports the email descriptionEmail address (optional)(see the check below). - The AI-chat docs no longer claim chats are embedded, searchable by meaning, or cloud-synced.
-
git grep -n 'invited teammates' -- packagesreturns nothing. -
BASELINESinscripts/check-pro-boundary.tsis lowered to the counts the CLI prints, and the CLI exits 0.
Tests and verification
cargo fmt --all --check, andcargo clippy -p nodespace-core --all-targets -- -D warnings.bun run test:changed, which runs the frontend and Rust tiers.- Schema description check. Run
.tools/bin/cargo-nextest nextest run -p nodespace-core --lib core_schemasfor the schema unit tests.- If no test asserts field descriptions, add a small assertion to an existing core-schema test in
core_schemas.rsthat thepersonemaildescription is"Email address (optional)". - Mutation-check it: restore the old string and confirm the test fails.
- If no test asserts field descriptions, add a small assertion to an existing core-schema test in
bun run --cwd packages/desktop-app test table-view-headers schema-field-labelbun run scripts/check-pro-boundary.tsandbun run scripts/check-code-references.ts.
Dependencies
- Guardrail: stop new Pro code from landing in core #3302: the ratchet whose baselines this lowers.
- NodeSpaceAI/nodespace-docs#92 (ADR-083): ADR-083 merged. The
restrictedToMembersandpermissiontext is its §4 decision, which is pending review (question 6).
Risks and rollback
- Existing databases keep the old email description until they are reset, because core schemas are seeded only when missing. This is cosmetic, and nothing parses it.
- Conflicts with Move Pro-owned data out of core's data model (ADR-083) #3345 on
behaviors/mod.rs,core_schemas.rsandnode_service/mod.rs. The hunks differ, so rebase. - Rollback. Revert the PR.
Plan key: C10.3 (pro-boundary DAG).
🤖 Generated with Claude Code
Activity