Skip to content

refactor: burn down wave 3 — CLI commands, deploy parser, and service helpers - #3438

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

refactor: burn down wave 3 — CLI commands, deploy parser, and service helpers#3438
bpamiri merged 5 commits into
developfrom
peter/complexity-burn-down-3

Conversation

@bpamiri

@bpamiri bpamiri commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Third burn-down wave — the CLI (cli/lucli). Extract-method refactors only, no behavior change.

Before → after (cyclomatic complexity)

Function File Before After
deploy Module.cfc 94 8
runUpgradeCheck Module.cfc 71 12
browserTest Module.cfc 59 12
displayTestResults Module.cfc 46 16
generate Module.cfc 28 3
emitTapResults Module.cfc 28 13
$buildCiAnnotations Module.cfc 26 7
console Module.cfc 25 12
routes Module.cfc 23 8
parse DeployArgsParser.cfc 57 2
processTemplate Templates.cfc 32 1
$recordProvidersFromManifest Doctor.cfc 28 5
mapColumnToFormHelper Admin.cfc 25 3
generateScaffold Scaffold.cfc 22 17
mapToWheelsType Scaffold.cfc 20 3
extractFunctionBody Analysis.cfc 19 1
$createSQLFieldList sql.cfc (vendor) 52 30
$includeFile rendering.cfc (vendor) 31 10

CLI-wide: functions over complexity 50 drop 4 → 0; functions at 10 or under rise 843 → 890.

Key design decisions

  • Module.cfc helpers are all private $-prefixed — the CLI component's public functions auto-surface as subcommands + MCP tools, so nothing new is public. Deploy decomposes into a per-verb dispatcher ($deployMain, $deployApp, $deployProxy, $deployRegistry, $deployBuild, $deployAccessory, $deployPrune, $deployLock, $deployServerVerb, $deploySecretsVerb).
  • DeployArgsParser.parse becomes a thin token loop fanning out to five contiguous byte-identical slices of the original if/else chain.
  • One hardener spec updated: DeployAliasSshPoolSpec — the bootstrap/exec $deployBuildSshPool invariant moved into $deployServerVerb (param accessed as arguments.opts). Same guarantee, new location.
  • *$createSQLFieldList* (second pass): per-item class mapping + duplicate-prefix resolution extracted. A doubled-backslash regex bug introduced by the extraction was caught by associationsSpec (aggregate calculated property with distinct) and fixed — byte-compared against the original before commit.

Verification

  • CLI suite: 1189 pass / 0 fail (2 environmental Docker-sshd errors in SshClient/SshPool specs, pre-existing)
  • Deploy verb smoke: all verbs pass (build, registry, prune, bootstrap, exec, lock, secrets, flat aliases)
  • Vendor areas re-verified on Lucee 7 + SQLite: model 979/0, controller 529/0, view 581/0
  • Both complexity gates PASS
  • CI runs the full Lucee suite + deploy subsystem CI on this PR (deploy paths touched)

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

…dList and $includeFile

$createSQLFieldList 52 to 30: per-item class mapping and duplicate-prefix
resolution extracted (byte-identical statement moves; a doubled-backslash
regex bug caught by associationsSpec was fixed before commit — model specs
979/0 confirm). $includeFile 31 to 10: grouped-query, plain-query, and
objects render loops extracted; args structs mutate by reference. Controller
and view suites stay green.

Signed-off-by: Peter Amiri <peter@alurium.com>
… to 8/12/12/16)

deploy 94 to 8: per-verb dispatcher ($deployMain, $deployApp, $deployProxy,
$deployRegistry, $deployBuild, $deployAccessory, $deployPrune, $deployLock,
$deployServerVerb, $deploySecretsVerb, ssh-pool verbs). runUpgradeCheck 71 to
12: version resolution, check definitions, scan-file collection, execution, and
report helpers. browserTest 59 to 12 and displayTestResults 46 to 16: walk +
summary helpers. Also generate 28 to 3, emitTapResults 28 to 13,
$buildCiAnnotations 26 to 7, console 25 to 12, routes 23 to 8. 33 private
$-prefixed helpers (CLI component — private keeps them off the MCP surface).

DeployAliasSshPoolSpec's two source pins updated: the flat bootstrap/exec
$deployBuildSshPool invariant moved into $deployServerVerb (now accessed as
arguments.opts). CLI suite: 1189 pass / 0 fail (2 environmental docker-sshd
errors); deploy verb smoke: all verbs pass.

Signed-off-by: Peter Amiri <peter@alurium.com>
…57 to 2)

parse is now a thin token loop dispatching to $matchFlag, which fans out
to five contiguous private helpers ($parseDeployFlags, $parseConfigFlags,
$parseBuildFlags, $parseRuntimeFlags, $parseAppFlags) — each a byte-identical
slice of the original if/else chain with the same order and token-consumption
semantics. DeployArgsParserSpec + deploy verb smoke cover the behavior.

Signed-off-by: Peter Amiri <peter@alurium.com>
…lysis services

processTemplate 32 to 1, $recordProvidersFromManifest 28 to 5,
mapColumnToFormHelper 25 to 3, generateScaffold 22 to 17, mapToWheelsType 20
to 3, extractFunctionBody 19 to 1 — 20 private $-prefixed helpers across five
service components. Placeholder ordering, manifest fallbacks, type mappings,
and golden-file codegen output preserved verbatim.

Signed-off-by: Peter Amiri <peter@alurium.com>
The 3.x -> 4.x check definitions moved out of runUpgradeCheck into the
$upgradeBuildChecks helper (round-3 extraction), and the branch condition is
now arguments-qualified. The coverage spec's source slice searched for the
unqualified condition and the "// Run checks" marker, which no longer bound
the block — update the slice to the helper's branch condition and return
statement. All 13 breaker-coverage assertions re-targeted.

Signed-off-by: Peter Amiri <peter@alurium.com>
@bpamiri
bpamiri merged commit 0279495 into develop Aug 28, 2026
13 checks passed
@bpamiri
bpamiri deleted the peter/complexity-burn-down-3 branch August 28, 2026 22:46
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