From 28e8f1ba7ab7b6722bc7239b7f2e41084820f4d7 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 15:58:13 +0000 Subject: [PATCH] =?UTF-8?q?release:=20autter=203.15.0=20+=20VS=20Code=20ex?= =?UTF-8?q?tension=200.3.0=20=E2=80=94=20more=20local=20checks;=20local=20?= =?UTF-8?q?reviews=20on=20the=20PR=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pairs with autter-monorepo#777, which runs 18 rule-based check bundles in the local review (was 4) and keeps each local review so the PR page lists it, each finding marked still flagged, dismissed or no longer flagged. - `autter review --dismiss [--undo]` records (or clears) a dismissal of one finding of the last local review: POST /api/cli/orgs/:slug/local-reviews/:id/dismissals, and in .autter/local-review.json (`dismissed` map) so `autter findings` leaves it out even when Autter is unreachable; `localReview.dismissed` counts them. An unknown finding id is an error naming `autter findings --json`. - VS Code: dismissing a local-review finding runs `autter review --dismiss` in its work tree (warning when Autter didn't record it); "Show Dismissed Review Findings Again" undoes those too. - Help text, README and CHANGELOGs list the wider checks and the PR page. - Cargo.toml / Cargo.lock 3.14.1 → 3.15.0; extension 0.2.1 → 0.3.0. Tests: option parsing and the saved-review dismissal map; dismissed findings leave `autter findings` (real-repo test); isLocalFindingId; end to end against a mock API (dismiss, unknown id, undo). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01TtUpr8sH39LAcxNTh4QreC --- CHANGELOG.md | 9 ++ Cargo.lock | 2 +- Cargo.toml | 2 +- agent-support/vscode/CHANGELOG.md | 5 + agent-support/vscode/README.md | 2 +- agent-support/vscode/package-lock.json | 4 +- agent-support/vscode/package.json | 2 +- agent-support/vscode/src/findings-manager.ts | 63 ++++++++ agent-support/vscode/src/findings-model.ts | 5 + .../vscode/src/test/findings-model.test.ts | 7 + src/commands/arg_parser.rs | 14 +- src/commands/findings.rs | 30 +++- src/commands/review.rs | 142 +++++++++++++++++- 13 files changed, 272 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23513cf..3726eb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,15 @@ This changelog is automatically generated by AI when releases are published. ## [Unreleased] +## [3.15.0] - 2026-11-17 + +### Added + +- **`autter review` runs many more rule-based checks.** Besides secrets, static security, auth and race conditions, it now runs the deterministic layer of the rate-limiting, resilience, LLM security, RLS, privacy, logging, infrastructure-as-code, CI/CD, supply-chain, architecture, code-health, code-hygiene, TODO and UI checks, with your organization's settings. Still no AI model calls; still a few seconds. +- **Local reviews show on the pull request.** Autter keeps each `autter review` result, and the pull request's page lists the reviews of its branch, with each finding marked as still flagged by the PR review, dismissed by you, or no longer flagged. +- **`autter review --dismiss [--undo]`** dismisses (or restores) one finding of your last local review: it leaves `autter findings`, and the pull request's page shows it as dismissed. `autter findings --json` reports how many were dismissed. +- **VS Code extension 0.3.0**: dismissing a local-review finding also records it in Autter (*Show Dismissed Review Findings Again* restores it there too). + ## [3.14.1] - 2026-11-17 ### Changed diff --git a/Cargo.lock b/Cargo.lock index 47024c5..116a961 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -258,7 +258,7 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "autter" -version = "3.14.1" +version = "3.15.0" dependencies = [ "autter", "base64", diff --git a/Cargo.toml b/Cargo.toml index f7bc83b..37ce83b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ resolver = "3" [package] name = "autter" -version = "3.14.1" +version = "3.15.0" edition = "2024" default-run = "autter" diff --git a/agent-support/vscode/CHANGELOG.md b/agent-support/vscode/CHANGELOG.md index 3dc37f3..af92fe1 100644 --- a/agent-support/vscode/CHANGELOG.md +++ b/agent-support/vscode/CHANGELOG.md @@ -6,6 +6,11 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how ## [Unreleased] +## [0.3.0] - 2026-11-17 + +- Dismissing a finding from **Autter: Review My Changes** also tells Autter, so the pull request's page shows it as dismissed. *Show Dismissed Review Findings Again* restores it there too. +- Local reviews run many more rule-based checks (needs autter CLI 3.15.0). + ## [0.2.1] - 2026-11-17 - **Autter: Review My Changes** runs only the deterministic, rule-based checks (no AI calls), so it usually finishes in a few seconds. The full review runs on the pull request. diff --git a/agent-support/vscode/README.md b/agent-support/vscode/README.md index be18a6a..e3093b6 100644 --- a/agent-support/vscode/README.md +++ b/agent-support/vscode/README.md @@ -34,7 +34,7 @@ Findings are only shown on lines the review saw. Line numbers follow your edits: The extension keeps `.autter/findings.md` up to date with every finding: a summary, its location, next steps, and a link. `.autter/` is added to `.git/info/exclude`, so it is never committed. -**Before a pull request exists**, run *Autter: Review My Changes*. It saves your files and runs `autter review`, which checks everything a pull request from this branch would contain (committed or not, new files included) with the deterministic, rule-based checks of Autter's PR review: secrets, static security, auth and race conditions. It makes no AI calls and usually takes a few seconds; the full review runs on the pull request. Its findings show up the same way, labelled "local review", and follow your edits the same way. The result is kept until you review again on that branch. +**Before a pull request exists**, run *Autter: Review My Changes*. It saves your files and runs `autter review`, which checks everything a pull request from this branch would contain (committed or not, new files included) with the deterministic, rule-based checks of Autter's PR review: secrets, security, race conditions, logging, infrastructure and CI/CD, supply chain, architecture, code health and more. It makes no AI calls and usually takes a few seconds; the full review runs on the pull request. Once you open the PR, its page in Autter lists these findings and which ones you dismissed. Its findings show up the same way, labelled "local review", and follow your edits the same way. The result is kept until you review again on that branch. - **Sign in**: click **autter: Sign in** in the status bar. It runs `autter login` in a terminal. - **Settings**: `autter.findings.display` (`inline`, `problems` or `off`; default `inline`) and `autter.findings.writeFile` (default `true`). diff --git a/agent-support/vscode/package-lock.json b/agent-support/vscode/package-lock.json index 84b3e83..477327b 100644 --- a/agent-support/vscode/package-lock.json +++ b/agent-support/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "autter-vscode", - "version": "0.2.1", + "version": "0.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "autter-vscode", - "version": "0.2.1", + "version": "0.3.0", "license": "Apache-2.0", "dependencies": { "posthog-node": "^5.35.14" diff --git a/agent-support/vscode/package.json b/agent-support/vscode/package.json index 5de91dc..fd00ef8 100644 --- a/agent-support/vscode/package.json +++ b/agent-support/vscode/package.json @@ -2,7 +2,7 @@ "name": "autter-vscode", "displayName": "autter", "description": "Keep track of code generated by AI.", - "version": "0.2.1", + "version": "0.3.0", "icon": "autter.png", "publisher": "autter", "repository": { diff --git a/agent-support/vscode/src/findings-manager.ts b/agent-support/vscode/src/findings-manager.ts index bc061c1..87e9909 100644 --- a/agent-support/vscode/src/findings-manager.ts +++ b/agent-support/vscode/src/findings-manager.ts @@ -10,6 +10,7 @@ import { diagnosticMessage, type FindingsOutcome, inlineText, + isLocalFindingId, parseFindingsOutput, type PlacedFinding, placeFindings, @@ -19,6 +20,8 @@ import { const SOURCE = "autter"; const DISMISSED_KEY = "autter.findings.dismissed"; +/** Local-review finding id → the work tree it came from, to undo its dismissal there. */ +const DISMISSED_LOCAL_KEY = "autter.findings.dismissedLocal"; const SAVE_DEBOUNCE_MS = 3_000; const POLL_MS = 5 * 60_000; const FOCUS_REFRESH_MIN_MS = 60_000; @@ -479,10 +482,63 @@ export class FindingsManager implements vscode.CodeActionProvider { } } + /** Run a short CLI command in `cwd` and parse its JSON line; null when it failed to run. */ + private async runCliJson(cwd: string, args: string[]): Promise | null> { + if (!(await resolveAutterBinary())) { + return null; + } + return new Promise((resolve) => { + let stdout = ""; + const proc = spawn(getAutterBinary(), args, { cwd, timeout: 60_000 }); + proc.stdout.on("data", (d) => { + stdout += d.toString(); + }); + proc.stderr.on("data", () => {}); + proc.on("error", () => resolve(null)); + proc.on("close", () => { + try { + resolve(JSON.parse(stdout.trim() || "null")); + } catch { + resolve(null); + } + }); + }); + } + + /** + * A local review's finding: tell Autter (`autter review --dismiss`), so the + * pull request page shows it as dismissed. Best effort; the editor hides it + * either way. + */ + private async sendLocalDismissal(workdir: string, findingId: string, dismissed: boolean): Promise { + const args = ["review", "--dismiss", findingId, "--json"]; + if (!dismissed) { + args.push("--undo"); + } + const out = await this.runCliJson(workdir, args); + if (dismissed && (!out || out.synced !== true)) { + const why = typeof out?.error === "string" ? ` (${out.error})` : ""; + void vscode.window.showWarningMessage( + `autter: Dismissed here, but Autter did not record it${why}. The pull request page won't show it as dismissed.`, + ); + } + } + private async dismiss(finding: CliFinding): Promise { const dismissed = new Set(this.context.workspaceState.get(DISMISSED_KEY, [])); dismissed.add(finding.id); await this.context.workspaceState.update(DISMISSED_KEY, [...dismissed]); + if (isLocalFindingId(finding.id)) { + const root = [...this.roots.values()].find((r) => + [...r.placed.values()].some((list) => list.some((p) => p.finding.id === finding.id)), + ); + if (root) { + const local = { ...this.context.workspaceState.get>(DISMISSED_LOCAL_KEY, {}) }; + local[finding.id] = root.workdir; + await this.context.workspaceState.update(DISMISSED_LOCAL_KEY, local); + void this.sendLocalDismissal(root.workdir, finding.id, true); + } + } for (const root of this.roots.values()) { for (const [rel, list] of root.placed) { const kept = list.filter((p) => p.finding.id !== finding.id); @@ -498,6 +554,13 @@ export class FindingsManager implements vscode.CodeActionProvider { private async restoreDismissed(): Promise { await this.context.workspaceState.update(DISMISSED_KEY, []); + // Local-review findings were also dismissed in Autter (and left out of + // `autter findings`): restore them there before refreshing. + const local = this.context.workspaceState.get>(DISMISSED_LOCAL_KEY, {}); + await Promise.all( + Object.entries(local).map(([findingId, workdir]) => this.sendLocalDismissal(workdir, findingId, false)), + ); + await this.context.workspaceState.update(DISMISSED_LOCAL_KEY, {}); this.refreshAll(true); } diff --git a/agent-support/vscode/src/findings-model.ts b/agent-support/vscode/src/findings-model.ts index 81868d2..0a375b9 100644 --- a/agent-support/vscode/src/findings-model.ts +++ b/agent-support/vscode/src/findings-model.ts @@ -235,3 +235,8 @@ export function statusSummary(result: CliFindingsResult, shown: number): { text: const icon = all.some((f) => f.severity === "critical") ? "$(error)" : total > 0 ? "$(warning)" : "$(pass)"; return { text: `${icon} autter: ${total}`, tooltip: lines.join("\n") }; } + +/** A finding from a local review (`autter review`), whose dismissal is sent to Autter. */ +export function isLocalFindingId(id: string): boolean { + return /^local-[0-9a-f]{1,8}-\d+$/i.test(id); +} diff --git a/agent-support/vscode/src/test/findings-model.test.ts b/agent-support/vscode/src/test/findings-model.test.ts index bbe1ed9..41a02c3 100644 --- a/agent-support/vscode/src/test/findings-model.test.ts +++ b/agent-support/vscode/src/test/findings-model.test.ts @@ -5,6 +5,7 @@ import { type CliFindingsResult, diagnosticMessage, inlineText, + isLocalFindingId, parseFindingsOutput, type PlacedFinding, placeFindings, @@ -136,4 +137,10 @@ suite("Findings model", () => { assert.strictEqual(withLocal.text, "$(error) autter: 1"); assert.ok(withLocal.tooltip.includes("1 from your last local review")); }); + + test("tells local-review findings from PR findings", () => { + assert.strictEqual(isLocalFindingId("local-0123abcd-3"), true); + assert.strictEqual(isLocalFindingId("f-123"), false); + assert.strictEqual(isLocalFindingId("local-xyz"), false); + }); }); diff --git a/src/commands/arg_parser.rs b/src/commands/arg_parser.rs index 863b846..3e178b4 100644 --- a/src/commands/arg_parser.rs +++ b/src/commands/arg_parser.rs @@ -943,13 +943,16 @@ autter findings [--write] [--branch ] [--pr ] [--repo ...] [--base | --uncommitted] [--write] [--repo ] [--org ] [--json] +autter review --dismiss [--undo] [--json] Runs the deterministic (rule-based) checks of Autter's pull request review on your changes, so you learn about problems before a pull request exists: - secrets, static security, auth and permissions, and race conditions. Your - organization's review settings apply. It makes no AI model calls and - usually takes a few seconds; the full review, AI checks included, runs on - the pull request. + secrets, security (static, auth, rate limiting, resilience, LLM, RLS, + privacy), race conditions, logging, infrastructure and CI/CD, supply chain, + architecture, code health and hygiene, TODOs and UI. Your organization's + review settings apply. It makes no AI model calls and usually takes a few + seconds; the full review, AI checks included, runs on the pull request. + Its findings, and the ones you dismiss, show on the pull request's page. By default it reviews what a pull request from this branch would contain: everything since the merge base with the default branch (origin/HEAD, @@ -965,6 +968,9 @@ autter review [...] [--base | --uncommitted] [--write] [--repo Compare with the merge base of this branch or commit --uncommitted Only changes not committed yet (compared with HEAD) --write Also write .autter/findings.md + --dismiss Dismiss one finding of your last local review: it leaves + `autter findings`, and the pull request page shows it as + dismissed. --undo restores it. --repo The repository, when the remote doesn't identify it --org Another organization you belong to --json The result as JSON, with a `local` placement per finding diff --git a/src/commands/findings.rs b/src/commands/findings.rs index 7466a53..2ac4ccc 100644 --- a/src/commands/findings.rs +++ b/src/commands/findings.rs @@ -755,7 +755,18 @@ pub(crate) fn attach_local_review(result: &mut Value, local: &Local) { if saved["branch"].as_str() != local.branch.as_deref() { return; } - let findings = place_local_findings(local, &saved); + // Findings dismissed with `autter review --dismiss` (or from the editor) + // are left out; the PR page still shows them, marked dismissed. + let dismissed = &saved["dismissed"]; + let all = place_local_findings(local, &saved); + let dismissed_count = all + .iter() + .filter(|f| f["id"].as_str().is_some_and(|id| !dismissed[id].is_null())) + .count(); + let findings: Vec = all + .into_iter() + .filter(|f| f["id"].as_str().is_none_or(|id| dismissed[id].is_null())) + .collect(); result["localReview"] = json!({ "reviewId": saved["result"]["review"]["reviewId"], "reviewedAt": saved["reviewedAt"], @@ -763,6 +774,7 @@ pub(crate) fn attach_local_review(result: &mut Value, local: &Local) { "baseRef": saved["baseRef"], "files": saved["files"].as_object().map(|f| f.len()).unwrap_or(0), "bundles": saved["result"]["review"]["bundles"], + "dismissed": dismissed_count, "findings": findings, }); } @@ -1517,5 +1529,21 @@ diff --git \"a/sp\\303\\251cial \\\"q\\\".ts\" \"b/sp\\303\\251cial \\\"q\\\".ts let mut result = json!({}); attach_local_review(&mut result, &other); assert!(result["localReview"].is_null()); + + // A dismissed finding leaves the list and is counted. + let mut dismissed = saved.clone(); + dismissed["dismissed"] = json!({ "f": { "at": "2026-11-17T10:00:00Z" } }); + std::fs::write(local_review_path(&other), dismissed.to_string()).unwrap(); + let mine = Local { + branch: Some("feat".into()), + ..other + }; + let mut result = json!({}); + attach_local_review(&mut result, &mine); + assert_eq!( + result["localReview"]["findings"].as_array().unwrap().len(), + 0 + ); + assert_eq!(result["localReview"]["dismissed"], 4); } } diff --git a/src/commands/review.rs b/src/commands/review.rs index c95348e..76b0cc6 100644 --- a/src/commands/review.rs +++ b/src/commands/review.rs @@ -3,9 +3,10 @@ //! Sends what a pull request from this branch would contain — the diff from //! the merge base with the default branch to your working tree, untracked //! files included — to `POST /api/cli/orgs//review`, which runs the -//! deterministic checks of the PR review (secrets, static security, auth, -//! race conditions) with no AI model calls, and streams back JSON lines. The -//! full review, AI checks included, runs on the pull request. +//! deterministic layer of the PR review's check bundles with no AI model +//! calls, and streams back JSON lines. The full review, AI checks included, +//! runs on the pull request, whose page also lists this review's findings. +//! `--dismiss ` records a dismissal there (and hides it here). //! //! Before sending, every reviewed file is saved as a git blob. The result and //! those blob ids go to `.autter/local-review.json`; `autter findings` (and so @@ -43,6 +44,10 @@ struct Options { repository: Option, organization: Option, write: bool, + /// `--dismiss `: record a dismissal instead of reviewing. + dismiss: Option, + /// With `--dismiss`: clear the dismissal instead. + undo: bool, } fn parse_options(args: &[String]) -> Result { @@ -59,7 +64,8 @@ fn parse_options(args: &[String]) -> Result { match arg { "--write" => options.write = true, "--uncommitted" => options.uncommitted = true, - "--base" | "--repo" | "--org" => { + "--undo" => options.undo = true, + "--base" | "--repo" | "--org" | "--dismiss" => { let value = args .get(index + 1) .map(|v| v.trim()) @@ -67,6 +73,7 @@ fn parse_options(args: &[String]) -> Result { .ok_or_else(|| format!("{arg} requires a value"))?; match arg { "--base" => options.base = Some(value.to_owned()), + "--dismiss" => options.dismiss = Some(value.to_owned()), "--repo" => options.repository = Some(value.to_owned()), _ => options.organization = Some(value.to_owned()), } @@ -81,6 +88,9 @@ fn parse_options(args: &[String]) -> Result { if options.uncommitted && options.base.is_some() { return Err("--uncommitted and --base can't be used together".into()); } + if options.undo && options.dismiss.is_none() { + return Err("--undo goes with --dismiss ".into()); + } options.paths.retain(|p| !p.is_empty()); Ok(options) } @@ -444,7 +454,108 @@ fn stream_result(code: u16, body: &str) -> Result { }))) } +/// The saved local review with `finding_id` marked dismissed (or not). +/// `Err` when the review has no such finding. +fn with_dismissal( + mut saved: Value, + finding_id: &str, + dismissed: bool, + at: &str, +) -> Result { + let known = saved["result"]["findings"] + .as_array() + .is_some_and(|list| list.iter().any(|f| f["id"].as_str() == Some(finding_id))); + if !known { + return Err(format!( + "No finding {finding_id} in the last local review on this branch. Run `autter findings --json` to see the ids." + )); + } + if !saved["dismissed"].is_object() { + saved["dismissed"] = json!({}); + } + let map = saved["dismissed"].as_object_mut().expect("set above"); + if dismissed { + map.insert(finding_id.to_owned(), json!({ "at": at })); + } else { + map.remove(finding_id); + } + Ok(saved) +} + +/// `autter review --dismiss [--undo]`: tell Autter the developer +/// dismissed (or restored) one finding of their last local review, so the PR +/// page shows it as dismissed, and leave it out of `autter findings` here. +fn dismiss(options: &Options, finding_id: &str) -> Result<(), AutterError> { + let local = local_context_for(options.repository.clone(), None)?; + let path = local_review_path(&local); + let saved: Value = std::fs::read_to_string(&path) + .ok() + .and_then(|text| serde_json::from_str(&text).ok()) + .ok_or_else(|| { + AutterError::Generic( + "No local review on this machine yet. Run `autter review` first.".into(), + ) + })?; + let review_id = saved["result"]["review"]["reviewId"] + .as_str() + .ok_or_else(|| { + AutterError::Generic( + "The saved local review has no id. Run `autter review` again.".into(), + ) + })? + .to_owned(); + let dismissed = !options.undo; + let updated = with_dismissal( + saved, + finding_id, + dismissed, + &chrono::Utc::now().to_rfc3339(), + ) + .map_err(AutterError::Generic)?; + + let (context, slug) = org_api_context(options.organization.as_deref(), 30)?; + let response = context.post_json( + &format!( + "/api/cli/orgs/{}/local-reviews/{}/dismissals", + component(&slug), + component(&review_id) + ), + &json!({ "findingId": finding_id, "dismissed": dismissed }), + )?; + let synced = response.status_code == 200; + if !synced && response.status_code == 401 { + return Err(AutterError::Generic(NOT_SIGNED_IN.into())); + } + // Kept locally either way: the editor stops showing it even if Autter is + // unreachable (a review run before reviews were kept is unknown there: 404). + write_if_changed(&path, &serde_json::to_string_pretty(&updated)?)?; + let output = json!({ + "findingId": finding_id, + "dismissed": dismissed, + "synced": synced, + }); + if arg_parser::json() { + println!("{output}"); + } else if synced { + println!( + "{} {finding_id}. The pull request page shows it{}.", + if dismissed { "Dismissed" } else { "Restored" }, + if dismissed { " as dismissed" } else { " again" } + ); + } else { + println!( + "{} {finding_id} on this machine; Autter did not record it (HTTP {}).", + if dismissed { "Dismissed" } else { "Restored" }, + response.status_code + ); + } + Ok(()) +} + fn run(options: Options) -> Result<(), AutterError> { + if let Some(finding_id) = options.dismiss.clone() { + return dismiss(&options, &finding_id); + } let local = local_context_for(options.repository.clone(), None)?; let (base, base_label) = resolve_base(&local, &options)?; let filters = repo_relative_filters(&local, &options.paths); @@ -741,4 +852,27 @@ Binary files a/img.png and b/img.png differ .contains("autter login") ); } + + #[test] + fn parses_dismiss_options() { + let o = parse_options(&s(&["--dismiss", "local-abc-1", "--undo"])).unwrap(); + assert_eq!(o.dismiss.as_deref(), Some("local-abc-1")); + assert!(o.undo); + assert!(parse_options(&s(&["--undo"])).is_err()); + assert!(parse_options(&s(&["--dismiss"])).is_err()); + } + + #[test] + fn records_and_clears_a_dismissal_in_the_saved_review() { + let saved = + json!({ "result": { "findings": [{ "id": "local-abc-1" }, { "id": "local-abc-2" }] } }); + let once = with_dismissal(saved, "local-abc-1", true, "2026-11-17T10:00:00Z").unwrap(); + assert_eq!( + once["dismissed"]["local-abc-1"]["at"], + "2026-11-17T10:00:00Z" + ); + let cleared = with_dismissal(once, "local-abc-1", false, "x").unwrap(); + assert!(cleared["dismissed"]["local-abc-1"].is_null()); + assert!(with_dismissal(cleared, "local-zzz-9", true, "x").is_err()); + } }