Skip to content

Commit 92e8c87

Browse files
committed
test(model): prove plan reuse with a portable in-place tag (#3236 review)
Replace the array `.equals()` identity check in the integration-plan-cache spec — whose behavior on BoxLang's array type is unverified — with a deep-path in-place tag of the cached entry that survives a second materialization. The write goes through the full application-scope path (no local-var copy), so it is reference-safe on Adobe CF too, and it uses only core struct functions, so it behaves identically on every engine. Same property proven (cached plan reused, not rebuilt), no `.equals()` dependency. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0167uSbSN4vZqQqL5QZfdiQm Signed-off-by: Claude <noreply@anthropic.com>
1 parent 59e7b09 commit 92e8c87

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

vendor/wheels/tests/specs/model/integrationPlanCacheSpec.cfc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,19 @@ component extends="wheels.WheelsTest" {
3333

3434
it("reuses the same cached plan across instances rather than rebuilding it", () => {
3535
model("author").new();
36-
var first = application.wheels.integrationPlans["wheels.model"];
37-
// A second materialization must not replace the cached plan.
36+
// Tag the cached plan entry in place. The write goes through the full
37+
// application-scope path (no intermediate local var), so it mutates the
38+
// cached array element directly — reference-safe on Adobe CF too, which
39+
// copies an array assigned to a local. Uses only core struct functions,
40+
// so it behaves identically on Lucee/Adobe/BoxLang (avoids the array
41+
// `.equals()` idiom, whose BoxLang behavior is unverified).
42+
application.wheels.integrationPlans["wheels.model"][1]["cacheReuseSentinel"] = true;
43+
// A second materialization must reuse the cached plan, not rebuild it
44+
// (a rebuild would replace the entry with a fresh struct lacking the tag).
3845
model("author").new();
39-
var second = application.wheels.integrationPlans["wheels.model"];
40-
// Same identity (Lucee/Adobe compare arrays by reference here): a
41-
// rebuild would produce a different array with fresh instances.
42-
expect(first.equals(second)).toBeTrue();
46+
expect(
47+
StructKeyExists(application.wheels.integrationPlans["wheels.model"][1], "cacheReuseSentinel")
48+
).toBeTrue();
4349
});
4450

4551
it("materializes instances that carry the full mixed-in model method surface", () => {

0 commit comments

Comments
 (0)