Repository navigation
[AI:zf-builder] refactor(configs+receive): receivePage inlines the ICE-server fallback ternary instead of calling shared resolveIceServer() (Ponytail Rung 2) - #150
Conversation
…k ternary instead of calling shared resolveIceServer() (Ponytail Rung 2) Task: zf-zs-d6b3a9d4 refactor(configs+receive): ReceivePage inlines the ICE-server fallback ternary instead of calling shared resolveIceServer() (Ponytail Rung 2)
ntsd
left a comment
There was a problem hiding this comment.
[AI:zf-reviewer] [Reviewer Feedback] Round 1: Approved for human review.
Scope check (Rung 7): Surgical, exactly as described — src/components/ReceivePage.svelte (import swap, comment update, one-line change) plus tests/ice-server-consistency.test.mjs (assertions flipped to pin the new shape). No drive-by reformatting, no unrelated churn, no debug leftovers.
Correctness: resolveIceServer(iceParam) (src/configs.ts:52-54) is body-identical to the removed inline ternary isSupportedIceServer(iceParam) ? iceParam : DEFAULT_SEND_OPTIONS.iceServer, so emitted/accepted i values are byte-identical before and after — no wire-protocol or behavior change. The downgrade toast (if (iceParam && iceServer !== iceParam)) is untouched and still correct. This fixes a real latent desync: the doc comment on resolveIceServer promises both peers resolve through it, but the receiver was bypassing it — a future change to the predicate or default would previously have applied to sender only.
Import cleanup: isSupportedIceServer fully removed from the ReceivePage import with zero remaining references (grep-verified). DEFAULT_SEND_OPTIONS correctly retained — still used at lines 46, 52, and 83.
Ponytail check: No new dependencies (Rungs 3/5 — the helper already existed in ../configs), and this reduces complexity by removing a duplicated decision instead of adding abstraction (Rungs 1/6). Correct direction.
Test coverage: The updated regression guard (test 4 in ice-server-consistency.test.mjs) now asserts both that the inlined isSupportedIceServer(iceParam) pattern is ABSENT and that const iceServer = resolveIceServer(iceParam) is PRESENT — so a future re-introduction of the inline ternary fails CI. Round-trip tests 1-3 still exercise the real src/configs.ts for default, all allowlist, and custom TURN values, and adversarial inputs remain covered. OfferPage callers were correctly not touched.
Verification (run in worktree on commit b6f8fec):
npm run typecheck— cleannpm test— 75/75 pass (incl. ice-server-consistency)npm run lint— clean (prettier + eslint)npm run build— succeeds- Mergeability: PR #150 is MERGEABLE, 0 commits behind main, 1 ahead — no conflicts.
Minor nit (non-blocking): The commit subject says "inlines the ICE-server fallback ternary instead of calling shared resolveIceServer()" — the inverse of what the diff actually does (the diff replaces the inline ternary with the shared helper). Code and task description are correct; only the commit message wording is inverted. No action required before merge.
GOTCHA: When a refactor commit's subject is worded as the pre-state ("X instead of Y"), re-read the actual diff before trusting the message — in PR #150 the subject described the opposite of the change.
[AI:zf-builder] Task: zf-zs-d6b3a9d4
refactor(configs+receive): ReceivePage inlines the ICE-server fallback ternary instead of calling shared resolveIceServer() (Ponytail Rung 2)
Automated PR for task zf-zs-d6b3a9d4
Completed by: @zf-builder