fix(cli): guard against duplicate 'create' lines in wheels new (#2311)#2358
Merged
fix(cli): guard against duplicate 'create' lines in wheels new (#2311)#2358
Conversation
The duplicate `create blog/Application.cfc` line reported in #2311 was a side-effect of the `copyTemplateDir()` recursion bug fixed in #2342: both `public/Application.cfc` and `public/miscellaneous/Application.cfc` emitted as the same flattened path. The current scaffold no longer reproduces it (verified via the onboarding harness F3 check and a manual `wheels new blog` run on the worktree), but follow the issue's own suggested approach and add defense-in-depth so a future regression in any `printCreated()` caller can't surface as a confusing duplicate. - `printCreated()` now consults `variables.$createdPathTracker` when set: same path twice is logged as a `verbose()` diagnostic and the user-visible line is suppressed. - `scaffoldNewApp()` opens the tracker at the start of the scaffold and closes it in a `finally` block so generator commands later in the same long-lived process (MCP / REPL) emit unconditionally. - `NewCommandTemplateSpec` now asserts both `public/Application.cfc` and `public/miscellaneous/Application.cfc` exist — the second is an intentional empty override so requests under `miscellaneous/` don't run through Wheels, and we don't want a future "cleanup" deleting it on the assumption it's the duplicate. Closes #2311.
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.
Summary
create blog/Application.cfcline reported in wheels new emits 'create blog/Application.cfc' twice (codegen duplicate) #2311 no longer reproduces — the symptom was a side effect of thecopyTemplateDir()recursion bug fixed in fix(cli): wheels new emits app-relative paths in 'create' log #2342, where bothpublic/Application.cfcandpublic/miscellaneous/Application.cfcprinted as the same flattened path.printCreated()deduplicates within a per-scaffold tracking session opened byscaffoldNewApp()and closed in afinallyblock. A future regression that re-emits the same path now surfaces as averbose()diagnostic instead of a confusing user-visible duplicate.wheels console) emit unconditionally.NewCommandTemplateSpecinvariant asserting bothpublic/Application.cfcandpublic/miscellaneous/Application.cfcexist. The emptymiscellaneous/Application.cfcis an intentional override so requests under that subtree skip the parent Wheels app, and the test prevents a future maintainer from deleting it as the "duplicate".Closes #2311.
Test plan
bash tools/test-cli-local.sh— 474 pass / 3 fail (3 failures are pre-existing on develop inDoctorSpec, unrelated to this change). NewNewCommandTemplateSpeccase included.wheels new blog --no-open-browseragainst the worktree: exit 0, 81 distinctcreatelines,sort | uniq -dreturns nothing, bothApplication.cfcfiles emit at their full distinct paths.wheels generate model Post title:stringafter the scaffold: emits itscreatelines normally — tracker is correctly scoped viatry/finallyand doesn't leak across commands.