Skip to main content

fallow_api/
output_contracts.rs

1//! Concrete output-contract aliases shared by schema and adapter crates.
2
3/// Concrete `fallow audit` envelope with this crate's verdict, summary, and
4/// attribution payloads filled into the generic output shell.
5pub type AuditOutput = fallow_output::AuditOutput<
6    crate::AuditVerdict,
7    crate::AuditSummary,
8    crate::AuditAttribution,
9    fallow_output::CheckOutput,
10    crate::DupesReportPayload,
11    fallow_output::HealthReport,
12>;
13
14/// Concrete combined check + dupes + health envelope for full analyses.
15pub type CombinedOutput = fallow_output::CombinedOutput<
16    fallow_output::CheckOutput,
17    crate::DupesReportPayload,
18    fallow_output::HealthReport,
19>;
20
21/// Concrete `fallow list boundaries` envelope with config-crate group and
22/// rule payloads.
23pub type ListBoundariesOutput = fallow_output::ListBoundariesOutput<
24    fallow_config::LogicalGroupStatus,
25    fallow_config::AuthoredRule,
26>;
27
28/// Concrete `fallow list workspaces` envelope with config-crate diagnostics.
29pub type WorkspacesOutput = fallow_output::WorkspacesOutput<fallow_config::WorkspaceDiagnostic>;
30
31/// Concrete boundaries listing body used inside list envelopes.
32pub type BoundariesListing = fallow_output::BoundariesListing<
33    fallow_config::LogicalGroupStatus,
34    fallow_config::AuthoredRule,
35>;
36
37/// Re-export of the boundaries zone row so adapters need only this crate.
38pub type BoundariesListZone = fallow_output::BoundariesListZone;
39
40/// Re-export of the boundaries rule row so adapters need only this crate.
41pub type BoundariesListRule = fallow_output::BoundariesListRule;
42
43/// Concrete logical-group row with config-crate status and rule payloads.
44pub type BoundariesListLogicalGroup = fallow_output::BoundariesListLogicalGroup<
45    fallow_config::LogicalGroupStatus,
46    fallow_config::AuthoredRule,
47>;
48
49/// Concrete `fallow list` body combining plugins, files, entry points,
50/// boundaries, and workspaces sections.
51pub type ListOutput =
52    fallow_output::ListOutput<BoundariesListing, fallow_config::WorkspaceDiagnostic>;
53
54/// Re-export of the entry-point row so adapters need only this crate.
55pub type ListEntryPointOutput = fallow_output::ListEntryPointOutput;
56
57/// Re-export of the plugin row so adapters need only this crate.
58pub type ListPluginOutput = fallow_output::ListPluginOutput;
59
60/// Concrete security gate with this crate's gate-mode payload.
61pub type SecurityGate = fallow_output::SecurityGate<crate::SecurityGateMode>;
62
63/// Concrete security output configuration with config-crate severities.
64pub type SecurityOutputConfig = fallow_output::SecurityOutputConfig<fallow_config::Severity>;
65
66/// Concrete `fallow security` summary envelope.
67pub type SecuritySummaryOutput =
68    fallow_output::SecuritySummaryOutput<SecurityOutputConfig, SecurityGate>;
69
70/// Concrete full `fallow security` envelope.
71pub type SecurityOutput = fallow_output::SecurityOutput<SecurityOutputConfig, SecurityGate>;
72
73/// Union of every `fallow trace` payload shape.
74///
75/// Serialized untagged: the JSON body is exactly one of the trace shapes with
76/// no discriminant field, so consumers dispatch on structure.
77#[derive(Debug, serde::Serialize)]
78#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
79#[serde(untagged)]
80pub enum TraceOutput {
81    /// Trace of a single export's usage.
82    Export(Box<fallow_types::trace::ExportTrace>),
83    /// Trace of a single class member's usage.
84    ClassMember(Box<fallow_types::trace::ClassMemberTrace>),
85    /// Trace of a file's reachability.
86    File(Box<fallow_types::trace::FileTrace>),
87    /// Trace of a dependency's usage.
88    Dependency(Box<fallow_types::trace::DependencyTrace>),
89    /// Trace of a clone group's instances.
90    Clone(Box<fallow_types::trace::CloneTrace>),
91    /// Transitive impact closure for a changed file set.
92    ImpactClosure(Box<fallow_types::trace::ImpactClosureTrace>),
93    /// Shortest import path between two modules.
94    ImportPath(Box<fallow_types::trace::ImportPathTrace>),
95    /// Symbol-level call chain trace.
96    SymbolChain(Box<fallow_types::trace_chain::SymbolChainTrace>),
97    /// Type-aware semantic symbol trace.
98    SemanticSymbol(Box<fallow_types::semantic::SemanticSymbolTrace>),
99}
100
101/// Union of `fallow impact` payload shapes, serialized untagged like
102/// [`TraceOutput`].
103#[derive(Debug, Clone, serde::Serialize)]
104#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
105#[serde(untagged)]
106pub enum ImpactOutput {
107    /// Project-level impact report for a changed file set.
108    Project(Box<fallow_output::ImpactReport>),
109    /// Type-aware impact for a single semantic symbol.
110    SemanticSymbol(Box<fallow_types::semantic::SemanticSymbolImpact>),
111}
112
113/// Concrete review-brief wire envelope with every typed section filled in.
114#[allow(
115    clippy::type_complexity,
116    reason = "the concrete review brief contract names every typed wire section"
117)]
118pub type ReviewBriefWireOutput = fallow_output::ReviewBriefWireOutput<
119    fallow_output::FocusMap,
120    fallow_output::WeakeningSignal,
121    fallow_output::RoutingFacts,
122    fallow_output::DecisionSurface,
123    crate::AuditVerdict,
124    crate::AuditSummary,
125    crate::AuditAttribution,
126    fallow_output::CheckOutput,
127    crate::DupesReportPayload,
128    fallow_output::HealthReport,
129>;
130
131/// Raw opt-in semantic similar-code candidate envelope.
132pub type SimilarCodeOutput = fallow_output::SimilarCodeOutput;
133
134/// Bounded exact-candidate handoff for source-grounded inspection.
135pub type SimilarCodeCandidateSnapshot = fallow_output::SimilarCodeCandidateSnapshot;
136
137/// Bounded source-grounded packet for one semantic candidate.
138pub type SimilarCodeInspectOutput = fallow_output::SimilarCodeInspectOutput;
139
140/// Semantic candidates joined with a separate verdict document.
141pub type SimilarCodeReviewOutput = fallow_output::SimilarCodeReviewOutput;
142
143/// Local-provider and pinned-model readiness envelope.
144pub type SimilarCodeStatusOutput = fallow_output::SimilarCodeStatusOutput;
145
146/// Project-local vector-cache clear result.
147pub type SimilarCodeCacheClearOutput = fallow_output::SimilarCodeCacheClearOutput;
148
149/// Versioned verdict document accepted by similar-code review.
150pub type SimilarCodeVerdictInput = fallow_output::SimilarCodeVerdictInput;
151
152/// Concrete root output union covering every fallow command payload; this is
153/// the top-level shape the published JSON schema is generated from.
154#[allow(
155    clippy::type_complexity,
156    reason = "concrete root union intentionally fills every output payload slot"
157)]
158pub type FallowOutput = fallow_output::FallowOutput<
159    AuditOutput,
160    fallow_output::ExplainOutput,
161    fallow_output::InspectOutput,
162    TraceOutput,
163    fallow_output::ReviewEnvelopeOutput,
164    fallow_output::ReviewReconcileOutput,
165    fallow_output::CoverageSetupOutput,
166    fallow_output::CoverageAnalyzeOutput,
167    ListBoundariesOutput,
168    WorkspacesOutput,
169    fallow_output::HealthOutput<fallow_output::HealthReport, fallow_output::HealthGroup>,
170    fallow_output::DupesOutput<crate::DupesReportPayload, crate::DuplicationGroup>,
171    fallow_output::CheckGroupedOutput,
172    ImpactOutput,
173    fallow_output::CrossRepoImpactReport,
174    SecuritySummaryOutput,
175    SecurityOutput,
176    fallow_output::SecuritySurvivorsOutput,
177    fallow_output::SecurityBlindSpotsOutput,
178    fallow_output::CheckOutput,
179    CombinedOutput,
180    fallow_output::FeatureFlagsOutput,
181    ReviewBriefWireOutput,
182    fallow_output::DecisionSurfaceOutput,
183    fallow_output::StandardWalkthroughGuide,
184    fallow_output::WalkthroughValidation,
185    fallow_output::SuppressionInventoryOutput,
186    fallow_output::DoctorOutput,
187    fallow_output::TypeAwareStatusOutput,
188    SimilarCodeOutput,
189    SimilarCodeInspectOutput,
190    SimilarCodeReviewOutput,
191    SimilarCodeStatusOutput,
192    SimilarCodeCacheClearOutput,
193>;