Repository navigation
Description
Summary
Rewrite the comment above the collection schema's fields in get_core_schemas (packages/core/src/models/core_schemas.rs). The new comment states the two storage contracts that ADR-083 §4 (proposed) defines, without naming a consumer:
restrictedToMembers;- the
permissionproperty onmember_ofedges.
Then lower the Pro-boundary baselines this pays down. The change is comment-only. It is also the first PR to lower a baseline, so it exercises the #3299 workflow end to end.
Context
-
What the comment says today. The
// ADR-037: opt-in restriction…block in thecollectionSchemaNode(5 lines, 525-529 at af8ddb6) says:- "the Pro RLS layer reads
properties->>'restrictedToMembers'to gate access"; permissionis "a free-form edge property the RLS reads directly".
It names a consumer, which ADR-081 rules out for core. It also doesn't tell a core engineer what must not change.
- "the Pro RLS layer reads
-
What ADR-083 decides. §4 keeps both fields in core, because they have local meaning, and turns their comments into contract statements. §7 step 2 lists this rewrite among the changes that nothing external calls, so it can land at any time.
-
What core does with them locally:
NodeService::seed_personal_ai_chat_collection_if_needed(node_service/mod.rs) finds the personal AI-chat collection. It looks for acollectionwhoseproperties.collection.restrictedToMembersis booleantrueand that has the local person'smember_ofedge withpermission"admin". It writes{"permission": "admin"}when it seeds that edge.restricted_collection_sql(db/sqlite_store/embedding_roots.rs) treats a restricted collection as an embedding-root boundary. It accepts both JSONtrueand the string"true".- Core never validates
permission. - The node API rejects a non-boolean
restrictedToMembers, because thecollectionschema declares itboolean.
-
Tests already pin the core side of the contract:
test_collection_has_restricted_to_members_field, inmod testsofcore_schemas.rs, checks the name,boolean, Core protection and the default offalse.core_schema_scalar_fields_are_enforced, inpackages/core/tests/it/scalar_field_type_validation_test.rs, checks that a string"true"is rejected.
-
Overlap with Reword core data-model and identity docs that cite Pro, Supabase, RLS or tenants #3365. Reword core data-model and identity docs that cite Pro, Supabase, RLS or tenants #3365 also planned to rewrite these lines ("drop both RLS sentences"), but without the contract and with no
permissionstatement. This issue owns the block, and Reword core data-model and identity docs that cite Pro, Supabase, RLS or tenants #3365 leaves it alone.
Scope
packages/core/src/models/core_schemas.rs:- in
get_core_schemas, the comment block directly abovefields: vec![in thecollectionSchemaNode; - in
mod tests, the leading comment oftest_collection_has_restricted_to_members_field.
- in
scripts/check-pro-boundary.ts:BASELINES, from the printed block.
Out of scope
- The field's
descriptionstring ("When true, only person members may access this collection's nodes…"). It is seeded into each database'scollectionschema node, and ADR-083 doesn't change it. - The
ConflictKind::SupersededEditdoc comment, which is also in ADR-083 §4. That belongs to Move Pro-owned data out of core's data model (ADR-083) #3345 or Remove Pro, Supabase and nodespace-sync wording from core comments, docs and the skill #3372. - The cloud-walk wording in
embedding_roots.rs, and every other comment. Those belong to Remove Pro, Supabase and nodespace-sync wording from core comments, docs and the skill #3372. - Any code, validation, schema field or test logic.
Steps
-
Read the merged ADR-083. Confirm it is merged with
git -C <docs> fetch origin main, then look fordecisions/083-in the output ofgit -C <docs> ls-tree --name-only origin/main decisions/. Read its final §4. -
Replace the comment block with the text below. If the merged ADR-083 words the two contract sentences differently, use its wording.
// `restrictedToMembers` (ADR-037 opt-in restriction) is stored at // `properties.collection.restrictedToMembers` as a JSON boolean; // absent or false means open (organizational). Locally it bounds // embedding roots and marks the personal AI-chat collection. 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`; // a content node's membership edge carries none. Core stores it as // a free-form edge property (no schema field) and does not validate // it; it reads `admin` back to find the personal AI-chat collection. // This path and these values are a storage contract: access-control // layers outside core read them directly and treat an absent value // as `modify`.
-
Update the test's leading comment to:
// ADR-037: opt-in restriction is a Core-protected boolean on collection. Its name, bucket and type are a storage contract (see the schema comment); this test pins them. -
Lower the baselines. Run
bun run scripts/check-pro-boundary.tsand paste the printed block overBASELINES. At af8ddb6 the old block held oneproWordingline and twocloudWordinglines, so expect 314 → 313 and 89 → 87. Take the real numbers from the check. -
Run
bun run quality:fix, then the verification below.
Acceptance criteria
- The block states both contracts in ADR-083 §4's wording, gives each field's local meaning, and names no consumer: no Pro, RLS, Supabase, tenant or nodespace-sync wording.
-
bun run scripts/check-pro-boundary.ts --list cloudWordingand--list proWordingshow no line from this block. - Ran
bun run scripts/check-pro-boundary.tsand pasted the printedBASELINESblock, and the check exits 0. OnlyproWordingandcloudWordingmoved, each by exactly the lines this block dropped. -
git diff origin/mainchanges only comment lines incore_schemas.rs, plus theBASELINESnumbers. -
bun run scripts/check-code-references.tspasses. - Both contract tests pass unchanged.
Tests and verification
- No new test. The change is comment-only, and the two tests above already pin the part of the contract that core owns. Run them:
.tools/bin/cargo-nextest nextest run -p nodespace-core --lib core_schemas.tools/bin/cargo-nextest nextest run -p nodespace-core --test it scalar_field_type_validation_test::
cargo clippy -p nodespace-core --all-targets -- -D warnings -D clippy::unused-asyncbun run scripts/check-pro-boundary.tsandbun run scripts/check-code-references.tsbun run test:changed. The diff reachespackages/coreandscripts/, so the Rust and scripts tiers run, and the Rust tier takes the machine slot.
Dependencies
- Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299: the check and its baselines.
- NodeSpaceAI/nodespace-docs#92 (ADR-083): ADR-083 accepted and merged. The comment text comes from its §4.
Risks and rollback
- Merge conflicts with Move Pro-owned data out of core's data model (ADR-083) #3345 and Reword core data-model and identity docs that cite Pro, Supabase, RLS or tenants #3365 in
core_schemas.rs. The hunks differ, so rebase. If Reword core data-model and identity docs that cite Pro, Supabase, RLS or tenants #3365 still lists this block, drop it there. - A queued PR that also lowers
proWordingorcloudWordingconflicts on thatBASELINESline. The merge queue ejects the second PR; rebase it, rerun the check and paste the block. - Rollback. Revert. Only a comment and two baseline numbers change.
Plan key: C1.3 (pro-boundary DAG).
🤖 Generated with Claude Code
Activity
mstomar125 commentedon Sep 30, 2026
Completed in #3389 (merged). Auto-close did not fire; closing manually.