Expand description
Typed envelope structs for the JSON output contract. Live here rather
than in fallow-types because the body fields reach into fallow-core
and into this crate’s own health_types.
Typed envelope structs for the JSON output contract.
Each top-level fallow command (check, dupes, health, audit,
explain, coverage setup, plus the bare combined invocation and the
CodeClimate / review-envelope side outputs) emits a distinct envelope
shape. This module is the schema-side source of truth for those shapes:
every type carries Serialize plus a cfg-gated JsonSchema derive so the
committed docs/output-schema.json can be regenerated from Rust.
Living in fallow-cli rather than fallow-types because the body fields
pull in DuplicationReport (from fallow-core) and HealthReport (from
this crate), neither of which is reachable from the lower-level types
crate. The shared utility shapes (SchemaVersion, Meta,
BaselineDeltas, …) still live in fallow_types::envelope because they
depend only on serde primitives.
Runtime construction of these envelopes happens in
crates/cli/src/report/json.rs; the JSON layer builds an envelope struct
and converts it to a serde_json::Value via serde_json::to_value. The
only remaining work on the Value tree is path relativisation
(strip_root_prefix) and the cross-result-type suppress-line action
harmonizer (harmonize_multi_kind_suppress_line_actions); both span
envelope boundaries that typed wrappers do not.
Runtime emit for the CodeClimate, review-envelope, and coverage-setup
shapes now flows through the typed structs in this module:
crates/cli/src/report/codeclimate.rs constructs CodeClimateIssue
directly via cc_issue,
crates/cli/src/report/ci/review.rs::render_review_envelope constructs
ReviewEnvelopeOutput, and
crates/cli/src/coverage/mod.rs::build_setup_envelope constructs
CoverageSetupOutput. The wire serde_json::Value is the
serde_json::to_value(&envelope) of those typed structs, so adding a
field to one of those structs automatically flows to the wire. The
AuditOutput and ListBoundariesOutput families remain
schema-source-of-truth only (their wire is still hand-built via
serde_json::json!); the drift gate keeps them honest.
Structs§
- Audit
Output - Envelope emitted by
fallow audit --format json. Combines dead code, complexity, and duplication scoped to changed files with a verdict (pass/warn/fail), a per-category summary, optional new-vs-inherited attribution, and full sub-results. - Boundaries
List Logical Group - A pre-expansion
autoDiscoverlogical group surfaced for observability (issue #373). Captured duringexpand_auto_discoverso consumers can see the user-authored parent name and grouping intent after expansion would otherwise flatten it out ofBoundariesListing::zones. - Boundaries
List Rule - A boundary import rule, expanded to operate on concrete child zone
names after
autoDiscoverflattening. The user’s pre-expansion rule (keyed on the logical parent name, if any) is preserved on the correspondingBoundariesListLogicalGroup::authored_rule. - Boundaries
List Zone - A boundary zone after preset and
autoDiscoverexpansion. Each entry classifies files into a single zone via glob patterns. - Boundaries
Listing boundariesblock carried byListBoundariesOutput.- Check
Grouped Entry - Single resolver bucket inside
CheckGroupedOutput. Carries the group’s identifier, optional section owners, and a per-group flattenedAnalysisResults. - Check
Grouped Output - Envelope emitted by
fallow dead-code --group-by ... --format json. - Check
Output - Envelope emitted by
fallow dead-code --format json(plus thecheckblock inside the combined and audit envelopes). - Code
Climate Issue - Single CodeClimate-compatible issue inside
CodeClimateOutput. - Code
Climate Lines lines.beginforCodeClimateLocation.- Code
Climate Location - Location block inside
CodeClimateIssue::location. - Code
Climate Output - Envelope emitted by
fallow --format codeclimateandfallow --format gitlab-codequality. GitLab Code Quality consumes the same shape. The wire form is a bare JSON array, not an object. - Combined
Output - Envelope emitted by bare
fallow --format json(the combined invocation). Wraps the per-analysis sub-results inside a single envelope with the standardschema_version/version/elapsed_msheader. - Coverage
Analyze Output - Envelope emitted by
fallow coverage analyze --format json. - Coverage
Setup File ToEdit - Single file to edit inside
CoverageSetupMember::files_to_editorCoverageSetupOutput::files_to_edit. - Coverage
Setup Member - Per-workspace setup recipe inside
CoverageSetupOutput::members. - Coverage
Setup Output - Envelope emitted by
fallow coverage setup --json. Deterministic agent-readable runtime coverage setup instructions. In workspaces,memberscarries one entry per detected runtime package;runtime_targetsis the union of all member targets. - Coverage
Setup Snippet - Single code snippet inside
CoverageSetupMember::snippetsorCoverageSetupOutput::snippets. - Dupes
Output - Envelope emitted by
fallow dupes --format json(plus thedupesblock inside the combined and audit envelopes). - Explain
Output - Envelope emitted by
fallow explain <issue-type> --format json. - GitHub
Review Comment - GitHub pull-request review comment.
- GitLab
Review Comment - GitLab merge-request discussion comment.
- GitLab
Review Position positionblock insideGitLabReviewComment. Mirrors the GitLab merge-request discussion-position API.- Health
Output - Envelope emitted by
fallow health --format json(plus thehealthblock inside the combined and audit envelopes). - List
Boundaries Output - Envelope emitted by
fallow list --boundaries --format json. Surfaces the architecture boundary zones, rules, and (issue #373) the user’s pre-expansionautoDiscoverlogical groups so consumers can render grouping intent thatexpand_auto_discoverwould otherwise flatten out ofzones[]. - Review
Envelope Meta metablock insideReviewEnvelopeOutput.- Review
Envelope Output - Envelope emitted by
fallow --format review-github/review-gitlab. Consumed byaction/scripts/review.shandci/scripts/review.shto post inline PR / MR review comments. - Review
Envelope Summary - Summary block on
ReviewEnvelopeOutput. Always present on v2 emit;serde(default)keeps schemars from marking it required so a future Deserialize derivation against v1 historical input synthesizes an empty value rather than erroring. - Review
Reconcile Output - Envelope emitted by
fallow ci reconcile-review --format json. Used by CI integrations to drive comment carry-over and stale-comment cleanup across PR / MR revisions.
Enums§
- Audit
Command - Singleton
commanddiscriminator forAuditOutput. - Code
Climate Issue Kind - Discriminator value for
CodeClimateIssue::kind. - Code
Climate Severity - CodeClimate severity scale.
- Coverage
Analyze Schema Version - Singleton schema-version discriminator for
CoverageAnalyzeOutput. Independent from the globalSchemaVersionbecause the runtime coverage envelope versions independently from the rest of the JSON contract. - Coverage
Setup Framework - Framework label inside coverage setup output.
- Coverage
Setup Package Manager - Package manager label inside coverage setup output.
- Coverage
Setup Runtime Target - Runtime target inside coverage setup output.
- Coverage
Setup Schema Version - Singleton schema-version discriminator for
CoverageSetupOutput. - Fallow
Output - Typed root of every fallow
--format jsonenvelope shape that serializes as a JSON object. The schema derived from this enum drives the document-rootoneOfindocs/output-schema.json, replacing the previously hand-maintained block. - GitHub
Review Side - Singleton side discriminator for
GitHubReviewComment::side. - GitLab
Review Position Type - Singleton position-type discriminator for
GitLabReviewPosition. - Group
ByMode - Resolver mode label for grouped envelopes (dead-code, dupes, health).
- Review
Check Conclusion meta.check_conclusionfor the GitHub review envelope. Maps to the GitHub Checks API conclusion field.- Review
Comment - Per-line review comment. Schema is an
anyOfbetween GitHub and GitLab shapes; at runtime every entry in a single envelope comes from the same provider because the envelope is built from one provider’s branch incrates/cli/src/report/ci/review.rs::render_review_envelope. - Review
Envelope Event - Singleton GitHub review-event marker.
- Review
Envelope Schema - Schema-version discriminator for the review envelope.
- Review
Provider - Review-envelope provider tag.
- Review
Reconcile Schema - Schema-version discriminator for the review reconcile envelope.
Constants§
- MARKER_
REGEX_ FLAGS_ V2 - Canonical v2 marker-regex flags. Paired with
MARKER_REGEX_V2. - MARKER_
REGEX_ V2 - Canonical v2 marker-regex literal. Mirrored by
MARKER_PREFIX_V2on the render side; if you change one, change the other and refresh both snapshots. NO(?m)baked into the pattern; consumers passMARKER_REGEX_FLAGS_V2as the second arg to their regex engine so the^/$anchors match at line boundaries inside a multi-line comment body. Pairing pattern + flags lets the wire stay compatible with both Rust’sregexcrate (viaRegexBuilder::multi_line(true)) and JavaScript RegExp (new RegExp(pat, "m")).
Functions§
- default_
marker_ regex - Default for
ReviewEnvelopeOutput::marker_regex. The canonical regex is stable across the v2 schema. Consumers that hardcode this string instead of reading the field stay correct until a v3 bump. - default_
marker_ regex_ flags - Default for
ReviewEnvelopeOutput::marker_regex_flags. Always"m"today; emitted as a sibling field rather than baked into the regex because JavaScript RegExp rejects the standalone(?m)inline flag group withSyntaxError: Invalid regular expression ... Invalid group. - is_
false - Helper for
skip_serializing_if = "is_false"ontruncatedfields above. Serde callsskip_serializing_ifwith&T, so the reference signature is dictated by the trait and cannot be changed to pass-by-value. Uses#[allow]rather than#[expect]per.claude/rules/code-quality.md:trivially_copy_pass_by_refis a pedantic lint that fires inconsistently across build configurations (lib vs bin), which would triggerunfulfilled_lint_expectationsunder#[expect].