test(ios): fail when snapshot bridge bounds drift between host and native

Merged
TH
2d ago
+62-10

Summary

Follow-up to #4089. The host snapshot-source limits mirrored native snapshot-bridge constants only by comment, and the Objective-C fixtures hard-coded 65 and 64. If one side changed, nothing failed.

  • SnapshotBridgeCapture.h now exports kMaximumRequestLevels (65) and kMaximumRequestsPerCapture (64). foreground-owner.m uses them instead of literals, and derives the expected continuation count from the window.
  • New limits.test.ts reads the bridge sources and asserts:
    • MAXIMUM_REQUEST_LEVELS equals kMaximumRequestLevels.
    • resolveSnapshotSourceLimits accepts each native bound (kMaximumFrameBytes, kMaximumDepth, kMaximumNodes, kMaximumDurationMs) and rejects one more. This checks through the public boundary, with no new test-only exports.

Why a parity test instead of reporting first-request levels in the recovery counters: the counter route changes the bridge wire (response keys, wire vocabulary, recovery conformance fixtures, source version) to replace one constant. The parity test is one file and leaves native behavior and the wire unchanged. Small scope expansion: frame, node and duration bounds are covered by the same table.

5 files, +61/āˆ’10. No device run: this change touches only constants, fixtures and tests.

Refs #4089

Validation

  • pnpm check:affected --run --head 281c5ae35eb351b631daebe2e03a53ba73327196: 41/41 passed (fail-open full set).
  • Mutation check: changing native kMaximumRequestLevels, native kMaximumDepth, TS MAXIMUM_DEPTH, or TS MAXIMUM_FRAME_BYTES makes limits.test.ts fail.
  • cache-native-runtime.test.ts (compiles the fixtures on macOS): 49/49 passed.
  • Independent review: nothing blocking. All three non-blocking notes were applied.

šŸ¤– Generated with Claude Code