Skip to content

fix: check the manifest format version before the JSON Schema - #71

Merged
dfkunstler merged 1 commit into
mainfrom
fix/manifest-format-first
Nov 17, 2026
Merged

dfkunstler merged 1 commit into
mainfrom
fix/manifest-format-first

Conversation

@dfkunstler

Copy link
Copy Markdown
Member

Closes #57.

scripts/manifest.py now checks the format version before the manifest JSON Schema (NAM-022). A manifest that is not
a JSON object, has no format member (NAM-021), or holds an unsupported format fails with one failure, and no
other check runs. A format 2 manifest now reports format 2 is not supported (supported: 1), not a JSON Schema failure.

  • Removes the post-schema format check, which could no longer fail.
  • Replaces test_nam_003_05_* (which asserted the old JSON Schema failure) with NAM-021.01, NAM-022.01, and
    NAM-022.02 tests, plus non-integer format values (true, "1", 1.5, null, [1]).
  • Updates the check order in AGENTS.md, DEVELOPING.md, and .agents/summary/workflows.md.

Independent of #70: names.schema.json declares format the same way (const: 1) in 0.7.0 and 0.8.0.

Benchmarks

No runtime code changed. hatch run python scripts/bench_serialization.py, SP 800-53 rev5 catalog, Python 3.14.8,
pydantic 2.14.2, median of 7 (ms, GC on / GC off).

Path Before After
parse_oscal(bytes) 65.0 / 47.0 63.6 / 47.1
serialize_oscal(doc, indent=None) 135.9 / 129.6 133.8 / 128.5
serialize_oscal(doc) 143.2 / 137.1 143.9 / 137.4
doc.model_dump_json() 140.9 / 135.3 140.9 / 135.0
pydantic_core.to_json(doc) 141.3 / 135.6 141.8 / 135.8

NAM-022 says a consumer reads `format` before it applies the manifest
JSON Schema, and rejects an unsupported value with a statement that the
format version is not supported. NAM-021 says a manifest that is not a
JSON object, or has no `format` member, is invalid.

validate_manifest now checks these three cases first and stops with one
failure, so a format 2 manifest reports "format 2 is not supported", not
a JSON Schema failure. The format check after the JSON Schema is gone,
because it could no longer fail.

Closes #57
@dfkunstler
dfkunstler force-pushed the fix/manifest-format-first branch from 384233c to d95bb97 Compare November 17, 2026 02:31
@dfkunstler
dfkunstler merged commit 0deb42f into main Nov 17, 2026
6 checks passed
@dfkunstler
dfkunstler deleted the fix/manifest-format-first branch November 17, 2026 02:39
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.

Check the manifest format version before the JSON Schema (NAM-022)

1 participant