Skip to content

fix(compat): method-param reorder severity follows passing style#76

Merged
gjtorikian merged 1 commit into
mainfrom
fix-kwarg-position-false-positive
May 18, 2026
Merged

fix(compat): method-param reorder severity follows passing style#76
gjtorikian merged 1 commit into
mainfrom
fix-kwarg-position-false-positive

Conversation

@gjtorikian
Copy link
Copy Markdown
Collaborator

Summary

Method parameter sensitivity.order was being sourced from policy.constructorOrderMatters, conflating constructor positional semantics with method call-site semantics. For Ruby/Python/Elixir (which have constructorOrderMatters: true), this caused kwarg-only method reorders to be flagged as breaking even though callers literally cannot observe parameter declaration order.

Concretely, on workos/openapi-spec#23 the Ruby diff reported Authorization.list_resources: request_options moved 9→8 as breaking. But the method signature is def list_resources(before:, after:, ..., request_options:) — every param is a keyword arg. The only real break in that method is search: being removed.

Changes

  • src/compat/ir.ts — method-param sensitivity.order now derives from passing style (only 'positional'), not policy.constructorOrderMatters.
  • src/compat/classify.ts — position-change handler now branches on passing:
    • keyword (Ruby/Python/Elixir) → no change emitted
    • options_object (Node) → no change emitted
    • named (PHP/Kotlin/C#) → constructor_reordered_named_friendly (soft-risk)
    • positional (Go/Rust) → parameter_position_changed_order_sensitive (breaking)
  • Constructors retain existing policy.constructorOrderMatters semantics — unchanged.
  • 6 new tests in language-matrix.test.ts covering each passing style.

Test plan

  • npm test — 1417 pass (6 new)
  • npm run typecheck clean
  • npm run lint / format clean
  • Regenerate the openapi-spec PR diff report and confirm Ruby Authorization.list_resources no longer flags request_options moved 9→8 as breaking

🤖 Generated with Claude Code

Method parameter `sensitivity.order` was being sourced from
`policy.constructorOrderMatters`, which conflates constructor positional
semantics with method call-site semantics. For Ruby/Python/Elixir
(`constructorOrderMatters: true`), this flagged kwarg-only method
reorders as breaking even though callers literally cannot observe
parameter declaration order.

Method param reorder severity is now decided by the param's `passing`
style: positional → breaking, named → soft-risk, keyword/options_object
→ not reported. Constructor handling is unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gjtorikian gjtorikian merged commit 6f7d4dc into main May 18, 2026
5 checks passed
@gjtorikian gjtorikian deleted the fix-kwarg-position-false-positive branch May 18, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant