fast-gate rubocop step does not see extensionless Ruby scripts #1457

Closed
opened 2026-10-28 07:28:49 +00:00 by jared · 2 comments
Owner

Problem

FastGate::ChangedFiles#changes keeps only paths that end with ".rb". The fast-gate rubocop new-offense step skips extensionless Ruby scripts. The full gate uses Project::Codebase#ruby? and RubyFileCheck.ruby?, which also accept an extensionless file with a ruby shebang. The two paths disagree.

Observed

fast-batch for #1455 (2026-10-28, merge 67762412) reported "0 changed files" on all three findings. Those findings edited the extensionless scripts audit-stats, self-test, and gen-logs under plugins/os-context.

Reproduce

Edit an extensionless Ruby script with a shebang under a target. Run fast-gate. The rubocop step reports "0 changed files".

Approach

ChangedFiles#changes already owns the changed paths and the repo root. Replace its .rb suffix test with Project::RubyFileCheck.ruby?, called on the path joined to root. RubyFileCheck.ruby? reads the working-tree file, so a path with no file on disk is not a change (tracked deletes are already dropped). No new object, no change to NewOffenseCheck, Rubocop, or RubyFileCheck.

Required work:

  1. Make ChangedFiles#changes use the same Ruby-file test as the gate (RubyFileCheck.ruby?) on File.join(root, change.path) — check: absent end_with?(".rb") in plugins/os-sdlc/lib/os_sdlc/fast_gate/changed_files.rb
  2. Call the shared test from ChangedFiles — check: present RubyFileCheck.ruby? in plugins/os-sdlc/lib/os_sdlc/fast_gate/changed_files.rb

Acceptance criteria

  1. Fast-gate on a diff that changes bin/foo (shebang #!/usr/bin/env ruby, no extension) under the target runs rubocop on bin/foo, and the rubocop step summary counts it as 1 changed file.
  2. Fast-gate on a diff that adds a new untracked bin/foo with a ruby shebang and no extension reports a new offense in it at bin/foo:<line>.

Owner sketch

# plugins/os-sdlc/lib/os_sdlc/fast_gate/changed_files.rb
def changes
  (tracked + untracked).select { |change| @target.include?(change.path) && ruby?(change.path) }
end

private

def ruby?(path) = Project::RubyFileCheck.ruby?(File.join(@root, path))

In scope

  • FastGate::ChangedFiles#changes file selection.
  • Existing exclusions stay as they are (they already hold today, so they get no new red test): extensionless non-Ruby scripts such as a bash script, non-Ruby files such as .md and .yml, and files outside the target path.

Out of scope

  • Project::RubyFileCheck and Project::Codebase#ruby? (already correct).
  • Lint::Autocorrection::ChangedFiles (a separate class).

Origin

  • Trigger: fast-batch #1455, 2026-10-28
  • Improvised this session: none
  • Chain: scripts unlinted by fast-gate ← ChangedFiles#changes filters on ".rb" ← DESIGN (plugins/os-sdlc/lib/os_sdlc/fast_gate/changed_files.rb:15); the gate RubyFileCheck (project/ruby_file_check.rb) already handles shebangs
  • Root candidate: none found; searched ChangedFiles, changed_files, extensionless, shebang, RubyFileCheck, fast-gate
  • Where: plugins/os-sdlc/lib/os_sdlc/fast_gate/changed_files.rb
  • Session: 9f415790-a6bd-4850-8d70-3dd45004ce2b
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/9f415790-a6bd-4850-8d70-3dd45004ce2b.jsonl

VERDICT: CREATE

## Problem `FastGate::ChangedFiles#changes` keeps only paths that end with ".rb". The fast-gate rubocop new-offense step skips extensionless Ruby scripts. The full gate uses `Project::Codebase#ruby?` and `RubyFileCheck.ruby?`, which also accept an extensionless file with a ruby shebang. The two paths disagree. ## Observed fast-batch for #1455 (2026-10-28, merge 67762412) reported "0 changed files" on all three findings. Those findings edited the extensionless scripts `audit-stats`, `self-test`, and `gen-logs` under `plugins/os-context`. ## Reproduce Edit an extensionless Ruby script with a shebang under a target. Run fast-gate. The rubocop step reports "0 changed files". ## Approach `ChangedFiles#changes` already owns the changed paths and the repo root. Replace its `.rb` suffix test with `Project::RubyFileCheck.ruby?`, called on the path joined to `root`. `RubyFileCheck.ruby?` reads the working-tree file, so a path with no file on disk is not a change (tracked deletes are already dropped). No new object, no change to `NewOffenseCheck`, `Rubocop`, or `RubyFileCheck`. Required work: 1. Make `ChangedFiles#changes` use the same Ruby-file test as the gate (`RubyFileCheck.ruby?`) on `File.join(root, change.path)` — check: absent `end_with?(".rb")` in `plugins/os-sdlc/lib/os_sdlc/fast_gate/changed_files.rb` 2. Call the shared test from `ChangedFiles` — check: present `RubyFileCheck.ruby?` in `plugins/os-sdlc/lib/os_sdlc/fast_gate/changed_files.rb` ## Acceptance criteria 1. Fast-gate on a diff that changes `bin/foo` (shebang `#!/usr/bin/env ruby`, no extension) under the target runs rubocop on `bin/foo`, and the rubocop step summary counts it as 1 changed file. 2. Fast-gate on a diff that adds a new untracked `bin/foo` with a ruby shebang and no extension reports a new offense in it at `bin/foo:<line>`. ## Owner sketch ```ruby # plugins/os-sdlc/lib/os_sdlc/fast_gate/changed_files.rb def changes (tracked + untracked).select { |change| @target.include?(change.path) && ruby?(change.path) } end private def ruby?(path) = Project::RubyFileCheck.ruby?(File.join(@root, path)) ``` ## In scope - `FastGate::ChangedFiles#changes` file selection. - Existing exclusions stay as they are (they already hold today, so they get no new red test): extensionless non-Ruby scripts such as a bash script, non-Ruby files such as `.md` and `.yml`, and files outside the target path. ## Out of scope - `Project::RubyFileCheck` and `Project::Codebase#ruby?` (already correct). - `Lint::Autocorrection::ChangedFiles` (a separate class). ## Origin - Trigger: fast-batch #1455, 2026-10-28 - Improvised this session: none - Chain: scripts unlinted by fast-gate ← ChangedFiles#changes filters on ".rb" ← DESIGN (plugins/os-sdlc/lib/os_sdlc/fast_gate/changed_files.rb:15); the gate RubyFileCheck (project/ruby_file_check.rb) already handles shebangs - Root candidate: none found; searched ChangedFiles, changed_files, extensionless, shebang, RubyFileCheck, fast-gate - Where: plugins/os-sdlc/lib/os_sdlc/fast_gate/changed_files.rb - Session: 9f415790-a6bd-4850-8d70-3dd45004ce2b - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/9f415790-a6bd-4850-8d70-3dd45004ce2b.jsonl VERDICT: CREATE
Author
Owner

Work started on branch ticket-1457 via /os-sdlc:implement.

Work started on branch ticket-1457 via /os-sdlc:implement.
Author
Owner

Resolution

Done: fast-gate ChangedFiles#changes now selects files with the shared Project::RubyFileCheck.ruby? test, so extensionless scripts with a ruby shebang get the rubocop new-offense step.

Evidence: Commit ba2103ca (implementation 210): changed_files.rb plus new tests in plugins/os-sdlc/tests/fast_gate/fast_gate_extensionless_script_test.rb; full suite green; contract-auditor pass.

Follow-ups: Contract-auditor LENS line: RubyFileCheck now has callers in two concepts (Project, FastGate) and could be promoted to OsSdlc::RubyFileCheck; goes through the lens challenge and is filed as a Lens proposal if it holds.

## Resolution **Done:** fast-gate ChangedFiles#changes now selects files with the shared Project::RubyFileCheck.ruby? test, so extensionless scripts with a ruby shebang get the rubocop new-offense step. **Evidence:** Commit ba2103ca (implementation 210): changed_files.rb plus new tests in plugins/os-sdlc/tests/fast_gate/fast_gate_extensionless_script_test.rb; full suite green; contract-auditor pass. **Follow-ups:** Contract-auditor LENS line: RubyFileCheck now has callers in two concepts (Project, FastGate) and could be promoted to OsSdlc::RubyFileCheck; goes through the lens challenge and is filed as a Lens proposal if it holds.
jared closed this issue 2026-10-28 13:15:48 +00:00
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#1457
No description provided.