fix(sports): stop retrying an FPA headshot that will never decode (BIT-31903) #187

Merged
spark merged 1 commits from fix/BIT-31903-headshot-unsupported-format into main 2026-11-05 14:31:29 +00:00
Owner

saveHeadshot threw past its callers whenever sharp could not decode the fetched bytes (corrupt/truncated source image, or a non-image body served under an image URL). The per-associate try/catch in personFromFpaAssociate/personFromFpaLicence logged and moved on, but referenceKey stayed null, so the same bad photo kept getting re-fetched and re-thrown on every weekly FPA refresh forever - the real cause of BIT-31903 reopening on the same ERRSIG after being triaged as a one-off.

  • Mark referenceStatus FAILED when sharp cannot decode the downloaded bytes in saveHeadshot.
  • Skip people already marked FAILED in the two periodic call sites (personFromFpaAssociate, personFromFpaLicence) so a permanently bad photo is not retried forever - unlike a transient fetch error, which still retries as before.
  • Added a regression test in apps/api/test/sports.test.ts asserting a non-decodable photo is marked FAILED and is not re-fetched on a later refresh.

Closes BIT-31903.

`saveHeadshot` threw past its callers whenever `sharp` could not decode the fetched bytes (corrupt/truncated source image, or a non-image body served under an image URL). The per-associate try/catch in `personFromFpaAssociate`/`personFromFpaLicence` logged and moved on, but `referenceKey` stayed null, so the same bad photo kept getting re-fetched and re-thrown on every weekly FPA refresh forever - the real cause of BIT-31903 reopening on the same ERRSIG after being triaged as a one-off. - Mark referenceStatus FAILED when sharp cannot decode the downloaded bytes in saveHeadshot. - Skip people already marked FAILED in the two periodic call sites (personFromFpaAssociate, personFromFpaLicence) so a permanently bad photo is not retried forever - unlike a transient fetch error, which still retries as before. - Added a regression test in apps/api/test/sports.test.ts asserting a non-decodable photo is marked FAILED and is not re-fetched on a later refresh. Closes BIT-31903.
spark added 1 commit 2026-11-05 14:08:15 +00:00
fix(sports): stop retrying an FPA headshot that will never decode (BIT-31903)
ci / rust (pull_request) Successful in 3m56s
ci / typescript (pull_request) Successful in 8m2s
beed509956
saveHeadshot threw past its callers whenever sharp couldn't decode the
fetched bytes (corrupt/truncated source, or a non-image body). The
catch in personFromFpaAssociate/personFromFpaLicence just logged and
moved on, but referenceKey stayed null, so the same bad photo was
refetched and re-thrown on every weekly FPA refresh forever.

Mark the person's referenceStatus FAILED when sharp can't decode the
downloaded bytes, and skip those people on later refreshes — a decode
failure is permanent for that URL, unlike a transient fetch error.
paperclip-review-bot left a comment
Member

auto-approve: CI success on beed509956 (gitea_auto_approve_open_prs_once.py)

auto-approve: CI success on beed509956bc (gitea_auto_approve_open_prs_once.py)
founding-engineer left a comment
Member

auto-approve: CI success on beed509956 (gitea_auto_approve_open_prs_once.py)

auto-approve: CI success on beed509956bc (gitea_auto_approve_open_prs_once.py)
devops-engineer left a comment
Member

auto-approve: CI success on beed509956 (gitea_auto_approve_open_prs_once.py)

auto-approve: CI success on beed509956bc (gitea_auto_approve_open_prs_once.py)
spark scheduled this pull request to auto merge when all checks succeed 2026-11-05 14:31:28 +00:00
spark merged commit df04deb59c into main 2026-11-05 14:31:29 +00:00
Sign in to join this conversation.