fix(public): isolate helpers include from $init promote scan - #3425
Merged
Conversation
Pin the include-then-promote order and the 4.0.6 helper visibility contract so the first-boot EmptyStack nest cannot return unnoticed. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.com>
Move the helpers.cfm include into its own method so Adobe's page context pops before the parent-class promote scan runs. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-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.
Summary
Adobe CF 2023 + CommandBox first cold start throws
EmptyStackExceptionfromNeoPageContext.popSuperScopewhileonapplicationstart.cfcinstantiates the Public GUI ($createObjectFromRoot→Public.$init). This is a 4.0.6 regression: discarding the 4.0.6 files and returning to 4.0.5 clears it; a later page load can succeed.This PR is the first-boot EmptyStack path only. It is not the torn-down
application.wo/onErrorString[]report on issue 3379. NoonError,EventHandlerInterface,Application.cfctemplate, oronSessionEndedits.Refs #3379. HEAD:
d96d6024ad0b6c839d5d20f2aae8620c5e7b1f6b.Root cause (verified)
The desk hypothesis holds. Investigation, not just the write-up:
vendor/wheels/events/onapplicationstart.cfc:409—$createObjectFromRoot(path="wheels", fileName="Public", method="$init"). Adobe then pops a super-scope insideUDFMethod.invoke(NeoPageContext.popSuperScope) and the stack is empty.Public.$init(commit6bff05441f/ PR 3302): afterinclude "/wheels/public/helpers.cfm"it now calls$scanAndPromoteIncludedGlobals(). That helper is a parent-class method onwheels.Global. 4.0.5$initis include + return only.include+ parent-method promote nests Adobe's include page-context with a super-scope push. On the first compile ofhelpers.cfmafter a CommandBox cold start,popSuperScoperuns against an empty stack. A later request succeeds because the include is already compiled — matching the report.this). The memoized$promoteIncludedGlobalsToThis()wrapper cannot be used here: Global's pseudo-constructor already cached a pre-include key list forwheels.Public.4.0.5 vs 4.0.6 vs develop
Public.$init51eb6e47include "/wheels/public/helpers.cfm"thenreturn this5928131d$scanAndPromoteIncludedGlobals(), then returnc64f6a9b$createObjectFromRoot(..., Public, $init): 4.0.5 line 419, 4.0.6 and develop line 409. Same call.What changed
$includePublicHelpers()so its UDF / page-context frame returns before$initcalls the parent-class promote scan.$initstill calls the raw$scanAndPromoteIncludedGlobals()(not the memoized wrapper) so the 4.0.6this-visibility contract stays.Public.$init/ the new include helper only.PROVEN
$inithas no promote call; 4.0.6 / develop add$scanAndPromoteIncludedGlobals()in the same method as the include; field stack is$createObjectFromRoot→$init→popSuperScope$initframePublicInitPromoteSpec: trace isinclude-start,include-return,promote$$findMatchingRoutesandpageHeaderare custom functions onthisafter$init;$createObjectFromRootpath still returns a promoted instance$initbody has no rawincludestatement$initdoes not throw on LuCLIonErrorreportPublic.cfc+ WheelsTest + changelog fragment onlywheels test --core --ci→ 5332 passed (LuCLI / Lucee 7 + SQLite)d96d6024completed without failuresTests
vendor/wheels/tests/specs/global/PublicInitPromoteSpec.cfc(extendswheels.WheelsTest) — 5/5 passedvendor/wheels/tests/_assets/global/PublicInitTraceFixture.cfcwheels test --core --ci --timeout=1800(full framework suite)--filter=global(directory=wheels.tests.specs.global) also hits this spec; confirmed 219 pass / 0 fail including all 5 new examplesAdobe CF 2023 + CommandBox first-boot is the field reproduction and cannot be fully simulated here. CI (LuCLI) is the real green for this VM. GitHub CI on this HEAD is also green (12/12).
Out of scope / leftover
Left on issue 3379, not this PR:
application.woduringonError(Element wo is undefined in a Java object of type class [Ljava.lang.String;)EventHandlerInterfacemissing-template during$invokefromonErrorApplication.cfc(that drop would remove the developonSessionEndguard)Type of Change
changelog.d/3379-public-init-emptystack.fixed.md)Test Plan
wheels test --core --ci— done here, 5332 passed