refactor: derive replay metadata platforms from the canonical selectors#899
Merged
Conversation
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
Member
Author
|
Reviewed — merge-ready. ✅ Verified
Residual risk (non-blocking, both out of scope per the description)
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to thymikee's review on #895: the replay parser hand-restated the leaf-platform allow-list a 4th time, and the type/runtime didn't agree.
Problem
src/replay/script.tsdefinedtype ReplayScriptPlatform = Exclude<PlatformSelector, 'apple'>(which still INCLUDES'web') whileREPLAY_METADATA_PLATFORMSwas a hardcodedSet(['ios','android','macos','linux'])(omits'web'). Socontext platform=weblines were silently dropped even though the type permittedweb— a type/runtime mismatch and a copy of the allow-list that can drift.Fix (behaviorless)
Exclude<PlatformSelector, 'apple' | 'web'>.PLATFORM_SELECTORS(src/utils/device.ts) instead of hardcoding. This yields exactly['ios','macos','android','linux']today and auto-includes any future leaf platform except web.context platform=lines do not support web.Web stays dropped exactly as before — now intentionally, type-safe, and derived from a single source. Adding web support remains a separate feature decision and is out of scope here. This branch does not depend on #895 (it derives from
PLATFORM_SELECTORS, already exported on main).Tests
Extended
src/replay/__tests__/script.test.ts:REPLAY_METADATA_PLATFORMSequals exactly the non-web leaf platforms.ios/android/macos/linux) is accepted in a context line.context platform=webline is dropped (behaviorless).Verified:
tsc --noEmit, oxfmt,oxlint --deny-warnings, andvitest run replay(153 passed) all green.