fix(schema): let memoryType satisfy conceptType's required check - #275
Merged
Conversation
schema/mif.schema.json's required list only ever accepted conceptType,
even though README.md, docs/SCHEMA-REFERENCE.md, ns/README.md, and
ADR-001's compliance audit describe memoryType as a deprecated alias
"retained for backward compatibility." A document carrying only the
legacy memoryType field always failed validation regardless of age.
Replaces the flat conceptType requirement with a top-level
anyOf: [{required: [conceptType]}, {required: [memoryType]}], mirroring
the existing DocumentReference $defs entry's own url/id anyOf pattern.
Applied the same fix to schema/container.schema.json's duplicate
kind:memory discrimination anchor (documented as needing to stay in
sync with mif.schema.json), and propagated both to every mirror that
is currently live (public/schema/, and the 1.3.0/latest/v1 dirs that
public/schema/index.json's aliases currently point at -- confirmed
via diff that those three are presently identical to the canonical
root, not a frozen prior release.
Adds scripts/test_concept_type_alias.py as a permanent regression gate
(15 cases: conceptType-alone/memoryType-alone/both/neither across both
schemas, mirror-consistency checks, and negative cases confirming the
anyOf doesn't mask other missing required fields or bypass the triad
enum), wired into validate.yml.
EOF
)
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes a long-standing schema/documentation mismatch by allowing the deprecated memoryType field (v0.1 alias) to satisfy the “required concept type” constraint that previously only accepted conceptType. It updates both the core MIF schema and the Container Profile envelope schema (plus their public mirrors), and adds a dedicated regression test to prevent future drift.
Changes:
- Updated
mif.schema.jsonto require eitherconceptTypeormemoryTypevia a top-levelanyOf. - Updated
container.schema.json’skind: "memory"discrimination anchor to acceptconceptTypeormemoryType, keeping it aligned with the core schema. - Added a new pytest regression suite and wired it into CI, including checks that public schema mirrors remain byte-identical where expected.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/test_concept_type_alias.py | New regression tests for conceptType/memoryType required-alias behavior + mirror consistency checks. |
| schema/mif.schema.json | Makes conceptType requirement satisfiable by legacy memoryType using anyOf. |
| schema/container.schema.json | Aligns the Container Profile kind:memory required anchor with the new core schema behavior and updates descriptive text. |
| public/schema/mif.schema.json | Propagates the core schema fix to the public canonical mirror. |
| public/schema/container.schema.json | Propagates the container schema fix to the public canonical mirror. |
| public/schema/latest/mif.schema.json | Propagates the core schema fix to the latest alias mirror. |
| public/schema/latest/container.schema.json | Propagates the container schema fix to the latest alias mirror. |
| public/schema/v1/mif.schema.json | Propagates the core schema fix to the v1 alias mirror. |
| public/schema/v1/container.schema.json | Propagates the container schema fix to the v1 alias mirror. |
| public/schema/1.3.0/mif.schema.json | Propagates the core schema fix to the current live versioned mirror. |
| public/schema/1.3.0/container.schema.json | Propagates the container schema fix to the current live versioned mirror. |
| .github/workflows/validate.yml | Adds CI execution of the new regression test suite. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #274.
Problem
schema/mif.schema.json'srequiredlist only ever acceptedconceptType, unconditionally — despiteREADME.md,docs/SCHEMA-REFERENCE.md,ns/README.md, andADR-001's compliance audit all describingmemoryTypeas a deprecated v0.1 alias forconceptType, "retained for backward compatibility." A document carrying only the legacymemoryTypefield always failed validation regardless of age — the documented promise was never actually implemented.This surfaced concretely in PR #205, where an example using
memoryTypeper that documented framing failed CI.Fix
schema/mif.schema.json(+public/schema/mif.schema.json): replaced the flatconceptTyperequirement with a top-levelanyOf: [{required:[conceptType]}, {required:[memoryType]}], mirroring the existingDocumentReference$defsentry's ownurl/idanyOfpattern already in the same file.schema/container.schema.json(+ its mirror): the Container Profile envelope schema has its own duplicateconceptType-required anchor forkind:memoryrecords (documented as needing to stay in sync withmif.schema.json) — fixed the same way, so a legacymemoryType-only record inside a*.corpus.jsonenvelope is no longer rejected at the envelope level after passing the per-unit schema.public/schema/1.3.0/,latest/, andv1/, whichpublic/schema/index.json's aliases currently point at and which were confirmed (via diff) to be byte-identical to the pre-fix canonical root, not a frozen prior release. Older frozen versions (1.2.2,1.2.1,1.2.0,1.0.0,0.1.0) are untouched.scripts/test_concept_type_alias.py(15 cases) as a permanent regression gate, wired into.github/workflows/validate.yml:conceptType-alone/memoryType-alone/both/neither across both schemas, mirror-consistency checks, and negative cases confirming theanyOfdoesn't mask an unrelated missing required field or bypass the triad enum.Verification
Re-ran every existing local gate against the change:
okf_validate.py(15 concepts, PASS),mif_convert.py roundtrip(lossless, PASS),scripts/validate_container.py(PASS), ajvcompileon all 5 copies of both schemas (all valid), fullemit-jsonld+ ajvvalidateover all 15 examples (all valid),test_subtype_of.pyandtest_temporal_and_properties.py(unaffected, still pass).Test plan
python -m pytest scripts/test_concept_type_alias.py -v— 15 passedpython scripts/okf_validate.py examples profiles/ai-memory/examples docs/examples/memories— PASSpython scripts/mif_convert.py roundtrip examples profiles/ai-memory/examples docs/examples/memories— PASSpython scripts/validate_container.py— PASScompileonschema/and allpublic/schema/mirrors for bothmif.schema.jsonandcontainer.schema.json— all valid