Repository navigation
Remove Pro-owned state from core's data model and the sync-only conflict kinds (ADR-083) - #3424
Conversation
Automated pragmatic-code-review (medium depth): APPROVEReview Type: Initial Review. Head Requirements Check
Column-position audit. All 24 embedding_roots consistency. Findings🟡 Important: contract docs still describe the removed "access differs" rule All three say the exception is "a descendant whose access differs from its root's". The code no longer compares access, and a descendant filed into its root's own collection is now a boundary. These are the contract docs callers read, so they now contradict the implementation. Reword them to "a non-person descendant holding a 🟢 Suggestion: test gap, filed node beneath a filed person The walk continues through a person only because the 🟢 Suggestion: grant/grantee wording on the person exemption ADR-083 §5 makes ADR-037's access model Pro's. Word it the way 🟢 Nit: 🟢 Nit: 🟢 Nit: Branch freshness: one commit behind Recommendation: APPROVE. Make the 🟡 doc fix and add the person-chain test before merge. The change clearly improves code health. |
mstomar125
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment, since GitHub blocks self-approval). Full findings are in the review comment above.
2b859ad to
9087494
Compare
Address-reviewCommit ✅ Addressed (4)
⏭️ Skipped (2)
Noted for later slices: the grant wording in Checks after the changes and the rebase
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: the changes are doc comments plus one added test case. No product logic changed. The added case is mutation-checked. |
…ict kinds Drop the node sequence and embedding provenance columns from the DDL and shift row_to_node and the related-nodes-with-edges read to the new positions. Delete the database-settings accessors, the AI-chat personal collection seeding, its schema-default stamping and its Play. Remove the collection restriction field; embedding roots now split on any non-person descendant holding a member_of edge. Delete ConflictKind::SupersededEdit and DuplicateReactiveCreate and their handling in the Conflicts view. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… node under a filed person Reword the embedding-root contract docs that still described an access comparison, drop the grant wording on the person exemption, and extend the boundary-shapes test with a filed node below a filed person. Co-Authored-By: Claude Opus 5.5 <[email protected]>
9087494 to
e722ef4
Compare
Part of #3412
Slice S2 of the one-pass strip: ADR-083's data model in
packages/coreand the conflict-kind UI. Core keeps the settings singleton, its ownerhas_roleedge andget_local_person; it loses the settings accessors, collection restriction, the AI-chat privacy machinery, the deadnode/embeddingcolumns and the two sync-only conflict kinds. Several items reverse work merged under the earlier draft ADRs (#3378, #3382, #3389, #3400); that work is deleted, not adapted.Acceptance (from the slice plan)
database-settingsschema declares no sync fields;required_extensionsis added by the step-3 issue.DatabaseSettingsNodeBehaviorloses its sync checks anddefault_metadatakeys, and seeding writes no sync values. The generic settings accessor (database_settings/merge_database_settings) and any remaining typed sync accessors are deleted. The singleton id staysdatabase-settings-singleton.restrictedToMembersis removed from thecollectionschema, and nothing in core reads or writes it or amember_ofpermission.embedding_roots.rstreats a non-person descendant holding amember_ofedge as the ADR-059 §7 defect without reading restriction, with a test.seed_personal_ai_chat_collection_if_needed,set_ai_chat_personal_collection_default, thepersonal_collection_idfield, theplay-core-ai-chat-privacyPlay andAI_CHAT_PRIVACY_PLAY_IDare deleted. A test shows a new chat has nomember_ofedge and can be moved under a page.embedding.origin,idx_emb_modifiedandnode.sync_seqare dropped fromdb/schema.rs, androw_to_nodepositions and the embedding write path are updated. Database reset.ConflictKind::SupersededEditandDuplicateReactiveCreateare deleted, with their UI handling.What changed
db/schema.rs):node.sync_seqandembedding.origindropped;idx_emb_modifiedwas already gone from the DDL.row_to_nodereadscreated_at/modified_atat 7/8. The embedding INSERTs already listed their columns withoutorigin, so the write path needed no further change.db/sqlite_store/relationships.rs,get_related_nodes_with_edges: it readsr.propertiesaftern.*by position, so dropping a node column moves it from index 10 to 9. One-line index fix plus its doc (item 4).services/mod.rs(NodeAccessor::access_boundaries_underdoc) andmodels/embedding.rs(module doc): doc-only. Both described the removed "access differs" rule, so after item 2 they contradicted the code (review finding).first_core_declared_keyand their tests deleted. Behaviour and schema docs now name only the owner edge.embedding_roots.rsno longer walks restriction (access_boundary,restricted_amongandrestricted_collection_sqlare gone). Any topmost non-person descendant holding amember_ofedge is the defect: it is excluded from its root's aggregate and is its own embedding root.embedding_root_idresolves to the nearest such node at or above the node. Public names (access_boundaries_under,embedding_root_id) are unchanged, so no caller outside the slice changes.refuse_ai_chat_targetand retype docs now cite ADR-061 §8 only.ConflictKindisUniqueFieldCollision | CollectionNameCollision. The reconcile match arm, the doc table, the proto comment, the TS union and the pane's label map are updated. The pane's merge/adopt guard only existed to exclude the two retired kinds, so it is now justnodeIds.length === 2.get_local_personcomments, conflicts UI comments, store test header, both catch-up comments, and thederive_friendly_nameexample (estimatedHours).playbook_invariant_integration_test.rshas no Supabase/RLS comment on current main; its onenodespace-syncmention is reworded instead.Two tests kept but retargeted, so a real guarantee keeps its coverage:
scalar_field_type_validation_test::core_schema_scalar_fields_are_enforcednow usestask.due_date, since the collection schema has no scalar field left.core_plays::tests::integration::re_seeding_keeps_an_existing_plays_editsnow uses the parent-task Play. "Seeding never overwrites a user's edits to a core Play" was only tested through the privacy Play.No daemon or CLI integration test asserted the old seeded-collection or Play counts, so none changed.
New and changed tests, with mutation checks
Each mutation was applied alone, the named tests run, and the file reverted. Every one fails the test.
schema_test::a_fresh_database_has_no_unused_node_or_embedding_columns(needles built from fragments)sqlite_store::tests::test_row_to_node_round_trips_every_node_columncreated_atandmodified_atreadsnode_service::tests::test_a_new_ai_chat_has_no_member_of_edge_and_moves_under_a_page(activates every seeded Play, as the app does)origin/main(fails on the member_of assertion: the chat lands in "AI Chats") / makemove_noderefuse an ai-chat gaining a parentaccess_boundary_descendant_is_excluded_and_rerooted_adr059,access_boundary_shapes_agree_across_exclusion_and_rerooting_adr059test_seed_database_settings_singleton_with_owner_edge(singleton stores{"database-settings": {}};get_local_personresolves the seeded owner)get_local_personreturnsNoneconflicts.test.ts›conflict kinds(pane renders one record of each kind)conflicts.test.ts›ConflictKindis exactly the two kinds (expectTypeOf, enforced by svelte-check)conflict::tests::conflict_kind_parses_only_locally_detected_kinds(fragment needles)core_schemas::tests::test_simple_schemas_have_no_fields(+collection)collectiona field againresolve_path_is_idempotent_no_duplicate_collections,test_get_all_collections_with_counts_returns_parent_ids,reopening_a_database_does_not_duplicate_the_playre_seeding_keeps_an_existing_plays_editscore_schema_scalar_fields_are_enforceddatetype checktest_add_to_collection_preserves_non_order_edge_data,test_add_to_collection_computed_order_overwrites_caller_order(neutralnotekey)add_to_collectiondrops the caller's non-order keysPro-boundary ratchet
bun run scripts/check-pro-boundary.tspasses.--changedreports 0 for every marker in every changed file.Before is
origin/mainat 4ca90c2; after is this branch rebased on it.BASELINESis not edited.Database reset: REQUIRED
The table shape changes (
node.sync_seqandembedding.originare dropped), so every dev database must be reset after this merges. The shape check refuses an existing one until it is. No migration.Left for later slices
add-synced-database-dialog.svelteand its test still writerestrictedToMembers(S4 deletes them).required_extensionsondatabase-settings(S6).test_database_settings_schema_declares_no_fieldswill need its expectation updated then.db/sqlite_store/nodes.rs~2833-2836 anddb/sqlite_store/relationships.rs~505-506 (ADR-037's access model is Pro's under ADR-083 §5).access_boundaries_underand the*_adr059test names to "filed descendants". This touchesservices/mod.rs,embedding_service.rsandbehaviors/mod.rsacross slices.db/sqlite_store/relationships.rs~1526/1576 (bulk mention skip),db/sqlite_store/search.rs:16,schema/mod.rs:398/413(including the user-visible error text) andschema/schema_test.rs:2771. The refusals themselves stand under ADR-061 §8; only the rationale wording names privacy.🤖 Generated with Claude Code