Repository navigation
Conversation
Allow descriptive and related function names in enforce mode instead of treating token subsets as symbol collisions. Keep naming-quality and Function ID enforcement intact. Add regression coverage for descriptive supersets, trailing specifiers, shorter related names, and retained naming-quality rejection. Validation: 102 targeted Java tests pass. Python unit suite: 1174 passed, 13 skipped, 1 default-branch assertion failure, and 17 fixture errors due to GPG signing configuration.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
rahul05ranjan
left a comment
There was a problem hiding this comment.
Checked the gate matrix in FunctionService after the change: the Q1–Q5 quality gate and the Function ID gate still hard-reject in enforce mode (and downgrade to disabledEnforcementWarning otherwise), and the token-subset check is now advisory in every mode, added straight to enforcementWarnings regardless of strict_mode. The tests pin all three behaviors from both directions — superset/trailing-specifier/shorter-related names rename with setName(..., USER_DEFINED) and carry the advisory, while Get still rejects with name_quality and never().setName(...) proves the rejection path doesn't write. Also confirmed tokenSubsetCollisionRejection is fully gone with no dangling references, and the collision scan still lives inside the auto-generated-name exemption where it always was.
One small thing lost in the swap: the old rejection carried a concrete suggestion — add a distinguishing token like Broadcast, Local, ByIndex when the functions really are the same behavior. That was good guidance for a model-driven renamer, and it's exactly the case where the new advisory fires. Since the advisory now shows up for every superset/subset pair, keeping a one-line "if this is the same behavior, add a distinguisher" hint inside the advisory would preserve the useful part of the old text without bringing back the rejection.
What this changes
rename_functionno longer rejects a name just because its tokens are a subset of another function's tokens. That case is now an advisory warning, and the naming-quality checks and the Function ID check are still enforced.Why
In enforce mode,
rename_functionrejected any name whose token set was a strict subset of an existing function's name in the same module prefix. Shared tokens don't mean two functions collide. They often mean related functions with different behaviour. A descriptive name such asGetNamedMatrixAlignmentTransformFlagswas refused only becauseGetTransformalready exists, and the same happened for a trailing-specifier name or a shorter related name.Reproduction: in a program that has a function
GetTransform, runrename_functionwithnew_name="GetNamedMatrixAlignmentTransformFlags"andstrict_mode="enforce". Before this change it returnsstatus: rejected, error: name_collision, issue: token_subset_duplicate. Now the rename succeeds with a warning that names the similar function.What changed:
FunctionService.renameFunctionByAddress: the token-subset check now adds an advisory warning in every mode. The rejection buildertokenSubsetCollisionRejectionis gone.strict_modenow only affects the naming-quality rejections. The tool and parameter descriptions say that token-subset similarity is advisory.FunctionServiceRenameTestcovers descriptive supersets, trailing specifiers, shorter related names, and a name that must still be rejected on naming quality.Behaviour change to be aware of: anything that relied on the
name_collision/token_subset_duplicaterejection will no longer see it.Tests you ran
uv run pytest tests/unit/— Python unit tier, no Ghidra needed./gradlew test --tests 'com.xebyte.offline.*' "-PGHIDRA_INSTALL_DIR=<dir>"— offline Java tier, needs a Ghidra install but no running server and no
Maven (
mvn test -Dtest='com.xebyte.offline.*Test'is the Maven equivalent)powershell -File tests\pester\Run-Tests.ps1— only if you touchedghidra-mcp-setup.ps1pytest tests/ -m readonly,./gradlew test) — needs Ghidrarunning on port 8089 with a program loaded
If you touched an @mcptool or @PARAM annotation
I changed only the description strings on
/rename_functionand itsnew_nameparameter. No tool, parameter or path was added, removed or renamed.mvn test -Dtest=RegenerateEndpointsJson -Dregenerate=true— Mavenonly; Gradle cannot pass the
-Dregenerateflag into the forked testJVM and exits BUILD SUCCESSFUL having regenerated nothing. No Maven? Say
so here and leave the catalog alone — a maintainer will regenerate it.
python -m tools.audit_server_scope --writepython -m tools.gen_readme_api_reference --writeNo Maven here, so I left the catalog alone.
tests/endpoints.jsonkeeps its hand-authored description for/rename_function("Rename function by name"), and the parity test and the Python catalog tests pass.tests/conformance/snapshots/mcp_schema.snapstill holds the old tool and parameter description text. That file is recorded from a live server, which I couldn't run, so a maintainer may want to re-record it.Checklist
devand targetingdevCHANGELOG.mdupdated, if this is user-visible