pub struct ScanReport {Show 16 fields
pub antigens: Vec<AntigenDeclaration>,
pub presentations: Vec<Presentation>,
pub immunities: Vec<Immunity>,
pub tolerances: Vec<Toleration>,
pub lineage_edges: Vec<LineageEdge>,
pub deferred_defenses: Vec<DeferredDefense>,
pub convergent_evidences: Vec<ConvergentEvidence>,
pub recurrent_declarations: Vec<RecurrentDeclaration>,
pub mucosal_declarations: Vec<MucosalDeclaration>,
pub prescriptive_declarations: Vec<PrescriptiveDeclaration>,
pub defenses: Vec<Defense>,
pub generates_declarations: Vec<GeneratesDeclaration>,
pub marked_unknowns: Vec<MarkedUnknown>,
pub files_scanned: usize,
pub parse_failures: Vec<ParseFailure>,
pub scan_coverage: Option<ScanCoverage>,
}Expand description
Aggregate result of scanning a workspace.
Fields§
§antigens: Vec<AntigenDeclaration>All discovered antigen declarations.
presentations: Vec<Presentation>All discovered #[presents] sites + synthetic fingerprint matches.
Distinguish the two via Presentation::match_kind.
immunities: Vec<Immunity>All discovered #[immune] sites.
tolerances: Vec<Toleration>All discovered #[antigen_tolerance] sites. W6a.
lineage_edges: Vec<LineageEdge>All discovered #[descended_from] edges.
#[serde(default)] so older reports deserialize
cleanly with an empty edge list (additive change, not breaking).
deferred_defenses: Vec<DeferredDefense>All discovered deferred-defense declarations: #[anergy],
#[immunosuppress], #[poxparty], #[orient]. ADR-023.
#[serde(default)] so pre-v0.2 reports deserialize cleanly.
convergent_evidences: Vec<ConvergentEvidence>All discovered convergent-evidence declarations: #[diagnostic],
#[clonal], #[igg], #[crossreactive], #[polyclonal],
#[monoclonal], #[adcc]. ADR-024.
#[serde(default)] so pre-v0.2 reports deserialize cleanly.
recurrent_declarations: Vec<RecurrentDeclaration>All discovered recurrent-emergence declarations: #[itch],
#[recurrence_anchor], #[crystallize], #[chronic],
#[saturate], #[strand]. ADR-024 §Family 2.
#[serde(default)] so pre-recurrent reports deserialize cleanly.
mucosal_declarations: Vec<MucosalDeclaration>All discovered mucosal-boundary declarations: #[mucosal],
#[mucosal_delegate], #[mucosal_tolerant]. ADR-027 + Amendment 1.
#[serde(default)] so pre-mucosal reports deserialize cleanly.
prescriptive_declarations: Vec<PrescriptiveDeclaration>All discovered prescriptive work-orchestration declarations: #[panel],
#[rx], #[refer], #[biopsy], #[ddx], #[triage], #[culture],
#[quarantine]. ADR-033 (extends ADR-024). The audit projects each to a
four-valued WorkVerdict (the board).
#[serde(default)] so pre-prescriptive reports deserialize cleanly.
defenses: Vec<Defense>All discovered #[defended_by(X)] code-tier witness registrations
(ADR-029). Each records that a test/proptest function declares it
defends a failure-class; cargo antigen audit cross-references these
to the #[presents(X)] sites they cover to compute the immune-state
verdict. Immunity is observed, not declared.
#[serde(default)] so pre-ADR-029 reports deserialize cleanly.
generates_declarations: Vec<GeneratesDeclaration>All discovered #[antigen_generates(X, ...)] declarations on macro
definitions (ADR-014). The generates-synthesis pass connects these to
macro invocation sites and emits synthetic presentations.
#[serde(default)] so pre-ADR-014 reports deserialize cleanly.
marked_unknowns: Vec<MarkedUnknown>All discovered marked-unknown markers (#[aura] / #[dread] /
#[red_flag], ADR-041) — the felt-but-unnamed dangers. These are the
scan-time half of ADR-039’s Finding; they surface at the dial’s
non-gating floor (never gate, never nag). #[serde(default)] so
pre-ADR-041 reports deserialize cleanly.
files_scanned: usizeFiles scanned successfully.
parse_failures: Vec<ParseFailure>Files that failed to parse.
scan_coverage: Option<ScanCoverage>Member-aware scan coverage (v0.3): which workspace member crates were
enumerated vs actually scanned. None for a flat
scan_workspace scan (which has no member concept) — preserves
byte-identical JSON for flat-scan consumers via
skip_serializing_if. Some only from
scan_workspace_multi_crate.
This is the substrate for ignorance detection (regulatory tier): a
member that exists in the workspace but was NOT scanned is a region
where #[presents] sites go unseen — ignored, not defended. The
coverage record makes that frontier explicit so a downstream audit can
surface it. The audit/verdict layer is ADR scope; this field is the
floor it stands on.
Implementations§
Source§impl ScanReport
impl ScanReport
Sourcepub fn unaddressed_presentations(&self) -> Vec<UnaddressedPresentation>
pub fn unaddressed_presentations(&self) -> Vec<UnaddressedPresentation>
Find presentations that lack a corresponding immunity declaration.
W3 — structural item-identity matching. A Presentation
and an Immunity “address each other” when:
- they reference the same
antigen_type, AND - they’re in the same source file, AND
- their
item_targetvalues are equal (i.e., they’re applied to the same Rust item).
This replaces the pre-W3 20-line proximity heuristic, which produced
false positives in multi-impl files (immunity on impl X matched
presentation on impl Y if their attributes happened to be within
20 lines) and false negatives when long doc-comments separated paired
declarations on the same item.
Cross-file matching remains out of scope here — different items can
share names across modules, and the structural identity of an
“item” extends to its containing module path. That’s future territory
(cross-crate scan + #[descended_from] propagation).
Sourcepub fn partitioned_presentations(&self) -> PartitionedPresentations
pub fn partitioned_presentations(&self) -> PartitionedPresentations
Unaddressed presentations split by confidence tier.
Equivalent to calling unaddressed_presentations
and partitioning by MatchKind, but in a single pass and with doc
guidance on what each bucket means for CI gates.
See PartitionedPresentations for the distinction between
explicit (CI-gateable) and inferred (human-triage).
Sourcepub fn orphaned_tolerances(&self) -> Vec<&Toleration>
pub fn orphaned_tolerances(&self) -> Vec<&Toleration>
Tolerances whose named antigen is no longer declared in the scanned workspace. Per ADR-011 §Mechanics + ATK-A2-009 (the stale-tolerance orphan check, the biology cognate “peripheral suppression continuing after the antigen it suppressed is no longer present”).
Cross-crate antigens are not yet handled — for now, an “orphan” is a
tolerance whose antigen type_name doesn’t appear in any
AntigenDeclaration in the same scan. Consumers using cross-crate
antigens may produce false positives here; that’s the recognized
v0.1 limitation.
Sourcepub fn orphaned_lineage_edges(&self) -> Vec<&LineageEdge>
pub fn orphaned_lineage_edges(&self) -> Vec<&LineageEdge>
Lineage edges whose parent antigen is not present in the scan.
ATK-A3-003 — parallel to ScanReport::orphaned_tolerances.
A #[descended_from(Parent)] declaration whose Parent is no
longer declared in the scanned workspace (rename, removal, or
— for v0.1 — a parent that lives in a not-yet-scanned crate) is
a semantic warning, not a structural error: the scan completed
correctly, but the declaration references something that isn’t
there. Surfaced via this query method rather than emitted into
parse_failures so callers (CLI, audit tooling, IDE plugins)
choose the severity, the same channel discipline used for
orphaned tolerances.
Cross-crate antigens are not yet handled — for now, an “orphan”
is a lineage edge whose parent doesn’t appear as a type_name
in any AntigenDeclaration in the same scan. Consumers using
cross-crate antigens may produce false positives here; that’s
the recognized v0.1 limitation.
See also ScanReport::dangling_child_lineage_edges for the dual case
(child missing rather than parent missing).
Sourcepub fn dangling_child_lineage_edges(&self) -> Vec<&LineageEdge>
pub fn dangling_child_lineage_edges(&self) -> Vec<&LineageEdge>
Lineage edges whose CHILD has no AntigenDeclaration in the scan.
BUG-A3-002 fix. The dual of
ScanReport::orphaned_lineage_edges — orphaned checks the
parent endpoint, dangling checks the child endpoint.
A struct or enum bearing #[descended_from(Parent)] without its
own #[antigen] declaration is structurally incoherent: it claims
to inherit into the antigen system without being a participant
itself. The propagation walk (D1.5) cannot meaningfully attach
inherited presentations to a non-antigen child — the descendant
has no record in ScanReport::antigens for inheritance to flow
into.
Surfaced as a semantic warning, not a parse_failure — the
declaration is structurally well-formed; only the relationship
to the antigen registry is missing. Caller (CLI, audit tooling)
chooses severity, mirroring the orphaned_tolerances /
orphaned_lineage_edges channel discipline.
The propagation walk skips edges flagged by this query the same
way it skips edges flagged by orphaned_lineage_edges.
Sourcepub fn stamp_canonical_path(&mut self, crate_id: &str)
pub fn stamp_canonical_path(&mut self, crate_id: &str)
Stamp canonical_path (and parent_canonical_path /
child_canonical_path on lineage edges) on every record in this
report that does not already have one.
ADR-017 (Option A — caller stamps post-scan). Called by the
cargo-metadata-driven --include-deps driver after running
scan_workspace on a dependency crate root: the driver knows
the dependency’s canonical path ("<crate-name>@<version>"), but
the directory scanner doesn’t, so the driver stamps the canonical
path on every record post-scan.
Idempotent + non-overwriting: records whose canonical_path
(or relevant lineage-edge endpoint) is already Some(_) are
left unchanged. This protects records that were stamped during
an earlier (e.g., nested) scan from being silently re-keyed.
crate_id is expected to be in the ADR-017 format
"<crate-name>@<version>" (e.g., "serde@1.0.193"); the method
does not validate the format — that’s the driver’s responsibility.
Sourcepub const fn total_declarations(&self) -> usize
pub const fn total_declarations(&self) -> usize
Total count of antigen-related declarations found.
Trait Implementations§
Source§impl Clone for ScanReport
impl Clone for ScanReport
Source§fn clone(&self) -> ScanReport
fn clone(&self) -> ScanReport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more