Skip to content

Move V_delta schema_version from base to document_class#141

Merged
stevevanhooser merged 1 commit into
V2from
claude/move-schema-version-to-document-class
May 22, 2026
Merged

Move V_delta schema_version from base to document_class#141
stevevanhooser merged 1 commit into
V2from
claude/move-schema-version-to-document-class

Conversation

@stevevanhooser
Copy link
Copy Markdown
Contributor

Summary

Companion to did-schema #55. schema_version is the version of the overarching schema set (V_delta vs did_v1), not a payload field on any class — so it lives at document_class.schema_version (sibling of class_name, class_version, superclasses), never on base.

The previous placement (base.schema_version, a declared field on V_delta's base.json) is what caused the ~16 DID:Database:ValidationFields errors on NDI-matlab #803 after #140 cleared the superclass-chain mismatch: NDI's legacy base_schema.json declares only session_id/id/name/datestamp under base, and the unknown 5th base field tripped the validator. Moving the tag to document_class removes it from the base block entirely — NDI's legacy validator sees no extra field; the V_delta strict-fields check (cache.m:446-458) only enforces declared fields on chain blocks, not on document_class, so the new structural key is accepted without further change.

Changes

  • universalRenames stamps document_class.schema_version instead of base.schema_version. Also migrates a stale base.schema_version forward (bodies emitted by an earlier V_delta-draft migrator carry the tag on base; the new pass moves it to document_class and strips from base) so the strict-fields validator on the next write doesn't reject the legacy placement.
  • v1_to_v2.isAlreadyVDelta short-circuit reads from document_class.schema_version.
  • cache.buildBlankDocument stamps document_class.schema_version = 'V_delta' so freshly built blanks are immediately recognised as V_delta-shaped.
  • Tests: makeVDeltaSkeleton puts schema_version on document_class; existing assertions on doc.get('base.schema_version') rewritten to doc.get('document_class.schema_version'). Three new assertions: stale-basedocument_class migration, blank-document stamp, and absence of base.schema_version after migration.

Merge order

  1. did-schema Documents and document data should be permanently removed when they are removed from all branches #55 (merged ✓)
  2. this PR (CI fetches did-schema@main, which now lacks schema_version from base fields)
  3. NDI-matlab #803 re-run picks both up via the dependency fetch and clears the remaining 16 DID:Database:ValidationFields errors. (The testTuningCurveCalc numeric failure is independent.)

Test plan

  • did-matlab CI green on this PR (unit tests including the new schema_version-placement assertions, end-to-end migrate-then-validate path)
  • After merge, kick NDI-matlab #803 CI and confirm the 16 structural failures clear

Generated by Claude Code


Generated by Claude Code

Companion to did-schema PR #55, which dropped schema_version from
V_delta's base.json fields array and re-spec'd it as a structural
key on document_class. schema_version names the overarching schema
set (V_delta vs did_v1), not a property of any one class, so it
lives alongside class_name / class_version / superclasses on
document_class.

The previous placement on base.schema_version was the cause of the
~16 DID:Database:ValidationFields errors on NDI-matlab #803 after
#140's superclass fix let validation get past the chain check:
NDI's legacy base_schema.json declares only session_id/id/name/
datestamp, and the unknown 5th base field tripped the strict-fields
validator.

Changes
-------

- universalRenames now stamps document_class.schema_version (not
  base.schema_version). It also migrates a stale base.schema_version
  forward when it finds one — bodies emitted by an earlier
  V_delta-draft migrator carry the tag on base; move it to
  document_class and strip from base so the strict-fields validator
  on the next write doesn't reject base.schema_version as undeclared.
- v1_to_v2.isAlreadyVDelta short-circuit reads from
  document_class.schema_version.
- cache.buildBlankDocument stamps document_class.schema_version =
  'V_delta' so freshly built blanks are immediately recognised as
  V_delta-shaped by the dispatcher.
- Tests updated end-to-end: makeVDeltaSkeleton puts schema_version on
  document_class; existing assertions on doc.get('base.schema_version')
  rewritten to doc.get('document_class.schema_version'). Three new
  assertions: stale-base->document_class migration, blank-document
  stamp, and the absence of base.schema_version after migration.

The validator's strict-fields check (cache.m:446-458) only applies to
chain blocks, so an extra structural key on document_class (the new
schema_version) is accepted without further changes. No new
schema_version-value enum check yet; the migrator + buildBlankDocument
both stamp 'V_delta' by construction.
@stevevanhooser stevevanhooser merged commit 48d2824 into V2 May 22, 2026
3 checks passed
@stevevanhooser stevevanhooser deleted the claude/move-schema-version-to-document-class branch May 22, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants