Skip to main content

Crate mollify_types

Crate mollify_types 

Source
Expand description

§mollify-types

The shared, versioned data contract for Mollify. Every command emits a JSON envelope with a discriminating top-level kind; downstream agents and CI depend on this JSON shape, not on Mollify’s internal Rust types.

Invariants (ported from fallow’s design — see RESEARCH.md §2.11):

  • Determinism: identical input → byte-identical output. All collections that reach output are sorted deterministically before serialization.
  • Evidence, not decisions: every Finding carries a stable Finding::fingerprint, a Confidence tier, and a human reason.
  • Candidate/verifier separation: Actions are proposed; only auto_fixable + Confidence::Certain may be applied without a human.

Structs§

Action
A proposed, machine-actionable remediation for a finding. The agent decides whether to apply it; Mollify never auto-applies non-Certain findings.
AuditReport
The full audit envelope: a quality score plus the findings.
FileMetrics
Maintainability and size metrics for one file.
Finding
A single piece of deterministic evidence. The atom of every report.
FindingsReport
A report that is just a sorted list of findings plus a summary.
Location
A source location, 1-based line/column, workspace-relative path.
MetricsReport
Per-file code metrics (radon/wily-style), plus project totals.
MetricsTotals
Project-wide metric totals.
Summary
Aggregate counts, always present so CI can gate without scanning findings.

Enums§

Attribution
Whether a finding was introduced by the current change or inherited from the base. The PR gate (--gate new-only) keys on Attribution::Introduced.
Category
The five co-equal analysis areas (plus dependency hygiene), mirroring fallow’s “never reduce it to a dead-code tool” rule.
Confidence
Confidence tier attached to every finding. This is the core honesty mechanism: Python dead-code detection is undecidable in general, so Mollify never claims boolean certainty.
Report
The kind-discriminated output envelope. kind lets clients switch on the result type and iterate findings.
Severity
Severity controls CI exit behavior.

Constants§

SCHEMA_VERSION
Current schema version of the JSON contract. Bump the minor on additive changes, the major on breaking ones. Agent skills pin to this.

Functions§

sort_findings
Deterministic ordering for findings: by path, then line, then rule, then fingerprint. Call before serializing any report.