Skip to content

feat: install compatible native scanner galleries - #529

Merged
Reilley64 merged 6 commits into
integration/mtgscan-273-rust-gpuifrom
feat/mtgscan-279-gallery-updates
Nov 13, 2026
Merged

Reilley64 merged 6 commits into
integration/mtgscan-273-rust-gpuifrom
feat/mtgscan-279-gallery-updates

Conversation

@Reilley64

@Reilley64 Reilley64 commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

Part of MTGSCAN-279 and MTGSCAN-273.
Targets integration/mtgscan-273-rust-gpui. This is not a release or publication change.

GPUI AccountPage
  CollectionBrowser + GalleryStatus
    GalleryController: readiness, progress, retry, cancellation, foreground
      existing authenticated background downloader
      canonical missing-part policy + verified native installer
        matching model and thresholds -> staged validation -> atomic activation
  build-owned app-delegate forwarding -> reused background engine

Keep format 2, model packaging, stable gallery identities and recognition behavior.
Retain the previous usable gallery when an update fails.
Mobile does not link backend application policy.
The composed source retains collection navigation, account-generation guards and the post-browser-layout header correction.

Evidence

  • Before: unit failures and caught mutations exposed missing verification, compatibility and cancellation rules. An actual production-root synthetic preview exposed hidden gallery controls after collection composition.
    After: canonical GalleryInstaller.partsToDownload owns reuse decisions. GalleryDownloadCommands registers generation ownership before asynchronous enumeration and orders download/cancel effects. Production-root controls are reachable from Collection and return with current gallery status after copy Close. Unit, type, lint, Rust, native Xcode compile/link and bounded Simulator evidence are recorded for exact head 6a4cb8288d7eb98a89072acf894281520de311e8.
  • Installer: the bounded synthetic fixture check preserved the installed base after a corrupt add-on, then activated a valid add-on. The later fixed-gallery installs below separately verify recorded catalog, vector and model metadata.
  • Background bridge: the actual Rust-to-Swift delegate selector completed a synthetic callback once. This is ABI/composition evidence, not observed OS-generated transfer delivery or relaunch.
  • CI: exact-head app, database, recognizer module, Rust, native-session, GPUI unit, camera-status and title checks pass. Site is path-skipped.

Local recognizer replay

PASS. Baseline origin/main is af5f59f66f9552c3dbe74035bc5fdb81f80523b3.
Feature is 6a4cb8288d7eb98a89072acf894281520de311e8.
Both pins were fetched and checked independently in a prepared worktree.
The owner's unpublished local main was not used.

Gallery: 20261021-c38f43, 102,857 rows, PE-Core pe-core-s16-384.
Packaged model SHA-256: a7b41405eb0a9b34cebc3acf64c42d4c009689df3686d7f22fc12ea53e521aab.
Both installs match recorded catalog.json and gallery.f16 hashes.
All 3,000 synthetic photo hashes match the unchanged canonical list.
Existing installer calls used a fail-closed download capability: zero download calls and no hosted credentials.
No expected file, feature-print recording, recipe, selection or dependency pin changed.

Actual commands ran from the repository root through Mise, with DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer (Xcode 27.1):

# Set stage=main or stage=feature at the corresponding pinned checkout.
export RECOGNIZER_DATA_DIR="/tmp/mtgscan-279-local-replay-f71cfcb2/$stage/data"
export RECOGNIZER_GALLERY_DIR="/tmp/mtgscan-273-implementation/279-local-replay/$stage/installed/20261021-c38f43"
export RECOGNIZER_LARGE_IMAGES_DIR="$HOME/Library/Caches/mtgscan/recognizer-large"
export RECOGNIZER_SIMULATED_DIR="$HOME/Library/Caches/mtgscan/recognizer-simulated"
mise exec -- swift test --package-path apps/mobile/modules/card-recognizer \
  --scratch-path "$RECOGNIZER_DATA_DIR/build"
mise exec -- bun /tmp/mtgscan-273-implementation/279-local-replay/offline-install.ts

# At the pinned main:
mise exec -- bun apps/mobile/modules/card-recognizer/scripts/replay.mjs
# At the pinned feature:
mise exec -- bun apps/mobile/modules/card-recognizer/scripts/replay.mjs \
  --baseline /tmp/mtgscan-273-implementation/279-local-replay/main/reports

The scratch install entry point calls the existing installGallery and native installer.
Fixture units: 89 pass per pin.
Full replay: exit 0 per pin, not exit 2.
Feature also passes four direct check.mjs comparisons against unchanged canonical recordings.
Feature-print gate: 24/24 cosines are 1.0 on both pins, above the 0.98 floor.

All following totals are identical on main, feature and canonical recordings:

Gate Full gallery True printing held out
Real: wrong-card accepts 0 0
Real: wrong-printing accepts 0 No accepts
Real: accepted cards 217 of 250 0 of 250
Real: non-card rejection 11 of 11 11 of 11
Simulated: wrong-card accepts 0 0
Simulated: wrong printings outside full-gallery candidates 0 Not a held-out criterion
Simulated: accepted cards 2,537 of 3,000 398 of 3,000
Recognizer errors 0 in both packs 0 in both packs

The recorded synthetic other-printing accepts remain 376 full and 398 held-out.
All are another printing of the correct card, not wrong-card accepts.
Changed results: none. All eight replay checks and four additional canonical checks report no total or scan changes.
Independent comparison found no differing non-timing result fields.
One scratch input verifier initially lacked hashlib.file_digest; a scratch-only streaming hash correction passed before installation and again after replay.
No native install, fixture-unit, replay or checker command failed.

Retained local evidence: /tmp/mtgscan-273-implementation/279-local-replay.md, results/provenance/artifact JSON receipts and both complete report sets.
Owned build, processes and matching native lock were removed.
Fixed caches and installed galleries are retained.
No app, phone or Simulator operation was used for replay.

Remaining limits

OS-generated background delivery, suspended transfer/relaunch, physical inference and Gate3 parity, full spoken VoiceOver and distribution remain outside this bounded evidence.
Physical edge-back proof remains inconclusive.
The production-root preview uses synthetic external capabilities; it does not prove live authorization or provider behavior.
No owner app, collection, photos, config or keychain was used.
No physical, publication, deployment or cutover gate is waived.
A fresh guarded integration merge review is still required.

Merge Danger

Door: two-way

No migration, deployment, gallery publication, provider change or shipping authentication bypass.
Only a fresh passing gate may mark this PR ready and merge it into integration.

Blast Radius: scanner

Installer compatibility, cancellation ordering and native gallery composition change.
Native camera and recognition replacement remain in later tickets.

@Reilley64

Copy link
Copy Markdown
Owner Author

Continuation head: 4346dd86bf9abd0630b72c1f5a459172ab2bad20.

Completed the missing explicit GPUI app-delegate background URLSession forwarding. The pinned GPUI patch is tracked and applied only to a build-owned source copy. Both native and Expo entries reuse GalleryDownloads. Completion ownership precedes reconnection. Persisted state restores before session events. Completions run once on the main queue after event drain and any installation result.

Unit red/green covers session matching, unknown-session refusal, startup ordering, stale foreground drains, retained callbacks, exact-once and installation deferral. A deliberate exact-once mutation failed and was restored. Local session/gallery units, Rust check/Clippy/boundaries, native Swift lint, actionlint and Python compilation pass.

Actual Xcode 27.1 GPUI iOS compilation and the full native app build pass. A real GPUI/shared-gallery presentation preview built, launched and ran on the existing iPhone 17. Synthetic external services exercised missing, progress, Wi-Fi, cancel, retry, installing, ready, corrupt/unsupported/offline, foreground/restart and app-scoped large text. The actual GPUI delegate selector also forwarded an explicitly injected unknown-session callback through Rust to Swift and completed it once.

This is not proof of an OS-generated background callback, real background transfer/relaunch, physical inference, spoken VoiceOver or recognition parity. Those limits and the unchanged owner-controlled publication/parity workflow remain explicit. No waiver or live capability escalation is requested.

The preview used a separate Simulator-only bundle, now uninstalled. Original test-app bundle hash is identical before/after. Its app data, keychain, public config and settings were not read or changed. Only this continuation's device session was closed, with shutdown false. Its claim/driver and owned lock are gone. Parent was notified that 276 can use the device.

Exact-head app/database, Rust, GPUI units/camera-status and title checks pass. Native-session and recognizer jobs are still queued at this comment, not claimed passed from an older head. Full evidence and final CI updates: /tmp/mtgscan-273-implementation/279-completion.md. PR remains draft. No merge or issue closure.

@Reilley64

Copy link
Copy Markdown
Owner Author

Final exact-head CI update for 4346dd86bf9abd0630b72c1f5a459172ab2bad20: all applicable checks PASS. App/database full suites, recognizer native compilation and libwebp link check, Rust, native session/gallery units and adapter typecheck/lint, GPUI units/camera-status and title are green. Site is path-skipped. Native-session attempt 1 never acquired a hosted macOS runner; the same-head failed-job rerun passed. No source or runner-policy change was made. Final fetch/merge confirms integration is still 23637cc1 and already included. PR stays draft. Detailed source, native preview proof, limits and cleanup receipts are in /tmp/mtgscan-273-implementation/279-completion.md. No OS-driven callback/physical parity or acceptance waiver is claimed; parent handles review and fresh merger.

Keep gallery controls reachable from the signed-in collection browse and preserve both native lifecycles.

Refs MTGSCAN-279
@Reilley64
Reilley64 marked this pull request as ready for review November 13, 2026 21:51
@Reilley64
Reilley64 merged commit 4d3b3d1 into integration/mtgscan-273-rust-gpui Nov 13, 2026
12 checks passed
@Reilley64 Reilley64 mentioned this pull request Nov 13, 2026
6 of 33 tasks
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.

1 participant