Skip to content

fix(move-method): keep static utilities out of data classes and reversed dependencies (#3830) - #4156

Open
Aman-goel-04 wants to merge 1 commit into
repowise-dev:mainfrom
Aman-goel-04:fix/3830-static-move-method
Open

Aman-goel-04 wants to merge 1 commit into
repowise-dev:mainfrom
Aman-goel-04:fix/3830-static-move-method

Conversation

@Aman-goel-04

Copy link
Copy Markdown
Contributor

Summary

  • Java static now reaches the method's graph node (modifiers), and Kotlin object / companion object functions are marked static by the parser. PARSER_SCHEMA_VERSION is bumped to 9 so stale parse caches are rebuilt.
  • MoveMethodDetector no longer moves a static method into a class when every target member it calls is an accessor (getX / isX / setX, or a record component). Such a class is a data holder, and its getters are the method's inputs, not envy.
  • MoveMethodDetector also refuses a move that would reverse a dependency on Java and Kotlin. If the method calls something outside the target and the target's file can't see it (no import, different package), the target would have to depend on the method's home.

Related Issues

Fixes #3830

Test Plan

  • Tests pass (pytest): test_refactoring_move_method.py, test_misc.py and test_lang_samples_golden.py (89 passed)
  • Lint passes (ruff check .)
  • Web build passes (npm run build) (if frontend changes); n/a, no frontend changes

Verification notes:

  • The issue's repro (ReleaseKeyGenerator.generateReleaseKey → Namespace) printed a plan on main and now prints none. A from-source test builds the issue's three-file fixture and covers it.
  • A control from source shows a static method calling validate / apply / merge on a same-package class still moves.
  • The new tests fail without the source change (11 of them), and test_java_envy_control_still_fires and the Python @staticmethod behaviour are unchanged.
  • Only golden/java.json was regenerated. The diff is purely added modifiers, and the Kotlin golden is unchanged.

Checklist

  • My code follows the project's code style
  • I have added tests for new functionality
  • All existing tests still pass
  • I have updated documentation if needed; module docstring in move_method.py and the PARSER_SCHEMA_VERSION notes

@repowise-bot

repowise-bot Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

🔍 2 things to check

  1. This PR introduces 5 new findings (1 critical) across 3 files: 2× complex method, 1× io in loop, 1× complex conditional (+1 more kind). The worst are marked on the diff (see all)
  2. packages/core/src/repowise/core/ingestion/call_resolver.py changed in 13 of the 26 commits that touched packages/core/src/repowise/core/upgrade/version.py and is not in this PR

⚠️ 1 new critical finding · Health of changed files: 7.6 → 7.2 (-0.4; structure -0.2)
Average full file score (structure and history) of 7 changed code files, weighted by size before this PR; not the repository score.

Check Result
Coverage Waiting for this PR's CI to upload a report (last report from this repo 1 hour ago)
Tests 5 of 5 changed code files reached by a test · which tests
Security No new findings on changed lines
Doc drift No drift in docs this PR edits · 1 document name changed files
Doc drift
  • docs/architecture/language-support.md names packages/core/src/repowise/core/ingestion/language_configs.py and is not in this PR
🧾 Evidence: 1 to look at, 6 not known
Item Status Evidence
Components touched ok · inferred 2 components: packages, tests
Declared owners ok · declared @RaghavChamadiya, @swati510
Suggested reviewers unknown · not known Not known: not gathered on a pull request
Tests reaching the change unknown · not known 0 of 5 changed files reached by a test; 5 not known
Contracts touched ok · measured No workspace contract touched; no breaking signature change
Consumers in other repos unknown · not known Not known: not gathered on a pull request
Decisions crossed unknown · not known Not known: decision records are read only for an AI review
Health delta look · measured Findings: 5 introduced, 0 worsened, 0 resolved
AI provenance unknown · not known Provenance: unknown, known for 0 of 1 commit; AI share withheld: coverage 0% is below 30%
Diff size rank ok · measured Larger than 62.8% of recent commits
Outcomes since merge unknown · not known Not known: a pull request is not a merged change

👀 Suggested reviewers @RaghavChamadiya

AI review is paused: this repository reached its monthly spending limit. Bot settings


📊 See the full report for this PR
Blast radius, every caller of the contracts it changes, and health before and after. No sign-in.
Plain markdown for agents

Settings and updates

Updated 2026-10-21 11:22 UTC, since the last push: health 7.3 to 7.2
Silence one PR with [skip repowise] in the title · Bot settings
⭐ Star Repowise · 📥 Install on another repo

@Aman-goel-04
Aman-goel-04 force-pushed the fix/3830-static-move-method branch from fbd0165 to 887e976 Compare October 19, 2026 19:37
@Aman-goel-04
Aman-goel-04 force-pushed the fix/3830-static-move-method branch from 887e976 to 046c97d Compare October 21, 2026 11:22
@Aman-goel-04

Copy link
Copy Markdown
Contributor Author

@RaghavChamadiya, rebased this one too. Please review and lmk if any changes need to be made.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move Method plans move a static utility method into the entity or DTO it reads (ReleaseKeyGenerator.generateReleaseKey into Namespace)

1 participant