Skip to content

Commit c96878c

Browse files
committed
fix(cli): address PR #2727 review — remove dead CLAUDE.md ref, dedup test
Reviewer A's required-before-merge items on #2727: 1. `cli/lucli/Module.cfc` — the `fix` string in the new `paginationLinks` upgrade check referenced `CLAUDE.md ## Pagination View Helpers`. End users running `wheels upgrade check --to=4.0.0` against their own app have no `CLAUDE.md` from this repo. Replace with the public GitHub issue URL. Remove the adjacent NOTE about doubling `##` — it was only relevant while the `fix` string contained `##1930`, and the URL form no longer needs the doubling. 2. `vendor/wheels/tests/specs/view/paginationLinksDeprecationSpec.cfc` — the upgrade-check coverage `it()` duplicated the block-extraction boilerplate (`expandPath`, `find("currentMajor <= 3...")`, etc.) that already lives in `UpgradeCheckCoverageSpec.cfc`. Move the assertion into that spec as one more `it()` alongside the other 3.x → 4.x coverage checks, and trim the deprecation spec down to the runtime warning tests only. Reviewer B's adjacent point (multi-line comment blocks per CLAUDE.md's "one short line max" rule): collapse the 5-line block in `vendor/wheels/view/links.cfc`, the 7-line preamble in `Module.cfc`, and the 18-line header in `paginationLinksDeprecationSpec.cfc`. Refs #2714, #2727. Signed-off-by: Peter Amiri <peter@alurium.com>
1 parent 6b375ab commit c96878c

4 files changed

Lines changed: 22 additions & 72 deletions

File tree

cli/lucli/Module.cfc

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3733,20 +3733,14 @@ component extends="modules.BaseModule" {
37333733
extensions: "cfm,cfc",
37343734
fix: "Missing manifest entries throw Wheels.ViteAssetNotFound in production. Rebuild assets during deploy (npm run build) or set(viteStrictManifest=false) to restore 3.x silent fallback."
37353735
});
3736-
// paginationLinks() is deprecated in favor of paginationNav()
3737-
// (#1930) and now emits a one-time per-request warning at
3738-
// runtime (#2714). Flag any view still calling the deprecated
3739-
// helper so 3.x apps see the rename during `wheels upgrade check`.
3740-
// NOTE: '#' is doubled in the `fix` string because CFML strings
3741-
// interpret a bare '#' as expression interpolation; we want a
3742-
// literal '#' in the user-visible remediation text.
3736+
// paginationLinks() deprecation grep (#2714, replacement: paginationNav() per #1930).
37433737
arrayAppend(checks, {
37443738
description: "Deprecated paginationLinks() helper (renamed to paginationNav() in 4.0)",
37453739
pattern: "paginationLinks\s*\(",
37463740
checkType: "grep",
37473741
scanDir: "app/views",
37483742
extensions: "cfm,cfc",
3749-
fix: "Replace paginationLinks() with paginationNav() (the all-in-one nav helper) or compose firstPageLink/previousPageLink/pageNumberLinks/nextPageLink/lastPageLink directly. See CLAUDE.md ## Pagination View Helpers and issue ##1930."
3743+
fix: "Replace paginationLinks() with paginationNav() (the all-in-one nav helper) or compose firstPageLink/previousPageLink/pageNumberLinks/nextPageLink/lastPageLink directly. See https://github.com/wheels-dev/wheels/issues/1930."
37503744
});
37513745
}
37523746

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ component extends="wheels.WheelsTest" {
8888
);
8989
});
9090

91+
it("scans for deprecated paginationLinks() helper", () => {
92+
expect(findNoCase("paginationLinks", block) > 0).toBeTrue(
93+
"3.x -> 4.x checks should grep views for paginationLinks( (renamed to paginationNav(), CHANGELOG ##2714)."
94+
);
95+
});
96+
9197
});
9298

9399
}

vendor/wheels/tests/specs/view/paginationLinksDeprecationSpec.cfc

Lines changed: 13 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,10 @@
1-
/**
2-
* Regression for issue ##2714: `paginationLinks()` is documented as
3-
* deprecated in favor of `paginationNav()` (per ##1930), but emits no
4-
* runtime warning and is invisible to `wheels upgrade check`.
5-
*
6-
* Two assertions:
7-
*
8-
* 1. The first call to `paginationLinks()` within a request sets a
9-
* request-scoped guard flag (`request.wheels.$paginationLinksDeprecationLogged`).
10-
* The flag is what gates the one-time `WriteLog(type="warning", ...)`
11-
* call so the deprecation surfaces once per request, not on every
12-
* render in a loop.
13-
*
14-
* 2. The 3.x -> 4.x scan rules in `cli/lucli/Module.cfc` include a
15-
* `paginationLinks` grep so `wheels upgrade check --to=4.0.0`
16-
* flags apps still calling the deprecated helper. Mirrors the
17-
* static-inspection pattern used by `UpgradeCheckCoverageSpec`.
18-
*/
191
component extends="wheels.WheelsTest" {
202

213
function run() {
224

235
g = application.wo
246

25-
describe("paginationLinks deprecation surface", () => {
7+
describe("paginationLinks deprecation warning (##2714)", () => {
268

279
beforeEach(() => {
2810
_params = {controller = "dummy", action = "dummy"}
@@ -36,48 +18,20 @@ component extends="wheels.WheelsTest" {
3618
structDelete(request.wheels, "$paginationLinksDeprecationLogged")
3719
})
3820

39-
describe("runtime warning", () => {
40-
41-
it("sets a request-scoped guard flag on first call", () => {
42-
g.model("author").findAll(page = 2, perPage = 3, order = "lastName")
43-
expect(structKeyExists(request.wheels, "$paginationLinksDeprecationLogged")).toBeFalse()
44-
_controller.paginationLinks()
45-
expect(structKeyExists(request.wheels, "$paginationLinksDeprecationLogged")).toBeTrue()
46-
expect(request.wheels.$paginationLinksDeprecationLogged).toBeTrue()
47-
})
48-
49-
it("does not re-log when called multiple times in the same request", () => {
50-
g.model("author").findAll(page = 2, perPage = 3, order = "lastName")
51-
_controller.paginationLinks()
52-
request.wheels.$paginationLinksDeprecationLogged = "first"
53-
_controller.paginationLinks()
54-
expect(request.wheels.$paginationLinksDeprecationLogged).toBe("first")
55-
})
56-
21+
it("sets a request-scoped guard flag on first call", () => {
22+
g.model("author").findAll(page = 2, perPage = 3, order = "lastName")
23+
expect(structKeyExists(request.wheels, "$paginationLinksDeprecationLogged")).toBeFalse()
24+
_controller.paginationLinks()
25+
expect(structKeyExists(request.wheels, "$paginationLinksDeprecationLogged")).toBeTrue()
26+
expect(request.wheels.$paginationLinksDeprecationLogged).toBeTrue()
5727
})
5828

59-
describe("upgrade-check coverage", () => {
60-
61-
it("3.x -> 4.x scan rules in Module.cfc grep for paginationLinks", () => {
62-
// expandPath("/wheels") resolves to vendor/wheels via the
63-
// configured Lucee mapping; the repo root is two levels above.
64-
var repoRoot = expandPath("/wheels/../..")
65-
var modulePath = repoRoot & "/cli/lucli/Module.cfc"
66-
expect(fileExists(modulePath)).toBeTrue("Missing: " & modulePath)
67-
68-
var moduleSource = fileRead(modulePath)
69-
var start = find("currentMajor <= 3 && targetMajor >= 4", moduleSource)
70-
expect(start > 0).toBeTrue("3.x -> 4.x branch not found in Module.cfc")
71-
72-
var endIdx = find("// Run checks", moduleSource, start)
73-
var sliceLen = endIdx > 0 ? endIdx - start : len(moduleSource) - start + 1
74-
var block = sliceLen > 0 ? mid(moduleSource, start, sliceLen) : ""
75-
76-
expect(findNoCase("paginationLinks", block) > 0).toBeTrue(
77-
"3.x -> 4.x checks should grep app views for paginationLinks( so apps still using the deprecated helper get flagged by 'wheels upgrade check --to=4.0.0'. See issue ##2714."
78-
)
79-
})
80-
29+
it("does not re-log when called multiple times in the same request", () => {
30+
g.model("author").findAll(page = 2, perPage = 3, order = "lastName")
31+
_controller.paginationLinks()
32+
request.wheels.$paginationLinksDeprecationLogged = "first"
33+
_controller.paginationLinks()
34+
expect(request.wheels.$paginationLinksDeprecationLogged).toBe("first")
8135
})
8236

8337
})

vendor/wheels/view/links.cfc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,7 @@ component {
233233
boolean pageNumberAsParam,
234234
any encode
235235
) {
236-
// Issue #2714: paginationLinks() is deprecated in favor of paginationNav().
237-
// Emit a one-time per-request warning so 3.x → 4.x upgraders see the
238-
// signal without flooding the log on a paginated view that renders
239-
// the helper many times. Follows the $checkPluginsDeprecation() pattern
240-
// in vendor/wheels/Plugins.cfc.
236+
// One-time per-request deprecation warning (#2714) — mirrors $checkPluginsDeprecation() in Plugins.cfc.
241237
if (!StructKeyExists(request.wheels, "$paginationLinksDeprecationLogged")) {
242238
request.wheels.$paginationLinksDeprecationLogged = true;
243239
WriteLog(

0 commit comments

Comments
 (0)