Skip to content

fix(cli): ship the 404 guard in the app-side scaffold template too - #3608

Merged
bpamiri merged 1 commit into
developfrom
fix/sync-crud-snippet
Sep 13, 2026
Merged

bpamiri merged 1 commit into
developfrom
fix/sync-crud-snippet

Conversation

@bpamiri

@bpamiri bpamiri commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

#3607 added the requireRecord filter to templates/codegen/CRUDContent.txt and was verified on a generated app — but a stock wheels new app never got it.

Why

wheels new copies every codegen template into the app's app/snippets/, and Templates.cfc resolves those first — they shadow the bundled copy. So the fix landed in the bundled template while the app-shipped twin silently overrode it with the old, guard-less body.

Release 2487 carried the fix. A fresh app generated from 2487 did not. My earlier verification had hand-written the rendered template into the controller, which is exactly why it looked fixed.

The fix

The snippet copy is now byte-identical to the bundled one. Confirmed on a genuinely stock app — fresh wheels new, real scaffold, soft-deleted through the real delete action, zero edits:

request result
/posts/10 (soft-deleted) 404
/posts/99999 404
/posts/10/edit 404
/posts/1 200

Pinning it

A new spec asserts the pair is identical. Only this pair. Two other snippet twins differ on purpose (the app copies read the reload password from .env), so a blanket "all snippets match codegen" rule would be wrong. 11 of 13 twins were already identical; this was the one that drifted.

CLI suite: 1357 pass, the 4 pre-existing DbCommandSpec failures, 0 errors.

#3607 added the requireRecord filter to templates/codegen/CRUDContent.txt and
was verified on a generated app — but a STOCK `wheels new` app never got it.

`wheels new` copies every codegen template into the app's app/snippets/, and
Templates.cfc resolves those FIRST: they shadow the bundled copy. So the fix
landed in the bundled template while the app-shipped twin silently overrode it
with the old, guard-less body. Release 2487 carried the fix; a fresh app
generated from 2487 did not. My verification had hand-written the rendered
template into the controller, which is why it looked fixed.

The snippet copy is now byte-identical to the bundled one. Confirmed on a
genuinely stock app (fresh `wheels new`, real scaffold, real delete action, no
edits): soft-deleted /posts/10 -> 404, /posts/99999 -> 404, /posts/10/edit ->
404, /posts/1 -> 200.

A new spec pins the pair. Only this pair: two other snippet twins differ on
purpose (the app copies read the reload password from .env), so a blanket
"all snippets match codegen" rule would be wrong. 11 of 13 twins were already
identical; this was the one that drifted.

CLI suite: 1357 pass, the 4 pre-existing DbCommandSpec failures, 0 errors.

Signed-off-by: Peter Amiri <peter@alurium.com>
@github-actions github-actions Bot added the bug label Sep 13, 2026
@bpamiri
bpamiri merged commit 8b42117 into develop Sep 13, 2026
13 checks passed
@bpamiri
bpamiri deleted the fix/sync-crud-snippet branch September 13, 2026 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant