Skip to main content

Module policy

Module policy 

Source
Expand description

Committed repo policy — the team’s decisions, shipped with the repository.

amont.conf could always ADD checks; it could never say anything about the built-ins, so “clippy is warn-only here” meant every teammate running the same git config incantation, unverified. severity and skip lines close that: committed, reviewed like code, and trust-gated exactly like declared checks — a repository you cloned to read cannot weaken your safety net until you consent.

Precedence is a specificity ladder decided per KEY: built-in default < system config < global config < POLICY < local config < worktree < command-line. Between different keys naming the same check, specificity (full id > short name > trigger) decides, whatever the source — a local amont.severity.pre-commit warn must never be unbeatable by policy, and a policy full-id beats a local trigger. Skips are a UNION of all sources: there is no unskip mechanism anywhere, so ordering has nothing to decide.

There is no store. A Policy is owned by the crate::config::Settings each entrypoint builds after manifest::load, and borrowed from there — the shape Ctx already used for manifest and push.

It WAS a process-global OnceLock, which was correct for the hook path (one process, one repository) and wrong as a contract: a multi-repo walker had to KNOW not to seed it, amont-fleet carried that knowledge as a comment, and no test could assert the rule because asserting it would have meant seeding it. Now the rule needs no remembering — a scanner cannot corrupt a store that does not exist. Every RULE here stays a pure function over &Policy.

Structs§

Policy
What a trusted manifest’s policy lines add up to.

Functions§

union_skips
The union hook.skip resolution sees: machine skips plus policy skips. A union and not a ladder — nothing anywhere can UN-skip, so there is no conflict for ordering to settle.