Skip to content

Augment a shared term handle through the replicator set that owns the term - #1565

Merged
bpmore merged 1 commit into
mainfrom
1517-certification-term-overlay
Nov 26, 2026
Merged

bpmore merged 1 commit into
mainfrom
1517-certification-term-overlay

Conversation

@joshdaugherty

Copy link
Copy Markdown
Contributor

Closes #1517.

An assessment-based certificate's Certification JSON-LD again leaves out its audit and expiration dates on statamic/cms 6.43.1. The schema context now augments a term stored under a handle shared by two replicator sets through the set whose taxonomy holds the term, rather than the first single-item field.

The bug

Two replicator sets on people store a term under activity: a degree row (taxonomies: [credentials]) and a certification row (taxonomies: [certifications]). selectTermsLikeBlueprintFieldForMergedValue() chose between same-handle fields by storage shape only, so a certification slug was augmented through the degree row's field, as a credentials term. Probed on 6.43.1: the certificate slug augmented with the credentials field config and returned null, which CertificationRowKind::termKind() then received as an empty collection.

The statamic/cms change that exposed it

statamic/cms#15974 (commit 92d484b83, first tagged in v6.43.0), "Cache term augmentation with taxonomy-qualified ID", in src/Fieldtypes/Terms.php:

  • v6.40.0, line 161: Blink::has($key = 'terms-augment-'.$site.'-'.json_encode($values)), keyed by the bare slug.
  • v6.43.1 and v6.44.0, line 165: $key = 'terms-augment-'.$site.'-'.json_encode($this->convertAugmentationValuesToIds($values));, keyed by taxonomy::slug.

Under the bare-slug key, the wrong-field augment hit the term an earlier augment through the right field had cached, so the wrong choice was invisible. Under the qualified key it misses, queries credentials::<slug>, and finds nothing. Confirmed on 6.43.1 by putting v6.40.0's key line back into vendor/statamic/cms/src/Fieldtypes/Terms.php with no site change: both tests passed (10 of 10), and failed again with the vendor file restored. git diff v6.43.1 v6.44.0 is empty for src/Fieldtypes/Terms.php, src/Stache/Query/TermQueryBuilder.php, src/Fields/Value.php and src/Taxonomies/.

Approach

No composer.json or composer.lock change.

Verification

Measured on Windows 11, PHP 8.4, in a worktree of this branch at 047f47862.

statamic/cms Lock used CertificationSchemaDatesJsonLdTest + CertificationNodeCountJsonLdTest
6.40.0 main without the fix: 10 passed; with it: 10 passed
6.43.1 #1563's branch, installed for the measurement and not committed without the fix: 2 failed, 8 passed (the two named in #1517); with it: 10 passed
6.44.0 none available not measured (no branch locks it, and moving the lock is outside this ticket); the four upstream paths above are unchanged from 6.43.1
  • The new dataset is version-independent: with the narrowing disabled (return $candidates;), the five rows expecting the certification field fail and the three expecting the degree field pass; restored, 8 of 8 pass.
  • SchemaOutputServiceTermsLikeTest and SchemaOutputServiceGuardsTest: 285 passed.
  • Every tests/Feature/Certification*Test.php and tests/Feature/Services/SchemaTemplates/SchemaOutputService*Test.php file (23 files) on 6.40.0, with vendor/bin/pest: 778 passed, 8 risky, 0 failed. The two edited test files report no risky test when run alone.
  • Pint, PHPStan (composer stan, no errors), Rector dry run on the changed app/ file, cspell on the three files, check-mutate-ignore-breadth and check-parallel-safe-tests pass.

Companion PRs

Test plan

  • Both tests pass on 6.40.0 and on 6.43.1 with the fix, and fail on 6.43.1 without it.
  • The selection dataset fails with the narrowing disabled.
  • Local CI green (node scripts/ci-local.mjs --branch 1517-certification-term-overlay).

- Two replicator sets on `people` store a term under `activity`: a degree row (`credentials`) and a certification row (`certifications`). The schema context picked the first single-item field, so a certification slug was augmented as a `credentials` term.
- On `statamic/cms` 6.40.0 the bare-slug Blink key in `Terms::augment()` returned the term an earlier augment had cached, which hid the wrong choice. Since 6.43.0 (statamic/cms#15974) the key is taxonomy-qualified, so the lookup misses and the row's kind resolves to null.
- Narrow same-handle candidates to those whose taxonomies hold the stored term before choosing by shape.

Closes #1517.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joshdaugherty joshdaugherty self-assigned this Nov 26, 2026
@bpmore

bpmore commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Gate verdict: ready, merging at 047f47862596426e313817e53a295dd950030ccb

@bpmore
bpmore merged commit a145df9 into main Nov 26, 2026
74 checks passed
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.

Keep assessment-based certificate dates out of the Certification JSON-LD on statamic/cms 6.44

2 participants