Skip to content
This repository was archived by the owner on Oct 16, 2026. It is now read-only.

Fix PartyKit esbuild advisory, clear PoseEstimator complexity, add iOS test target (#26) - #46

Merged
sarthakagrawal927 merged 4 commits into
mainfrom
fix/26-esbuild-poseestimator-tests
Oct 9, 2026
Merged

sarthakagrawal927 merged 4 commits into
mainfrom
fix/26-esbuild-poseestimator-tests

Conversation

@sarthakagrawal927

Copy link
Copy Markdown
Member

Continues #26. These are the three remaining code items: the esbuild advisory, the PoseEstimator complexity violations, and an iOS test target. Device testing is still the owner's job.

1. PartyKit esbuild advisory (GHSA-67mh-4wv8-2f99, moderate)

  • partykit@0.0.115 is the latest release, and it pins esbuild 0.21.5. The fix is a single pnpm.overrides entry, partykit>esbuild: 0.25.12 (the patched minor line). The lockfile was regenerated with --lockfile-only; no other package moved.
  • Compatibility: partykit.json has no serve.build assets config, so PartyKit uses esbuild only to bundle the worker (context/build). The vulnerable ctx.serve path never runs here. node scripts/qualify-relay.mjs passes locally against 0.25.12: real relay handshake/presence, ping/pong, pose/start relay, duplicate/replacement/malformed/disconnect, inspector fetch.
  • pnpm audit: 1 moderate → "No known vulnerabilities found" (323 audited).
  • Not verified: partykit deploy bundling. It uses the same esbuild API, but nothing was deployed.

2. PoseEstimator complexity (behavior-preserving)

  • The pure pieces move to the new Vision/PoseMath.swift: joint mapping with the y flip and mirrored L/R swap, head/torso fallbacks, exponential smoothing (one generic function now covers both the joint and arm loops), quality, ROI clamp, ROI→image lift, and the fingertips omission rule.
  • The hand pass is split into computeHands (MediaPipe primary), visionHands (Vision fallback) and performHandRequests. Arithmetic expressions, thresholds, fallback order, request/ROI side effects and left-before-right analyzeSide ordering are unchanged.

3. iOS test target

  • MotionTests (Swift Testing, hosted in the app) is defined in project.yml and added to the Motion scheme. The Podfile gets inherit! :search_paths, so Podfile.lock changes only its Podfile checksum.
  • 14 tests cover PoseMath. CI runs them after the Swift ratchets, on the first available iPhone simulator.
  • Local caveat: build-for-testing succeeds. On this Mac, xcodebuild test hangs at simulator connect (DTServiceHubClient failed to bless service hub) with both Xcode 27 beta and 26.6, sandboxed or not. This PR's CI run is the first actual test execution.

Before / after

Gate Before (main 11041e8) After
Complexity violations 2 0 (limit lowered to 0)
Max CCN / max length 22 / 149 15 / 95 (limits lowered)
Max params 7 7 (elsewhere)
pnpm audit 0 crit/high, 1 moderate 0 / 0 / 0
iOS unit tests none 14 (CI)
Swift-format diagnostics 8 8
Periphery (3.8.0) 66 66
Vitest 82 82

Local checks run: pnpm check (all gates), pnpm quality:swift with MOTION_INDEX_STORE, unsigned simulator xcodebuild build + build-for-testing, and qualify-relay.mjs. No device run, deploy or release.

🤖 Generated with Claude Code

sarthakagrawal927 and others added 4 commits October 9, 2026 08:40
PartyKit 0.0.115 (latest) pins esbuild 0.21.5, affected by the moderate
dev-server CORS advisory. Override only partykit>esbuild to 0.25.12, the
first patched minor line. Motion's partykit.json has no serve.build
assets config, so PartyKit uses esbuild only to bundle the worker; the
real relay qualifier passes with the new version. pnpm audit: no known
vulnerabilities.

Refs #26

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
buildAndEmit (149 lines) and computeHands (CCN 22, 101 lines) were the
last two complexity violations. Move joint mapping, smoothing, quality,
ROI geometry and ROI lifting into PoseMath (no Vision requests, no
pixel buffers) and split the hand pass into computeHands (MediaPipe
primary), visionHands and performHandRequests. Arithmetic, thresholds,
left/right swaps, fallback order and request side effects are unchanged.

Complexity ratchet: violations 2 -> 0, max CCN 22 -> 15, max length
149 -> 95.

Refs #26

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hosted Swift Testing target generated by XcodeGen, added to the Motion
scheme, with a CocoaPods search-path inherit so it resolves MediaPipe.
14 tests pin the y flip, mirrored left/right swap, head/torso
fallbacks, smoothing and dropout reuse, quality, ROI clamping and
ROI-to-image lifting. CI runs them after the Swift ratchets on the
first available iPhone simulator.

Refs #26

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI aborted the hosted test run at launch: CocoaPods copied MediaPipe's
-force_load graph library into Pods-MotionTests, so its classes were
registered twice (app + test bundle). Strip -force_load from the test
target xcconfigs in post_integrate; the app keeps it.

Refs #26

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sarthakagrawal927
sarthakagrawal927 merged commit 4a7947e into main Oct 9, 2026
2 checks passed
@sarthakagrawal927
sarthakagrawal927 deleted the fix/26-esbuild-poseestimator-tests branch October 9, 2026 04:00
@sarthakagrawal927
sarthakagrawal927 restored the fix/26-esbuild-poseestimator-tests branch October 13, 2026 05:26
@sarthakagrawal927
sarthakagrawal927 deleted the fix/26-esbuild-poseestimator-tests branch October 16, 2026 19:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant