Skip to content

fix: align detection overlays and prepare field.5 - #34

Merged
JasonWildMe merged 4 commits into
WildMeOrg:wildlife-reidfrom
BMichaelJ:fix/field5-detection-overlay
Sep 10, 2026
Merged

fix: align detection overlays and prepare field.5#34
JasonWildMe merged 4 commits into
WildMeOrg:wildlife-reidfrom
BMichaelJ:fix/field5-detection-overlay

Conversation

@BMichaelJ

@BMichaelJ BMichaelJ commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix detection boxes being scaled to the whole image container instead of the
photo's aspect-fit rectangle. Blank margins could stretch or displace the
overlay even when the saved detector crop was correct.

  • Measure image and layout dimensions, derive the contained image rectangle,
    and render the existing normalized boxes within it.
  • Hide overlays until dimensions are valid and reset image state on source
    changes. Stale load/error callbacks cannot change a replacement photo.
  • Keep detections reviewable through a scrollable fallback while the photo is
    loading, missing, or failed. A decode failure shows a safe error and retry;
    the existing note-saving review path is preserved.
  • Prepare signed Android 0.1.0-field.5 / 1787551546 from f42c618.
  • Based on merged PR feat: add EleBook offline individual browser #33 (a2e47f7), including Jason's token alias and short
    pack path fixes. No detector thresholds, weights, crop math, backend,
    pack format, or dependencies changed in this PR.

Review Follow-up (2026-09-10)

Jason's failed-image navigation request is addressed in e291fb8, including
the trailing newline. Six new red/green regressions cover missing/loading/failed
photos, per-detection review access, retry and late callbacks, and failed note
persistence. All 38 screen tests and 1,031 Jest tests pass.

Two independent iOS CI failures were addressed: debug native XCTest hosts no
longer start React Native without Metro, and the download tests now insert
fixtures under the existing barrier queue rather than racing background state
restoration. Production download behavior is unchanged.

CI run 34487558000
passed all four jobs on current head 65cbaaa, including the native iOS tests.
The archived field.5 APK and screenshots below remain evidence of the original
geometry fix only; they do not contain these follow-up commits.

An explicitly approved field.6 integration candidate (41c2dca) combines this
PR's runtime changes with #35. On Pixel9a Android16, upright/rotated/mirrored
gallery fixtures produced aligned boxes, close crop pixels, and the same top
match. Four pre-upgrade records were preserved; three new TEST ONLY records
remain pending/unsynced. Offline cold start and catalog return passed, and all
temporary phone settings were restored. The photo-error fallback is covered
by component tests, not by removing a device photo. Neither PR is merged, and
the candidate is not distributed.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (code change that neither fixes a bug nor adds a feature)
  • Chore (build process, CI, dependency updates, etc.)

Screenshots / Screen Recordings

Android

Before/after screenshots from the same approved fixture were captured on the
signed release on a Pixel 9a. The two cropped, metadata-free attachments below
were approved for publication. Raw screenshots and user records stay local and
are not committed.

Before After
Field.4 overlay extends into the blank margin Field.5 overlay follows the displayed photo
field.4: box height 693px, extending below the photo field.5: box height 322px, aligned to the photo; width remains 307px

iOS

Physical iPhone and simulator UI validation not performed on this Windows host.
The shared React Native geometry/lifecycle regressions run in Jest.

Checklist

General

  • My code follows the project's coding style and conventions
  • I have performed a self-review of my code
  • I have added/updated comments where the logic isn't self-evident
  • My changes generate no new warnings or errors

Testing

  • I have tested on Android (physical device or emulator)
  • I have tested on iOS (native simulator tests in CI; not UI or physical-device acceptance)
  • I have tested in light mode and dark mode
  • Existing tests pass locally (npm test)
  • I have added tests that prove my fix is effective or my feature works

Original field.5 gates at f42c618: all 67 Jest suites / 1,025 tests passed through the commit hook;
18 Android unit tests, TypeScript, JS lint, Android lint, and signed release
build passed. The combined npm test includes iOS tooling unavailable here.
Two existing JS lint warnings and existing Android baseline/deprecation warnings
remain. No full iOS pass is claimed from these local gates.

13 new geometry/lifecycle tests failed before the change, then passed:
landscape/portrait/square/matching-aspect frames, resize, invalid dimensions,
loading/error states, missing photos, and source changes with stale callbacks.
Jason's token-alias and pack-path regression suites also passed.

Physical evidence on the exact signed field.5 APK:

  • Reproduced the original defect with an approved 7008x4672 fixture on field.4.
  • After update, box coordinates matched the fitted-image calculation within
    1.1px in portrait, landscape, and light appearance. Keyboard interaction kept
    alignment but did not resize the frame; actual resize was checked by rotation.
  • 3,600 interior crop pixel samples matched field.4 exactly.
  • All three pre-upgrade records (two original plus one pending TEST ONLY record)
    survived; a second pending test record was added for the after comparison.
  • Offline catalog/profile/image Back retained position (0px delta), and release
    cold startup succeeded without Metro or detected fatal/JS startup errors.
  • Release data identity and development installation unchanged. No uploads,
    approvals, or deletion. Connectivity/location/rotation/appearance restored.

React Native Specific

  • No new native module without corresponding platform implementation (Android + iOS)
  • New native modules are added to the Xcode project build target (project.pbxproj) (not applicable: none added)
  • No hardcoded pixel values - uses measured image/layout geometry and existing theme constants
  • Styles use useThemedStyles pattern
  • Animations/gestures work smoothly on both platforms
  • Large lists use FlatList / FlashList (unchanged)
  • No unnecessary re-renders introduced (state changes are image/layout events; no profiler claim)

Performance & Models

  • Downloads / long-running tasks report progress to the UI (unchanged)
  • File paths are resolved correctly on both platforms (no path changes in this PR)
  • Large files (models, assets) are not committed to the repository

Security

  • No secrets, API keys, or credentials are included in the code
  • User input is validated/sanitized where applicable

Related Issues

Follow-up to Jason's YOLO11 box screenshot and merged #33.

Additional Notes

  • APK SHA-256: 6be6a02258fca9065cfe52392e1dccd2bf89200f03ca1157d58685c12ab8f16e.
  • Signed ARM64, non-debuggable, existing release certificate; APK source map
    checked against the overlay and both merged Jason fixes. No model, observation,
    credential, or signing material bundled.
  • Android 9/BlueStacks and physical iPhone retests remain open. Pixel Android16
    does not establish older Keystore/ARM-translation compatibility. No fresh
    sign-in or new pack download was attempted in this device run; existing packs
    retain their previous absolute paths. Jason's alias change requires a fresh
    sign-in for previously signed-in Android12+/iOS users.
  • Keep Hermes prebuilt/fallback CI hardening and detector threshold calibration
    separate. The current npm install reports 31 existing dependency findings
    (2 low, 19 moderate, 9 high, 1 critical); no dependency changes/remediation here.
  • Tester bundle remains local. No public release, distribution, or auto-merge.

@BMichaelJ

Copy link
Copy Markdown
Collaborator Author

/gemini review

@JasonWildMe

Copy link
Copy Markdown

Thank you!

Fix looks sound. One suggestion from the bots to prevent stuck navigation where image loading fails.

One item should be fixed before merge. Gating the overlay on a valid frame means a photo that fails to decode now renders no boxes at all. Base rendered them unconditionally, misplaced but tappable. This screen's boxes are the only in-screen route into Match Review, so a decode failure leaves a blank photo area, no error text, and no way forward, while the header still reports unreviewed detections and Save All stays enabled. The suite encodes this as intended behavior, so it was a deliberate choice, but it needs a fallback state. The missing trailing newline in the new component is worth the same commit, since no lint job catches it.

@BMichaelJ

Copy link
Copy Markdown
Collaborator Author

@JasonWildMe Addressed your failed-image navigation blocker in e291fb8, including the trailing newline.

  • Missing, failed, or loading photos keep a scrollable review action for every detection.
  • Decode failures show "Photo unavailable" and Retry; no raw error/path is displayed.
  • Review actions use the existing note-saving path, and stale retry callbacks cannot hide or distort the recovered photo.
  • Six new regressions failed before the fix; all 38 screen tests and 1,031 Jest tests pass.

Also resolved the two iOS CI failures encountered during validation: native-test
hosts starting React without Metro, and a separate download-test fixture write
racing background restoration. The latter only changes test synchronization.
All four checks now pass at 65cbaaa.

The combined field.6 candidate includes this fix and #35. Upright/rotated/mirrored
gallery checks passed on the Pixel; all four pre-upgrade records were preserved,
three labelled test records remain pending/unsynced, and phone settings were
restored. Failure/retry is component-tested; I did not remove device photos to
simulate it. The old field.5 APK remains unchanged and does not include the
follow-up. No PR merge or tester distribution performed.

@BMichaelJ

Copy link
Copy Markdown
Collaborator Author

/gemini review

@JasonWildMe
JasonWildMe merged commit cb95d52 into WildMeOrg:wildlife-reid Sep 10, 2026
4 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.

2 participants