Sdlc/Structural/ParameterThreadedThroughPrivateMethods: require real threading, not a shared parameter name #1365

Open
opened 2026-10-25 21:23:21 +00:00 by jared · 0 comments
Owner

Problem

The cop Sdlc/Structural/ParameterThreadedThroughPrivateMethods counts the same parameter name in 3+ private defs of one class.
It does not check that one method passes the parameter to another, so parallel dispatch targets match.
The prescribed fix (a <Name>Holder) is also the weaker fix when the parameter receives one message.

Found by the #1325 zero-false-positive audit (docs/plans/class-length-family/sdlc-cop-audit.md).

Observed

Counterexample: plugins/os-adr/lib/adr/record/command_line.rb:31-35. amend, delete, and challenge each take id from one send(command, id). No method passes id to another. 76 hits overall.

Reproduce

n/a: the cop matcher is at plugins/os-sdlc/lib/os_sdlc/cops/parameter_threaded_through_private_methods.rb:38-44; run the cop on plugins/os-adr/lib/adr/record/command_line.rb.

Approach

Carve-outs go in the cop matcher, never in a config Exclude list or a test-path exclusion.
Count a def only when it passes the parameter as an argument to another def in the chain.
Choose the fix text from the use at the end of the chain: one message means "move the job to the parameter", otherwise the holder.

Required work:

  1. Require a pass-through call in the matcher — check: present pass in plugins/os-sdlc/lib/os_sdlc/cops/parameter_threaded_through_private_methods/*.rb

Acceptance criteria

  1. Given 3 private defs that each take id and none passes it on, when the cop runs, then it reports no offense.
  2. Given 3 private defs where each passes id to the next, when the cop runs, then it reports an offense.

Origin

  • Trigger: #1325 zero-false-positive audit of the Sdlc cops
  • Improvised this session: none
  • Chain: false positive ← matcher counts names without checking pass-through ← DESIGN (plugins/os-sdlc/lib/os_sdlc/cops/parameter_threaded_through_private_methods.rb)
  • Root candidate: none found; searched ParameterThreadedThroughPrivateMethods
  • Where: plugins/os-sdlc/lib/os_sdlc/cops/parameter_threaded_through_private_methods.rb
  • Session: eb98cdcd-6783-46a0-b7df-cf18a8fe2a56
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os--claude-worktrees-ticket-1325/eb98cdcd-6783-46a0-b7df-cf18a8fe2a56.jsonl
    VERDICT: CREATE
## Problem The cop `Sdlc/Structural/ParameterThreadedThroughPrivateMethods` counts the same parameter name in 3+ private defs of one class. It does not check that one method passes the parameter to another, so parallel dispatch targets match. The prescribed fix (a `<Name>Holder`) is also the weaker fix when the parameter receives one message. Found by the #1325 zero-false-positive audit (docs/plans/class-length-family/sdlc-cop-audit.md). ## Observed Counterexample: `plugins/os-adr/lib/adr/record/command_line.rb:31-35`. `amend`, `delete`, and `challenge` each take `id` from one `send(command, id)`. No method passes `id` to another. 76 hits overall. ## Reproduce n/a: the cop matcher is at `plugins/os-sdlc/lib/os_sdlc/cops/parameter_threaded_through_private_methods.rb:38-44`; run the cop on `plugins/os-adr/lib/adr/record/command_line.rb`. ## Approach Carve-outs go in the cop matcher, never in a config Exclude list or a test-path exclusion. Count a def only when it passes the parameter as an argument to another def in the chain. Choose the fix text from the use at the end of the chain: one message means "move the job to the parameter", otherwise the holder. Required work: 1. Require a pass-through call in the matcher — check: present `pass` in `plugins/os-sdlc/lib/os_sdlc/cops/parameter_threaded_through_private_methods/*.rb` ## Acceptance criteria 1. Given 3 private defs that each take `id` and none passes it on, when the cop runs, then it reports no offense. 2. Given 3 private defs where each passes `id` to the next, when the cop runs, then it reports an offense. ## Origin - Trigger: #1325 zero-false-positive audit of the Sdlc cops - Improvised this session: none - Chain: false positive ← matcher counts names without checking pass-through ← DESIGN (plugins/os-sdlc/lib/os_sdlc/cops/parameter_threaded_through_private_methods.rb) - Root candidate: none found; searched ParameterThreadedThroughPrivateMethods - Where: plugins/os-sdlc/lib/os_sdlc/cops/parameter_threaded_through_private_methods.rb - Session: eb98cdcd-6783-46a0-b7df-cf18a8fe2a56 - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os--claude-worktrees-ticket-1325/eb98cdcd-6783-46a0-b7df-cf18a8fe2a56.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#1365
No description provided.