Skip to content

fix(cli): dry run prints one honest list, and the real run admits routes - #3617

Merged
bpamiri merged 2 commits into
developfrom
fix/dry-run-output
Sep 15, 2026
Merged

bpamiri merged 2 commits into
developfrom
fix/dry-run-output

Conversation

@bpamiri

@bpamiri bpamiri commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

wheels generate scaffold Post … --dry-run printed three contradicting things at once:

Dry run — nothing will be written.
Scaffolding Post...
  create  model: Post.cfc            <- reads as "written"
  … ten create lines …
Scaffold complete! Next steps:
  1. Run migrations: wheels migrate latest   <- migrate what?
Would create:
  /private/tmp/dr/app/app/models/Post.cfc    <- absolute, root repeated

Nothing was written (that part was correct), but the output said otherwise and the trailing advice was nonsense for a dry run.

Fix

printCreated() is the single choke point for all 30 generator call sites, so gating it on $isDryRun() fixes every generator at once — model, controller, migration and scaffold alike. The scaffold's modify lines and the "Next steps" block are gated the same way.

The list is headed Would write:, not Would create:, because it legitimately contains paths that would be modified — a --belongsTo scaffold rewrites the parent model, controller and show view. Paths are now project-relative.

Dry run — nothing will be written.
Scaffolding Post...
Would write:
  app/models/Post.cfc
  app/migrator/migrations/2026…_create_posts_table.cfc
  app/controllers/Posts.cfc
  app/views/posts/{index,show,new,edit,_form}.cfm
  tests/specs/models/PostSpec.cfc
  tests/specs/controllers/PostsControllerSpec.cfc
  config/routes.cfm

The inversion the dry run exposed

The dry run listed config/routes.cfm while the real run rewrote that file without a word. updateRoutes() has always returned whether it changed the file; the caller discarded the value.

Scaffold now records it in results.routes — deliberately not results.modified, because config/routes.cfm is a shared project file rather than a per-model artifact, and the 17 parent-wiring specs assert the exact contents of modified. Module.cfc reports it as modify routes: config/routes.cfm.

Verified

dry run 11 project-relative paths, nothing written
real run the same 10 creates + modify routes: config/routes.cfm
--belongsTo dry run parent files in the would-write list, left byte-unchanged
model / controller / migration clean single lists, no duplicates

CLI suite: 1375 pass, 0 error. The 4 remaining DbCommandSpec failures are environmental — they expect Wheels.ServerNotRunning and a live app was on 8080; on a clean port they pass.

`wheels generate scaffold Post ... --dry-run` printed three contradicting
things at once:

  Dry run — nothing will be written.
  Scaffolding Post...
    create  model: Post.cfc          <- reads as "written"
    ... ten create lines ...
  Scaffold complete! Next steps:
    1. Run migrations: wheels migrate latest   <- migrate what?
  Would create:
    /private/tmp/dr/app/app/models/Post.cfc    <- absolute, root repeated

Nothing was written (that part was correct), but the output said otherwise
and the trailing advice was nonsense for a dry run.

printCreated() is the single choke point for all 30 generator call sites,
so gating it on $isDryRun() fixes every generator at once — model,
controller, migration and scaffold alike. The scaffold's `modify` lines
and the "Next steps" block are gated the same way.

The list is now headed "Would write:", not "Would create:", because it
legitimately contains paths that would be MODIFIED — a --belongsTo
scaffold rewrites the parent model, controller and show view. Calling
those "created" was wrong. Paths print relative to the project so the
root isn't repeated on every line.

Separately, the dry run exposed an inversion: it listed config/routes.cfm
while the REAL run rewrote that file without a word. updateRoutes() has
always returned whether it changed the file; the caller discarded it.
Scaffold now records it in results.routes — deliberately NOT in
results.modified, because config/routes.cfm is a shared project file
rather than a per-model artifact and the 17 parent-wiring specs assert
the exact contents of `modified` — and Module.cfc reports it as
`modify routes: config/routes.cfm`.

Verified on a throwaway app: dry run lists 11 project-relative paths and
writes nothing; the real run lists the same 10 creates plus the routes
modification; the two outputs correspond. A --belongsTo dry run lists the
parent files in the would-write list and leaves them byte-unchanged.

CLI suite: 1375 pass, 0 error. The 4 remaining DbCommandSpec failures are
environmental — they expect Wheels.ServerNotRunning and a live app was on
8080. On a clean port they pass.

Signed-off-by: Peter Amiri <peter@alurium.com>
Beat 2's dry-run step promised "eleven Would create lines". The heading is
now Would write (the list includes files that would be modified), and the
card calls out config/routes.cfm appearing in it — which the real run now
reports as a modification rather than editing silently.

Signed-off-by: Peter Amiri <peter@alurium.com>
@bpamiri
bpamiri merged commit e32c536 into develop Sep 15, 2026
13 checks passed
@bpamiri
bpamiri deleted the fix/dry-run-output branch September 15, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant