fix(sports): wire a signer into SportsService and stamp M19 friendlies lastIngestAt (BIT-32085) #231

Merged
spark merged 3 commits from fix/BIT-32085-sports-youth-m19-regression into main 2026-11-06 23:31:59 +00:00
Owner

Fixes BIT-32085.

test/sports.test.ts had 2 reported failures on main, plus a tsc break and an uncapped refetch bug surfaced while reproducing them:

  1. Typecheck break (blocks ci/typescript on every PR): SportsService.facesOf() (added in the squads-face feature, commit c125d6e) called this.deps.storage.personUrl(...), but personUrl lives on UrlSigner, not LocalStorage. Added signer: UrlSigner to SportsDeps and wired it through app.ts, worker.ts, and the three places test/sports.test.ts constructs SportsService directly.
  2. Uncapped refetch: saveM19Friendlies()'s sportsCompetition.upsert for the new M19-AMIG competition never set lastIngestAt, so refreshDue() always treated the FPA group as due and refetched everything on every call instead of respecting the six-hour cache. Now stamps lastIngestAt: now like every other competition.
  3. Stale test expectations: the "15 vs 16 competitions" and "externalId 228107 number null vs 12" failures were the test lagging behind intentional recent data: M19-AMIG (the Portugal-Spain U19 friendlies) and the real shirt number from the Caminha match report (src/sports/national.ts's M19_POR_2026, already hardcoded as "12"). Updated the assertions to match.

Verified: DATABASE_URL_TEST=... npx vitest run test/sports.test.ts -> 18/18 passing; tsc -p tsconfig.json --noEmit clean on apps/api.

Note: a full apps/api vitest run still shows 4 unrelated failures in autopilot.test.ts/faces.test.ts - that is BIT-32084, already fixed by open PR #230; out of scope here.

Fixes BIT-32085. test/sports.test.ts had 2 reported failures on main, plus a tsc break and an uncapped refetch bug surfaced while reproducing them: 1. Typecheck break (blocks ci/typescript on every PR): SportsService.facesOf() (added in the squads-face feature, commit c125d6e) called this.deps.storage.personUrl(...), but personUrl lives on UrlSigner, not LocalStorage. Added signer: UrlSigner to SportsDeps and wired it through app.ts, worker.ts, and the three places test/sports.test.ts constructs SportsService directly. 2. Uncapped refetch: saveM19Friendlies()'s sportsCompetition.upsert for the new M19-AMIG competition never set lastIngestAt, so refreshDue() always treated the FPA group as due and refetched everything on every call instead of respecting the six-hour cache. Now stamps lastIngestAt: now like every other competition. 3. Stale test expectations: the "15 vs 16 competitions" and "externalId 228107 number null vs 12" failures were the test lagging behind intentional recent data: M19-AMIG (the Portugal-Spain U19 friendlies) and the real shirt number from the Caminha match report (src/sports/national.ts's M19_POR_2026, already hardcoded as "12"). Updated the assertions to match. Verified: DATABASE_URL_TEST=... npx vitest run test/sports.test.ts -> 18/18 passing; tsc -p tsconfig.json --noEmit clean on apps/api. Note: a full apps/api vitest run still shows 4 unrelated failures in autopilot.test.ts/faces.test.ts - that is BIT-32084, already fixed by open PR #230; out of scope here.
spark added 1 commit 2026-11-06 22:50:20 +00:00
fix(sports): wire a signer into SportsService and stamp the M19 friendlies' lastIngestAt (BIT-32085)
ci / rust (pull_request) Successful in 4m28s
ci / typescript (pull_request) Failing after 8m23s
e108c12d2b
facesOf() called storage.personUrl(), but signed URLs live on UrlSigner, not
LocalStorage — a typecheck break that blocks ci/typescript on every PR.
Threaded SportsDeps.signer through app.ts, worker.ts and the tests that
construct SportsService directly.

saveM19Friendlies()'s upsert never set lastIngestAt, so refreshDue() saw the
FPA group as always due and refetched everything on every call instead of
respecting the six-hour cache.

Also updates two sports.test.ts assertions (15 vs 16 competitions, and
externalId 228107's shirt number) that were written before the M19-AMIG
youth friendlies and verified Caminha match-report numbers landed.
Member

@cto — Gitea autopilot needs a CTO decision on BitReport.pt/photoreport#231: CI is red on the PR head.

  • Head: e108c12d2b59
  • Detail: failed contexts: ci / typescript (pull_request)
  • The bot did not approve or schedule a merge for this head.
  • Fix the branch, approve as CTO, or close the PR. The bot re-checks on the next run.
@cto — Gitea autopilot needs a CTO decision on BitReport.pt/photoreport#231: CI is red on the PR head. - Head: `e108c12d2b59` - Detail: failed contexts: ci / typescript (pull_request) - The bot did **not** approve or schedule a merge for this head. - Fix the branch, approve as CTO, or close the PR. The bot re-checks on the next run. <!-- gitea-autopilot-escalation kind=ci_failure sha=e108c12d2b59 -->
spark added 2 commits 2026-11-06 23:15:16 +00:00
fix(faces,autopilot): align crop-scale tests with linear semantics, fix dead vote gate
ci / typescript (pull_request) Failing after 4m7s
ci / rust (pull_request) Successful in 7m39s
d5a7271ddd
The crop-geometry refactor moved the area→linear sqrt conversion into
cropBiasOf but left two learning.ts test expectations on the old
area-ratio values, and a FoldedCrop.x0/.x1/.y0/.y1 access that no
longer exists now that FoldedCrop is { rect, angle } (silently
NaN -> null through the JSON round-trip, collapsing the learnt crop
factor to null).

In faces/service.ts, the conflicting-number score penalty required
read.votes >= 2, but majorityNumber() already only returns a result
once it has a real majority -- for a single-face group votes is
always 1, so the penalty could never fire.
Merge remote-tracking branch 'origin/fix/BIT-32084-ci-regression-tests' into fix/BIT-32085-sports-youth-m19-regression
ci / rust (pull_request) Successful in 4m7s
ci / typescript (pull_request) Successful in 8m9s
ea6578133f
Author
Owner

Merged origin/fix/BIT-32084-ci-regression-tests into this branch to break a circular CI block: this PR's merge-ref inherited the pre-existing autopilot/faces test failures that #230 fixes, and #230's merge-ref inherited the facesOf()/personUrl typecheck break that this PR fixes. Neither could go green alone. Reverified locally after the merge: build/typecheck clean, full apps/api suite 450 passed, 0 failed.

Merged origin/fix/BIT-32084-ci-regression-tests into this branch to break a circular CI block: this PR's merge-ref inherited the pre-existing autopilot/faces test failures that #230 fixes, and #230's merge-ref inherited the facesOf()/personUrl typecheck break that this PR fixes. Neither could go green alone. Reverified locally after the merge: build/typecheck clean, full apps/api suite 450 passed, 0 failed.
spark merged commit 837e3d70dc into main 2026-11-06 23:31:59 +00:00
Sign in to join this conversation.