Store runtime schemas with useDiscrete and activate verified revisions #34

Merged
michielbdejong merged 1 commit from codex/discrete-schema-storage into main 2026-10-12 17:38:34 +02:00

Editable schema definitions now live in NextGraph YMap documents read through React useDiscrete. useMemo derives the ORM shapes from the verified Atomic JSON-AD. RDF stores only the schema document pointer and active content-addressed revision, plus legacy schema literals until their next save.

Saving stages and verifies a JSON revision before a guarded SPARQL request activates its pointer together with any RDF predicate migration. SHA-256 revision IDs bind the exact canonical definition; object-key reordering survives native CRDT round trips, while changed contents under an existing revision ID are rejected. Resource IDs, URI property keys and metadata are preserved through a reversible path-safe payload codec.

The pinned ORM does not await its discrete engine write in commitTransaction, so the application bridge tracks that write and verifies storage through a fresh engine read. Failed writes remain inactive and can be retried. Existing schema-editing drafts remain mounted while an incoming revision is verified. The shopping list’s FieldSpec.readKinds support and integer-position migration from #33 are unchanged.

Validation:

  • 106 unit tests passed, including real offline NextGraph WASM JSON round trips, empty-graph activation, legacy RDF migration, revision checks, stale guards and failed-write retries.
  • Full browser suite: 42 passed, four existing CI profile tests skipped. Runtime editor cases also verify discrete storage, reload and draft retention across another revision.
  • Runtime/editor and shopping-list type checks passed.
  • All nine production apps built successfully.

Storage and permissions: new schema documents are created in the current wallet’s private store. Sharing a data graph does not automatically share its schema document; readers need access to both. Activation is staged, not a transaction spanning the JSON CRDT and RDF store; rejected activation can leave an inactive revision or unlinked document. Revision pruning and automatic sharing are not implemented. Concurrent record writes during preflight remain subject to RDF conflict behavior. Native checks cover the local engine, not peer transport or durable restarts; the broker-backed suite was not rerun.

Editable schema definitions now live in NextGraph YMap documents read through React `useDiscrete`. `useMemo` derives the ORM shapes from the verified Atomic JSON-AD. RDF stores only the schema document pointer and active content-addressed revision, plus legacy schema literals until their next save. Saving stages and verifies a JSON revision before a guarded SPARQL request activates its pointer together with any RDF predicate migration. SHA-256 revision IDs bind the exact canonical definition; object-key reordering survives native CRDT round trips, while changed contents under an existing revision ID are rejected. Resource IDs, URI property keys and metadata are preserved through a reversible path-safe payload codec. The pinned ORM does not await its discrete engine write in `commitTransaction`, so the application bridge tracks that write and verifies storage through a fresh engine read. Failed writes remain inactive and can be retried. Existing schema-editing drafts remain mounted while an incoming revision is verified. The shopping list’s `FieldSpec.readKinds` support and integer-position migration from #33 are unchanged. Validation: - 106 unit tests passed, including real offline NextGraph WASM JSON round trips, empty-graph activation, legacy RDF migration, revision checks, stale guards and failed-write retries. - Full browser suite: 42 passed, four existing CI profile tests skipped. Runtime editor cases also verify discrete storage, reload and draft retention across another revision. - Runtime/editor and shopping-list type checks passed. - All nine production apps built successfully. Storage and permissions: new schema documents are created in the current wallet’s private store. Sharing a data graph does not automatically share its schema document; readers need access to both. Activation is staged, not a transaction spanning the JSON CRDT and RDF store; rejected activation can leave an inactive revision or unlinked document. Revision pruning and automatic sharing are not implemented. Concurrent record writes during preflight remain subject to RDF conflict behavior. Native checks cover the local engine, not peer transport or durable restarts; the broker-backed suite was not rerun.
Persist runtime schemas in discrete JSON CRDT documents
Some checks failed
db-app-runner tests / test (pull_request) Failing after 3m23s
433eab1fcc
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ELFA/database-apps!34
No description provided.