Skip to main content

validate_predicate_edit

Function validate_predicate_edit 

Source
pub fn validate_predicate_edit(
    proposed_source: &str,
    author: &EditAuthor,
    previous_policy: Option<&BootstrapPolicy>,
) -> BootstrapValidation
Expand description

Validate a proposed edit to a per-directory invariants.harn file.

Bootstrap policy promotes the soft warnings on parse_invariants_source into hard errors:

  • Source must lex/parse cleanly.
  • Every @invariant predicate must declare exactly one of @deterministic or @semantic.
  • Every predicate must carry a complete @archivist(evidence, confidence, source_date, coverage_examples) provenance block.
  • @semantic predicates must declare a fallback whose target is a deterministic predicate visible in the proposed source.

previous_policy lets the caller pin the previously committed bootstrap hash into the validation result for audit. It does not change the rules applied — the bootstrap rules themselves live in this function so a repository can roll its policy hash forward without rewriting Rust.