lint-worklist: run the autocorrect phase on the gate chain and move unsafe-autocorrect cops to batch #1441

Open
opened 2026-10-27 18:17:50 +00:00 by jared · 0 comments
Owner

Problem

bin/lint-worklist prints the autocorrect phase as a bare rubocop -a --only <cops> command. The command does not use the gate's config chain (plugin config first, then the target config, ADR-0298). Run as printed, it fixes nothing. Also, two cops in the autocorrect phase have only unsafe autocorrect (Minitest/AssertTruthy, Minitest/RefuteFalse), so -a never fixes them and the phase never empties.

Observed

fix-lints on os-me, 2026-10-27. The worklist reported 19 autocorrect offenses and printed:

rubocop -a --only Minitest/AssertEmptyLiteral,Minitest/AssertInDelta,Minitest/AssertPredicate,Minitest/AssertTruthy,Minitest/RefuteFalse,Minitest/RefutePathExists,Minitest/RefutePredicate

From the repo root: 0 files inspected, no offenses detected. From plugins/os-sdlc with -c .rubocop.yml ../os-me: 228 files inspected, no offenses detected. OsSdlc::Lint::Run.new(only: cops).correct(files: ["plugins/os-me"], root: ...) fixed 14 of the 19. The other 5 (AssertTruthy, RefuteFalse) stayed in the autocorrect phase until they were fixed by hand. Their unsafe autocorrect (assert_equal false, x to refute x) also weakens a test: refute x passes when the key is missing.

Reproduce

plugins/os-sdlc/bin/lint-worklist --target os-me

On a target with an autocorrect offense, run the printed command from the repo root; it inspects 0 files.

Approach

The worklist runs the autocorrect itself on the gate chain (Lint::Run#correct), the same way it lints, and does not print a shell command. A cop whose autocorrect is unsafe goes to the batch phase (hand fix), not the autocorrect phase.

Required work:

  1. Stop printing a bare rubocop command for the autocorrect phase — check: absent rubocop -a --only in plugins/os-sdlc/lib/os_sdlc/lint/worklist/listing.rb
  2. Move the unsafe-autocorrect cops out of the autocorrect list — check: absent Minitest/AssertTruthy in plugins/os-sdlc/lib/os_sdlc/lint/worklist/cop_phase.rb

Rejected: print -c <plugin config> in the command — the chain has two layers; one -c flag cannot express it.

Acceptance criteria

  1. Given a target with autocorrectable offenses, when fix-lints runs the autocorrect phase through the worklist, then those offenses are fixed on the gate chain and the next checkpoint shows the phase empty.
  2. Given an offense from a cop whose autocorrect is unsafe, when the worklist sorts offenses, then the offense is in the batch phase.
  3. Given an offense from a cop whose autocorrect is safe, when the worklist sorts offenses, then the offense is in the autocorrect phase.

Owner sketch

class OsSdlc::Lint::Worklist::CopPhase
  def phase
end

class OsSdlc::Lint::Worklist::Listing
  def print
end

Origin

  • Trigger: fix-lints on os-me, lint-cops track, 2026-10-27 (autocorrect phase).
  • Improvised this session: ran Lint::Run#correct from a Ruby one-liner instead of the printed command.
  • Chain: autocorrect phase fixes nothing ← printed command has no config chain (plugins/os-sdlc/lib/os_sdlc/lint/worklist/listing.rb:34) ← DESIGN; phase never empties ← unsafe cops listed as autocorrect (plugins/os-sdlc/lib/os_sdlc/lint/worklist/cop_phase.rb:13-14) ← DESIGN
  • Root candidate: none found; searched AssertTruthy, RefuteFalse, unsafe autocorrect, rubocop -a --only, CopPhase, Listing, lint-worklist autocorrect
  • Where: plugins/os-sdlc/lib/os_sdlc/lint/worklist/listing.rb
  • Session: 0b4d7950-df1c-4eba-a561-ccc19b386a9a
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/0b4d7950-df1c-4eba-a561-ccc19b386a9a.jsonl

VERDICT: CREATE

## Problem `bin/lint-worklist` prints the autocorrect phase as a bare `rubocop -a --only <cops>` command. The command does not use the gate's config chain (plugin config first, then the target config, ADR-0298). Run as printed, it fixes nothing. Also, two cops in the autocorrect phase have only unsafe autocorrect (`Minitest/AssertTruthy`, `Minitest/RefuteFalse`), so `-a` never fixes them and the phase never empties. ## Observed fix-lints on os-me, 2026-10-27. The worklist reported 19 autocorrect offenses and printed: ``` rubocop -a --only Minitest/AssertEmptyLiteral,Minitest/AssertInDelta,Minitest/AssertPredicate,Minitest/AssertTruthy,Minitest/RefuteFalse,Minitest/RefutePathExists,Minitest/RefutePredicate ``` From the repo root: `0 files inspected, no offenses detected`. From `plugins/os-sdlc` with `-c .rubocop.yml ../os-me`: `228 files inspected, no offenses detected`. `OsSdlc::Lint::Run.new(only: cops).correct(files: ["plugins/os-me"], root: ...)` fixed 14 of the 19. The other 5 (`AssertTruthy`, `RefuteFalse`) stayed in the autocorrect phase until they were fixed by hand. Their unsafe autocorrect (`assert_equal false, x` to `refute x`) also weakens a test: `refute x` passes when the key is missing. ## Reproduce ``` plugins/os-sdlc/bin/lint-worklist --target os-me ``` On a target with an autocorrect offense, run the printed command from the repo root; it inspects 0 files. ## Approach The worklist runs the autocorrect itself on the gate chain (`Lint::Run#correct`), the same way it lints, and does not print a shell command. A cop whose autocorrect is unsafe goes to the batch phase (hand fix), not the autocorrect phase. Required work: 1. Stop printing a bare rubocop command for the autocorrect phase — check: absent `rubocop -a --only` in `plugins/os-sdlc/lib/os_sdlc/lint/worklist/listing.rb` 2. Move the unsafe-autocorrect cops out of the autocorrect list — check: absent `Minitest/AssertTruthy` in `plugins/os-sdlc/lib/os_sdlc/lint/worklist/cop_phase.rb` Rejected: print `-c <plugin config>` in the command — the chain has two layers; one `-c` flag cannot express it. ## Acceptance criteria 1. Given a target with autocorrectable offenses, when fix-lints runs the autocorrect phase through the worklist, then those offenses are fixed on the gate chain and the next checkpoint shows the phase empty. 2. Given an offense from a cop whose autocorrect is unsafe, when the worklist sorts offenses, then the offense is in the batch phase. 3. Given an offense from a cop whose autocorrect is safe, when the worklist sorts offenses, then the offense is in the autocorrect phase. ## Owner sketch ```ruby class OsSdlc::Lint::Worklist::CopPhase def phase end class OsSdlc::Lint::Worklist::Listing def print end ``` ## Origin - Trigger: fix-lints on os-me, lint-cops track, 2026-10-27 (autocorrect phase). - Improvised this session: ran `Lint::Run#correct` from a Ruby one-liner instead of the printed command. - Chain: autocorrect phase fixes nothing ← printed command has no config chain (plugins/os-sdlc/lib/os_sdlc/lint/worklist/listing.rb:34) ← DESIGN; phase never empties ← unsafe cops listed as autocorrect (plugins/os-sdlc/lib/os_sdlc/lint/worklist/cop_phase.rb:13-14) ← DESIGN - Root candidate: none found; searched AssertTruthy, RefuteFalse, unsafe autocorrect, rubocop -a --only, CopPhase, Listing, lint-worklist autocorrect - Where: plugins/os-sdlc/lib/os_sdlc/lint/worklist/listing.rb - Session: 0b4d7950-df1c-4eba-a561-ccc19b386a9a - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/0b4d7950-df1c-4eba-a561-ccc19b386a9a.jsonl VERDICT: CREATE
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#1441
No description provided.