Skip to content

Install gate, Phase 3 (lane 2): --json machine output#114

Open
juangaitanv wants to merge 3 commits into
install-gate-phase-3-uvfrom
install-gate-phase-3-json
Open

Install gate, Phase 3 (lane 2): --json machine output#114
juangaitanv wants to merge 3 commits into
install-gate-phase-3-uvfrom
install-gate-phase-3-json

Conversation

@juangaitanv

Copy link
Copy Markdown
Contributor

Phase 3, lane 2 of the install-gate restart

Stacked on #113 (Phase 3 lane 1). Base: install-gate-phase-3-uv.

Machine-readable output for the gate.

Scope (per the PRD)

  • --json prints the report as one pretty-printed JSON document on stdout: summary counts, verdict_mode ("public" / "recency-only"), per-result verdict objects, and the tree object (mode full/named-only, resolved_count, transitive[] with origin labels).
  • remediation field on vulnerable verdicts — the safe version covering every advisory, null when any advisory lacks a fix.
  • stdout purity — the wrapped package manager's stdout moves to stderr so stdout stays parseable; guard refusals (pip add, uv install, wrong manager, parse errors) emit an {"error": …} document.
  • VulnMatch gains Serialize for the JSON matches array.

Out of scope: auth/fail-closed (lane 3).

Exit criteria — met

--json stdout purity, verdict_mode, tree object, remediation field.

Covered by --json tests across cli_install.rs, cli_verdict.rs, cli_remediation.rs, cli_tree.rs, cli_bare_install.rs, cli_provenance.rs; confirmed live against staging (the workflow's exact corgea npm --threshold 0s --json install … invocation parses clean). ./harness check green.

🤖 Generated with Claude Code

Comment thread src/main.rs
Comment thread src/precheck/mod.rs
@juangaitanv juangaitanv force-pushed the install-gate-phase-3-uv branch from c39ab0f to d9af832 Compare June 12, 2026 14:51
juangaitanv added a commit that referenced this pull request Jun 12, 2026
…t refusals

Addresses Cursor review on #114.

- the wrapper's --json is now forwarded to the package manager on passthrough
  (non-install subcommands, bare exec): `corgea npm --json view x` reaches
  npm's --json again instead of the wrapper silently swallowing it. A
  non-install passthrough produces no Corgea report, so the flag is the
  manager's.
- the pre-report refusals that previously bypassed the JSON error helper
  (unparsable npm ci / uv sync lockfile, bare-npm root redirect, npm ci root
  redirect) now route through refuse_guard, so `--json` emits a parseable
  {"error": …} document instead of bare stderr. Machine consumers can parse
  every blocking path uniformly.
@juangaitanv juangaitanv force-pushed the install-gate-phase-3-json branch from 0e07df6 to c5715f9 Compare June 12, 2026 14:52
@juangaitanv juangaitanv force-pushed the install-gate-phase-3-uv branch from d9af832 to 36350f3 Compare June 12, 2026 16:42
juangaitanv added a commit that referenced this pull request Jun 12, 2026
…t refusals

Addresses Cursor review on #114.

- the wrapper's --json is now forwarded to the package manager on passthrough
  (non-install subcommands, bare exec): `corgea npm --json view x` reaches
  npm's --json again instead of the wrapper silently swallowing it. A
  non-install passthrough produces no Corgea report, so the flag is the
  manager's.
- the pre-report refusals that previously bypassed the JSON error helper
  (unparsable npm ci / uv sync lockfile, bare-npm root redirect, npm ci root
  redirect) now route through refuse_guard, so `--json` emits a parseable
  {"error": …} document instead of bare stderr. Machine consumers can parse
  every blocking path uniformly.
@juangaitanv juangaitanv force-pushed the install-gate-phase-3-json branch from c5715f9 to c79d501 Compare June 12, 2026 16:42
Harvested from the install-vuln-gate spike (dfac68e).

- --json prints the report as one pretty-printed JSON document on
  stdout: summary counts, verdict_mode ("public" / "recency-only"),
  per-result verdict objects (vulnerable verdicts carry matches and a
  remediation field — the safe version covering every advisory, null
  when any advisory lacks a fix), and the tree object (mode
  full/named-only, resolved_count, transitive[] with origin labels)
- stdout purity: the wrapped package manager's stdout moves to stderr
  so stdout stays parseable; guard refusals (pip add, uv install,
  wrong manager, parse errors) emit an {"error": …} document
- VulnMatch is now Serialize for the JSON matches array
…t refusals

Addresses Cursor review on #114.

- the wrapper's --json is now forwarded to the package manager on passthrough
  (non-install subcommands, bare exec): `corgea npm --json view x` reaches
  npm's --json again instead of the wrapper silently swallowing it. A
  non-install passthrough produces no Corgea report, so the flag is the
  manager's.
- the pre-report refusals that previously bypassed the JSON error helper
  (unparsable npm ci / uv sync lockfile, bare-npm root redirect, npm ci root
  redirect) now route through refuse_guard, so `--json` emits a parseable
  {"error": …} document instead of bare stderr. Machine consumers can parse
  every blocking path uniformly.
…ion holes

The --json contract is 'every exit path yields exactly one parseable
document on stdout'. Three paths broke it and two were inconsistent:

- --force over an unparsable lockfile now emits a {warning, proceeded}
  document before exec (stdout was empty).
- uv passthrough (and the no-files 'uv pip sync' branch) routes through
  passthrough_exec, so the wrapper's consumed --json is re-forwarded to
  uv ('corgea uv --json tree' reaches uv's own --json again).
- Bare yarn/pnpm installs under --json emit an empty report document
  (null tree, zero results) with the honesty note on stderr.
- Binary-not-found under --json emits an {error} document before exit
  127.
- refuse_guard pretty-prints, matching the main report's formatting;
  SKILL.md documents verdict_mode 'recency-only' as library-only.
- New position-sensitivity test pins that post-verb --json belongs to
  the manager ('corgea npm install --json x' forwards it; gate stays
  text).
@juangaitanv juangaitanv force-pushed the install-gate-phase-3-uv branch from 36350f3 to f8426b6 Compare June 12, 2026 18:28
@juangaitanv juangaitanv force-pushed the install-gate-phase-3-json branch from c79d501 to 07bb21d Compare June 12, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant