Skip to content

Fix --codemod-owner-picks in synthesize-plan CLI and single-embedded constant_subtype_answer - #637

Merged
trissim merged 1 commit into
mainfrom
fix/synthesize-plan-owner-picks
Nov 27, 2026
Merged

trissim merged 1 commit into
mainfrom
fix/synthesize-plan-owner-picks

Conversation

@trissim

@trissim trissim commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Two Toad-bench fixes discovered while driving NRA synthesis batches on OpenHCSDev/toad:

  1. Honor --codemod-owner-picks in --codemod-synthesize-plan and --codemod-synthesize-class-plan (nominal_refactor_advisor/cli.py:3582):

    • Synthesis rejections instruct callers to supply owner ... in --codemod-owner-picks, but CodemodSynthesizePlanCliCommand and CodemodSynthesizeClassPlanCliCommand passed raw self.findings and ignored --codemod-owner-picks completely.
    • Added CodemodSynthesisExecutionCliCommand.picked_findings(self) shared by both commands so CLI synthesis plans apply OwnerPicks.read(self.args.codemod_owner_picks).
  2. Count only embedded consumers needing a pick in ConstantSubtypeAnswerDetector (nominal_refactor_advisor/refactors/constant_subtype_answer.py:2687):

    • Previously checked pick is not None and len(metrics.consumer_locations) == 1, which ignored a supplied OwnerPick whenever a finding had one whole-function consumer (auto-named from function.name) plus one embedded consumer (e.g. Toad's SidebarModelState.shows_model read by ChannelTreeSidebar.sync and ChannelTreeSidebar.present), while still printing supply owner ... in --codemod-owner-picks.
    • Now counts only consumers needing a pick (embedded_count == 1), applies the single OwnerPick to that embedded consumer, and reports NeededInput.SOURCE_CHANGE when embedded_count > 1 instead of requesting a single pick that cannot name multiple methods.

Verification

  • Added 2 regression tests in tests/test_toad_bench_synthesis_fixes.py covering CLI --codemod-synthesize-plan --codemod-owner-picks and single-embedded + whole-function constant_subtype_answer push with runtime parity.
  • 27 passed, 0 failed (test_toad_bench_synthesis_fixes.py, test_constant_subtype_answer.py, test_repository_architecture.py), REL_IMPORTS=0.

@trissim
trissim merged commit 9a1b154 into main Nov 27, 2026
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.

1 participant