fix(planner): sync entity names when --rename overrides a target#82
Merged
Conversation
The planner names each entity after its rename target (it emits both `Shopkeeper -> Monitor` and an entity `Monitor` that replaces Shopkeeper). A --rename override updated renamePlan but not domain.entities[].name, so the validation report contradicted itself — rename plan showed `Shopkeeper -> Resident` while the entity card still read "Monitor (replaces Shopkeeper)". Add syncEntityNames(): for each "changed" override outcome, rename any entity whose `replaces` matches the override's source AND whose name still equals the planner's old target (an entity deliberately named differently is left alone). Wired into dispatch right after applyRenameOverrides. Report-metadata coherence only — code generation keys off renamePlan, not entities, so generated code was already correct (verified on a real sentova run: 108 files use the override target, zero use the old one). - src/rename-overrides.ts: syncEntityNames (pure) - src/dispatch.ts: call it alongside the renamePlan override - tests: 2 new covering rename, divergent-name, no-op, and no-match Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
dadachi
added a commit
that referenced
this pull request
May 23, 2026
Cut a release so the naming-override work reaches npx users — the registry still serves pre-flag 0.1.2. Since 0.1.2: - feat: --rename From=To and --slug=<kebab> naming overrides (CLI + MCP) (#81) - fix: sync entity names when --rename overrides a target (#82) - fix: rename scope covers .webmanifest / .svg / .swiftformat (#83) - fix: rename skips compiled build output (app/assets/builds, public/assets) (#84) Minor bump: additive features, no breaking changes. Verified the tarball ships scripts/ruby/rename.rb + dist/ via `npm pack --dry-run`. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-up to #81. When
--renameoverrode a planner target, the validation report contradicted itself: the rename plan correctly showedShopkeeper → Resident, but the entity card still read "Monitor (replaces Shopkeeper)".Cause: the override updated
domain.renamePlanbut notdomain.entities[].name. The planner names each entity after its rename target (it emits bothShopkeeper → Monitorand an entityMonitorthatreplacesShopkeeper), so changing only the plan desynced the two.How
New pure
syncEntityNames(entities, outcomes)insrc/rename-overrides.ts: for eachchangedoutcome, rename any entity whosereplacesmatches the override's source and whose name still equals the planner's old target. An entity deliberately named differently is left alone (conservative). Wired intodispatch()right afterapplyRenameOverrides.Scope: report-metadata coherence only. Code generation keys off
renamePlan, not entities — so generated code was already correct. Verified on a realsentovarun: 108 files use the override target (Resident), zero use the planner's oldMonitor(the 37 "Monitor" hits were all unrelatedvendor/bundlegem code).Testing
npm run buildclean;npm run test→ 70/70 (2 new: rename, divergent-name left-alone, no-op outcomes, no-match).Not included
site.webmanifest,social-preview.svg,.swiftformat) — separate, olderrename.rb-scope gap, deferred.🤖 Generated with Claude Code