Skip to content

refactor: keep findings typed through driver results - #1015

Merged
e54-bot merged 1 commit into
mainfrom
gh-1001-typed-findings
Oct 27, 2026
Merged

e54-bot merged 1 commit into
mainfrom
gh-1001-typed-findings

Conversation

@e54-bot

@e54-bot e54-bot commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Issue #1001: typed findings ride through the driver boundary instead of being re-parsed out of the serialized payload downstream.

Mechanism

  • SemanticService::findings_meta() (#[serde(skip)] per-row FindingMeta { severity, code, span_file }) is produced once, index-aligned with findings_json(); selection (apply_findings_meta) zips rows+metas so the severity threshold, code filter, withheld counting and max_severity read typed values.
  • LintResult::findings_meta, AnalyzeResult::risks_meta, CostResult::findings_meta, EssentialResult::findings_meta/max_severity carry the typed channel in-process only (#[serde(skip)] / custom Serialize — wire shapes unchanged).
  • EssentialResult::command declares which command produced the projection (EssentialCommand::{Lint,Inspect,Analyze}); renderers select their report by the tag rather than probing result keys.
  • Renderers take typed Severity/FindingMeta (finding_head, severity_label, finding_severity_rank, sorted_findings, grouped_findings, meta_severity_counts, github_findings, finding_annotation); essential::envelope sorts diagnostics by typed severity; SourceDiagnostic::severity is now lpp::DiagnosticSeverity (re-exported through wright-language) — the LSP conversion maps the enum directly, fixing hint collapsing to information.
  • Finding-section rendering extracted to present/findings.rs, shared helpers to present/common.rs; dead finding_severity()/findings_severity_counts()/group_runs()/lpp_severity() removed.

Serialization: byte-identical verified — diff of lint --format json output vs main on tests/fixtures/workshop/synthetic/declarations-numbers.ws is empty; wright-result/v1/wright-agent/v1 shapes unchanged (all new fields #[serde(skip)] or behind Serialize impls emitting self.result verbatim).

Verification

  • cargo fmt --all -- --check — clean
  • cargo clippy --workspace --all-targets --all-features -- -D warnings — clean
  • cargo test --workspace --all-targets — 65 binaries, all pass, 0 failures
  • git diff --check — clean
  • Real-project run: wright lint tests/fixtures/workshop/real-world/overpy-cake.ws renders identical warnings/text output; --format json byte-identical to main.

Fixes #1001

Carry each finding's typed severity and code alongside its serialized
row instead of re-parsing the wire projection downstream:

- `SemanticService::findings_meta()` derives `FindingMeta` (severity,
  code, span file index) once, index-aligned with `findings_json()`;
- `LintResult::findings_meta`, `AnalyzeResult::risks_meta`,
  `CostResult::findings_meta`, and `EssentialResult::findings_meta`
  carry the typed identities in-process (`#[serde(skip)]` — the wire
  shape is unchanged);
- `FindingSelection::apply_findings_meta` zips rows with metas so the
  severity threshold and withheld-count reading stay typed;
- `essential::{lint,analyze}` return the projected payload plus the
  metas aligned to the emitted rows after sort/cap;
- `EssentialResult::command` declares which command produced the
  projection, so renderers select their report by the tag rather than
  probing JSON keys;
- renderers take typed `Severity` (`finding_head`, `severity_label`,
  `sorted_findings`, `grouped_findings`, `meta_severity_counts`,
  `github_findings`); severity is never read back out of `serde_json`;
- `SourceDiagnostic::severity` carries `lpp::DiagnosticSeverity`
  (re-exported via wright-language) instead of a `String` match — the
  LSP conversion maps the enum directly and `hint` no longer
  collapses to `information`.

JSON output is byte-identical: verified against main on real fixtures.

Fixes #1001

@Teakowa Teakowa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after independent review.

@e54-bot
e54-bot merged commit 6bea05a into main Oct 27, 2026
36 checks passed
@e54-bot
e54-bot deleted the gh-1001-typed-findings branch October 27, 2026 12:51
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Make Workshop Great Again Oct 27, 2026
e54-bot pushed a commit that referenced this pull request Oct 27, 2026
Keep the shared LPP connect path from this branch: the language service
still connects through `CompilerSession::connect_provider` (no
`installed()` fallback, `provider-refusal-<code>` classification via the
shared `provider_failure_code`). Take main's typed `DiagnosticSeverity`
findings (#1015): `SourceDiagnostic.severity` stays typed, the dead
`lpp_severity`/`provider_failure_code` free functions both drop, and the
`Severity`/`DiagnosticSeverity` imports merge. `pub mod connect` /
`ConnectFloor` exports coexist with main's `pub mod store` promotion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Keep findings typed through driver results instead of re-parsing JSON

2 participants