fix(faces,autopilot): align crop-scale tests with linear semantics, fix dead vote gate #230

Closed
spark wants to merge 0 commits from fix/BIT-32084-ci-regression-tests into main
pull from: fix/BIT-32084-ci-regression-tests
Owner

Fixes BIT-32084 (ci / typescript red on main, blocking auto-merge for every open PR including #207/BIT-32083).

Root cause: two independent bugs introduced alongside the recent faces/autopilot refactors (not infra/DB-related):

  1. apps/api/src/autopilot/learning.ts's crop-scale refactor (c23432c) moved the area→linear sqrt conversion earlier into cropBiasOf, but two test/autopilot.test.ts expectations were left on the old area-ratio values (0.75→0.866 for the geometric-mean case; 0.7→0.75 for the pre-existing 0.75 floor clamp).
  2. Same test file: FoldedCrop became { rect, angle } in that refactor, but a test still read .x0/.x1/.y0/.y1 directly off it. That silently evaluated to undefined → NaN → null through the JSON round-trip, collapsing the learnt crop factor to null. Fixed by reading .rect.x0 etc.
  3. apps/api/src/faces/service.ts: the sure-face 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 (exactly the failing test's scenario) votes is always 1, so the penalty could never fire. Removed the redundant >= 2 gate.

Verified in an isolated, freshly rebuilt sandbox (own pnpm install + rebuilt @photoreport/contracts/@photoreport/metadata, not reusing any shared worktree state): autopilot.test.ts + faces.test.ts are 41/41 green.

Unblocks: PR #207 (BIT-32083) and any other PR currently failing ci / typescript only because of this.

Fixes BIT-32084 (`ci / typescript` red on `main`, blocking auto-merge for every open PR including #207/BIT-32083). Root cause: two independent bugs introduced alongside the recent faces/autopilot refactors (not infra/DB-related): 1. `apps/api/src/autopilot/learning.ts`'s crop-scale refactor (`c23432c`) moved the area→linear sqrt conversion earlier into `cropBiasOf`, but two `test/autopilot.test.ts` expectations were left on the old area-ratio values (0.75→0.866 for the geometric-mean case; 0.7→0.75 for the pre-existing 0.75 floor clamp). 2. Same test file: `FoldedCrop` became `{ rect, angle }` in that refactor, but a test still read `.x0/.x1/.y0/.y1` directly off it. That silently evaluated to `undefined` → `NaN` → `null` through the JSON round-trip, collapsing the learnt crop factor to `null`. Fixed by reading `.rect.x0` etc. 3. `apps/api/src/faces/service.ts`: the sure-face 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 (exactly the failing test's scenario) `votes` is always 1, so the penalty could never fire. Removed the redundant `>= 2` gate. Verified in an isolated, freshly rebuilt sandbox (own `pnpm install` + rebuilt `@photoreport/contracts`/`@photoreport/metadata`, not reusing any shared worktree state): `autopilot.test.ts` + `faces.test.ts` are 41/41 green. Unblocks: PR #207 (BIT-32083) and any other PR currently failing `ci / typescript` only because of this.
spark added 1 commit 2026-11-06 22:29:54 +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.
Member

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

  • Head: d5a7271ddde5
  • 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#230: CI is red on the PR head. - Head: `d5a7271ddde5` - 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=d5a7271ddde5 -->
Author
Owner

ci/typescript on this PR was red because the pull_request merge-ref inherits main's facesOf()/personUrl typecheck break (SportsService calling a UrlSigner method off a LocalStorage field) - unrelated to this PR's own fix, but it meant this branch could never go green standalone.

Merged this branch into fix/BIT-32085-sports-youth-m19-regression (PR #231), which fixes that typecheck break plus its own BIT-32085 scope. Full apps/api suite is green there now (450 passed/0 failed). Once #231 merges to main, this branch should rebase clean with no diff - safe to close as superseded at that point, or keep open if you want the commit history separate.

ci/typescript on this PR was red because the pull_request merge-ref inherits main's facesOf()/personUrl typecheck break (SportsService calling a UrlSigner method off a LocalStorage field) - unrelated to this PR's own fix, but it meant this branch could never go green standalone. Merged this branch into fix/BIT-32085-sports-youth-m19-regression (PR #231), which fixes that typecheck break plus its own BIT-32085 scope. Full apps/api suite is green there now (450 passed/0 failed). Once #231 merges to main, this branch should rebase clean with no diff - safe to close as superseded at that point, or keep open if you want the commit history separate.
Author
Owner

#231 merged to main as 837e3d7, carrying this branch's commit (d5a7271) in full - confirmed git merge-base --is-ancestor origin/fix/BIT-32084-ci-regression-tests origin/main is true. BIT-32084's fix is live on main. Closing this PR as superseded; no further action needed here.

#231 merged to main as 837e3d7, carrying this branch's commit (d5a7271) in full - confirmed `git merge-base --is-ancestor origin/fix/BIT-32084-ci-regression-tests origin/main` is true. BIT-32084's fix is live on main. Closing this PR as superseded; no further action needed here.
spark closed this pull request 2026-11-06 23:32:18 +00:00

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.