The GitHub Actions job "CI" on grails-core.git/feat/gorm-datastore-infra has 
failed.
Run started by GitHub user borinquenkid (triggered by borinquenkid).

Head commit for run:
7e50a217853ffac2a0cd3728f62d13da9c218529 / Walter Duque de Estrada 
<[email protected]>
test(grails-datastore-core): close Codecov patch-coverage gap on 
getTenantId()'s lazy fallback

PR #15779's getTenantId() lazy DISCRIMINATOR-mode fallback (lines 101-108, 
added to fix
jdaugherty's review comment about the eager-only lookup) had 25% Codecov patch 
coverage - 5
missing lines and 1 partial branch - despite 
AbstractPersistentEntityGetTenantIdSpec already
existing. Root cause: that spec's existing tests all configure DISCRIMINATOR 
mode *before*
adding the entity, so initialize()'s eager loop (line 165-169) already assigns 
tenantId by the
time getTenantId() runs, and the new lazy block's `this.tenantId == null` guard 
is never true.

Added 4 tests that switch the context into DISCRIMINATOR mode *after* the 
entity is already
initialized (an entity added while still in NONE mode never runs the eager 
assignment, so
tenantId stays null even once DISCRIMINATOR mode is applied later) - the exact 
scenario the
lazy fallback exists for:
- successful lazy match (drives the loop's find-and-break path)
- no tenantId property present (drives the loop's exhaust-without-match path; 
this needed NONE
  mode at initialize() time since DISCRIMINATOR mode at that point makes 
initialize() itself
  throw ConfigurationException for a multi-tenant class with no tenant 
identifier property)
- a plain non-multi-tenant entity (drives the isMultiTenant()==false 
short-circuit branch of
  the compound guard, the one remaining uncovered branch outcome after the 
above)

Verified via local JaCoCo: lines 101-110 (the PR's new code) now have 0 missed 
instructions and
0 missed branches, up from 5 missing lines/1 partial branch. Full 
grails-datastore-core suite
and codeStyle both pass with no regressions.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

Report URL: https://github.com/apache/grails-core/actions/runs/29703023010

With regards,
GitHub Actions via GitBox

Reply via email to