Stop ForwardingClass from raising on a destructured parameter #1710
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#1710
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
Sdlc/Structural/ForwardingClassraisesNoMethodErroron a public method that has a destructured parameter, such asdef build((left, right)).ConstantChain.of_methodcallsmethod.arguments.map(&:name), and anMlhsNodehas noname. A cop error stops the inspection of that file, so a valid Ruby file can break a rubocop run.Observed
respond_to?(:name)guard inMethodMatch#parameter_namesstill present.undefined method 'name' for an instance of RuboCop::AST::MlhsNode (NoMethodError)plugins/os-sdlc/lib/os_sdlc/cops/structural/forwarding_class/constant_chain.rb:10, inConstantChain.of_method, called fromClassMatch#forwarding?.namefrom each parameter:constant_chain.rb:10(method.arguments.map(&:name)),method_match.rb:24(@def_node.arguments.filter_map { |argument| argument.name }), andinitialization.rb:11(def_node.arguments.map(&:name)). #1703 (c390a8a5b) deleted therespond_to?(:name)guard inmethod_match.rb; the same input crashed inconstant_chain.rbbefore that.def initialize((left, right))crashes atinitialization.rb:11. A check in memory witharguments.argument_list.map(&:name)(rubocop-ast 1.50.0ArgsNode#argument_list, which flattens destructured parameters) at all three sites: no crash;def build((left, right))that forwards both values gives 1 offense, the same as plain parameters; forwarding onlyleftgives 0.Reproduce
Run
offenses_for(RuboCop::Cop::Sdlc::Structural::ForwardingClass, source)fromtest/support/cop_helpers.rbon this source. It raisesNoMethodError.Approach
Required work: none beyond the acceptance criteria.
Acceptance criteria
initializehas a destructured parameter, when the cop runs, then it raises no error.Owner sketch
Origin
ConstantChain.of_methodmapsnameover every argument ← DESIGN (lib/os_sdlc/cops/structural/forwarding_class/constant_chain.rb:10)VERDICT: CREATE (ticket-skeptic, 2026-11-12): crash in a shipped cop on valid Ruby; #2358 covers other cops.
Work started: os-sdlc pipeline on branch ticket-1710 (session 01fe836c).
Resolution
Done: ForwardingClass no longer raises on a destructured parameter: the three name reads (ConstantChain.of_method, MethodMatch#parameter_names, Initialization) use arguments.argument_list. A destructured parameter follows the plain-parameter rule.
Evidence: Implementation 285 (11 dispatches, 7 min 25 s; one test-reviewer fail round):
2b93f2c91(lib) anda238876ed(test + History row) on branch ticket-1710. New test file 4 runs, 0 failures; suite gate and survivor gate green.Follow-ups: none