Skip to main content

Module facts

Module facts 

Source
Expand description

Deterministic repo-fact detector (port of infer-repo-facts.py — ADR-0001 §3).

gather is a pure function of (repo tree, git HEAD): it sniffs ecosystems and manifests, counts committers, reads tags, detects CI/bot/ issues signals, extracts a README self-label and description, and applies the SCHEMA.md §4 maturity truth table. All I/O goes through the Fs and GitRepo ports (crate::ports), so the detector is exercised entirely against in-memory fakes and never touches the real filesystem or git — the whole point of the injected-port seam (ADR-0001 §2).

The report shape lives in crate::protocol::facts (the versioned wire DTO); this module owns only the detection logic. It is reproducible: for a fixed repository state and wall-clock day it produces byte-identical facts, so /shipshape-init and the readiness audit reading the same shipshape facts output agree on maturity and the gated core. It is not a pure function of HEAD alone: the recent-committer count uses git’s --since=1 year ago (evaluated against the current clock) and reads all refs/tags, so a run that crosses the one-year boundary, or after refs change, can shift — the same time-relative behavior infer-repo-facts.py has.

§Fidelity to the Python detector

Field names, the manifest set, the SemVer/monorepo-prefix handling, the CI globs, the spike-label list, and the maturity truth table all mirror infer-repo-facts.py. TOML manifests (Cargo.toml, pyproject.toml) are parsed by scanning the relevant [section] for key = "value" (single or double quotes) rather than via a full TOML library — the contract normalizer avoids new parser deps the same way. This matches the Python tomllib path for the common manifest shapes; two edge cases are not reproduced and are deliberately out of scope: escaped/multiline TOML strings, and Python’s whole-file regex fallback that fires only when tomllib itself fails on malformed TOML (there, Python may surface a name from an unrelated table; this port returns none). Both are exotic in a real pyproject.toml.

Re-exports§

pub use crate::protocol::facts::CargoPublishFlag;
pub use crate::protocol::facts::CargoPublishPolicy;

Functions§

cargo_publish_evidence
Read every Cargo manifest’s publish disposition under repo_root — the supporting evidence for (or contradiction of) the contract’s crates.io publish targets.
detect_distribution_surface
Detect cargo-dist configuration and tag-triggered GitHub workflows through the injected filesystem port. The trigger scanner intentionally recognizes only the ordinary nested on: push: tags: shape: missing an exotic YAML spelling is safe, while treating an unrelated tags: key as release infrastructure is not.
gather
Detect the deterministic repo facts under repo_root.
gather_report
Gather the complete public facts report, including the Cargo publish evidence used by the contract normalizer’s hard floor.