Skip to content

test: support full-null relationship coverage - #312

Open
elpete wants to merge 2 commits into
nextfrom
test/154-full-null-belongs-to
Open

test: support full-null relationship coverage#312
elpete wants to merge 2 commits into
nextfrom
test/154-full-null-belongs-to

Conversation

@elpete

@elpete elpete commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Closes #154

Issue review

Recommendation: 10/10. Empty belongs-to relationships must work under Lucee full-null support. Null mode is an engine-level compatibility setting, and relationship access should preserve the same semantic result in either representation.

Reasons for:

  • A missing foreign key is normal relationship state, not an exceptional condition.
  • Quick and qb should accept a real null anywhere the partial-null runtime previously supplied an empty string.
  • Tests should assert Quick null semantics instead of coupling unrelated behavior to one engine representation.

Tradeoffs:

  • Full-null and partial-null modes intentionally expose different raw values. Cross-mode tests need semantic assertions or narrowly normalized snapshots when their actual subject is casing or query shape.

Reproduction review

I launched a separate Lucee 6.2.8.20 server with -Dlucee.full.null.support=true and current qb 14.0.0-beta.3. The existing public test getInstance( "Post" ).find( 7777 ).getAuthor() returned null without throwing, so the original Quick/qb exception no longer reproduces.

The first full-null suite run exposed seven failing assertions and zero errors. They were stale tests that hard-coded partial-null empty strings or compared snapshots without normalizing null representation; the product behavior itself was correct. I updated those tests to assert public null semantics where possible and normalized only the representation fields in snapshot-focused tests.

Implementation

No production behavior change was necessary. The test updates:

  • use isNullAttribute() and isNullValue() for entity null behavior;
  • keep the BooleanCast regression entirely on the public entity flow and assert semantic null preservation;
  • verify readonly persistence through a reloaded Quick entity;
  • normalize nullable fields only in memento/asQuery snapshot comparisons;
  • correct the expected component casing of externalID;
  • make the belongs-to dissociation assertion valid in both null modes.

Validation

Lucee full-null mode:

  • Focused affected bundles: 76 passed, 0 failed, 0 errors
  • Full suite: 495 passed, 0 failed, 0 errors, 3 skipped

Normal Lucee mode:

  • Focused affected bundles: 76 passed, 0 failed, 0 errors
  • Full suite: 495 passed, 0 failed, 0 errors, 3 skipped

Also:

  • box run-script format
  • git diff --check

Dependency: latest prerelease qb 14.0.0-beta.3.

@elpete

elpete commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator Author

Attempted reproduction: I ran the existing public empty-belongs-to flow on a dedicated Lucee 6.2.8.20 server started with -Dlucee.full.null.support=true and qb 14.0.0-beta.3. getInstance( "Post" ).find( 7777 ).getAuthor() returned null and did not throw, so the original exception no longer reproduces. I then made the surrounding tests representation-independent and verified the entire suite in both full-null and normal modes: each finished with 495 passed, 0 failed, 0 errors, and 3 skipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant