Skip to content

Commit e32399d

Browse files
fix(cli): address Reviewer A/B consensus findings (round 1)
- Set HTTP 500 status code in the onError fallback in both cli/lucli/templates/app/public/Application.cfc and public/Application.cfc so monitoring tools and CDNs don't cache the Wheels-init failure as a successful response. Uses a plain struct for cfheader's attributeCollection per CLAUDE.md cross-engine invariant #10 (Adobe CF 2023/2025 reject the arguments scope on built-in tags). - Document the no-nested-braces assumption behind catchClosePattern in vendor/wheels/tests/specs/cli/OnErrorFallbackGuardSpec.cfc so a future edit that adds nested braces inside the outer catch knows why the silent fallback to scanFrom=1 is the safety net. - Fix the contradictory recovery steps in the first-15-minutes guide (wheels reload requires a running server) at web/sites/guides/src/content/docs/v4-0-1-snapshot/start-here/first-15-minutes.mdx. - Replace the speculative "pre-4.0.2" wording in .ai/wheels/troubleshooting/common-errors.md with "4.0.1 or earlier" since the fix is still in [Unreleased]. Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
1 parent 71c35ec commit e32399d

5 files changed

Lines changed: 34 additions & 2 deletions

File tree

.ai/wheels/troubleshooting/common-errors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Wheels failed to initialize. Check the server log for details.
2727
3. Verify the `/wheels` mapping resolves: on a fresh install, `vendor/wheels/Injector.cfc` must exist. If it doesn't, re-run `wheels new` or copy the framework files manually.
2828
4. Run `wheels reload` (or stop/start the server) to pick up the corrected mapping.
2929

30-
**Note:** Before the #2774 fix, this failure cascaded into a second `[WO] does not exist` exception that hid the real cause. If you see the old cascade on a pre-4.0.2 app, the underlying cause is always a failed `onApplicationStart` — see above.
30+
**Note:** Before the #2774 fix, this failure cascaded into a second `[WO] does not exist` exception that hid the real cause. If you see the old cascade on a version that predates this fix (i.e. 4.0.1 or earlier), the underlying cause is always a failed `onApplicationStart` — see above.
3131

3232
## Common Association Errors
3333

cli/lucli/templates/app/public/Application.cfc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,16 @@ component output="false" {
280280
// cascading into "The key [WO] does not exist." (issue ##2773).
281281
if (!StructKeyExists(application, "wo")) {
282282
setting requestTimeout=30;
283+
// Surface a real 5xx so monitoring tools and CDNs don't cache this
284+
// failure as a successful response. Use a plain struct for
285+
// attributeCollection — Adobe CF 2023/2025 reject the `arguments`
286+
// scope on built-in tags (CLAUDE.md cross-engine invariant ##10).
287+
try {
288+
local.statusArgs = {statusCode: 500, statusText: "Internal Server Error"};
289+
cfheader(attributeCollection=local.statusArgs);
290+
} catch (any headerErr) {
291+
// Header may already have been written; the body still renders.
292+
}
283293
WriteOutput("<h1>Application Error</h1>");
284294
WriteOutput("<p>Wheels failed to initialize. Check the server log for details.</p>");
285295
try {

public/Application.cfc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,16 @@ component output="false" {
294294
// cascading into "The key [WO] does not exist." (issue ##2773).
295295
if (!StructKeyExists(application, "wo")) {
296296
setting requestTimeout=30;
297+
// Surface a real 5xx so monitoring tools and CDNs don't cache this
298+
// failure as a successful response. Use a plain struct for
299+
// attributeCollection — Adobe CF 2023/2025 reject the `arguments`
300+
// scope on built-in tags (CLAUDE.md cross-engine invariant ##10).
301+
try {
302+
local.statusArgs = {statusCode: 500, statusText: "Internal Server Error"};
303+
cfheader(attributeCollection=local.statusArgs);
304+
} catch (any headerErr) {
305+
// Header may already have been written; the body still renders.
306+
}
297307
WriteOutput("<h1>Application Error</h1>");
298308
WriteOutput("<p>Wheels failed to initialize. Check the server log for details.</p>");
299309
try {

vendor/wheels/tests/specs/cli/OnErrorFallbackGuardSpec.cfc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@ component extends="wheels.WheelsTest" {
8888
// application.wo.* dereference. Find the position of
8989
// the first such call after the catch block closes,
9090
// and assert the guard appears before it.
91+
//
92+
// Assumption: the outer catch body has no nested
93+
// braces. `[^\}]*` only matches catch bodies whose
94+
// contents (after comment stripping) contain no `{`
95+
// or `}`. If a future edit introduces a conditional
96+
// or nested try inside the outer catch, this regex
97+
// will fail to match and `scanFrom` falls back to 1
98+
// (top of onErrorBody) — the spec still passes as
99+
// long as the guard exists, but the "scan after the
100+
// catch" precision is lost. Widen the pattern (e.g.
101+
// a brace-counter like the one above) if that
102+
// becomes necessary.
91103
var catchClosePattern = "catch\s*\(\s*any\s+\w+\s*\)\s*\{[^\}]*\}";
92104
var catchMatch = reFindNoCase(catchClosePattern, onErrorBody, 1, true);
93105

web/sites/guides/src/content/docs/v4-0-1-snapshot/start-here/first-15-minutes.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ You'll see log lines ending with something like `Server started successfully`. O
4848
The dev server stays running in the background. Leave the terminal open.
4949

5050
<Aside type="caution" title="Seeing an Application Error page instead?">
51-
If the browser shows `Application Error — Wheels failed to initialize` rather than the welcome page, the error message on screen includes the underlying cause. Check the server log for the full stack trace. The most common cause on a fresh install is a stale `/wheels` CFML mapping — try stopping the server, running `wheels reload`, and restarting. If the mapping issue persists, the server log will point to the specific file that failed to load.
51+
If the browser shows `Application Error — Wheels failed to initialize` rather than the welcome page, the error message on screen includes the underlying cause. Check the server log for the full stack trace. The most common cause on a fresh install is a stale `/wheels` CFML mapping. While the server is running, try `wheels reload` to pick up the corrected mapping. If that does not clear it, stop and restart the server. The server log will point to the specific file that failed to load.
5252
</Aside>
5353

5454
## 3. Add a page (5 min)

0 commit comments

Comments
 (0)