Repository navigation
test: put back the model class state four specs change - #4365
Conversation
The label specs call validatesPresenceOf() on a tag object, which registers on the shared tag class, so every later tag save in the run had to pass presence checks on name and virtual. A full-suite run's tag create was rejected for an empty virtual property and sent no INSERT. The label specs now restore the class's validations after each spec, and a check confirms the tag class ends the bundle with the validations it started with. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Peter Amiri <peter@alurium.com>
|
rev1-r3 review @ 6ac6ad9: code APPROVE (final sign-off after orch1's matrix run, or PR CI if orch1 treats this test-only change as PR-CI-gated)
Not blocking, one robustness point: the pin compares The three other shared-class leaks listed in the body ( |
Three model specs register a validation or callback on a shared model class (or clear all its callbacks) and never put it back: - ModelHardenerM2M8Spec adds a uniqueness validation to post. - transactionsSpec adds an afterSave crashMe callback to tagWithDataCallbacks. - ModelSurfaceCoverageSpec cleared every post callback with $clearCallbacks(). Each now snapshots the class struct, restores it in a catch-free finally, and checks the class ends the bundle as it started. The checks, including the formsSpec one, compare a canonical form with struct keys sorted, so struct key order can't make them flaky. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Peter Amiri <peter@alurium.com>
|
rev1-r3 re-review @ b79e874: code APPROVE (final sign-off after matrix run 37344929902 and PR CI) Four specs now put back the shared model-class state they change, each with a no-leftover check compared through
These are test-harness files under |
Wheels Test Results224 116 tests 218 995 ✅ 1h 27m 24s ⏱️ Results for commit b79e874. |
|
rev1-r3 review @ b79e874: APPROVE (final; matrix run 37344929902 read leg by leg, PR CI checked)
|
Summary
Test-only. Four specs register a validation or callback on a shared model class, or clear its callbacks, without putting the class back. Model classes are shared for the whole test run, so the change follows every later spec that uses that model.
view/formsSpec.cfc("Tests that label")tag.validatesPresenceOf(properties = "name" / "virtual")→ every latertagsave needed bothmodel/hardener/ModelHardenerM2M8Spec.cfc(M2)newPost.validatesUniquenessOf(properties = "title", includeSoftDeletes = true)→ a second uniqueness validation on every laterpostsavemodel/transactionsSpec.cfc("rollback when error raised")tagModel.afterSave(methods = "crashMe")→ every latertagWithDataCallbackssave rancrashMemodel/ModelSurfaceCoverageSpec.cfc(callback registration helpers)m.$clearCallbacks()with no type wiped everypostcallback. It's harmless today, because the registrars there are called withoutmethods(they register nothing) andpost'sconfig()declares no callbacks, but it would silently drop any callbackpostgains.How it was found. A spec in #4357 created a
tagand expected an INSERT. It passed when its directory ran alone, but in a full run the create sent no INSERT: thetagclass carried the formsSpec presence validations, and the create failed withVirtual property can't be empty.Fix (same shape in each spec)
validationsorcallbackswithDuplicate()before the spec changes them.finally.SerializeJSON($canonicalCacheValue(...)), which sorts struct keys at every depth, so struct key order can't make them flaky.Tests
RED from a clean develop worktree, Lucee 7. Each spec was copied in with only its new check (the restore line removed):
keeps only the validations it was configured with: expectedonSave: [], received the presence validations.leaves the post class with only the validations it was configured with: received an extra$validatesUniquenessOf.leaves the tagWithDataCallbacks class with only the callbacks it was configured with: receivedcrashMeinafterSave.GREEN, full core suite on SQLite, 546 bundles, 0 fail / 0 error:
Adobe and RustCFML are covered by the matrix (the change is test-only).
🤖 Generated with Claude Code