Repository navigation
Description
Overview
Nothing records what changed in NodeSpace's built-in shape from one release to the next. A database from an earlier build is either refused (a core type or table differs), reconciled silently (seeded content), or opened with the old behaviour (an index, trigger, relationship or structural rule changed, which the shape check does not read). No record says which changes fall in which group, or what carrying a database forward would require. This issue adds that record: a generated snapshot of the built-in shape, a hand-classified change log that a gate keeps complete, and a release check that keeps the costly entries decided.
It does not move or rewrite any data and does not change what opening a database does. It is the input a later decision on backward compatibility needs. Decision and design: ADR-104 and Built-In Shape Record.
Problem Statement
What exists today:
check_shape(core/src/db/schema.rs) refuses a database whose table columns differ from this build's; an existing table is never altered. A changed index or trigger body is not detected, becauseIF NOT EXISTSleaves the old object in place.core_type_shape.rsrefuses a database whose core-type fields differ from the ones this build declares. It reads fields only (not relationships or structural rules), from the schema nodes themselves, because "nothing on disk records" a version. A user may add namespaced fields, extend extensible enums, changeuser-protected fields and change context paths without tripping it.- Core type schemas are written when a database is created and never rewritten. Seeded skills, Plays, queries, guidance, links and context paths are reconciled by fixed id on every open, per aspect: an unedited aspect is replaced, an edited one is kept and a shipped change to it is recorded as pending for the user to keep or take (ADR-072, ADR-094 §8). A deleted seed comes back on the next open.
schema_versionon schema nodes is 1 everywhere and is read only by the Play validator.types:check,node-types:checkand the prompt snapshots compare Rust, TypeScript, docs and prompts within one build. Nothing compares one release with the next.- A migration runner once existed (SQLite DDL migration runner (pre-launch requirement) #1320) and was collapsed into a single bootstrap (Collapse the five-step migration ladder into a single current-shape schema bootstrap #2688). No issue tracks a record of shape changes across releases.
Without a record, a change that needs user data to move looks the same as one that is purely additive until a user's database is refused, and a change the shape check cannot see is never noticed.
Proposed Solution
1. A shape snapshot, generated
JSON produced from the type registry, core_schemas.rs and the table DDL. It holds everything the build ships and has no exclusions: the full DDL (tables, columns, indexes, triggers); each core type's fields, field types, enum values, protection, extends, relationships, structural rules and context paths; and, for seeded content, the shipped fingerprint of each aspect of each seed id, computed by the function seed reconciliation already uses (no second fingerprint). A canonical hash covers the whole.
- Two copies. A working snapshot is one file, updated by every change that alters the shape and checked by the gate. A release copy is made from it at release time, committed and never changed.
- A database fingerprint is a separate function: one shared normaliser applied to a database's contents, leaving out what a user may legitimately change (the exclusions
core_type_shape.rsmakes). For a database this build created, it equals the fingerprint of the working snapshot. - Embedded in the binary only if the prototype in §4 passes. Nothing reads it at runtime otherwise.
2. A change log, classified by hand
One entry per changed key. Each entry records:
- key: a stable path into the snapshot (type and field, table and column, index, trigger, seed id and aspect)
- area: table shape, core schema, seeded content, user-data bucket, derived data, wire/tooling, local app state, settings
- class:
additive(nothing needed),reconcile(the seed system covers it),rebuild(regenerated by the system),stale(an older database opens and keeps the old behaviour),migrate(existing rows must change),refuse(an older database cannot be opened) - for seeded content: which aspect changed (config, guidance, context paths, links), whether users who kept an edit are affected, and whether the change must not wait for a user's keep-or-take decision
- whether a user could have produced the same state themselves
- for
migrate: what data is affected and what would have to change - for
migrate,refuse,stale, at release time: a decision,adr: ADR-<number>oraccepted_reset_required
The format is machine-readable (structured fields and one line of free text).
3. A gate
Regenerates the snapshot, computes the changed keys against the committed one, and fails on a changed key with no entry and on an entry for a key that did not change. The generator prints the key-level difference as a log skeleton with the class unset, so the hand work is classification only. It runs where types:check and node-types:check run (test:changed and the merge gate), with scripts/gate-scope.ts aware of the paths, and reads no other repository.
3b. A release check
bun run release regenerates the working snapshot, writes it as the release's copy, compares it with the previous release's copy, prints the entries between them grouped by class (and into the release notes), and refuses while any migrate, refuse or stale entry has no decision. The decision's form is validated; the record is not looked up, so the check needs no other repository. It runs before the version bump, so a refusal leaves nothing to undo. Until a database has users, the answer to all three classes is a database reset, and accepted_reset_required says so.
4. Settle the open points first
Recorded answers (ADR-104 and the architecture page carry the evidence):
- A seed that stops shipping: neither removed nor recorded as pending today; classified
migrate(remove if unedited, keep and record as pending if edited, if a mechanism is ever chosen). - Switching a Play off: counts as an edit to its configuration. The implementation confirms with a test that the switch stamps the modified mark.
- Identifying a database: the fingerprint identifies the shape, not the release; no stored version. A fingerprint matching no committed snapshot is an unknown shape, which is not
refuse. Prototype behind a test. - Earlier snapshots: history starts at the current shape. No backfill from tags unless a classification needs it.
Documentation
Written in nodespace-docs:
- ADR-104 and Built-In Shape Record
- node-type-sequence.md (the change-log step), releasing.md, seeded-nodes.md
Still to do with the implementation: the decision tree and the migration-ban paragraph in AGENTS.md (recording and classifying a change is not migrating it); a pointer in creating-node-types.md; a scope note at the top of architecture/schema-migration-strategy.md (it covers cloud tenant schemas, not the local store). Related: ADR-072, ADR-094 §8, ADR-086, ADR-078.
Architecture Impact
AGENTS.md bans migration strategies and any code that carries existing rows from an old shape to a new one, and core_type_shape.rs states that NodeSpace does not migrate databases. This issue respects both: it records and classifies changes and moves no data. The migrate class exists so that a later decision on backward compatibility has an accurate list of what would have to move. Lifting or narrowing the ban, and choosing a migration mechanism, is a separate decision and needs its own decision record first.
Acceptance Criteria
- ADR-104's four open points are confirmed with evidence from the implementation (the Play switch test, the identification prototype), and any answer that changes is amended in the ADR and the architecture page.
- The snapshot generator produces the same bytes on two runs, and a test covers that.
- The fingerprint of a freshly created database equals the fingerprint of the working snapshot. A test mutates a table, a core field and a seed in both directions: a shape change moves the fingerprint, and a namespaced field or an added enum value does not.
- An index change, a trigger change and a relationship change each alter the snapshot and each require an entry (the
stalecase is covered by a test). - A snapshot of the current shape is committed. It is embedded in the binary and readable from the daemon crate only if the identification prototype passes.
- A change-log format exists with the fields above, including a stable key, and a test validates every entry against it.
- The gate fails on a changed key with no entry and on an entry whose key did not change, and passes when entries match. Both directions are tested.
- The generator prints the changed keys as a log skeleton with the class unset.
- The gate runs in
test:changedand the merge gate, and reads no other repository. -
bun run releasewrites the release copy, prints the entries since the previous release grouped by class, includes them in the release notes, and refuses on an undecidedmigrate,refuseorstaleentry. Tests cover the refusal, theadrpath and theaccepted_reset_requiredpath, and that it runs before the version bump. - The node type sequence names the change-log step, and the
AGENTS.mddecision tree and migration-ban paragraph carry the pointer. - No existing behavior of opening a database changes; the existing shape-check tests pass unchanged.
- Code passes
bun run quality:fix;bun run test:changedpasses.
Technical Specifications
Reference Files
packages/core/src/db/schema.rs-create_schema,check_shape,expected_shape, and the DDL source (indexes and triggers included in the hash)packages/core/src/db/core_type_shape.rs- the shape comparison and what a user may changepackages/core/src/models/core_schemas.rs- the seeded core schemaspackages/core/src/models/seed_update.rs-SeedAspect, the pending record and the aspect fingerprintpackages/core/src/markdown/mod.rs-SeedTier, seeded-node reconciliationscripts/gate-scope.ts,scripts/check-node-types-doc.ts- how an existing generated-artifact check is wired into the gatesscripts/release.ts,scripts/release.test.ts- where the release check runs
Implementation Details
Keep the snapshot and change log in this repository, not in nodespace-docs; the gate reads them and the docs repository is being frozen. Follow the existing pattern for generated artifacts: generated by a script, committed, compared by a check. The gate and the release check do not read the docs repository.
Non-Goals
- Moving or rewriting any existing data, or adding a stored version or migration step to the database
- Reversing or narrowing the ban on migration strategies
- Regenerating snapshots for releases before the current shape
- How the app or CLI tells a user their install is too old (see An agent on a CLI older than its installed skill improvises with basic commands instead of stopping and telling the user to update #4203)
- Local app state versioning (see Restored tabs and the active database id are never checked against the daemon #4197)
Related Issues
- An agent on a CLI older than its installed skill improvises with basic commands instead of stopping and telling the user to update #4203 (wire and CLI compatibility, one of the areas the classes cover)
- Restored tabs and the active database id are never checked against the daemon #4197 (local app state, another)
Activity
mstomar125 commentedon Nov 3, 2026
Picking this up (sweep drain).
mstomar125 commentedon Nov 6, 2026
Status check against main: the snapshot generator, current snapshot, 0.3.11 snapshot, change log, identification prototype and the gate are merged (the shape record change and the 0.3.11 snapshot). The one acceptance item still open is the first: ADR-104's four open points are still marked Proposed in the ADR, so they are not yet confirmed with evidence and amended. That needs an architect answer on the four points (seed that stops shipping, switching a Play off, identifying the release from the database, earlier snapshots from tags). Keeping this open until then.
mstomar125 commentedon Nov 6, 2026
Done. The shape record is on main (generator, current snapshot, 0.3.11 snapshot, change log, identification prototype, and the shape:check gate that the merge gate runs), and the last open acceptance item is now met: ADR-104's four open points are confirmed with evidence and amended in the ADR and the architecture page (docs, merged 4e026d6).