You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
scan exits 1 in human output but 0 with --json when every patch query returns nothing #1062
agent:triagedarch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)bugSomething isn't workingcompatibilityPublic CLI/JSON, saved state, upgrades, or package-manager compatibility.priority:p1uxCLI commands, help, diagnostics, output consistency, or actionable recovery instructions.v5-blockerMust resolve before v5: public interface/migration or ordinary patch-install-undo failure.
Problem:run_scan's human arm treats Ok(discovered) with fetched == 0 as a fetch failure and exits 1 (scan/mod.rs#L2734). The JSON arms (agent apply, vendored run_vendor_json_path, report-only) accept the same result and exit 0 with an empty block. discover_selected returns Err only when every query fails. The vendored --dry-run GC preview and the hosted prune argument (args.prune || args.sync vs the policy-gated prune) also differ between the arms.
Symptoms: earlier bugs from the same fork: #424 (fixed), #732 (fixed), #744 (open). Impact: a CI job using scan --json and a developer running scan against the same API state get different exit codes and different previews; every fix has to land twice.
Proposed change: move the fetched == 0 rule (and the prune flag) into discover_selected/one shared decision, so both arms read it; delete the arm-local checks.
Size and scope:commands/scan/mod.rs, vendor_flow.rs, hosted.rs; under 100 lines. The full split is #843/#844 (C11).
Acceptance criteria:
A parity test runs each mode × {json, human} over one fixture where every successful query returns no patches, and compares exit codes and actions.
v5 release blocker (P1). A successful scan with no applicable patches must have the same exit code and actions in human and JSON mode. This is basic first-run/CI UX.
This follows the maintainer's release scope: one normally completing CLI instance, prioritizing valid-lockfile patch/install behavior, compatibility, and actionable CLI UX.
[agent] Claiming for v5 blocker burn-down (shared root cause: scan's human arm applies its own fetched == 0 exit rule that the JSON arms don't). Branch: agent/v5-scan-empty-fetch-parity. Claim-ID: 2026-10-09T16:27:48Z-989b90
agent:triagedarch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)bugSomething isn't workingcompatibilityPublic CLI/JSON, saved state, upgrades, or package-manager compatibility.priority:p1uxCLI commands, help, diagnostics, output consistency, or actionable recovery instructions.v5-blockerMust resolve before v5: public interface/migration or ordinary patch-install-undo failure.
Activity
mikolalysenko commentedon Oct 7, 2026
[agent] Triage: priority:p3 (general CLI). Not a duplicate of #744 (a different scan human/JSON fork). No open PR references it.
Generated by Claude Code
mikolalysenko commentedon Oct 9, 2026
[agent] I re-checked this on main @
f3c6313. It still holds, and the code has moved, so here are fresh permalinks.Ok(discovered)withfetched == 0into exit 1 for agent, vendored and report-only runs:scan/mod.rs#L2794-L2798.``discovered.fetched, so the JSON arms still accept the same result and exit 0.Generated by Claude Code
mikolalysenko commentedon Oct 9, 2026
v5 release blocker (P1). A successful scan with no applicable patches must have the same exit code and actions in human and JSON mode. This is basic first-run/CI UX.
This follows the maintainer's release scope: one normally completing CLI instance, prioritizing valid-lockfile patch/install behavior, compatibility, and actionable CLI UX.
mikolalysenko commentedon Oct 9, 2026
[agent] Claiming for v5 blocker burn-down (shared root cause: scan's human arm applies its own
fetched == 0exit rule that the JSON arms don't). Branch: agent/v5-scan-empty-fetch-parity. Claim-ID: 2026-10-09T16:27:48Z-989b90Generated by Claude Code
mikolalysenko commentedon Oct 9, 2026
[agent] Draft PR: #1298
Generated by Claude Code
Make scan exit alike in human and JSON output
Read scan's unified dry-run GC key in the #1062 prune preview test
Move scan and get --json onto the shared envelope
Document the scan/get envelope and add shape and parity tests