fix(discovery): dead manual pin falls through instead of blanking the thumbnail; stabilize representative test #1441

Merged
chris merged 1 commit from fix/representative-thumbnail-flake into main 2026-10-29 22:30:05 +01:00
Owner

Fixes the intermittent PersonRelationServicePostgresTest.theChosenRepresentativeWinsOverTheLatestOccurrence failure that flaked CI on PR #1437 (run 5937) — verified pre-existing on clean main (2-of-4 fresh-rerun failure matrix on a pristine origin/main worktree, unrelated to the search branch).

Root cause — three stacked defects

  1. Test fixture: the pin was written as a bare representative_occurrence_id pointer without the manual_selection provenance pair, so the resolver never honored it — the test always exercised the terminal fallback ladder.
  2. That ladder was a full tie (equal confidence 0.9, no quality_score, NULL capture timestamps under the fixed clock) → the pick fell to the random-UUID cio.id DESC tiebreak → coin flip.
  3. Production bug exposed by fixing #1: a manual pin whose occurrence was later superseded (re-clustering, release, media delete) resolved to nothing — the validator rejected the dead pin without re-queueing the instance and the unresolved.isEmpty() early return skipped rules 2/3, blanking the thumbnail across every surface. Violates the documented ADR-0114 contract (never blank on a dead pin).

Fix

  • Production: resolveValidatedPinnedOccurrences returns rejected-pin ids; resolveChunk re-queues them into the unresolved candidate set so rules 2/3 run. Pinned still always wins while resolvable.
  • Test fixtures: production-shaped pin (provenance pair), quality_score seeded like the crop-accept path, supersede flips occurrence+discovery-result together.
  • New regression test deadManualPinFallsThroughInsteadOfBlankingTheThumbnail — red on unpatched resolver.

Validation

10/10 consecutive green --rerun runs of the target class; dev.memories.api.people.* + representative/face/self-person suites green; compile clean. Issue logged as ISSUE-223.

Fixes the intermittent `PersonRelationServicePostgresTest.theChosenRepresentativeWinsOverTheLatestOccurrence` failure that flaked CI on PR #1437 (run 5937) — verified pre-existing on clean main (2-of-4 fresh-rerun failure matrix on a pristine origin/main worktree, unrelated to the search branch). ## Root cause — three stacked defects 1. **Test fixture**: the pin was written as a bare `representative_occurrence_id` pointer without the `manual_selection` provenance pair, so the resolver never honored it — the test always exercised the terminal fallback ladder. 2. **That ladder was a full tie** (equal confidence 0.9, no quality_score, NULL capture timestamps under the fixed clock) → the pick fell to the random-UUID `cio.id DESC` tiebreak → coin flip. 3. **Production bug exposed by fixing #1**: a manual pin whose occurrence was later superseded (re-clustering, release, media delete) resolved to **nothing** — the validator rejected the dead pin without re-queueing the instance and the `unresolved.isEmpty()` early return skipped rules 2/3, blanking the thumbnail across every surface. Violates the documented ADR-0114 contract (never blank on a dead pin). ## Fix - Production: `resolveValidatedPinnedOccurrences` returns rejected-pin ids; `resolveChunk` re-queues them into the unresolved candidate set so rules 2/3 run. Pinned still always wins while resolvable. - Test fixtures: production-shaped pin (provenance pair), quality_score seeded like the crop-accept path, supersede flips occurrence+discovery-result together. - New regression test `deadManualPinFallsThroughInsteadOfBlankingTheThumbnail` — red on unpatched resolver. ## Validation 10/10 consecutive green `--rerun` runs of the target class; `dev.memories.api.people.*` + representative/face/self-person suites green; compile clean. Issue logged as ISSUE-223.
fix(discovery): dead manual pin falls through instead of blanking the thumbnail; stabilize representative test
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 3s
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Build Android CI image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Deploy review instance (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Successful in 28m6s
6886cb7dfa
Three stacked defects:

1. Test fixture: the pin was written as a bare pointer without the
   manual_selection provenance pair, so ClassInstanceRepresentativeService
   never honored it and the test always exercised the terminal fallback
   ladder.
2. That ladder was a full tie (equal confidence, no quality_score, NULL
   capture timestamps under a fixed clock), so the pick fell to the
   random-UUID cio.id DESC tiebreak — the intermittent
   theChosenRepresentativeWinsOverTheLatestOccurrence failure (2-of-4 on
   clean main).
3. Production bug the fixtures had hidden: a manual pin whose occurrence
   was later superseded (re-clustering, release, media delete) resolved
   to NOTHING — the validator rejected the dead pin without re-queueing
   the instance, and the unresolved.isEmpty() early return skipped rules
   2/3 entirely, blanking the thumbnail across every surface.

Fix: resolveValidatedPinnedOccurrences now returns rejected-pin ids and
resolveChunk re-queues them into the unresolved candidate set, restoring
the documented ADR-0114 fall-through (pinned still wins while
resolvable). Test fixtures now pin with the production provenance pair,
seed quality_score like the crop-accept path, and supersede
occurrence+discovery-result together; new regression test
deadManualPinFallsThroughInsteadOfBlankingTheThumbnail is red on the
unpatched resolver. 10/10 consecutive green reruns of
PersonRelationServicePostgresTest; people.* suite green.
chris merged commit cefaf7f1c3 into main 2026-10-29 22:30:05 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
chris/memories!1441
No description provided.