fix(model): harden model-layer SHOULDs M2–M8 - #3399
Merged
Merged
Conversation
Failing specs for uniqueness soft-delete default, QueryBuilder raw where docs, create() class leak, GetTickCount nested keys, belongsTo inner orphans, hasChanged StructDelete, and open mass assignment. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.com>
Change validatesUniquenessOf and belongsTo defaults toward the fail-safe forms, keep create() mass-assign on the instance, replace the GetTickCount nested-key heuristic, detect StructDelete in hasChanged, document raw query-builder where(), and add an opt-in massAssignmentStrict guard. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.com>
Revert belongsTo include default joinType to inner. Opt-in joinType=outer still keeps orphan parents (hardener + restored #449/#3334 SQL pins). Invoke afterFind on each returnAs=struct row so callbacks no longer read columns off the class singleton. Co-authored-by: Peter Amiri <peter@alurium.com> Signed-off-by: Cursor Agent <cursoragent@cursor.com>
Prove default include drops orphans, and that a declared joinType=outer association keeps rows with no parent. Co-authored-by: Peter Amiri <peter@alurium.com> Signed-off-by: Cursor Agent <cursoragent@cursor.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
Model-layer Hardener SHOULDs M2–M8. Red proofs and green locks live in
vendor/wheels/tests/specs/model/hardener/.M6 is default-inner + opt-in outer.
belongsToinclude still defaults tojoinType="inner"(orphans are dropped). PassjoinType="outer"on the association to keep parent rows with no associated record. This PR does not change the belongsTo default to outer.Does not close #3378 or basecoat #15. Does not close unrelated issues. Do not merge. Keep draft.
Type of Change
Feature Completeness Checklist
Signed-off-by:vendor/wheels/tests/specs/model/hardener/ModelHardenerM2M8Spec.cfcplus existing-spec pin updates invalidationsSpec,crudSpec,queryBuilderSpecweb/sites/guides/src/content/docs/v4-0-0/basics/query-builder-and-scopes.mdx,upgrading/whats-new-in-4.mdx; APIbelongsto.md(default inner),validatesuniquenessof.md;vendor/wheels/public/docs/reference/model/{belongsto,validatesuniquenessof,accessibleproperties,protectedproperties}.txtCLAUDE.mdquery-builder line names the 1-arg raw-SQL exceptionchangelog.d/model-hardener-m2-m8.{added,changed,fixed}.md(no "belongsTo now defaults to outer" claim)596f22e3c. Full LuCLI still needs CI confirmation on this HEAD.Test Plan
(
directory=must point at a folder; a single-file scope discovers 0 bundles.)add1daaa4prove-red only):4 passed, 7 failed, 1 error(s).acfdf85cafix commit):12 passed.596f22e3c): restore default-inner + opt-in outer;afterFindonreturnAs=structrows.Local on
596f22e3c:wheels test --core --ci --filter=model.hardener→ 14 passed (0.04s)wheels test --core --ci --filter=model→ 983 passed (2.14s) (includes callbacksreturnAs=struct/ VIEWS path and restored JOINs should be grouped #449/SQL Generation Bug: Variable state leakage in findAll(include="...") when mixed nested and shallow joins are used #3334 SQL pins)PROVEN / UNPROVEN
validatesUniquenessOfdefaultincludeSoftDeletes=falseso a soft-deleted value can be reusedwheels test --core --ci --filter=model.hardener— 14 passedwhere()is raw SQL; class/docs no longer claim universal injection-safetycreate()does not mass-assign onto the shared class model (setOnModel=false)hasManykeys usenew-/_new/ blank PK, not aGetTickCountwindowbelongsToinclude is inner (orphans dropped). Opt-injoinType=outerkeeps orphans.crudSpecSQL pins infilter=modelhasChangedtreatsStructDeleteof a persisted property as a change;findAll(returnAs="struct")afterFind no longer reads columns off the classfilter=model(983 passed; VIEWS path inserialize.cfc)set(massAssignmentStrict=true). Default stays open.HEAD:
596f22e3c0d7e42ff29d510e6a6826fe0aa9ddec