Expand description
Versioned envelope types shared between the public fallow CLI and the
closed-source fallow-cov production-coverage sidecar.
The public CLI builds a Request from its static analysis output, spawns
the sidecar, writes the request to stdin, and reads a Response from
stdout. Both sides depend on this crate to guarantee contract alignment.
§Versioning
The top-level protocol_version field is a full semver string. Major
bumps indicate breaking changes; consumers MUST reject mismatched majors.
Minor bumps add optional fields; consumers MUST forward-accept unknown
fields and SHOULD map unknown enum variants to Feature::Unknown,
ReportVerdict::Unknown, or Verdict::Unknown rather than erroring.
§0.2 overview
This is the first production-shaped contract. The top-level
ReportVerdict (previously Verdict) is unchanged in meaning but was
renamed to avoid colliding with per-finding Verdict. Each
Finding and HotPath now carries a deterministic finding_id /
hot_path_id hash, a full Evidence block, and — for findings — a
per-function verdict and nullable invocation count. Confidence
gained VeryHigh and None variants to match the decision table in
.internal/spec-production-coverage.md.
StaticFunction::static_used and StaticFunction::test_covered are
intentionally required (no #[serde(default)]) — a silent default would
hide every safe_to_delete finding, so 0.1-shape requests must fail
deserialization instead of parsing into a wrong answer.
§0.5 changes
HotPathgained anend_linefield so consumers can match a hot path against a PR diff at line granularity, not just file granularity. The field is#[serde(default)]for forward-tolerance with 0.4-shape sidecars; readers MUST treat a0value as a single-line range (line..=line).ReportVerdict::HotPathChangesNeededwas renamed toReportVerdict::HotPathTouched. The wire string changes fromhot-path-changes-neededtohot-path-touched. The verdict reads as a state observation rather than an action item; it is informational.
§0.6 changes
- New
FunctionIdentitytype and optionalidentityfield threaded throughStaticFunction,Finding,HotPath,BlastRadiusEntry, andImportanceEntry. Becomes the canonical join key between the CLI’s static function inventory, V8 / Istanbul runtime coverage, test coverage fromoxc-coverage-instrument, source-map remapped findings, andfallow-cloudaggregation when present. Older 0.5-shape envelopes continue to deserialize withidentity: None; consumers SHOULD preferidentity.stable_idas the join key when present and fall back to the legacyfile+function+linetriple otherwise. - New
function_identity_idhelper emittingfallow:fn:<8 hex>(this 0.6 recipe was reconciled to a NUL-delimited 16-hex digest in 0.8.0; see# 0.8 changes). The helper hashes onlyfile + name + start_line + "function"(NOT columns) so producers with different positional fidelity (V8 byte offsets vs Istanbul UTF-16 columns vs oxc spans) agree on the join key for the same function. Columns survive on the wire as descriptive metadata for same-line disambiguation in display. - New
IdentityResolutionenum withResolved/Fallback/Unresolved/Unknownvariants. Lets cloud aggregation record per function whether the identity came from a source-map lookup, a line-only fallback, or remains unresolved. StaticFunction,Finding,HotPath,BlastRadiusEntry, andImportanceEntryare now#[non_exhaustive]. This is a one-time source-side break for downstream Rust consumers that constructed these via struct literals (the wire shape is unchanged and forward-compatible). Future field additions become pure additive changes; the CHANGELOG calls out the migration path.
§0.7 changes
FunctionIdentity::source_hashformat is now pinned: the first 8 bytes ofSHA-256(<canonical body bytes>)rendered as 16 lowercase hex characters. Compute via the newsource_hash_forhelper. Producers that cannot canonicalize the bytes the same way as their siblings MUST omit the field rather than emit a divergent format. Closes the cross-producer non-comparability gap that the 0.6.0 “producer-defined, opaque string” wording allowed.- New
source_hash_forhelper. Reuses the existingsha2dependency. No new transitive deps. Anchor fixture (source_hash_for_anchor_fixturein the test module) pins a known input to a known output so producers can self-test. - Tightened rustdoc on
FunctionIdentity::stable_id_computeddocumenting the method as a diagnostic helper, NOT a validation gate. Consumers MUST NOT reject payloads whosestable_iddiffers from the value returned by the helper. - Byte-level JSON-shape anchor fixtures added for
FunctionIdentity(full + minimal) plus anchor fixtures forblast_radius_idandimportance_idparallel to the existingfunction_identity_idfixture. RiskBandandCoverageSourcegainUnknownsentinel variants with#[serde(other)]. Future producers MAY add new variants as additive minor bumps; consumers map unseen variants toUnknownrather than failing deserialization.- 0.7.2 (docs only, no wire change): corrected the rustdoc and
CHANGELOG claim that
FunctionIdentity::stable_idis “stable across line moves”. It hashesstart_line, so a moved function gets a newstable_id; it is the cross-surface + cross-producer join key, not a line-move-immune one. Line-move-tolerant matching belongs on the content-basedFunctionIdentity::source_hash.
§0.8 changes
- BREAKING:
function_identity_idrecipe reconciled. Thestable_idpreimage is now NUL-delimited (file \0 name \0 start_line) and truncated to 16 hex chars (64 bits) instead of the 0.7.x unseparatedfile + name + start_line + "function"truncated to 8 hex. This matches the cloud aggregation store’s recipe (authored NUL-delimited + 64-bit first) and keeps the column exclusion. Everyfallow:fn:value changes; persisted ids (CI dedup, suppression files, cloudfunction_hits) reset and must be regenerated.function_identity_id_v1retains the 0.7.x recipe for the upgrade grace window: consumers recompute both and match either until the next re-baseline.
Structs§
- Action
- Machine-readable next-step hint for AI agents.
- Blast
Radius Entry - A function with meaningful static or traffic-weighted blast radius.
- Capture
Quality - Capture-quality telemetry surfaced alongside the aggregate summary.
- Diagnostic
Message - Error / warning surfaced by the sidecar.
- Evidence
- Supporting evidence for a
Finding. Mirrors the rows of the decision table in.internal/spec-production-coverage.mdso the CLI can render the “why” behind each verdict without re-deriving it. - Finding
- A per-function finding combining static analysis and runtime coverage.
- Function
Identity - Canonical, versioned identity for a function.
- HotPath
- A function the sidecar identified as a hot path in the current dump.
- Importance
Entry - A function ranked by runtime traffic, complexity, and ownership risk.
- License
- The license material the sidecar should validate.
- Options
- Runtime knobs. All fields are optional so new options can be added without a breaking change.
- Request
- Sent by the public CLI to the sidecar via stdin.
- Response
- Emitted by the sidecar to stdout.
- Static
File - Static analysis results for a single source file.
- Static
Findings - Static analysis output the public CLI already produced.
- Static
Function - Static analysis results for a single function within a
StaticFile. - Summary
- Aggregate statistics describing the observed coverage dump.
Enums§
- Confidence
- Confidence the sidecar attaches to a
Finding::verdict. - Coverage
Source - A single coverage artifact on disk.
- Feature
- Feature flags present in the license JWT’s
featuresclaim. - Identity
Resolution - How a
FunctionIdentitywas produced by the upstream coverage pipeline. - Report
Verdict - Top-level report verdict for a coverage analysis run.
- Risk
Band - Risk band for a blast-radius entry.
- Verdict
- Per-finding verdict. Replaces the 0.1
CallStateenum. - Watermark
- What to render in the human output when the license is in the grace window.
Constants§
- PROTOCOL_
VERSION - Current protocol version. Bumped per the semver rules above.
Functions§
- blast_
radius_ id - Compute the deterministic
BlastRadiusEntry::idfor a blast-radius entry. - finding_
id - Compute the deterministic
Finding::idfor a production-coverage finding. - function_
identity_ id - Compute the deterministic
FunctionIdentity::stable_idfor a function. - function_
identity_ id_ v1 Deprecated - Compute the pre-0.8.0
FunctionIdentity::stable_idrecipe. - hot_
path_ id - Compute the deterministic
HotPath::idfor a hot-path finding. Uses the same canonical order asfinding_idwith kind"hot", emittingfallow:hot:<hash>. - importance_
id - Compute the deterministic
ImportanceEntry::idfor an importance entry. - source_
hash_ for - Compute the canonical
FunctionIdentity::source_hashfor the given canonical body bytes.