You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR Review — claude-opus-4-6 (Claude Opus 4.6, 1M context)
Overall
Well-designed API addition. getRuntimeInfo() gives apps a single, generic entry point for runtime/capability introspection instead of importing adapter-specific helpers. The type system, fallback chain, and test coverage are solid.
Verdict: Approve with observations.
Strengths
Clean type layering: RuntimeCapabilities has required universal flags (events, fs, dialog, window, task, convertFileSrc) and optional runtime-specific extensions (renderMode?, hasGpuWindow?, etc.). This means consumers can branch on universal capabilities without knowing which runtime they're on, and opt-in to runtime-specific fields when needed.
RuntimeInfoResolver (RuntimeInfo | (() => RuntimeInfo)): Supporting both static and lazy resolution is the right call — Electrobun capabilities can change after initial bootstrap, and the function form lets providers defer reads until getRuntimeInfo() is actually called.
Backwards-compatible: CoreProvider.runtimeInfo is optional. Existing providers work unchanged — deriveRuntimeInfo() falls back to id-based heuristics when runtimeInfo isn't supplied.
cloneRuntimeInfo(): Shallow-cloning both the top-level object and capabilities before returning prevents callers from mutating internal state. Good defensive practice.
normalizeElectrobunRenderMode() allowlist: Only "browser", "hybrid", "gpu" pass through; anything else becomes "unknown". Prevents downstream consumers from relying on arbitrary string values.
Test coverage: 4 tests covering WASM default, Tauri auto-detection, explicit custom provider, and Electrobun bridge derivation. The Electrobun test exercises the fallback path (provider without runtimeInfo), which is the most complex derivation chain.
Scaffold integration: document.body.dataset.runtime and document.body.dataset.renderMode in the base template is a nice touch — enables CSS selectors like [data-runtime="electrobun"] with zero JS ceremony.
CI: Adding bunx tsc --noEmit -p examples/electrobun-counter/tsconfig.json catches type errors in the example that previously would have gone unnoticed.
Observations
Dual Electrobun capability derivation — core.ts:getElectrobunBridgeCapabilities() and electrobun.ts:getElectrobunRuntimeCapabilities() both derive capabilities from the Electrobun bridge, but through different type interfaces (ElectrobunRuntimeBridge vs ElectrobunBridge) and with slightly different logic. The core.ts version normalizes renderMode and derives hasGpuWindow/hasWgpuView/hasWebGpu from it; the electrobun.ts version passes renderMode through as-is. The layering is defensible (core.ts is best-effort fallback for bare providers, adapter provides authoritative data), but if either changes independently they could diverge. Worth a brief comment in core.ts noting this is the fallback path.
No test for function-form RuntimeInfoResolver — deriveRuntimeInfo() handles typeof provider.runtimeInfo === "function" but all 4 tests supply static runtimeInfo objects. A small test registering a provider with runtimeInfo: () => ({ ... }) would exercise that branch cheaply.
wasmCapabilities and tauriCapabilities are identical — Both declare all 6 boolean flags as true. Having them as separate constants is correct for future divergence, but they're currently identical. Not a problem, just noting it.
CRLF → LF normalization — core.ts and provider.ts show full-file diffs because line endings were normalized from \r\n to \n. The actual logical change is ~50 new lines. Consider a .gitattributes with *.ts text eol=lf to prevent this from recurring and inflating future diffs.
getRuntimeInfo() not cached — Each call re-derives from the provider or environment. For the current use case (called once at startup) this is fine, but if it ever gets called in a hot path, the allocation from cloneRuntimeInfo() on every call could add up. Non-issue today, just noting the design choice.
No Issues Found
No security concerns — document.body.dataset is set from internal state, not user input.
The getElectrobunCapabilities() import is correctly removed from the example since getRuntimeInfo() now provides the same data through the generic API.
The auto-registered Tauri provider in invoke() now includes runtimeInfo, keeping the auto-detection and explicit-registration paths consistent.
LGTM.
Reviewed by claude-opus-4-6 (Claude Opus 4.6, 1M context)
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
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.
Summary
getRuntimeInfo()API towebtau/coreWhat changed
webtau/corenow exportsgetRuntimeInfo()plusRuntimeInfo/RuntimeCapabilitiestypesCoreProvidernow supports optionalruntimeInfogetRuntimeInfo()instead of adapter-specific helpersdocument.body.datasetexamples/electrobun-counterValidation
bun test packages/webtau/src/core.test.ts packages/webtau/src/adapters/electrobun.test.tsbun test packages/create-gametau/src/cli.test.tsbun run testinexamples/electrobun-counterbunx tsc --noEmit -p packages/webtau/tsconfig.jsonbunx tsc --noEmit -p packages/create-gametau/tsconfig.jsonbunx tsc --noEmit -p examples/electrobun-counter/tsconfig.jsonbun run build:webinexamples/electrobun-counterbun run build:electrobun:hybridinexamples/electrobun-counterbun run build:electrobun:gpuinexamples/electrobun-counterTracking