Fix ParameterThreadedThroughPrivateMethods crash on destructured parameters #1102
Labels
No labels
P0
P1
P2
P3
bug
category/code-change
category/cross-repo
category/eval-run
category/investigation
category/no-test-target
category/owner-ruling
category/prose-artifact
category/recurring-chore
category/structure
category/umbrella
crc-refactor
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
rule-proposal
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#1102
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The cop
Sdlc/Structural/ParameterThreadedThroughPrivateMethodscrashes on a destructured parameter.A crash hides all other offenses of this cop in the file, and RuboCop still prints "no offenses detected".
(The ticket first named two cops.
BooleanControlParameterno longer crashes; see the comment "Correction 2026-11-12".)Observed
Run in
plugins/os-sdlconmainon 2026-11-12:With
-d, the cause isundefined method 'name' for an instance of RuboCop::AST::MlhsNodeatlib/os_sdlc/cops/structural/parameter_threaded_through_private_methods.rb:35(def_node.arguments.each { |arg| tally[arg.name.to_s] << def_node }).The trigger is
def locate(scope, (segment, *rest))atlib/os_sdlc/cops/structural/simulated_polymorphism/owned_type.rb:35.Reproduce
Approach
Make the cop skip or handle
mlhsparameters.Required work:
mlhsparameters inSdlc/Structural/ParameterThreadedThroughPrivateMethods.Acceptance criteria
Earlier false-positive shapes of
BooleanControlParameter(not re-checked)These came from the #1325 audit. Not re-checked on 2026-11-12.
The cited site
plugins/os-adr/lib/adr/record/matches.rbreports no offense of this cop now.all_statuses). A split moves the branch to the caller._without_for a false default;m_with_<param>fits.Origin
17d4c688), session 6f78b932-f117-4bd7-bbed-524776dbb719.Occurrence: Make two Sdlc cops handle destructured parameters instead of crashing
Seen: plugins/os-sdlc/lib/os_sdlc/cops/boolean_control_parameter/def_site.rb:29 (MlhsNode has no default_value), on collaborator_pass/subcommand.rb 7:4 and 46:6
Run: Session acb1c3d0-87bc-425e-ac2b-413f0a7b6f32, after merging #1118 and #1119 (main
5890a574)Adds: Still present on main
5890a574. rubocop exits 0 with 'no offenses detected' despite both crashes, so the lint gate passes and hides any offense of these cops in the file.Occurrence: Sdlc/Structural/BooleanControlParameter: fix mlhs crash; carve out data-driven filter flags; correct split name
Seen: plugins/os-sdlc/lib/os_sdlc/cops/boolean_control_parameter/def_site.rb (NoMethodError on MlhsNode at plugins/os-sdlc/lib/os_sdlc/collaborator_pass/subcommand.rb:46)
Run: eb98cdcd-6783-46a0-b7df-cf18a8fe2a56 (#1325 zero-false-positive audit, docs/plans/class-length-family/sdlc-cop-audit.md)
Adds: two more false-positive shapes: a data-driven filter flag used only in an iteration condition (plugins/os-adr/lib/adr/record/matches.rb:13 all_statuses, fed from plugins/os-adr/bin/adr-find:26), where a split moves the branch to the caller; and the message suggests without for a false default, where m_with_ fits. Carve-outs belong in the cop matcher, not config Exclude lists.
Occurrence: Fix ParameterThreadedThroughPrivateMethods crash on destructured parameter
Seen: plugins/os-sdlc/lib/os_sdlc/cops/structural/parameter_threaded_through_private_methods.rb:35
Run: Session a48658d5-b566-40ce-8257-ebeabf56f7e1
Adds: a second trigger file:
plugins/os-sdlc/lib/os_sdlc/simulated_polymorphism/owned_type.rb,def locate(scope, (segment, *rest)). Detail follows.Observed
Run in
plugins/os-sdlconmain(commit031244657):With
-d, the cause is:The line is
def_node.arguments.each { |arg| tally[arg.name.to_s] << def_node }.The trigger is the private method
def locate(scope, (segment, *rest))inowned_type.rb(a destructured parameter).RuboCop prints "1 file inspected, no offenses detected" after the error, so the file looks clean.
The session path
lib/os_sdlc/simulated_polymorphism/owned_type.rbdoes not exist; the file is underlib/os_sdlc/cops/structural/simulated_polymorphism/.Reproduce
Approach
In
build_tally, skip anMlhsNodeargument, or tally the names inside it.Add a test with a private method that takes a destructured parameter in
plugins/os-sdlc/test/cops/parameter_threaded_through_private_methods_test.rb.Merge this into #1102 if its fix covers
defparameters of the same cop.Required work:
mlhsarguments inbuild_tally— check: presentmlhsinplugins/os-sdlc/lib/os_sdlc/cops/structural/parameter_threaded_through_private_methods.rbAcceptance criteria
def locate(scope, (segment, *rest)), when the cop runs, then it raises no error.Owner sketch
Fix two Sdlc cops crashing on destructured parametersto Fix ParameterThreadedThroughPrivateMethods crash on destructured parametersCorrection 2026-11-12
Facts checked on
mainon 2026-11-12:BooleanControlParameterno longer crashes on a destructured parameter. Commit055bb6166fixed it. The testtest/cops/boolean_control_parameter_test.rb:31pins it.lib/os_sdlc/collaborator_pass/subcommand.rbno longer exists.Sdlc/Structural/ParameterThreadedThroughPrivateMethodsstill crashes on a destructured parameter. The cause islib/os_sdlc/cops/structural/parameter_threaded_through_private_methods.rb:35. The trigger islib/os_sdlc/cops/structural/simulated_polymorphism/owned_type.rb:35.bundle exec rubocop --only Sdlc/Structural/ParameterThreadedThroughPrivateMethods lib/os_sdlc/cops/structural/simulated_polymorphism/owned_type.rbinplugins/os-sdlc. The error line isAn error occurred while Sdlc/Structural/ParameterThreadedThroughPrivateMethods cop was inspecting .../lib/os_sdlc/cops/structural/simulated_polymorphism/owned_type.rb:8:10.This ticket now concerns that one cop. I rewrote the title and body to match.