ReviewOS

also looking at this

craft-native/craft

fix(location): unify watch handles across mobile surfaces

#268
Merged glennmichael123 wants to merge codex/location-watch-parity into main
4 files +168 -13
9 days ago

Closes #220

Summary

  • make the flat craft.watchPosition and craft.clearWatch surface delegate to the typed location implementation and return numeric watch handles
  • share one native location stream across typed and legacy subscribers without allowing either API to clear the other's active watches
  • remove rejected-start callbacks, allow a later retry, and prevent rejected native starts from becoming unhandled promise rejections
  • preserve no-argument clearWatch() compatibility by clearing every active watch with at most one native clear request
  • update the public TypeScript declarations and lock the bridge surface with Zig tests

Regression proof

The new tests were run against the pre-fix implementation first. Five page-script cases and the bridge-surface assertion failed, covering numeric flat handles, shared-stream ownership, rejected-start cleanup/retry, listener cleanup, and no-argument clearing.

Explicit mutation checks also proved that the suite rejects:

  1. restoring the flat geolocation delegation
  2. removing rejected-start cleanup
  3. retaining callbacks after no-argument clear
  4. letting a legacy clear stop an active typed watch

Verification

  • bun test in packages/ios: 73 passed
  • zig build test:ios: passed
  • bun run test:sdk: 566 passed
  • bun run typecheck: passed
  • bun run verify:packages: 36 checks passed
  • bunx --bun pickier .: 0 errors (36 existing warnings)
  • git diff --check: passed
  • zig fmt --check packages/zig/test/bridge_surface_test.zig: passed
  • iOS template compilation reached and passed the iPhone, Live Activity, Watch extension, and Watch app compile stages; the final embedded Watch-app scheme cannot run locally because this host does not have the watchOS 26.5 runtime installed

The repository-wide Zig suite remains blocked locally by the existing external sibling zig-js incompatibility with the installed Zig 0.17 development toolchain. The focused iOS target passes, and CI uses the repository-pinned toolchain.

4 changed files on the files tab, with 0 review threads.

Sign in to comment on this pull request.