Expand description
Product façade crate for unsafe-review.
unsafe-review finds unsafe Rust changes missing a safety contract, guard,
test, or witness. It is advisory static review evidence: it does not prove
memory safety, UB-free status, or Miri-clean status, and it does not run
witnesses, post comments, edit source, or block by default.
Most users want the command-line interface:
cargo install unsafe-review --locked
unsafe-review pr --base origin/mainProgrammatic integrations should depend on unsafe-review-core directly:
build an AnalyzeInput, call analyze, and render or consume the
returned AnalyzeOutput. Every output surface (CLI, JSON, Markdown PR
summary, SARIF, LSP diagnostics, agent packets) projects from the same
ReviewCard truth object.
Start with unsafe-review doctor to check a repository is set up for
review, then unsafe-review pr or unsafe-review check --base origin/main
for the first advisory review.
Modules§
Structs§
- Analysis
Identity - Facts identifying the analysis run that produced an output envelope.
- Analyze
Input - Analyze
Output - Baseline
Health Counts - Bucket counts, mirrored 1:1 with
HealthBucket. - Baseline
Health Entry - One classified ledger entry or unbaselined card.
- Baseline
Health Report - Full baseline-health classification result (
baseline status, issue #1893). - Baseline
Init Result - Result returned by
baseline_initsummarizing what was captured. - Baseline
Refresh Plan - Deterministic per-entry refresh preview (
baseline refresh --dry-run, issue #1893). Writes nothing; a future apply mode is out of scope (see module docs). - CardId
- Cargo
Careful Receipt Input - Concurrency
Receipt Input - Contract
Evidence - Discharge
Evidence - Discovery
Options - Editor
Action Arguments - Editor
Action Command - Editor
Action Contract - Editor
Action Diagnostic - Editor
Action Payload - Editor
Coverage Block - Editor
Diagnostic - Canonical, card-scoped diagnostic data for editor and agent projections.
- Editor
Evidence State - Editor
Evidence Summary - Editor
Obligation Evidence - Editor
Position - Editor
Projection - Editor
Range - Editor
Reach Evidence - Editor
Safety Condition - Editor
Simple Evidence - Editor
Witness Route - Manual
Candidate - Manual
Candidate Evidence - Manual
Candidate Location - Manual
Candidate Oracle Map - Manual
Candidate Proof Mode - Manual
Candidate Stable Byte - Miri
Receipt Input - Missing
Evidence - Next
Action - Outcome
Report - PerFile
Scan Stats - Per-file scan timing entry. Diagnostic only — not a coverage claim, proof, UB-free, Miri-clean, site-execution, or performance guarantee.
- Policy
Report - Proof
Receipt Input - Provenance
- Traceable evidence metadata that the CLI layer assembles from argv, git, and the filesystem before calling the JSON renderer.
- Reach
Evidence - Receipt
Audit Report - Refresh
Plan Entry - Refresh
Plan Summary - Related
Test - Repair
Candidate - Repair
Candidate Position - Repair
Candidate Range - Repair
Candidate Target - Repair
Evidence Movement - Repo
Scan Event - Repo
Scan Status - Review
Card - Review
Card Confirmation Projection - Safety
Obligation - Sanitizer
Receipt Input - Scan
Cost - Run cost aperture measured by the CLI emit layer and injected into
usefulness-telemetry.json(SPEC-0038 §scan_cost). - Source
Location - Unsafe
Operation - Unsafe
Site - Witness
Evidence - Witness
Receipt - Witness
Route
Enums§
- Analysis
Mode - Analysis
State - Lifecycle state produced by the analysis-identity slice.
- Confidence
- Diff
Source - Editor
Action Applicability - Editor
Action Readiness - Executed
Receipt Input - Typed output captured by an explicit unsafe-review witness execution.
- Hazard
Kind - Health
Bucket - One of the ten SPEC-0030 baseline-health buckets (issue #1893).
- Policy
Mode - Priority
- Proof
Path - Receipt
Card IdKind - Refresh
Action - Refresh-plan action for one ledger entry (
baseline refresh --dry-run, issue #1893). - Repair
Candidate Applicability - Repair
Candidate Kind - Repo
Scan Phase - Repo
Stop Reason - Why a repo scan stopped short of scanning every discovered file.
- Review
Class - Scope
- Witness
Kind
Constants§
- COMMENT_
BODY_ WORD_ LIMIT - Maximum word count for a comment-plan comment body.
- FILE_
TIMINGS_ CAP - Maximum number of files for which per-file timing is collected.
Scans touching more files omit
file_timingsentirely rather than silently emitting a partial list (truncation honesty). - MANUAL_
CANDIDATE_ SCHEMA_ VERSION - MANUAL_
CANDIDATE_ STABLE_ BYTE_ CLASSES - MANUAL_
CANDIDATE_ TRUST_ BOUNDARY - WITNESS_
RECEIPT_ SCHEMA_ VERSION
Functions§
- actions_
for_ card - analyze
- analyze_
with_ discovery - analyze_
with_ discovery_ and_ progress - analyze_
with_ discovery_ and_ repo_ events - audit_
witness_ receipts - baseline_
add baseline add(SPEC-0030): add or update a single baseline entry (plus its snapshot state) by re-analyzing the repo, finding the card matchingcard_id, and recording its current coverage state.- baseline_
init baseline init(SPEC-0030): scan the repo for open actionable cards, capture each card’s identity and coverage state, and write both the baseline ledger and the coverage snapshot. Idempotent — re-running overwrites with a fresh snapshot of the current state.- baseline_
init_ preview - Preview the baseline entries that
baseline initwould author without writing files. The returned result is the same plan used by the applying command, preserving one source of truth for card selection and output paths. - baseline_
ledger_ path - Canonical location of the baseline debt ledger for a scan root.
- baseline_
refresh_ preview baseline refresh --dry-run(issue #1893): build the deterministic per-entry action plan from the same classification asbaseline_status. Writes nothing; there is no apply mode (SPEC-0030 non-goal — a future apply command would be separately approved, explicit, idempotent, and refuse to overwrite a changed ledger).- baseline_
status baseline status(issue #1893): classify every baseline ledger entry, plus every currently open actionable card the ledger does not represent, into the ten SPEC-0030 baseline-health buckets. Read-only — runs a full repo scan and reads policy files; writes nothing.- bless_
fixture_ card_ goldens - Regenerate
expected.cards.jsonfor each named fixture (or all registered fixtures ifnamesis empty), always writing LF line endings. - bless_
fixture_ card_ goldens_ from_ workspace - Runtime-root-aware variant of
bless_fixture_card_goldens. - bless_
fixture_ surface_ goldens - Regenerate surface goldens (
expected.lsp.json,expected.repair-queue.json) for a single named fixture, writing LF line endings. - bless_
fixture_ surface_ goldens_ from_ workspace - Runtime-root-aware variant of
bless_fixture_surface_goldens. - collect_
context - collect_
context_ range - Render a
file_range_scanenvelope for SPEC-0033. - compare_
outcome_ json - discover_
repo_ files - evaluate_
policy_ report - evaluate_
policy_ report_ from_ output - explain_
card - lint_
manual_ candidate_ text - Lints manual candidate JSON text without importing or writing anything.
It reports the first schema or cross-field error from the same validation
path
candidate importuses, plus every remainingTODOplaceholder marker found in string fields. An empty result means the text would import cleanly. Lint is advisory authoring validation only: it is not analyzer discovery, not witness execution, not proof of memory safety, not UB-free status, not Miri-clean status, not a site-execution claim, and not policy gating. - load_
manual_ candidate - Look up one manual advisory candidate by id.
- load_
manual_ candidates - manual_
candidate_ implementer_ handoff - manual_
candidate_ path - new_
manual_ candidate_ skeleton - Builds a schema-correct
manual-candidate/v1authoring skeleton for one stable-byte class. Free-text fields carryTODOplaceholder text for the author to replace, while every cross-field consistency rule the validator enforces (class vocabulary,stable_byte.proof_required==proof_mode.kind,fix_boundary==stable_byte.suggested_fix_boundary,pr_aperture==stable_byte.pr_aperture, trust boundary phrases) is already satisfied. The skeleton is an authoring aid only: it is not analyzer discovery, not witness execution, not proof of memory safety, not UB-free status, not Miri-clean status, not a site-execution claim, and not policy gating. - project_
actionable_ editor_ diagnostics - Project only actionable canonical editor diagnostics for live transport.
- project_
editor - project_
editor_ diagnostics - Project only the canonical editor diagnostics without constructing hovers or code actions that a caller does not need.
- project_
review_ card_ confirmation - read_
manual_ candidate - render_
badge_ jsons - render_
baseline_ refresh_ human - render_
baseline_ refresh_ json - render_
baseline_ status_ human - render_
baseline_ status_ json - render_
comment_ plan - render_
fixture_ surface - Render a single surface for a fixture as the bless path would write it (normalised, LF-terminated) without writing a file.
- render_
fixture_ surface_ from_ workspace - Runtime-root-aware variant of
render_fixture_surface. - render_
gate_ manifest - Render the
unsafe-review-gate.jsonrouting manifest (SPEC-0034). - render_
gate_ manifest_ repo - Render
unsafe-review-gate.jsonfor areporun (SPEC-0034 parity). - render_
github_ summary - render_
human - render_
human_ short - render_
json - render_
json_ with_ provenance - Render the JSON analyze artifact with attached traceable evidence metadata.
- render_
lsp - render_
lsp_ hover - Render the rich hover markdown for a single
ReviewCardas the live LSP server would produce it. - render_
manual_ candidate_ context - render_
manual_ candidate_ explain - render_
manual_ candidate_ witness_ plan - render_
markdown - render_
outcome_ json - render_
outcome_ markdown - render_
policy_ report_ json - render_
policy_ report_ markdown - render_
pr_ summary - render_
receipt_ audit_ json - render_
receipt_ audit_ markdown - render_
repair_ queue - render_
sarif - render_
usefulness_ telemetry - Render the
usefulness-telemetry.jsonlow-noise usefulness telemetry artifact (SPEC-0038). - render_
usefulness_ telemetry_ with_ cost - Render
usefulness-telemetry.jsonwith CLI-layer scan cost injected (SPEC-0038 §scan_cost). - render_
witness_ plan - sha256_
hex_ of - Compute the SHA-256 hex digest of raw bytes.
- validate_
witness_ receipts