Add `scan --check`: a read-only exit status for "patches are available but not applied"

Aberta
#2,051 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
35/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
rust
Domínio
cli

Direção de pesquisa

Start by reading the scan --dry-run and existing apply --check and vendor --check implementations to understand discovery, selection, and current exit codes. The issue names no files or tests, so locate the CLI entry points and their tests before estimating the change. Done means scan --check stays read-only, reports missing patches with apply commands, distinguishes findings from failures, and adds upToDate to JSON; the owner has explicitly deferred the idea.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

agent:needs-human agent:triaged enhancement priority:p3 ux

Problem

There is no way to use scan as a linter. scan --dry-run exits 0 whether or not patches are missing, so a CI job that should fail when a project has unapplied patches has to parse --json (redirect.rewrittenFiles, rollout.counts) to find out.

apply --check and vendor --check already give a read-only pass/fail answer, but only for state that exists: agent-mode records and vendored artifacts. Nothing answers the question for the default (hosted) mode, or for "a new patch has been published since the last scan".

Proposal

socket-patch scan --check:

  • Runs the same discovery and selection as scan --dry-run (same mode inference, socket.yml policy, --max-new-patches, --ecosystems, --package, PATHs).
  • Never writes.
  • Exit 0 when the run would change nothing: every selected patch is already in place.
  • Exit 1 when a wet scan would add, upgrade or unpin something, with one line per package saying what and the command that applies it.
  • Keeps today's failure exits (API unreachable, usage errors) distinct from "patches are missing", so a pipeline can tell an outage from a finding. Today both would be exit 1; this needs a decision, e.g. a dedicated exit code for "check failed" as terraform plan -detailed-exitcode does.
  • --json: the dry-run envelope plus a top-level boolean (upToDate), so scripts do not have to infer it.

Notes

  • Found by the 2026-11-10 usability review ("it cannot be used as a linter").
  • Owner decision 2026-11-10: a good idea, not right now. Filed to track.
  • Related: apply --check (agent), vendor --check (vendored); the three --check gates should agree on vocabulary and exit codes.
Linguagem predominante
Rust
Estrelas
9
Forks
2
Merge médio
1d 8h
PRs com merge (30d)
309

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de SocketDev/socket-patch

Todas as issues de SocketDev/socket-patch

Issues semelhantes

Mais issues de Rust

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.