Skip to content

refactor: burn down wave 4 — view templates, assertion equalizer, app-template request handling - #3439

Merged
bpamiri merged 3 commits into
developfrom
peter/complexity-burn-down-4
Aug 29, 2026
Merged

refactor: burn down wave 4 — view templates, assertion equalizer, app-template request handling#3439
bpamiri merged 3 commits into
developfrom
peter/complexity-burn-down-4

Conversation

@bpamiri

@bpamiri bpamiri commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fourth burn-down wave: the procedural view templates, the test-assertion equalizer, and the scaffolded Application.cfc template.

Before → after (cyclomatic complexity)

File Function Before After
events/onrequestend/debug.cfm template 64 max 5 (4 helpers)
public/views/consoleeval.cfm template 60 24
public/views/mcp.cfm template 33 25
public/views/plugins.cfm template 30 12
public/migrator/command.cfm template 30 15
events/onerror/cfmlerror.cfm template 34 max 9 (3 helpers)
wheelstest/system/Assertion.cfc equalize 46 19
templates/app/public/Application.cfc onRequestStart 44 4

vendor/wheels now has ZERO functions over complexity 50 (max is 30); ≤10 functions rose to 2,468. The CLI tree's max is 26.

Approach

  • Templates: branchy data logic extracted into local $-prefixed functions in the same file; the HTML markup stays byte-identical. Live-verified: debug-bar panels match the pre-change baseline, plugins headings match, console eval POST returns {TYPE:number, RESULT:5}, wheels migrate info works through the command bridge.
  • equalize: six private type helpers; every expect() in the suite flows through it (model suite 979/0).
  • Template Application.cfc: seven public $-prefixed helpers (request guards, reload gate, restart path). The onboarding harness shows the identical 34/10/3 result with the original and the refactored template — the 10 failures are pre-existing environmental (migration empty-string-default hardening vs. the harness fixture + sandbox cache denials).

Fixes made during verification

  • #-escaping: the debug-bar env-color extraction initially used single-# hex literals — # interpolates in CFScript strings too, which 500'd every page with the debug bar. Fixed to ##dc3545 etc.
  • Parity spec: ReloadEnvironmentSwitchParitySpec's environment-switch source pins now accept both the inline shape and the delegated-helper shape (computed before the gate; gate skips when already applied).

Verification

  • Local: hardener 247/0, cli 151 + parity 24/0, security 290/0, events 87/0 on a fresh server; model 979/0; debug bar/plugins/console/migrator hand-tests above.
  • Both complexity gates PASS.
  • CI runs the full Lucee suite + smokes on this PR.

No changelog fragment: internal refactor, no user-facing change.

…3/30/30 to max 25)

debug.cfm 64, consoleeval.cfm 60, cfmlerror.cfm 34, mcp.cfm 33,
plugins.cfm 30, and command.cfm 30 — branchy data logic moved into local
$-prefixed functions in each file. Render markup byte-identical; verified
live: debug bar panels match baseline, plugins headings match, console eval
POST returns {TYPE:number, RESULT:5}, wheels migrate info works through the
command bridge. Fixes a #-escaping bug in the debug env-color extraction
(##dc3545 etc. — # interpolates in CFScript strings too) caught by hand-testing.

Signed-off-by: Peter Amiri <peter@alurium.com>
Six private $-prefixed helpers for the simple-value, query, array, struct,
function, and XML comparison branches; pass/fail semantics and failure
messages unchanged (model suite 979/0 exercises every expect() through it).

Signed-off-by: Peter Amiri <peter@alurium.com>
…nRequestStart (44 to 4)

Seven public $-prefixed helpers in the Application.cfc shipped by
wheels new: content-only, debug-IP overrides, environment-switch detection,
rate limiting, refusal recording, the fail-closed reload gate, and the
restart path. The onboarding harness shows the identical 34/10/3 result with
the original and the refactored template (the 10 failures are pre-existing
environmental ones: migration empty-string-default hardening vs the harness
fixture + sandbox denials).

ReloadEnvironmentSwitchParitySpec: the two environment-switch source pins now
accept both the inline shape and the delegated-helper shape (same guarantee —
computed before the gate, gate skips on already-applied).

Signed-off-by: Peter Amiri <peter@alurium.com>
@bpamiri
bpamiri merged commit f098907 into develop Aug 29, 2026
13 checks passed
@bpamiri
bpamiri deleted the peter/complexity-burn-down-4 branch August 29, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant