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 /oss-init and the readiness audit reading the same ossctl 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.

Functions§

gather
Detect the deterministic repo facts under repo_root.