Skip to main content

Module validate

Module validate 

Source
Expand description

Conformance checking and structural validation against OKF v0.2.

A bundle is conformant if (1) every non-reserved .md file has a parseable frontmatter block, (2) every frontmatter has a non-empty type, and (3) reserved files follow their structure when present. Everything else is soft guidance: consumers MUST NOT reject a bundle for missing optional fields, unknown types or keys, broken links, or missing index.md files.

Accordingly, validate_bundle reports only true conformance violations as Severity::Error. Material soft-guidance deviations, data integrity issues, temporal inconsistencies, contract discrepancies, and syntax errors are reported as Severity::Warning (producer mistakes worth fixing) or Severity::Info (permitted states worth noting).

Staleness is the one check that depends on the wall clock, so it is opt-in: validate_bundle is deterministic and validate_bundle_at takes the date to compare against.

CodeSeverityFinding
V1errorunparseable concept document (frontmatter parse error)
V2errormissing or non-scalar required type field
V3warningmissing recommended frontmatter field (title, description, generated)
V4warningconcept body is empty
V5warningtags is not a YAML list of strings
V6warninggenerated is malformed, missing by, or at is not a valid ISO datetime
V7warningverified is malformed, missing by, or at is not a valid ISO datetime
V8warninglatest verified.at predates generated.at (content modified after verification)
V9warningtimestamp in generated, verified, or sources is in the future
V10warningunknown status value (not draft, stable, deprecated)
V11warningstale_after is not a valid ISO datetime
V12infostale concept (past stale_after with --today)
V13warningsources malformed, missing resource, or duplicate id
V14warningsources.last_modified or usage_window not valid ISO datetime
V15warningsources.usage_count without usage_window or not an integer
V16warningfootnote attribution matches no sources[].id
V17warningfootnote is cited in body but never defined
V18warningcircular concept derivation in sources graph
V19warninglegacy v0.1 timestamp present (superseded by generated)
V20warninglegacy v0.1 body # Citations list present (superseded by sources)
V21warningmissing runtime or computation source on Attested Computation
V22warningcontract parameters, executor, or attester missing required fields
V23warningexecutor, attester, or computation resource missing on disk
V24warningcode block syntax error in concept body
V25warningcomputation, executor, or attester script syntax error
V26infocomputation fields on non-computation concept type
V27infoexplicit path field does not resolve to a file in the bundle
V28infobroken link (target does not resolve to a concept in the bundle)
V29warninglinks to a status: deprecated concept
V30warningtitle shared with another concept
V31warningconcept-id segment outside portable ASCII set
V32errorreserved index.md or log.md unreadable, unparseable, or bad frontmatter
V33errorreserved log.md structural errors or invalid ISO date format
V34warninglog.md contains duplicate date heading ## YYYY-MM-DD
V35warningexisting index.md is out of sync with its directory
V36infobundle declares unrecognized or non-target okf_version

Structs§

Diagnostic
A single finding about a bundle.
ParseSeverityError
Error returned when a string cannot be parsed into a Severity.
Report
The result of validating a bundle.

Enums§

Severity
Severity of a diagnostic.

Functions§

index_listed_targets
Every link target an index.md lists, paired with the raw target as written, resolved to a concept id whether or not that concept exists in the bundle.
index_source_id
Synthesizes the concept id an index.md would have if it were itself a concept, so okf_core::links::Link::resolve_all can resolve its relative links against the index’s own directory.
is_concept_link
true when a raw link target names a concept (a .md file or a bare id) rather than a non-markdown resource such as attester.py.
is_iso8601_datetime
Checks an ISO-8601 datetime with a time of day and an explicit UTC offset.
validate_bundle
Validates a loaded bundle, returning all findings.
validate_bundle_at
Validates a bundle, additionally reporting concepts that are stale on today.