fix(cli): ship the 404 guard in the app-side scaffold template too - #3608
Merged
Merged
Conversation
#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>
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.
#3607 added the
requireRecordfilter totemplates/codegen/CRUDContent.txtand was verified on a generated app — but a stockwheels newapp never got it.Why
wheels newcopies every codegen template into the app'sapp/snippets/, andTemplates.cfcresolves 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:/posts/10(soft-deleted)/posts/99999/posts/10/edit/posts/1Pinning 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
DbCommandSpecfailures, 0 errors.