refactor: burn down wave 2 — adapter type maps, ORM dynamic methods, URLFor, form/migrator helpers - #3437
Merged
Merged
Conversation
Three Adobe-only parser traps in the S6 optionsIncludeDefault describe: - a variable named `abstract` (reserved word on Adobe CF) — rename to abstractMigrator - `default` passed as a named argument to optionsIncludeDefault — use positional args - unquoted `default:` struct-literal keys — quote them Verified on Adobe 2023 + MySQL: database specs 101/0/0 (previously the whole leg failed at compile time with MissingNameException). Signed-off-by: Peter Amiri <peter@alurium.com>
The id column was varchar(36) (UUID-sized) but channel event ids can be arbitrarily long (spec ids like "test.hard.s1.<36 chars>" are 42+ chars), which made MySQL legs fail with "Data too long for column 'id'". Matches the channel/event columns' 255 width. Verified on Adobe 2023 + MySQL: channel specs 43/0/0. Signed-off-by: Peter Amiri <peter@alurium.com>
…2/2/6/2/2) Converts the constant switch cases in the four adapter $getType functions and AutoMigrator's $dbTypeToMigrationType into variables-scoped lookup structs. Lookups normalize with LCase (original switches are case-insensitive); conditional branches (MySQL unsigned) and default fallthroughs are preserved verbatim. Independent parity audit: every original case label present with identical result. Signed-off-by: Peter Amiri <peter@alurium.com>
…ionMethod (46/61 to 7/11)
Named-scope/enum/property/finder resolvers on the onMissingMethod side;
polymorphic belongsTo, hasOne, hasMany, and belongsTo dispatch on the
association side. Helpers return {handled, rv} so rv-may-be-unset semantics
and the MethodNotFound throw guard survive; missingMethodArguments is
mutated via struct-by-reference. No hardener source-pins on these functions.
Signed-off-by: Peter Amiri <peter@alurium.com>
…n (45/37 to 11/8) URLFor: route memo resolution, controller/action fallback, and route variable substitution helpers. $checkMinimumVersion: version-part parsing, BoxLang message, and shared/per-major floor helpers. Argument mutation via struct-by-reference; IncorrectRoutingArguments/IncorrectArguments throws and the BoxLang lazy Len(minimumBuild) semantics preserved. Signed-off-by: Peter Amiri <peter@alurium.com>
Route lookup + method matching + non-get/post rewrite move into a helper that mutates the args struct by reference and returns the original verb (empty string sentinel replaces the unset local — exactly equivalent because the original never set method to an empty string). Signed-off-by: Peter Amiri <peter@alurium.com>
…35 to 14/25) $expandedAssociations: metadata fill (double-checked lock, marker written last) and per-variant JOIN fragment construction extracted verbatim. migrateTo: down/up iteration loops extracted; transaction/lock boundaries live in untouched $runMigrationStep. Signed-off-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
Second burn-down wave on the framework's complexity hotspots. Extract-method / table-driven refactors only — no behavior change.
Before → after (cyclomatic complexity)
$getTypeH2 adapter$getTypePostgreSQL adapter$getTypeMySQL adapter$getTypeMSSQL adapter$dbTypeToMigrationType(AutoMigrator)$associationMethod(onmissingmethod)onMissingMethodURLFor(routing.cfm)$checkMinimumVersion(plugins.cfm)startFormTag(forms.cfc)$expandedAssociations(sql.cfc)migrateTo(Migrator.cfc)Repo-wide: functions over complexity 50 drop 7 → 3 (remaining are .cfm templates + $createSQLFieldList); functions at 10 or under rise to 2429.
How it was verified
$-prefixed mixin helpers, hardener-spec awareness.UUID→uuidcovered by the LCase-normalized lookup, matching the case-insensitive original switch).Also fixed along the way (separate PR #3436, already merged)
DatabaseAdapterHardenerSpec.cfc(var abstract,default =named args, unquoteddefault:keys)wheels_events.idwidened to varchar(255) for MySQL channel specsNo changelog fragment: internal refactor, no user-facing change.