Skip to content

Reference: read only SMF documents, one-pager fields, checked build ids - #40

Merged
anykolaiszyn merged 2 commits into
mainfrom
reference/validator-scope-one-pager-fields-build-ids
Oct 9, 2026
Merged

anykolaiszyn merged 2 commits into
mainfrom
reference/validator-scope-one-pager-fields-build-ids

Conversation

@anykolaiszyn

@anykolaiszyn anykolaiszyn commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Draft, for owner review. Per GOVERNANCE.md these are spec changes, so the three proposal issues should stay open for comment before this merges. Closes #36, closes #37, closes #39. It does not touch #38 (contract versions), which needs a decision first.

What changes

1. The CLI reads only SMF documents (#36)

  • A file is read as SMF when at least one of its documents carries smf: or names an SMF kind. Any other YAML or JSON under the path is skipped and counted in the summary line. Folders whose name starts with a dot are not walked.
  • A document that names an SMF kind and omits smf: is still an error. A junk document inside an SMF file is still an error. A file that cannot be parsed is an error only when it has a top-level smf: line.
  • validate and test accept --format json.
  • reference/README.md gains "Where the files live".
  • Result: python reference/tools/smf.py validate . --strict now passes at the root of this repository (78 documents, 16 files skipped). Before, it failed on mkdocs.yml and the workflow files.

2. Every row of the one-pager has a field (#37)

  • MetricContract: optional plain_words, inclusions, not_certified_for, change_note, sign_off {by, date}.
  • Concept: optional plain_words, change_note, sign_off.
  • The spec says "Maintained by" is Ownership.steward.
  • Service Gross Margin in the example now carries the plain-words line, what it includes, what it is not approved for and its effective date. All four values are copied from docs/metric-contract.md; nothing was invented. change_note and sign_off are not used in the examples, because the docs give no values for them.

3. A claim's build is checked (#39)

  • Binding: optional id; a duplicate is an error.
  • validate: ClaimTrace.execution.binding must name a build record in the set, by Binding id or as <platform>:<ref>. No match is a warning, and an error in strict mode. A match that belongs to a different Metric Contract than the claim's measurement is an error.

Things to look at

  • The sign-off date key is date, not on. The issue proposed {by, on}. YAML 1.1 parsers, including the one this CLI uses, read a bare on key as the boolean true, so sign_off: { by: Controller, on: 2026-07-01 } failed validation. Issue Proposal: fields for the one-pager rows the schemas cannot store (plain words, not approved for, change note, sign-off) #37 is updated to match.
  • Text output changed in two failure cases. A missing path and an empty folder used to print one line; they now print the error followed by the usual FAILED: summary line, so text and JSON output have the same shape. Exit codes are unchanged.
  • test --format json covers results only. Its early exits (no documents, no TestCase, unreadable results file) still print a text error and a non-zero exit code.
  • resolve and import-csv are untouched.
  • Site build folders. After python site/build.py, _site_src/ and _site/ hold copies of the examples, so validate . at the root reports duplicates until they are removed. They are gitignored and CI validates the example folders, so nothing breaks; say so if you want them skipped by name.

Checks

Checked by hand, not by an automated test, since the repository has no test suite: a repository-root layout with a workflow, a configuration file, a data contract and a results file; an SMF kind with no smf: key; a junk document beside valid ones; a claim with a misspelled build, a claim naming another contract's build, a claim using a Binding id, a duplicate Binding id; the new fields accepted and a sign_off with no date rejected; both JSON outputs parsed. Run locally on Python 3.13; CI covers 3.9 and 3.12.

🤖 Generated with Claude Code

https://claude.ai/code/session_01251FoFjbkpn1d7jeNZYjAZ


Generated by Claude Code

claude added 2 commits October 9, 2026 11:31
Three additive changes to the reference tools and spec.

Validator scope (#36): smf.py reads a file as SMF only when one of its
documents carries the smf: key or names an SMF kind. Other YAML or JSON
under the path is skipped and counted, and dot-folders are not walked.
A document that names an SMF kind and omits smf: is still an error.
validate and test gain --format json.

One-pager fields (#37): MetricContract gains optional plain_words,
inclusions, not_certified_for, change_note and sign_off {by, date};
Concept gains plain_words, change_note and sign_off. The sign-off date
key is "date" because YAML 1.1 parsers read a bare "on" key as true.
Service Gross Margin in the example carries the values from
docs/metric-contract.md.

Build ids (#39): Binding gains an optional id. validate checks that a
claim's execution.binding names a build record in the set, by id or as
<platform>:<ref>, and that the build belongs to the claim's contract.

Both examples validate with 0 errors and 0 warnings; test counts are
unchanged (7/0/1 and 9/0/2); link check and strict site build pass.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01251FoFjbkpn1d7jeNZYjAZ
A YAML file that fails to parse is reported only when it has a
top-level smf: line. Other tools' YAML (mkdocs.yml with Python tags,
templated manifests) is skipped and counted, so pointing validate at a
repository root works. Found by running validate on this repository.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01251FoFjbkpn1d7jeNZYjAZ
@anykolaiszyn
anykolaiszyn marked this pull request as ready for review October 9, 2026 16:00
@anykolaiszyn
anykolaiszyn merged commit 789eb21 into main Oct 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants