Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(web): support the Safari 16.4 webview floor and guard compatibility (#8220)

teobff39a2fcb97
diff --git a/.github/workflows/web-app-check-main.yml b/.github/workflows/web-app-check-main.yml
index 4829b5101c..497d8b9945 100644
--- a/.github/workflows/web-app-check-main.yml
+++ b/.github/workflows/web-app-check-main.yml
@@ -48,6 +48,7 @@ jobs:
- 'packages/sdk-docs/**'
- 'services/ai-editing-worker/**'
- 'packages/code-mode-sdk/**'
+ - 'tooling/platform-compat/**'
- 'crates/code_execution/src/outbound/deno/*.mjs'
- 'crates/agent_code_mode/src/domain/documentation.json'
- 'crates/agent_code_mode/SKILL.md'
@@ -376,6 +377,12 @@ jobs:
- name: Run Collaboration Package Biome
run: biome ci --changed --no-errors-on-unmatched --error-on-warnings
working-directory: packages/collaboration
+ - name: Install Platform Compatibility Tooling
+ run: bun install --frozen-lockfile
+ working-directory: tooling/platform-compat
+ - name: Check Browser Floor and Native Permissions
+ run: bun run check
+ working-directory: tooling/platform-compat
- name: Teardown Nix
if: always()
uses: './.github/actions/teardown-nix'
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index 16ee087083..b9db05b919 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -8,6 +8,11 @@
- Run Linux native cache-plugin tests from the repository root with `nix develop .#tauri-linux --command cargo test --manifest-path apps/web/tauri/Cargo.toml -p graphql_cache_plugin`; the [Tauri platform shell](../../docs/development/running-locally.md) supplies the required desktop libraries.
- `bun run lint:oxlint` (repository root): type-aware oxlint. `typescript/no-floating-promises` is an error with no suppressions and `ignoreVoid: false` (FE-13), enforced in `just check` and CI; start detached work with `fireAndForget` from `@core/util/fireAndForget`, not `void`. Plain `oxlint` without `--type-aware` skips that rule silently. The ast-grep rule `ts-no-expression-void` covers `() => void p()`, which the lint can't see.
- Email rendering is isolated in `packages/email-renderer` at the repository root. Run `just test-email-rendering` for its Node and Chromium suites. Add fixtures under `packages/email-renderer/tests/fixtures`, run `just test-email-rendering-update`, and review changed images. These are renderer tests, not inbox e2e.
+- Supported browsers are the `browserslist` in `package.json`. Safari and iOS
+ 16.4 is the oldest WebKit the app starts on: startup code, including
+ `@pierre/diffs`, evaluates regex lookbehind. `vite.base.ts` builds to it
+ and `tooling/platform-compat` lints for newer APIs; feature-detect them or
+ raise the floor there.
- The app does not register a service worker. Keep `public/sw.js` as a retirement
endpoint for existing installations; see the [startup bundle rule](../../.agents/rules/web/startup-bundle.md).
Loro uses async WASM loading and HTML preloads independently of service workers.
diff --git a/apps/web/package.json b/apps/web/package.json
index 674a0c088a..c1fb875dfe 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -3,6 +3,14 @@
"version": "2.5.0",
"private": true,
"type": "module",
+ "browserslist": [
+ "safari >= 16.4",
+ "ios_saf >= 16.4",
+ "chrome >= 111",
+ "and_chr >= 111",
+ "edge >= 111",
+ "firefox >= 128"
+ ],
"scripts": {
"dev": "bun run dev:prepare && bun run dev:server",
"dev:prepare": "just ensure-cache-wasm && just ensure-agent-fold-wasm && just ensure-database-sql-wasm && just ensure-pptx-engine-wasm && just ensure-docx-engine-wasm && just ensure-fig-engine-wasm && just ensure-psd-engine-wasm && just ensure-ai-engine-wasm",
diff --git a/apps/web/src/features/email-compose/primitives/draft-persistence.test.ts b/apps/web/src/features/email-compose/primitives/draft-persistence.test.ts
new file mode 100644
index 0000000000..ea83004aa2
--- /dev/null
+++ b/apps/web/src/features/email-compose/primitives/draft-persistence.test.ts
@@ -0,0 +1,37 @@
+import { createRoot } from 'solid-js';
+import { expect, it, vi } from 'vitest';
+import { createComposeContext } from '../tests/capabilities';
+import { createDraftPersistence } from './draft-persistence';
+import { createDraftSession } from './draft-session';
+
+it('deletes an emptied draft on webviews without Promise.withResolvers', async () => {
+ const withResolvers = Promise.withResolvers;
+ Reflect.deleteProperty(Promise, 'withResolvers');
+ const deleteDraft = vi.fn(async () => {});
+ const { dispose, session, persistence } = createRoot((dispose) => {
+ const session = createDraftSession({
+ draftId: 'draft',
+ threadId: 'thread',
+ persistence: 'committed',
+ });
+ const persistence = createDraftPersistence({
+ session,
+ drafts: { ...createComposeContext().drafts, deleteDraft },
+ attachments: { upload: vi.fn(async () => {}) },
+ mintThreadHandle: true,
+ onAlreadySent: vi.fn(),
+ });
+ return { dispose, session, persistence };
+ });
+ try {
+ await persistence.remove({});
+
+ expect(deleteDraft).toHaveBeenCalledWith(
+ expect.objectContaining({ draftId: 'draft', threadId: 'thread' })
+ );
+ expect(session.draftId()).toBeUndefined();
+ } finally {
+ Object.assign(Promise, { withResolvers });
+ dispose();
+ }
+});
diff --git a/apps/web/src/features/email-compose/primitives/draft-persistence.ts b/apps/web/src/features/email-compose/primitives/draft-persistence.ts
index 6fdd38a53d..081287b11b 100644
--- a/apps/web/src/features/email-compose/primitives/draft-persistence.ts
+++ b/apps/web/src/features/email-compose/primitives/draft-persistence.ts
@@ -162,8 +162,10 @@ export function createDraftPersistence(options: {
},
/** The draft has no content left: delete its row and drop its identity. */
async remove(input: { inboxId?: string; completingThread?: boolean }) {
- const removed = Promise.withResolvers<void>();
- removal = removed.promise;
+ let removed!: () => void;
+ removal = new Promise<void>((resolve) => {
+ removed = resolve;
+ });
try {
const draftId = session.draftId();
const epoch = session.epoch();
@@ -183,7 +185,7 @@ export function createDraftPersistence(options: {
if (session.isStale(epoch)) return;
session.dispatch({ type: 'emptied' });
} finally {
- removed.resolve();
+ removed();
}
},
diff --git a/apps/web/src/features/meetings/browser/meeting-media.test.ts b/apps/web/src/features/meetings/browser/meeting-media.test.ts
new file mode 100644
index 0000000000..4da39bf672
--- /dev/null
+++ b/apps/web/src/features/meetings/browser/meeting-media.test.ts
@@ -0,0 +1,19 @@
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { browserMeetingMedia } from './meeting-media';
+
+describe('browserMeetingMedia', () => {
+ afterEach(() => {
+ vi.unstubAllGlobals();
+ });
+
+ it('rejects with NotSupportedError when the webview exposes no media devices', async () => {
+ vi.stubGlobal('navigator', { mediaDevices: undefined });
+
+ await expect(
+ browserMeetingMedia.request({ audio: true, video: false })
+ ).rejects.toMatchObject({ name: 'NotSupportedError' });
+ await expect(browserMeetingMedia.enumerate?.()).rejects.toMatchObject({
+ name: 'NotSupportedError',
+ });
+ });
+});
diff --git a/apps/web/src/features/meetings/browser/meeting-media.ts b/apps/web/src/features/meetings/browser/meeting-media.ts
index 1640f8462a..8aa4425acd 100644
--- a/apps/web/src/features/meetings/browser/meeting-media.ts
+++ b/apps/web/src/features/meetings/browser/meeting-media.ts
@@ -1,10 +1,22 @@
import { backgroundProcessorOptions } from '@core/media/background-effect';
import type { MeetingMediaAccess } from '../primitives/meeting-media';
+/**
+ * WebKit leaves `navigator.mediaDevices` undefined in insecure contexts and in
+ * apps whose Info.plist lacks camera and microphone usage strings.
+ */
+const mediaDevicesUnavailable = () =>
+ Promise.reject(
+ new DOMException('Media devices are unavailable', 'NotSupportedError')
+ );
+
/** Preview processors own a clone, so disposal never stops the join track. */
export const browserMeetingMedia: MeetingMediaAccess = {
- request: (constraints) => navigator.mediaDevices.getUserMedia(constraints),
- enumerate: () => navigator.mediaDevices.enumerateDevices(),
+ request: (constraints) =>
+ navigator.mediaDevices?.getUserMedia(constraints) ??
+ mediaDevicesUnavailable(),
+ enumerate: () =>
+ navigator.mediaDevices?.enumerateDevices() ?? mediaDevicesUnavailable(),
onDeviceChange: (refresh) => {
navigator.mediaDevices?.addEventListener('devicechange', refresh);
return () =>
diff --git a/apps/web/src/features/meetings/primitives/meeting-media.test.ts b/apps/web/src/features/meetings/primitives/meeting-media.test.ts
index 86d1eb8854..0f51fc081d 100644
--- a/apps/web/src/features/meetings/primitives/meeting-media.test.ts
+++ b/apps/web/src/features/meetings/primitives/meeting-media.test.ts
@@ -108,6 +108,24 @@ describe('prejoin media', () => {
}
});
+ it('explains when the app exposes no media devices', async () => {
+ const request = vi
+ .fn()
+ .mockRejectedValue(
+ new DOMException('Media devices are unavailable', 'NotSupportedError')
+ );
+ const { media, dispose } = setup(request);
+ try {
+ await media.prepare();
+ expect(media.microphoneEnabled()).toBe(false);
+ expect(media.errors()).toEqual([
+ 'Microphone isn’t available in this app or browser. Update it, then turn it on to retry.',
+ ]);
+ } finally {
+ dispose();
+ }
+ });
+
it('does not request the camera until the microphone permission settles', async () => {
const microphone = fakeTrack('audio');
const camera = fakeTrack('video');
diff --git a/apps/web/src/features/meetings/primitives/meeting-media.ts b/apps/web/src/features/meetings/primitives/meeting-media.ts
index d2bb863d79..7b64841dd9 100644
--- a/apps/web/src/features/meetings/primitives/meeting-media.ts
+++ b/apps/web/src/features/meetings/primitives/meeting-media.ts
@@ -52,6 +52,11 @@ function mediaErrorMessage(device: 'microphone' | 'camera', error: unknown) {
permission: false,
text: `${label} is in use by another app or tab. Close it, ${retry}`,
};
+ case 'NotSupportedError':
+ return {
+ permission: false,
+ text: `${label} isn’t available in this app or browser. Update it, ${retry}`,
+ };
case 'NotFoundError':
case 'OverconstrainedError':
return {
diff --git a/apps/web/src/features/notifications/components/BrowserNotificationModal.tsx b/apps/web/src/features/notifications/components/BrowserNotificationModal.tsx
index 5e0b8bbef2..dfcd61ab31 100644
--- a/apps/web/src/features/notifications/components/BrowserNotificationModal.tsx
+++ b/apps/web/src/features/notifications/components/BrowserNotificationModal.tsx
@@ -9,6 +9,7 @@ import {
type SupportedNotificationSettings,
useNotificationSettings,
} from '../notification-settings';
+import { notificationsBlockedMessage } from '../notifications-blocked-message';
export const BrowserNotificationModal = () => {
const settings = useNotificationSettings();
@@ -67,6 +68,9 @@ function NotificationToastTrigger(props: {
onClick: async () => {
try {
await props.settings.toggle(true);
+ if (!props.settings.isEnabled()) {
+ toast.failure(notificationsBlockedMessage());
+ }
} catch (error) {
console.error('Failed to enable notifications:', error);
}
diff --git a/apps/web/src/features/notifications/components/PlatformNotificationProvider.tsx b/apps/web/src/features/notifications/components/PlatformNotificationProvider.tsx
index 41b80b4000..2526b05fa9 100644
--- a/apps/web/src/features/notifications/components/PlatformNotificationProvider.tsx
+++ b/apps/web/src/features/notifications/components/PlatformNotificationProvider.tsx
@@ -67,16 +67,24 @@ function createDefaultBrowserInterface(
return 'not-granted';
}
- return createBrowserNotication(data);
+ return createBrowserNotification(data);
},
unregisterNotifications,
};
}
-function createBrowserNotication(
+export function createBrowserNotification(
data: PlatformNotificationData
-): PlatformNotificationHandle {
- const notif = new Notification(data.title, data.options);
+): PlatformNotificationHandle | NotGranted {
+ let notif: Notification;
+ try {
+ notif = new Notification(data.title, data.options);
+ } catch (error) {
+ // Chrome on Android only shows notifications through a service worker,
+ // which this app does not register.
+ if (error instanceof TypeError) return 'not-granted';
+ throw error;
+ }
return {
onClick: (cb) => {
diff --git a/apps/web/src/features/notifications/notifications-blocked-message.ts b/apps/web/src/features/notifications/notifications-blocked-message.ts
new file mode 100644
index 0000000000..c9136ebfe4
--- /dev/null
+++ b/apps/web/src/features/notifications/notifications-blocked-message.ts
@@ -0,0 +1,9 @@
+import { isTauri } from '@core/util/platform';
+import { type as osType } from '@tauri-apps/plugin-os';
+
+/** Tells the user where to allow notifications after a request ends without permission. */
+export function notificationsBlockedMessage(): string {
+ return isTauri() && osType() === 'macos'
+ ? 'Open System Settings → Notifications → Macro and turn on Allow notifications.'
+ : 'Allow notification permissions, then try again.';
+}
diff --git a/apps/web/src/features/notifications/tests/browser-notification.test.ts b/apps/web/src/features/notifications/tests/browser-notification.test.ts
new file mode 100644
index 0000000000..50c1963c82
--- /dev/null
+++ b/apps/web/src/features/notifications/tests/browser-notification.test.ts
@@ -0,0 +1,40 @@
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { createBrowserNotification } from '../components/PlatformNotificationProvider';
+
+afterEach(() => {
+ vi.unstubAllGlobals();
+});
+
+describe('createBrowserNotification', () => {
+ it('reports not granted where the Notification constructor is illegal', () => {
+ vi.stubGlobal(
+ 'Notification',
+ class {
+ constructor() {
+ throw new TypeError(
+ "Failed to construct 'Notification': Illegal constructor."
+ );
+ }
+ }
+ );
+
+ expect(createBrowserNotification({ title: 'Hello' })).toBe('not-granted');
+ });
+
+ it('returns a handle that closes the notification', () => {
+ const close = vi.fn();
+ vi.stubGlobal(
+ 'Notification',
+ class extends EventTarget {
+ close = close;
+ }
+ );
+
+ const handle = createBrowserNotification({ title: 'Hello' });
+
+ expect(handle).not.toBe('not-granted');
+ if (handle === 'not-granted') return;
+ handle.close();
+ expect(close).toHaveBeenCalledOnce();
+ });
+});
diff --git a/apps/web/src/features/settings/Notifications.tsx b/apps/web/src/features/settings/Notifications.tsx
index 338a76045a..34d8aaa204 100644
--- a/apps/web/src/features/settings/Notifications.tsx
+++ b/apps/web/src/features/settings/Notifications.tsx
@@ -3,12 +3,12 @@ import { useAnalytics } from '@app/lib/analytics/analytics-context';
import { toast } from '@core/component/Toast/Toast';
import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
import { fireAndForget } from '@core/util/fireAndForget';
-import { isTauri } from '@core/util/platform';
import {
EMAIL_DIGEST_NOTIFICATION_TYPE,
NOTIFICATION_EVENT_GROUPS,
} from '@notifications/notification-event-catalog';
import { useNotificationSettings } from '@notifications/notification-settings';
+import { notificationsBlockedMessage } from '@notifications/notifications-blocked-message';
import { openSnoozeNotifications } from '@notifications/SnoozeNotificationsDialog';
import { queryReadyGate } from '@queries/gate';
import {
@@ -19,7 +19,6 @@ import {
useMutedEntitiesQuery,
useUnmuteItemMutation,
} from '@queries/notification/unsubscribes';
-import { type as osType } from '@tauri-apps/plugin-os';
import { ToggleSwitch } from '@ui';
import { createSignal, For, getOwner, Show } from 'solid-js';
import { MutedItemRow } from './MutedItemRow';
@@ -66,11 +65,7 @@ export function Notifications() {
analytics.track('notifications_toggled');
await platformSettings.toggle(enabled);
if (enabled && !platformSettings.isEnabled()) {
- toast.failure(
- isTauri() && osType() === 'macos'
- ? 'Open System Settings → Notifications → Macro and turn on Allow notifications.'
- : 'Allow notification permissions, then try again.'
- );
+ toast.failure(notificationsBlockedMessage());
}
} catch (error) {
console.error('Could not update notification permission', error);
diff --git a/apps/web/src/features/slack-import/queries/import-source.test.ts b/apps/web/src/features/slack-import/queries/import-source.test.ts
index 42d7dea467..75bbf9e221 100644
--- a/apps/web/src/features/slack-import/queries/import-source.test.ts
+++ b/apps/web/src/features/slack-import/queries/import-source.test.ts
@@ -660,6 +660,30 @@ describe('import commands', () => {
expect(h.client.cancelSlackImport).toHaveBeenCalledWith({ jobId });
});
+ it('uploads with a caller signal on webviews without AbortSignal.any', async () => {
+ const { any } = AbortSignal;
+ Reflect.deleteProperty(AbortSignal, 'any');
+ try {
+ const h = mount();
+ h.client.registerSlackImportUploads.mockResolvedValue(ok([grant]));
+ const [capability] = await h.commands.register(identity, [
+ grant.descriptor,
+ ]);
+ h.upload.mockResolvedValue(ok('uploaded'));
+ const caller = new AbortController();
+ const listen = vi.spyOn(caller.signal, 'addEventListener');
+
+ expect(
+ await capability.put(new Blob(['{}']), { signal: caller.signal })
+ ).toBe('uploaded');
+ // A finished upload stops listening to the long-lived caller signal.
+ const options = listen.mock.calls[0]?.[2];
+ expect(typeof options === 'object' && options.signal?.aborted).toBe(true);
+ } finally {
+ Object.assign(AbortSignal, { any });
+ }
+ });
+
it('rejects stale commands, late mutation responses and stale upload grants', async () => {
const h = mount();
h.client.registerSlackImportUploads.mockResolvedValue(ok([grant]));
diff --git a/apps/web/src/features/slack-import/queries/import-source.ts b/apps/web/src/features/slack-import/queries/import-source.ts
index 36a4777a6e..96f81d8b2c 100644
--- a/apps/web/src/features/slack-import/queries/import-source.ts
+++ b/apps/web/src/features/slack-import/queries/import-source.ts
@@ -1,3 +1,4 @@
+import { anyAbortSignal } from '@core/util/abort-signal';
import { fireAndForget } from '@core/util/fireAndForget';
import {
invalidateSlackImport,
@@ -243,7 +244,7 @@ export function createImportSource(
activeUploads.add(controller);
try {
const signal = options?.signal
- ? AbortSignal.any([options.signal, controller.signal])
+ ? anyAbortSignal([options.signal, controller.signal])
: controller.signal;
const result = await upload(grant, blob, { ...options, signal });
check();
@@ -257,6 +258,8 @@ export function createImportSource(
return result.value;
} finally {
activeUploads.delete(controller);
+ // Releases the combined signal's listener on options.signal.
+ controller.abort();
}
},
}));
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/popup/popupPlugin.ts b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/popup/popupPlugin.ts
index 27c8523498..93234a6055 100644
--- a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/popup/popupPlugin.ts
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/popup/popupPlugin.ts
@@ -161,9 +161,9 @@ function $updateDomRectInSelction(
if (selection.type === 'table') {
newRect = $tableSelectionToRect(selection.lexicalSelection);
}
- if (selection.type === 'range') {
- newRect =
- selection.domSelection.getRangeAt(0).getBoundingClientRect() ?? null;
+ // iOS clears the DOM selection when focus leaves the editor.
+ if (selection.type === 'range' && selection.domSelection.rangeCount > 0) {
+ newRect = selection.domSelection.getRangeAt(0).getBoundingClientRect();
}
if (newRect) {
return { ...selection, rect: newRect };
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/utils.test.ts b/apps/web/src/lib/core/component/LexicalMarkdown/utils.test.ts
index a660a622d1..12f3ce7bb5 100644
--- a/apps/web/src/lib/core/component/LexicalMarkdown/utils.test.ts
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/utils.test.ts
@@ -3,6 +3,7 @@ import { SupportedNodeTypes } from '@macro-inc/lexical-core';
import { $getRoot, $isParagraphNode, createEditor } from 'lexical';
import { describe, expect, it, vi } from 'vitest';
import {
+ $getCaretRect,
editorStateAsMarkdown,
setEditorStateFromHtml,
setEditorStateFromMarkdown,
@@ -85,3 +86,12 @@ describe('setEditorStateFromMarkdown', () => {
).toBe(false);
});
});
+
+describe('$getCaretRect', () => {
+ it('returns null when the document has no selection range', () => {
+ const editor = makeEditor();
+ window.getSelection()?.removeAllRanges();
+
+ expect(editor.read(() => $getCaretRect())).toBeNull();
+ });
+});
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/utils.ts b/apps/web/src/lib/core/component/LexicalMarkdown/utils.ts
index a22b934752..143d683632 100644
--- a/apps/web/src/lib/core/component/LexicalMarkdown/utils.ts
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/utils.ts
@@ -472,7 +472,10 @@ export function bindStateAs<T extends EditorState | string>(
* wrapping and is therefore hard to query with lexical alone.
*/
export function $getCaretRect(): DOMRect | null {
- const domRange = window.getSelection()?.getRangeAt(0);
+ const domSelection = window.getSelection();
+ const domRange = domSelection?.rangeCount
+ ? domSelection.getRangeAt(0)
+ : undefined;
if (domRange) {
const rects = domRange.getClientRects();
if (rects.length) return rects[rects.length - 1];
diff --git a/apps/web/src/lib/core/util/abort-signal.test.ts b/apps/web/src/lib/core/util/abort-signal.test.ts
new file mode 100644
index 0000000000..93928d8d02
--- /dev/null
+++ b/apps/web/src/lib/core/util/abort-signal.test.ts
@@ -0,0 +1,38 @@
+import { describe, expect, it, vi } from 'vitest';
+import { anyAbortSignal } from './abort-signal';
+
+describe('anyAbortSignal', () => {
+ it('aborts with the reason of the first input to abort', () => {
+ const first = new AbortController();
+ const second = new AbortController();
+ const signal = anyAbortSignal([first.signal, second.signal]);
+
+ second.abort('second');
+ first.abort('first');
+
+ expect(signal.aborted).toBe(true);
+ expect(signal.reason).toBe('second');
+ });
+
+ it('starts aborted when an input already is', () => {
+ const signal = anyAbortSignal([
+ new AbortController().signal,
+ AbortSignal.abort('done'),
+ ]);
+
+ expect(signal.aborted).toBe(true);
+ expect(signal.reason).toBe('done');
+ });
+
+ it('detaches from a long-lived input once it aborts', () => {
+ const longLived = new AbortController();
+ const shortLived = new AbortController();
+ const add = vi.spyOn(longLived.signal, 'addEventListener');
+ anyAbortSignal([longLived.signal, shortLived.signal]);
+
+ shortLived.abort();
+
+ const options = add.mock.calls[0]?.[2];
+ expect(typeof options === 'object' && options.signal?.aborted).toBe(true);
+ });
+});
diff --git a/apps/web/src/lib/core/util/abort-signal.ts b/apps/web/src/lib/core/util/abort-signal.ts
new file mode 100644
index 0000000000..e35471f9d7
--- /dev/null
+++ b/apps/web/src/lib/core/util/abort-signal.ts
@@ -0,0 +1,24 @@
+// `AbortSignal.any` needs Safari 17.4, newer than the webview floor in
+// apps/web/package.json `browserslist`.
+
+/**
+ * Aborts with the first input's reason as soon as any input aborts. Listeners
+ * on the inputs are removed only when the result aborts, so pair a long-lived
+ * input with a short-lived one such as a timeout.
+ */
+export function anyAbortSignal(signals: readonly AbortSignal[]): AbortSignal {
+ const controller = new AbortController();
+ for (const signal of signals) {
+ if (signal.aborted) {
+ controller.abort(signal.reason);
+ return controller.signal;
+ }
+ }
+ for (const signal of signals) {
+ signal.addEventListener('abort', () => controller.abort(signal.reason), {
+ once: true,
+ signal: controller.signal,
+ });
+ }
+ return controller.signal;
+}
diff --git a/apps/web/src/lib/filesystem/open.ts b/apps/web/src/lib/filesystem/open.ts
index eb889cf826..9dacc04d52 100644
--- a/apps/web/src/lib/filesystem/open.ts
+++ b/apps/web/src/lib/filesystem/open.ts
@@ -14,6 +14,7 @@ async function openInBrowser(
filters: Array<FileFilter>,
multiple: boolean
): Promise<FileHandle[]> {
+ // eslint-disable-next-line platform-compat/browser-floor -- checked before use below.
const openFilePicker = window?.showOpenFilePicker;
if (!openFilePicker) {
throw new FileSystemError(
diff --git a/apps/web/src/lib/graphql-cache/exchange/mutation-queue-runner.ts b/apps/web/src/lib/graphql-cache/exchange/mutation-queue-runner.ts
index 363bfc38ad..04c9893268 100644
--- a/apps/web/src/lib/graphql-cache/exchange/mutation-queue-runner.ts
+++ b/apps/web/src/lib/graphql-cache/exchange/mutation-queue-runner.ts
@@ -30,6 +30,7 @@
* queued and scheduling the pump are idempotent wakeups and are not fenced.
*/
+import { anyAbortSignal } from '@core/util/abort-signal';
import { fireAndForget } from '@core/util/fireAndForget';
import {
type Client,
@@ -178,7 +179,7 @@ export function withQueueRequestTimeout(op: Operation): Operation {
operationFetch(input, {
...init,
signal: init?.signal
- ? AbortSignal.any([init.signal, timeoutSignal])
+ ? anyAbortSignal([init.signal, timeoutSignal])
: timeoutSignal,
});
const response = await (attempt?.telemetry?.run(send) ?? send());
diff --git a/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.test.ts b/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.test.ts
index aa5ea3faf6..4cef5eb215 100644
--- a/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.test.ts
+++ b/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.test.ts
@@ -4757,13 +4757,14 @@ describe('normalizedCacheExchange', () => {
it('bounds queued network attempts to one minute', async () => {
const timeoutSignal = new AbortController().signal;
- const existingSignal = new AbortController().signal;
- const combinedSignal = new AbortController().signal;
+ const existing = new AbortController();
const timeout = vi
.spyOn(AbortSignal, 'timeout')
.mockReturnValue(timeoutSignal);
- const any = vi.spyOn(AbortSignal, 'any').mockReturnValue(combinedSignal);
const operationFetch = vi.fn().mockResolvedValue(new Response());
+ // Webviews below Safari 17.4 have no AbortSignal.any.
+ const { any } = AbortSignal;
+ Reflect.deleteProperty(AbortSignal, 'any');
try {
const mutation = makeMutationOp(1, optimistic);
const mutationWithFetch = makeOperation(mutation.kind, mutation, {
@@ -4774,7 +4775,7 @@ describe('normalizedCacheExchange', () => {
const { ops } = harness(host, (op) => {
if (op.kind === 'mutation') {
fetched = op.context.fetch?.('http://test', {
- signal: existingSignal,
+ signal: existing.signal,
});
}
return {};
@@ -4783,15 +4784,15 @@ describe('normalizedCacheExchange', () => {
await tick();
expect(timeout).toHaveBeenCalledWith(60_000);
- expect(any).toHaveBeenCalledWith([existingSignal, timeoutSignal]);
- expect(operationFetch).toHaveBeenCalledWith(
- 'http://test',
- expect.objectContaining({ signal: combinedSignal })
- );
+ const signal: AbortSignal = operationFetch.mock.calls[0]?.[1].signal;
+ expect(signal.aborted).toBe(false);
+ existing.abort('cancelled');
+ expect(signal.aborted).toBe(true);
+ expect(signal.reason).toBe('cancelled');
await fetched;
} finally {
+ Object.assign(AbortSignal, { any });
timeout.mockRestore();
- any.mockRestore();
}
});
diff --git a/apps/web/src/lib/graphql-cache/worker/coordinator-page-adapter.ts b/apps/web/src/lib/graphql-cache/worker/coordinator-page-adapter.ts
index fb05212c33..4cc17a58db 100644
--- a/apps/web/src/lib/graphql-cache/worker/coordinator-page-adapter.ts
+++ b/apps/web/src/lib/graphql-cache/worker/coordinator-page-adapter.ts
@@ -116,6 +116,7 @@ const defaultSharedWorkerFactory = (
scope: string,
buildTime: number
): SharedWorkerLike =>
+ // eslint-disable-next-line platform-compat/browser-floor -- connect() checks for SharedWorker before calling this.
new SharedWorker(
new URL('./cache.coordinator.shared-worker.ts', import.meta.url),
{ type: 'module', name: `graphql-cache-coordinator:${scope}:${buildTime}` }
diff --git a/apps/web/src/lib/queries/email/server-sends.test.ts b/apps/web/src/lib/queries/email/server-sends.test.ts
index 7a481a442a..34cc05b737 100644
--- a/apps/web/src/lib/queries/email/server-sends.test.ts
+++ b/apps/web/src/lib/queries/email/server-sends.test.ts
@@ -50,6 +50,18 @@ it('loads sends from other devices on sign-in without a local send or rollout fl
expect(readPendingEmailSends).toHaveBeenCalledTimes(1);
});
+it('loads sends on webviews without AbortSignal.any', async () => {
+ const { any } = AbortSignal;
+ Reflect.deleteProperty(AbortSignal, 'any');
+ try {
+ setServerSendSession('owner');
+ await refreshServerEmailSends();
+ expect(serverEmailSends()).toEqual(pending.pendingEmailSends.attempts);
+ } finally {
+ Object.assign(AbortSignal, { any });
+ }
+});
+
it('waits offline and refreshes server sends on reconnect', async () => {
vi.spyOn(navigator, 'onLine', 'get').mockReturnValue(false);
setServerSendSession('owner');
diff --git a/apps/web/src/lib/queries/email/server-sends.ts b/apps/web/src/lib/queries/email/server-sends.ts
index 083eaf49b8..fbda8ce0a2 100644
--- a/apps/web/src/lib/queries/email/server-sends.ts
+++ b/apps/web/src/lib/queries/email/server-sends.ts
@@ -1,3 +1,4 @@
+import { anyAbortSignal } from '@core/util/abort-signal';
import { fireAndForget } from '@core/util/fireAndForget';
import { readPendingEmailSends } from '@service-storage/email-send';
import type { PendingEmailSendsQuery } from '@service-storage/graphql/generated/graphql';
@@ -45,7 +46,7 @@ function createServerSendObserver(accountId: string) {
try {
if (navigator.onLine === false) return;
controller = new AbortController();
- const signal = AbortSignal.any([
+ const signal = anyAbortSignal([
controller.signal,
AbortSignal.timeout(15_000),
]);
diff --git a/apps/web/src/lib/queries/soup/request-timeout.test.ts b/apps/web/src/lib/queries/soup/request-timeout.test.ts
index 9150e71c48..54567e44a9 100644
--- a/apps/web/src/lib/queries/soup/request-timeout.test.ts
+++ b/apps/web/src/lib/queries/soup/request-timeout.test.ts
@@ -29,6 +29,21 @@ describe('createSoupRequestSignal', () => {
timeout.mockRestore();
});
+ it('works on webviews without AbortSignal.any', () => {
+ const { any } = AbortSignal;
+ Reflect.deleteProperty(AbortSignal, 'any');
+ try {
+ const query = new AbortController();
+ const signal = createSoupRequestSignal(query.signal);
+
+ query.abort();
+
+ expect(signal.aborted).toBe(true);
+ } finally {
+ Object.assign(AbortSignal, { any });
+ }
+ });
+
it('pauses while offline and resumes when connectivity returns', async () => {
onlineManager.setOnline(false);
const queryFn = vi.fn(async () => 'loaded');
diff --git a/apps/web/src/lib/queries/soup/request-timeout.ts b/apps/web/src/lib/queries/soup/request-timeout.ts
index 05dfc5b451..dc662c9423 100644
--- a/apps/web/src/lib/queries/soup/request-timeout.ts
+++ b/apps/web/src/lib/queries/soup/request-timeout.ts
@@ -1,4 +1,5 @@
import { getNativeNetworkAbortSignal } from '@core/mobile/native-network-status';
+import { anyAbortSignal } from '@core/util/abort-signal';
/** Maximum time an active Soup view may wait for its network response. */
export const SOUP_REQUEST_TIMEOUT_MS = 12_000;
@@ -17,7 +18,7 @@ export function createSoupRequestSignal(
querySignal: AbortSignal,
timeoutMs = SOUP_REQUEST_TIMEOUT_MS
): AbortSignal {
- return AbortSignal.any([
+ return anyAbortSignal([
querySignal,
getNativeNetworkAbortSignal(),
AbortSignal.timeout(timeoutMs),
diff --git a/apps/web/src/lib/split-router/router/runner.ts b/apps/web/src/lib/split-router/router/runner.ts
index 6c75e64240..a0fb461381 100644
--- a/apps/web/src/lib/split-router/router/runner.ts
+++ b/apps/web/src/lib/split-router/router/runner.ts
@@ -167,20 +167,23 @@ export function createRunner(options: {
navigation: Navigation,
begin: () => void
): MaybePromise<NavigationResult> => {
- const deferred = Promise.withResolvers<NavigationResult>();
+ let resolve!: (value: NavigationResult) => void;
+ const promise = new Promise<NavigationResult>((settle) => {
+ resolve = settle;
+ });
let result: NavigationResult | undefined;
settlers.set(navigation, {
settle(value) {
result = value;
- deferred.resolve(value);
+ resolve(value);
},
callbacks: [],
});
- fireAndForget(track(deferred.promise), 'split-router');
+ fireAndForget(track(promise), 'split-router');
begin();
- return result ?? deferred.promise;
+ return result ?? promise;
};
const settle = (navigation: Navigation, result: NavigationResult) => {
diff --git a/apps/web/src/lib/split-router/tests/router.test.ts b/apps/web/src/lib/split-router/tests/router.test.ts
index e259675c43..8cc1351491 100644
--- a/apps/web/src/lib/split-router/tests/router.test.ts
+++ b/apps/web/src/lib/split-router/tests/router.test.ts
@@ -304,6 +304,29 @@ describe('split router', () => {
expect(routeIds(router.entry(pane(0)))).toEqual(['mail']);
});
+ it('navigates on webviews without Promise.withResolvers', async () => {
+ const withResolvers = Promise.withResolvers;
+ Reflect.deleteProperty(Promise, 'withResolvers');
+ try {
+ const { router, pane } = track(setup('/home'));
+ let allow: (value: boolean) => void = () => {};
+ router.registerGuard(
+ pane(0),
+ PANE_ROUTE_LEVEL,
+ () =>
+ new Promise<boolean>((resolve) => {
+ allow = resolve;
+ })
+ );
+ const result = router.navigatePane(pane(0), '/mail');
+ allow(true);
+ await expect(result).resolves.toMatchObject({ status: 'committed' });
+ expect(routeIds(router.entry(pane(0)))).toEqual(['mail']);
+ } finally {
+ Object.assign(Promise, { withResolvers });
+ }
+ });
+
it('a newer navigation in the same pane supersedes a pending one', async () => {
const { router, pane } = track(
setup('/home', {
diff --git a/apps/web/src/lib/tauri/notification.test.ts b/apps/web/src/lib/tauri/notification.test.ts
index 7b98ae67b2..e1d61bb60d 100644
--- a/apps/web/src/lib/tauri/notification.test.ts
+++ b/apps/web/src/lib/tauri/notification.test.ts
@@ -225,6 +225,27 @@ describe('desktop notification delivery', () => {
expect(mocks.sendNotification).not.toHaveBeenCalled();
});
+ it('reports denied when macOS no longer allows this app to ask', async () => {
+ mocks.invoke.mockImplementation(async (command) => {
+ if (command === 'get_macos_notification_permission') return 'default';
+ throw 'macOS notification authorization failed (UNErrorDomain 1): Notifications are not allowed for this application';
+ });
+ const adapter = createTauriNotificationInterface(vi.fn());
+
+ await expect(adapter.requestPermission()).resolves.toBe('denied');
+ });
+
+ it('propagates other macOS authorization failures', async () => {
+ const failure = 'macOS notification callback was dropped';
+ mocks.invoke.mockImplementation(async (command) => {
+ if (command === 'get_macos_notification_permission') return 'default';
+ throw failure;
+ });
+ const adapter = createTauriNotificationInterface(vi.fn());
+
+ await expect(adapter.requestPermission()).rejects.toBe(failure);
+ });
+
it.each(['windows', 'ios', 'android'])(
'preserves plugin delivery on %s',
async (os) => {
diff --git a/apps/web/src/lib/tauri/notification.ts b/apps/web/src/lib/tauri/notification.ts
index c106764968..3b77fbf4eb 100644
--- a/apps/web/src/lib/tauri/notification.ts
+++ b/apps/web/src/lib/tauri/notification.ts
@@ -51,9 +51,17 @@ export function createTauriNotificationInterface(
// macOS will not prompt again after denial; permission must be changed
// in System Settings.
if (cur === 'denied') return 'denied';
- return await invoke<NotificationPermission>(
- 'request_macos_notification_permission'
- );
+ try {
+ return await invoke<NotificationPermission>(
+ 'request_macos_notification_permission'
+ );
+ } catch (error) {
+ // UNErrorCodeNotificationsNotAllowed: only System Settings can
+ // allow this app again, for example after it was re-signed.
+ if (typeof error === 'string' && error.includes('(UNErrorDomain 1)'))
+ return 'denied';
+ throw error;
+ }
}
return await requestPermission();
},
diff --git a/apps/web/vite.base.ts b/apps/web/vite.base.ts
index 12c0e24308..b620868849 100644
--- a/apps/web/vite.base.ts
+++ b/apps/web/vite.base.ts
@@ -9,7 +9,7 @@ import solidSvg from 'vite-plugin-solid-svg';
import wasm from 'vite-plugin-wasm';
import tsconfigpaths from 'vite-tsconfig-paths';
// @ts-ignore
-import { version } from './package.json';
+import { browserslist, version } from './package.json';
import { devCompression } from './scripts/dev-compression';
import { devHttps } from './scripts/dev-https';
import { devExternalSourcemaps } from './scripts/dev-sourcemaps';
@@ -249,6 +249,27 @@ function loroAsyncWasm(): Plugin {
};
}
+const ESBUILD_BROWSERS: Record<string, string> = {
+ safari: 'safari',
+ ios_saf: 'ios',
+ chrome: 'chrome',
+ and_chr: 'chrome',
+ edge: 'edge',
+ firefox: 'firefox',
+};
+
+/** Converts the `browser >= version` floors in package.json `browserslist` to esbuild targets. */
+function esbuildTargets(queries: readonly string[]): string[] {
+ return queries.map((query) => {
+ const match = /^(\w+) >= (\d+(?:\.\d+)?)$/.exec(query);
+ const browser = match ? ESBUILD_BROWSERS[match[1]] : undefined;
+ if (!match || !browser) {
+ throw new Error(`Unsupported browserslist query for esbuild: ${query}`);
+ }
+ return `${browser}${match[2]}`;
+ });
+}
+
/** Hashed assets the first screen needs; index.html requests them while it parses. */
const HTML_PRELOADS = [
// The app waits for Loro to initialize before rendering.
@@ -362,7 +383,7 @@ export const createAppViteConfig = (): UserConfigFn => {
// target older safari to avoid lightningcss using text-decoration shorthand:
// https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration#browser_compatibility
cssTarget: ['esnext', 'safari15'],
- target: 'esnext',
+ target: esbuildTargets(browserslist),
outDir: 'dist',
emptyOutDir: true,
minify: !NO_MINIFY,
diff --git a/docs/development/style-guide.md b/docs/development/style-guide.md
index 3130a21bb9..29e5717b17 100644
--- a/docs/development/style-guide.md
+++ b/docs/development/style-guide.md
@@ -4,8 +4,9 @@ Code conventions are agent rules in [`.agents/rules/`](../../.agents/rules/). Ag
load each file when they touch matching paths; reviewers and CodeRabbit read the
same files. This page explains the scheme and indexes the rule files.
-**Check locally.** `just check` is the single gate: format, lint, code rules, and
-a PII scan of added lines, scoped to your changes against `origin/main`, with
+**Check locally.** `just check` is the single gate: format, lint, code rules, the
+web browser floor ([`tooling/platform-compat`](../../tooling/platform-compat/AGENTS.md)),
+and a PII scan of added lines, scoped to your changes against `origin/main`, with
every finding printed as `file:line [rule-id]` and the command that fixes it.
`just check full` adds `tsc`
and clippy. Mechanically enforceable rules live in [`rules/ast-grep/`](../../rules/ast-grep/).
diff --git a/packages/collaboration/src/sync-service/source.test.ts b/packages/collaboration/src/sync-service/source.test.ts
index 704ecb7775..0308182468 100644
--- a/packages/collaboration/src/sync-service/source.test.ts
+++ b/packages/collaboration/src/sync-service/source.test.ts
@@ -370,6 +370,21 @@ describe('SyncServiceSource', () => {
expect((await pending)._unsafeUnwrap()).toEqual(bytes);
});
+ it('waits for replies on webviews without Promise.withResolvers', async () => {
+ const withResolvers = Promise.withResolvers;
+ Reflect.deleteProperty(Promise, 'withResolvers');
+ try {
+ const ws = new FakeSocket();
+ const src = new SyncServiceSource(ws, 'doc1');
+ const pending = src.requestSnapshot();
+ const bytes = new Uint8Array([7]);
+ ws.deliver(remote.snapshot(bytes));
+ expect((await pending)._unsafeUnwrap()).toEqual(bytes);
+ } finally {
+ Object.assign(Promise, { withResolvers });
+ }
+ });
+
it('re-syncs and emits reconnect after a Reconnect event', async () => {
const ws = new FakeSocket();
const src = new SyncServiceSource(ws, 'doc1');
diff --git a/packages/collaboration/src/sync-service/source.ts b/packages/collaboration/src/sync-service/source.ts
index 5956e642b8..c79ac3c4b3 100644
--- a/packages/collaboration/src/sync-service/source.ts
+++ b/packages/collaboration/src/sync-service/source.ts
@@ -290,7 +290,12 @@ export class SyncServiceSource implements LiveSyncSource {
timeoutMs: number,
cancelOnDisconnect = false
): Promise<FromRemote> {
- const { promise, resolve, reject } = Promise.withResolvers<FromRemote>();
+ let resolve!: (message: FromRemote) => void;
+ let reject!: (error: unknown) => void;
+ const promise = new Promise<FromRemote>((settle, fail) => {
+ resolve = settle;
+ reject = fail;
+ });
const waiter: MessageWaiter = {
match,
cancelOnDisconnect: cancelOnDisconnect
diff --git a/tooling/just/check.just b/tooling/just/check.just
index 206e80becd..bafa89c4c3 100644
--- a/tooling/just/check.just
+++ b/tooling/just/check.just
@@ -7,6 +7,7 @@
# typescript/no-floating-promises, so apps/web files are linted --type-aware.
#
# just check fast: rustfmt + biome + oxlint + ast-grep + PII (~seconds)
+# + browser floor and native permissions (tooling/platform-compat)
# just check full also runs tsc + clippy (~minutes)
#
# Override the diff base with CHECK_BASE=<ref> (useful in shallow clones,
@@ -30,7 +31,7 @@ check *ARGS:
rs=$(grep -E '^(crates|services|tooling)/.*\.rs$' <<<"$changed" || true)
# Match the SDK and collaboration Biome configs: preserve generator output verbatim.
- js=$(grep -E '^(apps/(web|marketing)|packages|services/(analytics-proxy|ai-editing-worker|lexical-service|websocket-service))/.*\.(ts|tsx)$' <<<"$changed" | grep -Ev '^packages/(sdk/generated|collaboration/src/sync-service/generated)/' || true)
+ js=$(grep -E '^(apps/(web|marketing)|packages|services/(analytics-proxy|ai-editing-worker|lexical-service|websocket-service)|tooling/platform-compat)/.*\.(ts|tsx)$' <<<"$changed" | grep -Ev '^packages/(sdk/generated|collaboration/src/sync-service/generated)/' || true)
sg=$(grep -E '^(apps|crates|packages|services|tooling)/.*\.(rs|ts|tsx)$' <<<"$changed" || true)
fail=0
@@ -100,6 +101,25 @@ check *ARGS:
echo "── ast-grep code rules (rule ids map to docs/development/style-guide.md)"
bunx --yes @ast-grep/[email protected] scan --report-style=short $sg || fail=1
fi
+ # A changed floor or rule rechecks all of the web sources (~40 s).
+ # lint-web.ts skips files outside its configured web sources.
+ web_src=$(grep -E '^(apps/web/src|packages)/.*\.(ts|tsx)$' <<<"$changed" || true)
+ compat_changed=$(grep -E '^(apps/web/package\.json|tooling/platform-compat/)' <<<"$changed" || true)
+ native_changed=$(grep -E '^(apps/web/tauri/(src-tauri|desktop-cef)/(.*\.plist|tauri.*\.json)|tooling/platform-compat/)' <<<"$changed" || true)
+ if [ -n "$web_src$compat_changed$native_changed" ] && [ ! -d tooling/platform-compat/node_modules ]; then
+ (\cd tooling/platform-compat && bun install --frozen-lockfile) || fail=1
+ fi
+ if [ -n "$compat_changed" ]; then
+ echo "── browser floor (all web sources vs apps/web/package.json browserslist)"
+ (\cd tooling/platform-compat && ./node_modules/.bin/tsc -p . && bun test && bun src/lint-web.ts) || fail=1
+ elif [ -n "$web_src" ]; then
+ echo "── browser floor (changed web sources vs apps/web/package.json browserslist)"
+ bun tooling/platform-compat/src/lint-web.ts $web_src || fail=1
+ fi
+ if [ -n "$native_changed" ]; then
+ echo "── native media permissions (Info.plist usage strings, macOS entitlements)"
+ bun tooling/platform-compat/src/check-native-permissions.ts || fail=1
+ fi
echo "── PII scan (added lines vs merge-base)"
python3 tooling/pii/scan.py --changed --skip-gitleaks || fail=1
if grep -q '^tooling/pii/' <<<"$changed"; then
diff --git a/tooling/platform-compat/AGENTS.md b/tooling/platform-compat/AGENTS.md
new file mode 100644
index 0000000000..2cd44147f8
--- /dev/null
+++ b/tooling/platform-compat/AGENTS.md
@@ -0,0 +1,50 @@
+# platform-compat
+
+## What it is
+
+Guards that keep the web app running on the oldest webviews it supports: an
+ESLint rule that checks `apps/web/src` against the `browserslist` in
+`apps/web/package.json`, and a check that the native bundles keep the camera and
+microphone permissions meetings and dictation need: the usage strings in the
+macOS (`desktop-cef/tauri.conf.json`) and iOS Info.plists, and the macOS
+entitlements.
+
+## How it works
+
+`src/browser-floor-rule.ts` finds references to globals (`SharedWorker`),
+their statics (`AbortSignal.any`), members of singleton globals
+(`navigator.permissions`), and regex syntax (lookbehind, the `v` flag). It looks
+each up in `@mdn/browser-compat-data` and reports any the floor lacks, unless a
+feature check guards the use. `src/lint-web.ts` runs it from the repository root.
+
+## Start here
+
+- `src/browser-floor-rule.ts`: what counts as a use and as a guard.
+- `src/compat-data.ts`: how a reference maps to a compatibility-data key.
+
+## Scope
+
+- Owns: the browser-floor lint and the native media permission check.
+- Not here: the floor itself (`apps/web/package.json` `browserslist`, which
+ `apps/web/vite.base.ts` also turns into the esbuild target); signed-DMG
+ validation (`tooling/xtask/crates/xtask_workflows/src/workflows/scripts/validate_signed_dmg.sh`).
+
+## Checks
+
+- `bun install --frozen-lockfile && bun run check` (types, tests, native
+ permissions, full `apps/web/src` lint; CI runs this in Web App Check).
+- `just check` lints changed `apps/web/src` files, or everything when the floor
+ or this package changes.
+
+## Gotchas
+
+- This package has its own `bun.lock` and is not a root workspace, so it does
+ not change the Nix `node_modules` hash. Install it here, not from the root.
+- Only `browser >= version` queries are allowed: the Vite config maps them
+ one-to-one to esbuild targets.
+- Prototype methods (`array.toSorted()`) need type information and are not
+ checked. Neither is partial support such as Chrome for Android's throwing
+ `Notification` constructor, because the data marks common APIs like
+ `window.open` partial too.
+- Silence a guarded use the rule cannot see with
+ `// eslint-disable-next-line platform-compat/browser-floor -- <why it is safe>`.
diff --git a/tooling/platform-compat/CLAUDE.md b/tooling/platform-compat/CLAUDE.md
new file mode 120000
index 0000000000..47dc3e3d86
--- /dev/null
+++ b/tooling/platform-compat/CLAUDE.md
@@ -0,0 +1 @@
+AGENTS.md
\ No newline at end of file
diff --git a/tooling/platform-compat/bun.lock b/tooling/platform-compat/bun.lock
new file mode 100644
index 0000000000..a2fa0f5dd0
--- /dev/null
+++ b/tooling/platform-compat/bun.lock
@@ -0,0 +1,226 @@
+{
+ "lockfileVersion": 1,
+ "configVersion": 1,
+ "workspaces": {
+ "": {
+ "name": "@macro/platform-compat",
+ "devDependencies": {
+ "@mdn/browser-compat-data": "8.1.6",
+ "@types/bun": "1.4.3",
+ "@typescript-eslint/parser": "8.71.2",
+ "browserslist": "4.29.3",
+ "eslint": "10.13.0",
+ "typescript": "6.0.3",
+ },
+ },
+ },
+ "packages": {
+ "@cacheable/memory": ["@cacheable/[email protected]", "", { "dependencies": { "@cacheable/utils": "^2.5.0", "@keyv/bigmap": "^1.3.1", "hookified": "^1.15.1", "keyv": "^5.6.0" } }, "sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ=="],
+
+ "@cacheable/utils": ["@cacheable/[email protected]", "", { "dependencies": { "hashery": "^1.5.1", "keyv": "^5.6.0" } }, "sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA=="],
+
+ "@eslint-community/eslint-utils": ["@eslint-community/[email protected]", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg=="],
+
+ "@eslint-community/regexpp": ["@eslint-community/[email protected]", "", {}, "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew=="],
+
+ "@eslint/config-array": ["@eslint/[email protected]", "", { "dependencies": { "@eslint/object-schema": "^3.0.5", "debug": "^4.3.1", "minimatch": "^10.2.4" } }, "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA=="],
+
+ "@eslint/config-helpers": ["@eslint/[email protected]", "", { "dependencies": { "@eslint/core": "^1.2.1" } }, "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw=="],
+
+ "@eslint/core": ["@eslint/[email protected]", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ=="],
+
+ "@eslint/object-schema": ["@eslint/[email protected]", "", {}, "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw=="],
+
+ "@eslint/plugin-kit": ["@eslint/[email protected]", "", { "dependencies": { "@eslint/core": "^1.2.1", "levn": "^0.4.1" } }, "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q=="],
+
+ "@humanfs/core": ["@humanfs/[email protected]", "", { "dependencies": { "@humanfs/types": "^0.15.0" } }, "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA=="],
+
+ "@humanfs/node": ["@humanfs/[email protected]", "", { "dependencies": { "@humanfs/core": "^0.19.2", "@humanfs/types": "^0.15.0", "@humanwhocodes/retry": "^0.4.0" } }, "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ=="],
+
+ "@humanfs/types": ["@humanfs/[email protected]", "", {}, "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q=="],
+
+ "@humanwhocodes/module-importer": ["@humanwhocodes/[email protected]", "", {}, "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA=="],
+
+ "@humanwhocodes/retry": ["@humanwhocodes/[email protected]", "", {}, "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ=="],
+
+ "@keyv/bigmap": ["@keyv/[email protected]", "", { "dependencies": { "hashery": "^1.4.0", "hookified": "^1.15.0" }, "peerDependencies": { "keyv": "^5.6.0" } }, "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ=="],
+
+ "@keyv/serialize": ["@keyv/[email protected]", "", {}, "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA=="],
+
+ "@mdn/browser-compat-data": ["@mdn/[email protected]", "", {}, "sha512-bTP5c58cBsgMOokwa/ECLcAxTkIwBe9csIts92Nq2wviediIJadh9iHI4Ezn2q6RiZhy7b54SNRn/tZpPKtTsA=="],
+
+ "@types/bun": ["@types/[email protected]", "", { "dependencies": { "bun-types": "1.4.3" } }, "sha512-N67Pqy8JXbAY/j0tNraS3V5mubGvc6rrrNDmDCtZLlFzccbUJPDb0tvgUBC5q4m8ybkP93Jcn1QB+RYQ6PvBhw=="],
+
+ "@types/esrecurse": ["@types/[email protected]", "", {}, "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw=="],
+
+ "@types/estree": ["@types/[email protected]", "", {}, "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg=="],
+
+ "@types/json-schema": ["@types/[email protected]", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="],
+
+ "@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~8.9.0" } }, "sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg=="],
+
+ "@typescript-eslint/parser": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.71.2", "@typescript-eslint/types": "8.71.2", "@typescript-eslint/typescript-estree": "8.71.2", "@typescript-eslint/visitor-keys": "8.71.2", "debug": "^4.4.3" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "sha512-aTtmZjp/x3gsGHkDs04/1I8kNogBJkpQaeGaN0PfiG43NzDEmW2n+OP5im9wfsvyX0yP1UZWBrAGtDBfH9jEVw=="],
+
+ "@typescript-eslint/project-service": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.71.2", "@typescript-eslint/types": "^8.71.2", "debug": "^4.4.3" }, "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-Pd68GsLVh5ZXlcEccFPdhSOvtHZ/2WU0XsA8zmXOS3F158lVlcTLhfQ6qvtL1RzbMie0Kp8xtbVwAg4nejKPHw=="],
+
+ "@typescript-eslint/scope-manager": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/types": "8.71.2", "@typescript-eslint/visitor-keys": "8.71.2" } }, "sha512-YF4wgg5iUX5Obywoac27B56FhozMNFhdJSbh11H5GBAwmBtfyRhmgTQqW9tRNNmHDvsZ2CX6UGzoz+YfYn2Leg=="],
+
+ "@typescript-eslint/tsconfig-utils": ["@typescript-eslint/[email protected]", "", { "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-jz49TAWokm/7yWD9/o837nYax9DyALxIPOImdImvVzo6canBCZYzin8zJyqNR5k1j9K1DE0bVvr0XYB+99uAdg=="],
+
+ "@typescript-eslint/types": ["@typescript-eslint/[email protected]", "", {}, "sha512-y5Ukl3oVp7e/VGxqIoEXoeb/Roj71PAJ4WG/N/RGj+eeDvKRLM15kGr9MijLbN0i03S52zxu31Z98E5gWChJKw=="],
+
+ "@typescript-eslint/typescript-estree": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/project-service": "8.71.2", "@typescript-eslint/tsconfig-utils": "8.71.2", "@typescript-eslint/types": "8.71.2", "@typescript-eslint/visitor-keys": "8.71.2", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", "tinyglobby": "^0.2.15", "ts-api-utils": "^2.5.0" }, "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-DgNOEsl4pdYzwSL+N/Cl33tX1Hlw3FvId73LnKXfq7jnrF2viOEn7X+P7RBkkSWCVm92gnWd28GIC5vJuLREeA=="],
+
+ "@typescript-eslint/visitor-keys": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/types": "8.71.2", "eslint-visitor-keys": "^5.0.0" } }, "sha512-zozlN0UA32bSG2zkKAgQyRYSbEISVoyU6vvkKYo2aSny74D8Jh4e+POkJ6Lk0dlezZi5x7TtD+88Xb06IB8nhg=="],
+
+ "acorn": ["[email protected]", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw=="],
+
+ "acorn-jsx": ["[email protected]", "", { "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ=="],
+
+ "ajv": ["[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="],
+
+ "balanced-match": ["[email protected]", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="],
+
+ "baseline-browser-mapping": ["[email protected]", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-YeesxhUmR4h5y5V8KF8iBCqJb8YFrBJ++XBTeGcWIaQOYXGN19JM0FoiOjAhwuDoln8owMgXcWBmgHtYSkky2w=="],
+
+ "brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ=="],
+
+ "browserslist": ["[email protected]", "", { "dependencies": { "baseline-browser-mapping": "^2.11.26", "caniuse-lite": "^1.0.30001813", "electron-to-chromium": "^1.5.439", "node-releases": "^2.0.57", "update-browserslist-db": "^1.3.3" }, "bin": { "browserslist": "cli.js" } }, "sha512-1R4kiYKXGViqEN0CnoDrXc1StD9niAwu+j2dukWzrD4bJgsD4lDmEp0CRbc6E/vYJIfTHwPmwyaKtVSudICdPA=="],
+
+ "bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*", "undici-types": "*" } }, "sha512-tinRJNGOmUN+tEAsn2y2e942n9JHRHR42iUYzDH75NmhJqVBokGSQkkfSFdNWwsANIdrK6ACH9t01M452YyTwg=="],
+
+ "cacheable": ["[email protected]", "", { "dependencies": { "@cacheable/memory": "^2.2.0", "@cacheable/utils": "^2.5.0", "hookified": "^1.15.0", "keyv": "^5.6.0", "qified": "^0.10.1" } }, "sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g=="],
+
+ "caniuse-lite": ["[email protected]", "", {}, "sha512-+8Yx7BXCoqk6IF8yTicjfUR6D/ldJzdlsodlEOiOSPmhK844WIgk67/zIQaGAOxNkZyyvBlrRFnLvqKIoqbAFw=="],
+
+ "cross-spawn": ["[email protected]", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
+
+ "debug": ["[email protected]", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
+
+ "deep-is": ["[email protected]", "", {}, "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ=="],
+
+ "electron-to-chromium": ["[email protected]", "", {}, "sha512-/hIH2gRSmxrf4/X4Nw/t/Wc8PVS22l8/3HnWjWTWsTOM5dsnMUPZF/+u+yr3LqweNuTBJE1rq6qAQzKkZVwMfA=="],
+
+ "escalade": ["[email protected]", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="],
+
+ "escape-string-regexp": ["[email protected]", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="],
+
+ "eslint": ["[email protected]", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.2", "@eslint/config-array": "^0.23.5", "@eslint/config-helpers": "^0.7.0", "@eslint/core": "^1.2.1", "@eslint/plugin-kit": "^0.7.3", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.14.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^9.1.2", "eslint-visitor-keys": "^5.0.1", "espree": "^11.2.0", "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "11.1.5 || >11.1.6 <12", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "minimatch": "^10.2.5", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-UohDjD4zSzEwhf58M3O7vc/ycc8O1I7dNlhtD0WxE8Px8EHNJKtUwzBqrzeGhisRuv2ag4sAYswszCJRgKXYUg=="],
+
+ "eslint-scope": ["[email protected]", "", { "dependencies": { "@types/esrecurse": "^4.3.1", "@types/estree": "^1.0.8", "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ=="],
+
+ "eslint-visitor-keys": ["[email protected]", "", {}, "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA=="],
+
+ "espree": ["[email protected]", "", { "dependencies": { "acorn": "^8.16.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^5.0.1" } }, "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw=="],
+
+ "esquery": ["[email protected]", "", { "dependencies": { "estraverse": "^5.1.0" } }, "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g=="],
+
+ "esrecurse": ["[email protected]", "", { "dependencies": { "estraverse": "^5.2.0" } }, "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag=="],
+
+ "estraverse": ["[email protected]", "", {}, "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA=="],
+
+ "esutils": ["[email protected]", "", {}, "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="],
+
+ "fast-deep-equal": ["[email protected]", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="],
+
+ "fast-json-stable-stringify": ["[email protected]", "", {}, "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="],
+
+ "fast-levenshtein": ["[email protected]", "", {}, "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="],
+
+ "fdir": ["[email protected]", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],
+
+ "file-entry-cache": ["[email protected]", "", { "dependencies": { "flat-cache": "^6.1.23" } }, "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q=="],
+
+ "find-up": ["[email protected]", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="],
+
+ "flat-cache": ["[email protected]", "", { "dependencies": { "cacheable": "^2.5.0", "flatted": "^3.4.2", "hookified": "^1.15.0" } }, "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA=="],
+
+ "flatted": ["[email protected]", "", {}, "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q=="],
+
+ "glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.3" } }, "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A=="],
+
+ "hashery": ["[email protected]", "", { "dependencies": { "hookified": "^1.15.0" } }, "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ=="],
+
+ "hookified": ["[email protected]", "", {}, "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg=="],
+
+ "ignore": ["[email protected]", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="],
+
+ "imurmurhash": ["[email protected]", "", {}, "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="],
+
+ "is-extglob": ["[email protected]", "", {}, "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ=="],
+
+ "is-glob": ["[email protected]", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="],
+
+ "isexe": ["[email protected]", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
+
+ "json-schema-traverse": ["[email protected]", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
+
+ "json-stable-stringify-without-jsonify": ["[email protected]", "", {}, "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw=="],
+
+ "keyv": ["[email protected]", "", { "dependencies": { "@keyv/serialize": "^1.1.1" } }, "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw=="],
+
+ "levn": ["[email protected]", "", { "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" } }, "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ=="],
+
+ "locate-path": ["[email protected]", "", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="],
+
+ "minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^5.0.8" } }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="],
+
+ "ms": ["[email protected]", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
+
+ "natural-compare": ["[email protected]", "", {}, "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="],
+
+ "node-releases": ["[email protected]", "", {}, "sha512-5qr2okC4ItAI0hG5SaV0HoYMpnM/Y6+Oqr7AmPYy/2uEoGvS+GbSKLeRxSS1uAdu59yz0ouzcuXievSgg///WA=="],
+
+ "optionator": ["[email protected]", "", { "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", "word-wrap": "^1.2.5" } }, "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g=="],
+
+ "p-limit": ["[email protected]", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="],
+
+ "p-locate": ["[email protected]", "", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="],
+
+ "path-exists": ["[email protected]", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="],
+
+ "path-key": ["[email protected]", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="],
+
+ "picocolors": ["[email protected]", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
+
+ "picomatch": ["[email protected]", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="],
+
+ "prelude-ls": ["[email protected]", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="],
+
+ "punycode": ["[email protected]", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="],
+
+ "qified": ["[email protected]", "", { "dependencies": { "hookified": "^2.1.1" } }, "sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA=="],
+
+ "semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="],
+
+ "shebang-command": ["[email protected]", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],
+
+ "shebang-regex": ["[email protected]", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="],
+
+ "tinyglobby": ["[email protected]", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="],
+
+ "ts-api-utils": ["[email protected]", "", { "peerDependencies": { "typescript": ">=4.8.4" } }, "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA=="],
+
+ "type-check": ["[email protected]", "", { "dependencies": { "prelude-ls": "^1.2.1" } }, "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew=="],
+
+ "typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw=="],
+
+ "undici-types": ["[email protected]", "", {}, "sha512-VoMeD2O0KdHhcn+oPqOrpivN+7aDOklVSwOLD7JNjbzV1CboAFek9IFOXnreoufTUtAsCsOK0iETiERPNR/fDA=="],
+
+ "update-browserslist-db": ["[email protected]", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-t8wonIOdQyOjtPd2VktlBu6QjTVTks6v8bSi7kd0r2Vll8TK1JYDZtRRdbmCHOAMphkZgrzK+L+vXK4pyZ8t4A=="],
+
+ "uri-js": ["[email protected]", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="],
+
+ "which": ["[email protected]", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
+
+ "word-wrap": ["[email protected]", "", {}, "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA=="],
+
+ "yocto-queue": ["[email protected]", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="],
+
+ "@eslint-community/eslint-utils/eslint-visitor-keys": ["[email protected]", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
+
+ "@types/node/undici-types": ["[email protected]", "", {}, "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg=="],
+
+ "qified/hookified": ["[email protected]", "", {}, "sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA=="],
+ }
+}
diff --git a/tooling/platform-compat/eslint.config.ts b/tooling/platform-compat/eslint.config.ts
new file mode 100644
index 0000000000..711976d2ab
--- /dev/null
+++ b/tooling/platform-compat/eslint.config.ts
@@ -0,0 +1,36 @@
+import typescriptParser from '@typescript-eslint/parser';
+import type { Linter } from 'eslint';
+import { browserFloorRule } from './src/browser-floor-rule';
+import { WEB_SOURCES } from './src/web-sources';
+
+// Paths are relative to the repository root, where src/lint-web.ts runs ESLint.
+const config: Linter.Config[] = [
+ {
+ files: WEB_SOURCES.map((source) => `${source}/**/*.{ts,tsx}`),
+ ignores: [
+ // Tests and browser harnesses run in Node or current Chromium, not the
+ // supported webviews.
+ '**/*.test.{ts,tsx}',
+ '**/*.spec.{ts,tsx}',
+ '**/*.e2e.{ts,tsx}',
+ '**/*.d.ts',
+ '**/__tests__/**',
+ '**/browser-test/**',
+ '**/fuzz/**',
+ '**/tests/**',
+ '**/test-utils/**',
+ '**/scripts/**',
+ '**/testing.ts',
+ ],
+ languageOptions: {
+ parser: typescriptParser,
+ parserOptions: { ecmaFeatures: { jsx: true } },
+ },
+ plugins: {
+ 'platform-compat': { rules: { 'browser-floor': browserFloorRule } },
+ },
+ rules: { 'platform-compat/browser-floor': 'error' },
+ },
+];
+
+export default config;
diff --git a/tooling/platform-compat/package.json b/tooling/platform-compat/package.json
new file mode 100644
index 0000000000..e46085d486
--- /dev/null
+++ b/tooling/platform-compat/package.json
@@ -0,0 +1,19 @@
+{
+ "name": "@macro/platform-compat",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "lint-web": "bun src/lint-web.ts",
+ "check-native-permissions": "bun src/check-native-permissions.ts",
+ "test": "bun test",
+ "check": "tsc -p . && bun test && bun src/check-native-permissions.ts && bun src/lint-web.ts"
+ },
+ "devDependencies": {
+ "@mdn/browser-compat-data": "8.1.6",
+ "@types/bun": "1.4.3",
+ "@typescript-eslint/parser": "8.71.2",
+ "browserslist": "4.29.3",
+ "eslint": "10.13.0",
+ "typescript": "6.0.3"
+ }
+}
diff --git a/tooling/platform-compat/src/browser-floor-rule.ts b/tooling/platform-compat/src/browser-floor-rule.ts
new file mode 100644
index 0000000000..25845d0359
--- /dev/null
+++ b/tooling/platform-compat/src/browser-floor-rule.ts
@@ -0,0 +1,260 @@
+import bcd from '@mdn/browser-compat-data' with { type: 'json' };
+import type { Rule, Scope, SourceCode } from 'eslint';
+import type * as ESTree from 'estree';
+import { parseBrowserFloor, WEB_BROWSER_FLOOR } from './browser-floor';
+import {
+ constructorFeature,
+ type Feature,
+ globalFeature,
+ memberFeature,
+ missingSupport,
+ regexFeatures,
+} from './compat-data';
+
+const GLOBAL_OBJECTS = new Set(['window', 'globalThis', 'self']);
+
+function isTypeOnly(reference: object): boolean {
+ return (
+ 'isValueReference' in reference && reference.isValueReference === false
+ );
+}
+
+function exits(statement: ESTree.Statement): boolean {
+ switch (statement.type) {
+ case 'ReturnStatement':
+ case 'ThrowStatement':
+ case 'BreakStatement':
+ case 'ContinueStatement':
+ return true;
+ case 'BlockStatement': {
+ const last = statement.body.at(-1);
+ return last !== undefined && exits(last);
+ }
+ default:
+ return false;
+ }
+}
+
+function precedingStatements(
+ parent: ESTree.Node,
+ child: ESTree.Node
+): readonly ESTree.Node[] {
+ const body =
+ parent.type === 'BlockStatement' ||
+ parent.type === 'Program' ||
+ parent.type === 'StaticBlock'
+ ? parent.body
+ : parent.type === 'SwitchCase'
+ ? parent.consequent
+ : [];
+ const index = body.findIndex((statement) => statement === child);
+ return index < 0 ? [] : body.slice(0, index);
+}
+
+/**
+ * Whether the use sits behind a feature check: an optional call or access,
+ * `typeof`, an existence check in a condition, a branch whose condition names
+ * the feature, or an earlier early-exit check. Calling the feature inside a
+ * condition is not a check, and neither is a `try` block: its `catch` usually
+ * reports a failure instead of falling back.
+ */
+function isGuarded(
+ chain: readonly ESTree.Node[],
+ featureName: string,
+ sourceCode: SourceCode
+): boolean {
+ const node = chain.at(-1);
+ const parent = chain.at(-2);
+ if (
+ node?.type === 'MemberExpression' &&
+ ((parent?.type === 'MemberExpression' &&
+ parent.object === node &&
+ parent.optional) ||
+ (parent?.type === 'CallExpression' &&
+ parent.callee === node &&
+ parent.optional))
+ ) {
+ return true;
+ }
+ // An existence check reads the feature without calling, constructing or
+ // dereferencing it.
+ const checksExistence =
+ !(
+ (parent?.type === 'CallExpression' || parent?.type === 'NewExpression') &&
+ parent.callee === node
+ ) && !(parent?.type === 'MemberExpression' && parent.object === node);
+ const namePattern = new RegExp(
+ `\\b${featureName.replace(/[$]/g, '\\$&')}\\b`
+ );
+ const mentions = (test: ESTree.Node) =>
+ namePattern.test(sourceCode.getText(test));
+ for (let index = chain.length - 1; index > 0; index--) {
+ const child = chain[index];
+ const ancestor = chain[index - 1];
+ switch (ancestor.type) {
+ case 'UnaryExpression':
+ if (ancestor.operator === 'typeof') return true;
+ break;
+ case 'IfStatement':
+ case 'ConditionalExpression':
+ if (child === ancestor.test ? checksExistence : mentions(ancestor.test))
+ return true;
+ break;
+ case 'LogicalExpression':
+ if (child === ancestor.left ? checksExistence : mentions(ancestor.left))
+ return true;
+ break;
+ default:
+ for (const statement of precedingStatements(ancestor, child)) {
+ if (
+ statement.type === 'IfStatement' &&
+ exits(statement.consequent) &&
+ mentions(statement.test)
+ ) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
+function stringArgument(node: ESTree.Node | undefined): string | undefined {
+ return node?.type === 'Literal' && typeof node.value === 'string'
+ ? node.value
+ : undefined;
+}
+
+export const browserFloorRule: Rule.RuleModule = {
+ meta: {
+ type: 'problem',
+ docs: {
+ description:
+ 'Disallow web platform features that the browsers in apps/web/package.json `browserslist` lack, unless feature-detected',
+ },
+ schema: [
+ {
+ type: 'object',
+ properties: {
+ browserslist: { type: 'array', items: { type: 'string' } },
+ },
+ additionalProperties: false,
+ },
+ ],
+ messages: {
+ unsupported:
+ '{{feature}} is missing in {{browser}} {{floor}} ({{added}}), which apps/web/package.json `browserslist` supports. Feature-detect it, add a fallback, or raise the floor.',
+ },
+ },
+ create(context) {
+ const options: { browserslist?: string[] } | undefined = context.options[0];
+ const floor = options?.browserslist
+ ? parseBrowserFloor(options.browserslist)
+ : WEB_BROWSER_FLOOR;
+ const sourceCode = context.sourceCode;
+
+ function report(
+ found: Feature | undefined,
+ node: ESTree.Node,
+ label: string,
+ chain: readonly ESTree.Node[],
+ featureName: string
+ ) {
+ if (!found) return;
+ const missing = missingSupport(found.compat, floor);
+ if (!missing || isGuarded(chain, featureName, sourceCode)) return;
+ context.report({
+ node,
+ messageId: 'unsupported',
+ data: {
+ feature: label,
+ browser: bcd.browsers[missing.browser].name,
+ floor: missing.floorVersion,
+ added: missing.addedVersion
+ ? `added in ${missing.addedVersion}`
+ : 'never released there',
+ },
+ });
+ }
+
+ function checkGlobalReference(reference: Scope.Reference) {
+ const identifier = reference.identifier;
+ if (identifier.type !== 'Identifier' || isTypeOnly(reference)) return;
+ const ancestors = sourceCode.getAncestors(identifier);
+ const parent = ancestors.at(-1);
+ const name = identifier.name;
+
+ if (
+ parent?.type === 'MemberExpression' &&
+ parent.object === identifier &&
+ !parent.computed &&
+ parent.property.type === 'Identifier'
+ ) {
+ const property = parent.property.name;
+ const label = GLOBAL_OBJECTS.has(name)
+ ? property
+ : `${name}.${property}`;
+ report(
+ memberFeature(name, property),
+ parent,
+ label,
+ ancestors,
+ property
+ );
+ }
+ if (GLOBAL_OBJECTS.has(name)) return;
+
+ const chain = [...ancestors, identifier];
+ const invoked =
+ (parent?.type === 'NewExpression' ||
+ parent?.type === 'CallExpression') &&
+ parent.callee === identifier
+ ? parent
+ : undefined;
+ if (invoked?.type === 'NewExpression') {
+ report(
+ constructorFeature(name),
+ identifier,
+ `new ${name}()`,
+ chain,
+ name
+ );
+ } else {
+ report(globalFeature(name), identifier, name, chain, name);
+ }
+
+ const pattern =
+ name === 'RegExp' ? stringArgument(invoked?.arguments[0]) : undefined;
+ if (invoked && pattern !== undefined) {
+ for (const found of regexFeatures(
+ pattern,
+ stringArgument(invoked.arguments[1]) ?? ''
+ )) {
+ report(found, invoked, found.key, ancestors, name);
+ }
+ }
+ }
+
+ return {
+ Literal(node) {
+ if (!('regex' in node) || !node.regex) return;
+ for (const found of regexFeatures(
+ node.regex.pattern,
+ node.regex.flags
+ )) {
+ report(found, node, found.key, [], found.key);
+ }
+ },
+ 'Program:exit'(program) {
+ const globalScope = sourceCode.getScope(program);
+ for (const reference of globalScope.through)
+ checkGlobalReference(reference);
+ for (const variable of globalScope.variables) {
+ if (variable.defs.length > 0) continue;
+ for (const reference of variable.references)
+ checkGlobalReference(reference);
+ }
+ },
+ };
+ },
+};
diff --git a/tooling/platform-compat/src/browser-floor.ts b/tooling/platform-compat/src/browser-floor.ts
new file mode 100644
index 0000000000..d6277e87af
--- /dev/null
+++ b/tooling/platform-compat/src/browser-floor.ts
@@ -0,0 +1,45 @@
+import type { BrowserName } from '@mdn/browser-compat-data';
+import webPackage from '../../../apps/web/package.json' with { type: 'json' };
+
+/** Compatibility-data ids for the browserslist names the web app may target. */
+const COMPAT_BROWSERS: Readonly<Record<string, BrowserName>> = {
+ safari: 'safari',
+ ios_saf: 'safari_ios',
+ chrome: 'chrome',
+ and_chr: 'chrome_android',
+ edge: 'edge',
+ firefox: 'firefox',
+};
+
+/** The oldest version of each browser the code must run on. */
+export type BrowserFloor = ReadonlyMap<BrowserName, string>;
+
+export function compareVersions(left: string, right: string): number {
+ const leftParts = left.split('.').map(Number);
+ const rightParts = right.split('.').map(Number);
+ for (
+ let index = 0;
+ index < Math.max(leftParts.length, rightParts.length);
+ index++
+ ) {
+ const difference = (leftParts[index] ?? 0) - (rightParts[index] ?? 0);
+ if (difference !== 0) return difference;
+ }
+ return 0;
+}
+
+/** Parses `browser >= version` queries, the only form apps/web/vite.base.ts can map to esbuild targets. */
+export function parseBrowserFloor(queries: readonly string[]): BrowserFloor {
+ const floor = new Map<BrowserName, string>();
+ for (const query of queries) {
+ const match = /^(\w+) >= (\d+(?:\.\d+)?)$/.exec(query);
+ const browser = match ? COMPAT_BROWSERS[match[1]] : undefined;
+ if (!match || !browser) {
+ throw new Error(`Unsupported browserslist query: ${query}`);
+ }
+ floor.set(browser, match[2]);
+ }
+ return floor;
+}
+
+export const WEB_BROWSER_FLOOR = parseBrowserFloor(webPackage.browserslist);
diff --git a/tooling/platform-compat/src/check-native-permissions.ts b/tooling/platform-compat/src/check-native-permissions.ts
new file mode 100644
index 0000000000..fafce645a2
--- /dev/null
+++ b/tooling/platform-compat/src/check-native-permissions.ts
@@ -0,0 +1,53 @@
+// Fails when a native bundle lacks what meetings and dictation need for camera
+// and microphone access.
+import { readFileSync } from 'node:fs';
+import { relative, resolve } from 'node:path';
+import {
+ MEDIA_ENTITLEMENTS,
+ MEDIA_USAGE_KEYS,
+ missingStrings,
+ missingTrue,
+} from './native-permissions';
+
+const repoRoot = resolve(import.meta.dir, '../../..');
+const tauriDir = resolve(repoRoot, 'apps/web/tauri');
+// The macOS release bundles from the Chromium (CEF) config; iOS from src-tauri.
+const macosDir = resolve(tauriDir, 'desktop-cef');
+const iosPlist = resolve(tauriDir, 'src-tauri/Info.ios.plist');
+const read = (path: string) => readFileSync(path, 'utf8');
+const show = (path: string) => relative(repoRoot, path);
+
+const macosConfigPath = resolve(macosDir, 'tauri.conf.json');
+const macosConfig: {
+ bundle?: { macOS?: { infoPlist?: string; entitlements?: string } };
+} = JSON.parse(read(macosConfigPath));
+const macos = macosConfig.bundle?.macOS;
+const problems: string[] = [];
+
+if (!macos?.infoPlist || !macos.entitlements) {
+ problems.push(
+ `${show(macosConfigPath)} must set bundle.macOS.infoPlist and bundle.macOS.entitlements`
+ );
+}
+const plists = [
+ macos?.infoPlist ? resolve(macosDir, macos.infoPlist) : undefined,
+ iosPlist,
+];
+for (const plist of plists) {
+ if (!plist) continue;
+ for (const key of missingStrings(read(plist), MEDIA_USAGE_KEYS)) {
+ problems.push(`${show(plist)} needs a non-empty ${key}`);
+ }
+}
+if (macos?.entitlements) {
+ const entitlements = resolve(macosDir, macos.entitlements);
+ for (const key of missingTrue(read(entitlements), MEDIA_ENTITLEMENTS)) {
+ problems.push(`${show(entitlements)} needs ${key} set to true`);
+ }
+}
+
+if (problems.length > 0) {
+ console.error('Native media permissions are incomplete:');
+ for (const problem of problems) console.error(` ${problem}`);
+ process.exit(1);
+}
diff --git a/tooling/platform-compat/src/compat-data.ts b/tooling/platform-compat/src/compat-data.ts
new file mode 100644
index 0000000000..ca3fdde1a9
--- /dev/null
+++ b/tooling/platform-compat/src/compat-data.ts
@@ -0,0 +1,155 @@
+import bcd from '@mdn/browser-compat-data' with { type: 'json' };
+import type {
+ BrowserName,
+ CompatStatement,
+ Identifier,
+ SimpleSupportStatement,
+} from '@mdn/browser-compat-data';
+import { type BrowserFloor, compareVersions } from './browser-floor';
+
+export type Feature = { key: string; compat: CompatStatement };
+
+export type MissingSupport = {
+ browser: BrowserName;
+ floorVersion: string;
+ addedVersion: string | undefined;
+};
+
+function child(
+ identifier: Identifier | undefined,
+ name: string
+): Identifier | undefined {
+ if (!identifier || name === '__compat' || !Object.hasOwn(identifier, name))
+ return undefined;
+ return identifier[name];
+}
+
+function feature(
+ root: 'api' | 'javascript',
+ path: readonly string[]
+): Feature | undefined {
+ let identifier: Identifier | undefined = bcd[root];
+ for (const name of path) identifier = child(identifier, name);
+ const compat = identifier?.__compat;
+ return compat ? { key: [root, ...path].join('.'), compat } : undefined;
+}
+
+/** A global such as `SharedWorker`, `structuredClone` or `WeakRef`. */
+export function globalFeature(name: string): Feature | undefined {
+ return (
+ feature('api', [name]) ??
+ feature('api', ['Window', name]) ??
+ feature('javascript', ['builtins', name])
+ );
+}
+
+/** `new Name()`, whose constructor can lag behind the interface. */
+export function constructorFeature(name: string): Feature | undefined {
+ return feature('api', [name, name]) ?? globalFeature(name);
+}
+
+const GLOBAL_OBJECTS = new Set(['window', 'globalThis', 'self']);
+
+/** Globals that are instances of an interface, keyed to that interface. */
+const GLOBAL_INSTANCES: Readonly<Record<string, string>> = {
+ navigator: 'Navigator',
+ document: 'Document',
+ crypto: 'Crypto',
+ performance: 'Performance',
+ screen: 'Screen',
+ location: 'Location',
+ history: 'History',
+ localStorage: 'Storage',
+ sessionStorage: 'Storage',
+ indexedDB: 'IDBFactory',
+ visualViewport: 'VisualViewport',
+};
+
+function isStaticBuiltin(object: string, property: string): boolean {
+ const value: unknown = Reflect.get(globalThis, object);
+ return (
+ (typeof value === 'function' || typeof value === 'object') &&
+ value !== null &&
+ property in value
+ );
+}
+
+/** `object.property` where `object` is a global. */
+export function memberFeature(
+ object: string,
+ property: string
+): Feature | undefined {
+ if (GLOBAL_OBJECTS.has(object)) return globalFeature(property);
+ const instanceOf = GLOBAL_INSTANCES[object];
+ if (instanceOf) return feature('api', [instanceOf, property]);
+ if (property === 'prototype') return undefined;
+ // Compatibility data lists builtin statics next to prototype methods, so
+ // only a property this runtime has on the constructor is a static.
+ return (
+ feature('api', [object, `${property}_static`]) ??
+ (isStaticBuiltin(object, property)
+ ? feature('javascript', ['builtins', object, property])
+ : undefined)
+ );
+}
+
+export function regexFeatures(pattern: string, flags: string): Feature[] {
+ const features: (Feature | undefined)[] = [];
+ if (/\(\?<[=!]/.test(pattern)) {
+ features.push(
+ feature('javascript', ['regular_expressions', 'lookbehind_assertion'])
+ );
+ }
+ if (flags.includes('v'))
+ features.push(feature('javascript', ['builtins', 'RegExp', 'unicodeSets']));
+ if (flags.includes('d'))
+ features.push(feature('javascript', ['builtins', 'RegExp', 'hasIndices']));
+ return features.filter((found) => found !== undefined);
+}
+
+function supportedAt(
+ statement: SimpleSupportStatement,
+ version: string
+): boolean {
+ if (statement.flags || statement.prefix || statement.alternative_name)
+ return false;
+ const added = statement.version_added;
+ if (typeof added !== 'string' || added === 'preview') return false;
+ if (compareVersions(added.replace('≤', ''), version) > 0) return false;
+ const removed = statement.version_removed;
+ return (
+ typeof removed !== 'string' ||
+ compareVersions(removed.replace('≤', ''), version) > 0
+ );
+}
+
+function firstRelease(
+ statements: readonly SimpleSupportStatement[]
+): string | undefined {
+ return statements
+ .filter(
+ (statement) =>
+ !statement.flags && !statement.prefix && !statement.alternative_name
+ )
+ .map((statement) => statement.version_added)
+ .find(
+ (added): added is string =>
+ typeof added === 'string' && added !== 'preview'
+ );
+}
+
+/** The first floor browser without unprefixed, unflagged support. Browsers the data omits count as supported. */
+export function missingSupport(
+ compat: CompatStatement,
+ floor: BrowserFloor
+): MissingSupport | undefined {
+ for (const [browser, floorVersion] of floor) {
+ const support = compat.support[browser];
+ if (!support) continue;
+ const statements = Array.isArray(support) ? support : [support];
+ if (statements.some((statement) => supportedAt(statement, floorVersion)))
+ continue;
+ return { browser, floorVersion, addedVersion: firstRelease(statements) };
+ }
+ return undefined;
+}
diff --git a/tooling/platform-compat/src/lint-web.ts b/tooling/platform-compat/src/lint-web.ts
new file mode 100644
index 0000000000..a13a15e38d
--- /dev/null
+++ b/tooling/platform-compat/src/lint-web.ts
@@ -0,0 +1,42 @@
+// Lints the web app's sources against its browserslist floor. Pass files to
+// lint only those that the config covers; with no arguments it lints them all.
+import { relative, resolve } from 'node:path';
+import { ESLint } from 'eslint';
+import { WEB_SOURCES } from './web-sources';
+
+const repoRoot = resolve(import.meta.dir, '../../..');
+const requested = process.argv
+ .slice(2)
+ .map((file) => relative(repoRoot, resolve(file)));
+
+const eslint = new ESLint({
+ cwd: repoRoot,
+ overrideConfigFile: resolve(import.meta.dir, '../eslint.config.ts'),
+ errorOnUnmatchedPattern: false,
+ warnIgnored: false,
+});
+const linted = await eslint.lintFiles(
+ requested.length > 0 ? requested : WEB_SOURCES
+);
+// The code also carries disable comments for oxlint and generated-code rules
+// that this config does not load; only this rule and parse failures count.
+const results = linted.map((result) => {
+ const messages = result.messages.filter(
+ (message) =>
+ message.fatal || message.ruleId === 'platform-compat/browser-floor'
+ );
+ return {
+ ...result,
+ messages,
+ errorCount: messages.length,
+ fatalErrorCount: messages.filter((message) => message.fatal).length,
+ warningCount: 0,
+ fixableErrorCount: 0,
+ fixableWarningCount: 0,
+ suppressedMessages: [],
+ };
+});
+const formatter = await eslint.loadFormatter('stylish');
+const output = await formatter.format(results);
+if (output) console.log(output);
+if (results.some((result) => result.errorCount > 0)) process.exit(1);
diff --git a/tooling/platform-compat/src/native-permissions.ts b/tooling/platform-compat/src/native-permissions.ts
new file mode 100644
index 0000000000..696fb6d68a
--- /dev/null
+++ b/tooling/platform-compat/src/native-permissions.ts
@@ -0,0 +1,36 @@
+/** Info.plist keys without which macOS and iOS refuse camera and microphone capture. */
+export const MEDIA_USAGE_KEYS = [
+ 'NSCameraUsageDescription',
+ 'NSMicrophoneUsageDescription',
+];
+
+/** Hardened-runtime entitlements a signed macOS app needs to capture media. */
+export const MEDIA_ENTITLEMENTS = [
+ 'com.apple.security.device.camera',
+ 'com.apple.security.device.audio-input',
+];
+
+function escapeKey(key: string): string {
+ return key.replace(/[.]/g, '\\.');
+}
+
+/** Keys that are absent or have an empty string value. */
+export function missingStrings(
+ plist: string,
+ keys: readonly string[]
+): string[] {
+ return keys.filter(
+ (key) =>
+ !new RegExp(
+ `<key>${escapeKey(key)}</key>\\s*<string>[^<\\s][^<]*</string>`
+ ).test(plist)
+ );
+}
+
+/** Keys that are absent or not set to `<true/>`. */
+export function missingTrue(plist: string, keys: readonly string[]): string[] {
+ return keys.filter(
+ (key) =>
+ !new RegExp(`<key>${escapeKey(key)}</key>\\s*<true\\s*/>`).test(plist)
+ );
+}
diff --git a/tooling/platform-compat/src/web-sources.ts b/tooling/platform-compat/src/web-sources.ts
new file mode 100644
index 0000000000..2bf6c873e4
--- /dev/null
+++ b/tooling/platform-compat/src/web-sources.ts
@@ -0,0 +1,12 @@
+/** Source the web app bundles: its own and the workspace packages it depends on, relative to the repository root. */
+export const WEB_SOURCES = [
+ 'apps/web/src',
+ 'packages/collaboration/src',
+ 'packages/email-renderer/src',
+ 'packages/graphics/src',
+ 'packages/lexical-core',
+ 'packages/loro-mirror/src',
+ 'packages/machine/src',
+ 'packages/observability/src',
+ 'packages/spreadsheet/src',
+];
diff --git a/tooling/platform-compat/test/browser-floor-rule.test.ts b/tooling/platform-compat/test/browser-floor-rule.test.ts
new file mode 100644
index 0000000000..1885038a58
--- /dev/null
+++ b/tooling/platform-compat/test/browser-floor-rule.test.ts
@@ -0,0 +1,155 @@
+import { describe, it } from 'bun:test';
+import typescriptParser from '@typescript-eslint/parser';
+import { RuleTester } from 'eslint';
+import { browserFloorRule } from '../src/browser-floor-rule';
+
+RuleTester.describe = describe;
+RuleTester.it = it;
+
+const safari = [{ browserslist: ['safari >= 15.4'] }];
+const tester = new RuleTester({
+ languageOptions: { parser: typescriptParser },
+});
+
+tester.run('browser-floor', browserFloorRule, {
+ valid: [
+ { code: 'structuredClone(value); crypto.randomUUID();', options: safari },
+ { code: 'let worker: SharedWorker | undefined;', options: safari },
+ {
+ code: 'const SharedWorker = class {}; new SharedWorker();',
+ options: safari,
+ },
+ {
+ code: "if (typeof SharedWorker === 'function') new SharedWorker('worker.js');",
+ options: safari,
+ },
+ {
+ code: 'const worker = window.SharedWorker ? new SharedWorker("w.js") : undefined;',
+ options: safari,
+ },
+ { code: 'navigator.vibrate?.(10);', options: safari },
+ {
+ code: 'const signal = AbortSignal.any && AbortSignal.any([a, b]);',
+ options: safari,
+ },
+ {
+ code: 'const status = navigator.permissions?.query({ name: "camera" });',
+ options: safari,
+ },
+ {
+ code: "function connect() { if (!('SharedWorker' in window)) return; return () => new SharedWorker('w.js'); }",
+ options: safari,
+ },
+ {
+ code: "function start() { if (typeof SharedWorker !== 'function') throw new Error('unsupported'); return new SharedWorker('w.js'); }",
+ options: safari,
+ },
+ { code: "'a<br/>'.replace(/(.)<br\\/>$/, '$1');", options: safari },
+ {
+ code: 'AbortSignal.any([signal]);',
+ options: [{ browserslist: ['safari >= 17.4'] }],
+ },
+ ],
+ invalid: [
+ {
+ code: 'AbortSignal.any([signal]);',
+ options: safari,
+ errors: [
+ {
+ messageId: 'unsupported',
+ data: {
+ feature: 'AbortSignal.any',
+ browser: 'Safari',
+ floor: '15.4',
+ added: 'added in 17.4',
+ },
+ },
+ ],
+ },
+ {
+ code: 'AbortSignal.timeout(1000);',
+ options: [{ browserslist: ['ios_saf >= 15.4'] }],
+ errors: [
+ {
+ messageId: 'unsupported',
+ data: {
+ feature: 'AbortSignal.timeout',
+ browser: 'Safari on iOS',
+ floor: '15.4',
+ added: 'added in 16',
+ },
+ },
+ ],
+ },
+ {
+ code: 'const deferred = Promise.withResolvers();',
+ options: safari,
+ errors: [{ messageId: 'unsupported' }],
+ },
+ {
+ code: "if (ready) new SharedWorker('w.js');",
+ options: safari,
+ errors: [{ messageId: 'unsupported' }],
+ },
+ {
+ code: 'if (AbortSignal.any([signal]).aborted) cancel();',
+ options: safari,
+ errors: [{ messageId: 'unsupported' }],
+ },
+ {
+ code: 'const deferred = Promise.withResolvers() || fallback();',
+ options: safari,
+ errors: [{ messageId: 'unsupported' }],
+ },
+ {
+ code: 'try { load(AbortSignal.any([signal])); } catch { fail(); }',
+ options: safari,
+ errors: [{ messageId: 'unsupported' }],
+ },
+ {
+ code: 'navigator.permissions.query({ name: "camera" });',
+ options: safari,
+ errors: [{ messageId: 'unsupported' }],
+ },
+ {
+ code: 'window.requestIdleCallback(work);',
+ options: safari,
+ errors: [
+ {
+ messageId: 'unsupported',
+ data: {
+ feature: 'requestIdleCallback',
+ browser: 'Safari',
+ floor: '15.4',
+ added: 'never released there',
+ },
+ },
+ ],
+ },
+ {
+ code: 'const endBreak = /(?<=.)<br\\/>$/;',
+ options: safari,
+ errors: [
+ {
+ messageId: 'unsupported',
+ data: {
+ feature: 'javascript.regular_expressions.lookbehind_assertion',
+ browser: 'Safari',
+ floor: '15.4',
+ added: 'added in 16.4',
+ },
+ },
+ ],
+ },
+ {
+ code: "const pattern = new RegExp('(?<=a)b');",
+ options: safari,
+ errors: [{ messageId: 'unsupported' }],
+ },
+ {
+ code: 'const pattern = /[\\p{L}--a]/v;',
+ options: safari,
+ errors: [{ messageId: 'unsupported' }],
+ },
+ ],
+});
diff --git a/tooling/platform-compat/test/native-permissions.test.ts b/tooling/platform-compat/test/native-permissions.test.ts
new file mode 100644
index 0000000000..4d3b3ff925
--- /dev/null
+++ b/tooling/platform-compat/test/native-permissions.test.ts
@@ -0,0 +1,51 @@
+import { describe, expect, it } from 'bun:test';
+import { parseBrowserFloor } from '../src/browser-floor';
+import {
+ MEDIA_ENTITLEMENTS,
+ MEDIA_USAGE_KEYS,
+ missingStrings,
+ missingTrue,
+} from '../src/native-permissions';
+
+describe('native media permissions', () => {
+ it('requires a non-empty usage string for each key', () => {
+ const plist = `<dict>
+ <key>NSCameraUsageDescription</key>
+ <string>Macro uses the camera for calls.</string>
+ <key>NSMicrophoneUsageDescription</key>
+ <string></string>
+ </dict>`;
+ expect(missingStrings(plist, MEDIA_USAGE_KEYS)).toEqual([
+ 'NSMicrophoneUsageDescription',
+ ]);
+ });
+
+ it('requires each entitlement to be true', () => {
+ const plist = `<dict>
+ <key>com.apple.security.device.camera</key>
+ <true/>
+ <key>com.apple.security.device.audio-input</key>
+ <false/>
+ </dict>`;
+ expect(missingTrue(plist, MEDIA_ENTITLEMENTS)).toEqual([
+ 'com.apple.security.device.audio-input',
+ ]);
+ });
+});
+
+describe('browser floor', () => {
+ it('maps browserslist names to compatibility data ids', () => {
+ expect([
+ ...parseBrowserFloor(['ios_saf >= 15.4', 'and_chr >= 111']),
+ ]).toEqual([
+ ['safari_ios', '15.4'],
+ ['chrome_android', '111'],
+ ]);
+ });
+
+ it('rejects queries the build target cannot use', () => {
+ expect(() => parseBrowserFloor(['last 2 versions'])).toThrow(
+ 'Unsupported browserslist query: last 2 versions'
+ );
+ });
+});
diff --git a/tooling/platform-compat/tsconfig.json b/tooling/platform-compat/tsconfig.json
new file mode 100644
index 0000000000..90fe8cc997
--- /dev/null
+++ b/tooling/platform-compat/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "target": "esnext",
+ "module": "preserve",
+ "moduleResolution": "bundler",
+ "resolveJsonModule": true,
+ "strict": true,
+ "noEmit": true,
+ "skipLibCheck": true,
+ "types": ["bun"]
+ },
+ "include": ["src", "test", "eslint.config.ts"]
+}
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rs
index 81efc13384..ba780732cc 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rs
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rs
@@ -182,6 +182,8 @@ fn biome_check() -> Job {
.add_step(steps::setup_dev_shell())
.add_step(run_biome())
.add_step(run_collaboration_biome())
+ .add_step(install_platform_compat())
+ .add_step(check_platform_compat())
.add_step(steps::teardown_nix())
}
@@ -293,7 +295,7 @@ fn paths_filter() -> Step<Use> {
.add_with((
"filters",
format!(
- "should_run:\n{artifact_paths} - 'services/lexical-service/**'\n - 'packages/sdk/**'\n - 'packages/sdk-docs/**'\n - 'services/ai-editing-worker/**'\n - 'packages/code-mode-sdk/**'\n - 'crates/code_execution/src/outbound/deno/*.mjs'\n - 'crates/agent_code_mode/src/domain/documentation.json'\n - 'crates/agent_code_mode/SKILL.md'\n - 'crates/ai_tools/src/display_results/schema.generated.json'\n - '.github/actions/setup-reqs-web/**'\ncodegen_changed:\n - 'crates/**/*.rs'\n - 'services/**/*.rs'\n - 'Cargo.toml'\n - 'Cargo.lock'\n - 'apps/web/scripts/generate-api-schema.ts'\n - 'apps/web/scripts/services.ts'\n - 'packages/sdk/**'\n - 'apps/docs/**'\n - '.github/actions/setup-reqs-web/**'\ni18n_changed:\n - 'apps/web/src/lib/i18n/**'\n - 'apps/web/src/lib/core/component/ContextMenu.tsx'\n - 'apps/web/src/lib/core/constant/settingsTabsConfig.tsx'\n - 'apps/web/src/components/ui/components/Dropdown.tsx'\n - 'apps/web/src/features/settings/**'\n"
+ "should_run:\n{artifact_paths} - 'services/lexical-service/**'\n - 'packages/sdk/**'\n - 'packages/sdk-docs/**'\n - 'services/ai-editing-worker/**'\n - 'packages/code-mode-sdk/**'\n - 'tooling/platform-compat/**'\n - 'crates/code_execution/src/outbound/deno/*.mjs'\n - 'crates/agent_code_mode/src/domain/documentation.json'\n - 'crates/agent_code_mode/SKILL.md'\n - 'crates/ai_tools/src/display_results/schema.generated.json'\n - '.github/actions/setup-reqs-web/**'\ncodegen_changed:\n - 'crates/**/*.rs'\n - 'services/**/*.rs'\n - 'Cargo.toml'\n - 'Cargo.lock'\n - 'apps/web/scripts/generate-api-schema.ts'\n - 'apps/web/scripts/services.ts'\n - 'packages/sdk/**'\n - 'apps/docs/**'\n - '.github/actions/setup-reqs-web/**'\ni18n_changed:\n - 'apps/web/src/lib/i18n/**'\n - 'apps/web/src/lib/core/component/ContextMenu.tsx'\n - 'apps/web/src/lib/core/constant/settingsTabsConfig.tsx'\n - 'apps/web/src/components/ui/components/Dropdown.tsx'\n - 'apps/web/src/features/settings/**'\n"
),
))
}
@@ -416,6 +418,20 @@ fn run_biome() -> Step<Run> {
.working_directory(xtask_paths::repo_dir!("apps/web"))
}
+fn install_platform_compat() -> Step<Run> {
+ Step::new("Install Platform Compatibility Tooling")
+ .run("bun install --frozen-lockfile")
+ .working_directory(xtask_paths::repo_dir!("tooling/platform-compat"))
+}
+
+/// Lints all of `apps/web/src` against its `browserslist` floor and checks the
+/// native bundles keep their camera and microphone permissions.
+fn check_platform_compat() -> Step<Run> {
+ Step::new("Check Browser Floor and Native Permissions")
+ .run("bun run check")
+ .working_directory(xtask_paths::repo_dir!("tooling/platform-compat"))
+}
+
fn run_collaboration_biome() -> Step<Run> {
Step::new("Run Collaboration Package Biome")
.run("biome ci --changed --no-errors-on-unmatched --error-on-warnings")