Skip to content

engine: fix param parsing in rename detection (ENGINE-04, ENGINE-05) - #30

Merged
kridaydave merged 1 commit into
mainfrom
fix/pr-09-engine-param-parsing
Nov 8, 2026
Merged

kridaydave merged 1 commit into
mainfrom
fix/pr-09-engine-param-parsing

Conversation

@kridaydave

Copy link
Copy Markdown
Contributor

Bugs

  • ENGINE-04: parameter stripping splits on commas inside generics/braces/brackets
  • ENGINE-05: first ( in a signature taken as the param list when it belongs to a decorator/attribute

What was wrong

  • ENGINE-04 (src/engine/mod.rs, strip_param_names): segment splitting tracked only () depth, so commas inside <A, B>, {a, b}, or [...] were treated as top-level parameter separators. In an untyped split fragment (e.g. B> from Foo<A, B>), strip_segment erased identifiers, letting distinct generic type arguments collapse and rename_score return 80.
  • ENGINE-05 (src/engine/mod.rs, strip_param_names): param list location used squashed.find('(') over the whole signature. For decorated Python definitions (@register(1) def f(a):) and similar attribute/decorator forms, the first ( can belong to the decorator, so stripping operated on decorator args and left real parameter names intact, breaking rename pairing.

Fix

  • ENGINE-04: track (), <>, {}, and [] nesting depths when splitting parameter segments; only split on commas when all depths are zero.
  • ENGINE-05: rename signatures blank the function name to \0; locate the parameter list ( after that marker (falling back to the first ( only when no marker is present) so earlier decorator/attribute parens are skipped.

Verification

CI green (fmt, clippy, tests, release build, adjudication) + regression tests test_rename_score_tiers (ENGINE-04/05 cases) and test_decorated_python_param_rename_detected (ENGINE-05 integration).

@kridaydave kridaydave added the purging Batch purge: bug-fix swarm PRs label Nov 8, 2026
@kridaydave
kridaydave force-pushed the fix/pr-09-engine-param-parsing branch from dee92a2 to 5328c3c Compare November 8, 2026 18:14
ENGINE-04: `strip_param_names` split parameter segments on commas at any
paren depth of 0, but ignored `<>{}[]` nesting. Commas inside generic
type args (e.g. `Foo<A, B>`), brace literals, or brackets were treated
as top-level param separators, so the type fragment after such a comma
could be erased as a bare name and distinct types could falsely score 80.

Track all bracket depths when splitting segments so commas only split at
the true top level of the parameter list.

ENGINE-05: `strip_param_names` searched for the first `(` in the whole
signature to locate the param list. For decorated Python definitions
(e.g. `@register(1) def f(a):`) and similar cases, that hit a
decorator/attribute paren and stripped the wrong arguments, leaving real
param names untouched and preventing rename pairing.

Rename signatures blank the function name to `\0`; search for the param
list `(` after that marker so decorator/attribute parens are skipped.
@kridaydave
kridaydave force-pushed the fix/pr-09-engine-param-parsing branch from 5c86e60 to 49c6cd4 Compare November 8, 2026 18:54
@kridaydave
kridaydave merged commit 9cbf56e into main Nov 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

purging Batch purge: bug-fix swarm PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant