mirror of
https://github.com/stablyai/orca.git
synced 2026-11-17 03:15:01 +00:00
Merge main and preserve background removal contracts
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@
|
||||
/skill-stubs/*.md text eol=lf
|
||||
/skill-stubs/_shared/*.md text eol=lf
|
||||
/skills/*/SKILL.md text eol=lf
|
||||
/src/cli/bundled-skill-guides.ts text eol=lf
|
||||
/src/cli/skills/bundled-skill-guides.ts text eol=lf
|
||||
# SVG bytes feed embedded data URLs and asset hashes on every build host.
|
||||
*.svg text eol=lf
|
||||
# Compiler input line breaks must not depend on the checkout OS.
|
||||
|
||||
@@ -48,7 +48,7 @@ on:
|
||||
- 'src/cli/**'
|
||||
- 'src/main/computer/**'
|
||||
- 'src/main/runtime/rpc/dispatcher.ts'
|
||||
- 'src/main/runtime/rpc/errors.ts'
|
||||
- 'src/main/runtime/rpc/responses/rpc-response.ts'
|
||||
- 'src/main/runtime/rpc/methods/computer/computer*.ts'
|
||||
- 'src/shared/computer-use-*.ts'
|
||||
- 'tests/e2e/computer-linux.e2e.ts'
|
||||
@@ -97,9 +97,8 @@ jobs:
|
||||
src/main/computer/macos-native/macos-native-provider-client.test.ts
|
||||
src/main/providers/windows-shell-preflight-runtime.windows.test.ts
|
||||
src/main/computer/desktop-script/actions/desktop-script-provider-actions.test.ts
|
||||
src/cli/format.test.ts
|
||||
src/cli/handlers/computer-action-validation.test.ts
|
||||
src/cli/handlers/computer-state-formatting.test.ts
|
||||
src/cli/output/command-result-output.test.ts
|
||||
src/cli/computer/computer-state-formatting.test.ts
|
||||
src/cli/index.test.ts
|
||||
src/cli/runtime/envelope-schema.test.ts
|
||||
src/shared/remote-runtime/remote-runtime-client.test.ts
|
||||
|
||||
@@ -11,8 +11,8 @@ on:
|
||||
- 'native/macos-shipit-scheduling/**'
|
||||
- 'config/scripts/macos-shipit-scheduling*'
|
||||
- 'config/electron-builder.config.cjs'
|
||||
- 'src/main/startup/main-process-quit*'
|
||||
- 'src/main/window/main-window-state-lifecycle*'
|
||||
- 'src/main/startup/quit/main-process-quit*'
|
||||
- 'src/main/window/main-window/main-window-state-lifecycle*'
|
||||
- 'src/main/window/dashboard-popout-window*'
|
||||
- 'src/packages/process-host/**'
|
||||
- 'src/main/runtime/agent-session/lifecycle/structured-agent-cli-writers*'
|
||||
@@ -55,8 +55,8 @@ jobs:
|
||||
src/main/updater/mac-install/updater.mac-install.test.ts
|
||||
src/main/updater/updater.headless-serve-install.test.ts
|
||||
src/main/updater/mac-install/updater-mac-quit-guard.test.ts
|
||||
src/main/startup/main-process-quit-update-veto.test.ts
|
||||
src/main/window/main-window-state-lifecycle.test.ts
|
||||
src/main/startup/quit/main-process-quit-update-veto.test.ts
|
||||
src/main/window/main-window/main-window-state-lifecycle.test.ts
|
||||
- name: Prove login-backed terminal writer census on the disposable runner
|
||||
env:
|
||||
ORCA_MACOS_LOGIN_CENSUS_CI: '1'
|
||||
|
||||
@@ -34,7 +34,7 @@ on:
|
||||
- 'src/main/runtime/agent-session/agent-session-unsaved-*.ts'
|
||||
# The phone/host contract program's unmocked desktop sources and its declaration owner's inputs.
|
||||
- 'src/main/runtime/integrations/github/runtime-github-repository-query-commands.ts'
|
||||
- 'src/main/github/issue-field-options.ts'
|
||||
- 'src/main/github/issues/issue-field-options.ts'
|
||||
- 'config/tsconfig.test.mobile-host-declarations.json'
|
||||
- 'config/tsconfig.node.json'
|
||||
- 'src/types/build-constants.d.ts'
|
||||
@@ -54,7 +54,55 @@ on:
|
||||
- 'src/main/codex/structured/journal/codex-goal-journal-rows.ts'
|
||||
- 'src/main/codex/__fixtures__/codex-hook-outcomes.jsonl'
|
||||
- 'src/main/ai-vault/session-scanner-*.ts'
|
||||
- 'src/main/ai-vault/ai-vault-scan-cancellation.ts'
|
||||
- 'src/main/ai-vault/discovery/agent-session-directories.ts'
|
||||
- 'src/main/ai-vault/discovery/session-file-discovery.ts'
|
||||
- 'src/main/ai-vault/discovery/session-json-file.ts'
|
||||
- 'src/main/ai-vault/discovery/session-path-absence.ts'
|
||||
- 'src/main/ai-vault/discovery/session-scanner-agent-sources.ts'
|
||||
- 'src/main/ai-vault/discovery/session-scanner-candidates.ts'
|
||||
- 'src/main/ai-vault/discovery/session-scanner-directory-reader.test.ts'
|
||||
- 'src/main/ai-vault/discovery/session-scanner-discovery-pipeline.test.ts'
|
||||
- 'src/main/ai-vault/discovery/session-scanner-discovery.ts'
|
||||
- 'src/main/ai-vault/discovery/session-scanner-roots.ts'
|
||||
- 'src/main/ai-vault/discovery/session-scanner-source-discovery.ts'
|
||||
- 'src/main/ai-vault/parsing/session-json-object.ts'
|
||||
- 'src/main/ai-vault/parsing/session-record-fields.ts'
|
||||
- 'src/main/ai-vault/parsing/session-record-time.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-accumulator.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-agent-parser.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-candidate-parse.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-core-parser-wsl-stall.test.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-injected-title.test.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-jsonl-reader.test.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-jsonl-reader.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-messages.test.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-messages.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-parse-wsl-stall.test.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-record-budget.test.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-recoverable-empty.test.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-text-normalization.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-token-values.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-unlimited-dedup.test.ts'
|
||||
- 'src/main/ai-vault/prompts/session-scanner-first-user-prompt-capture.ts'
|
||||
- 'src/main/ai-vault/prompts/session-scanner-first-user-prompt.test.ts'
|
||||
- 'src/main/ai-vault/prompts/session-scanner-first-user-prompt.ts'
|
||||
- 'src/main/ai-vault/scanner-fixtures/session-scanner-incremental-fixtures.ts'
|
||||
- 'src/main/ai-vault/scanner-fixtures/session-scanner-prime-agent-fixtures.ts'
|
||||
- 'src/main/ai-vault/scanner-fixtures/session-scanner-test-fixtures.ts'
|
||||
- 'src/main/ai-vault/scanners/copilot/session-scanner-copilot-parser.ts'
|
||||
- 'src/main/ai-vault/scanners/opencode/session-scanner-opencode-parser.ts'
|
||||
- 'src/main/ai-vault/scope/session-scanner-scope-discovery.ts'
|
||||
- 'src/main/ai-vault/scope/session-scanner-scope-inventory.test.ts'
|
||||
- 'src/main/ai-vault/scope/session-scanner-scope-inventory.ts'
|
||||
- 'src/main/ai-vault/scope/session-scanner-scope-only.test.ts'
|
||||
- 'src/main/ai-vault/scope/session-scanner-scope-walk.test.ts'
|
||||
- 'src/main/ai-vault/scope/session-scanner-scope-walk.ts'
|
||||
- 'src/main/ai-vault/scope/session-scanner-scope.test.ts'
|
||||
- 'src/main/ai-vault/session-scanner.ts'
|
||||
- 'src/shared/error-message.ts'
|
||||
- 'src/shared/surrogate-safe-text-slice.ts'
|
||||
- 'src/shared/trimmed-string.ts'
|
||||
- 'src/main/ai-vault/scan-lifecycle/ai-vault-scan-cancellation.ts'
|
||||
- 'src/main/ai-vault/scan-service/session-scanner-service-env.ts'
|
||||
- 'src/main/ai-vault/scanners/grok/session-scanner-grok-user-text.ts'
|
||||
- 'src/main/provider-process/provider-json-record.ts'
|
||||
@@ -122,7 +170,7 @@ on:
|
||||
- 'src/main/runtime/agent-session/agent-session-unsaved-*.ts'
|
||||
# The phone/host contract program's unmocked desktop sources and its declaration owner's inputs.
|
||||
- 'src/main/runtime/integrations/github/runtime-github-repository-query-commands.ts'
|
||||
- 'src/main/github/issue-field-options.ts'
|
||||
- 'src/main/github/issues/issue-field-options.ts'
|
||||
- 'config/tsconfig.test.mobile-host-declarations.json'
|
||||
- 'config/tsconfig.node.json'
|
||||
- 'src/types/build-constants.d.ts'
|
||||
@@ -142,7 +190,55 @@ on:
|
||||
- 'src/main/codex/structured/journal/codex-goal-journal-rows.ts'
|
||||
- 'src/main/codex/__fixtures__/codex-hook-outcomes.jsonl'
|
||||
- 'src/main/ai-vault/session-scanner-*.ts'
|
||||
- 'src/main/ai-vault/ai-vault-scan-cancellation.ts'
|
||||
- 'src/main/ai-vault/discovery/agent-session-directories.ts'
|
||||
- 'src/main/ai-vault/discovery/session-file-discovery.ts'
|
||||
- 'src/main/ai-vault/discovery/session-json-file.ts'
|
||||
- 'src/main/ai-vault/discovery/session-path-absence.ts'
|
||||
- 'src/main/ai-vault/discovery/session-scanner-agent-sources.ts'
|
||||
- 'src/main/ai-vault/discovery/session-scanner-candidates.ts'
|
||||
- 'src/main/ai-vault/discovery/session-scanner-directory-reader.test.ts'
|
||||
- 'src/main/ai-vault/discovery/session-scanner-discovery-pipeline.test.ts'
|
||||
- 'src/main/ai-vault/discovery/session-scanner-discovery.ts'
|
||||
- 'src/main/ai-vault/discovery/session-scanner-roots.ts'
|
||||
- 'src/main/ai-vault/discovery/session-scanner-source-discovery.ts'
|
||||
- 'src/main/ai-vault/parsing/session-json-object.ts'
|
||||
- 'src/main/ai-vault/parsing/session-record-fields.ts'
|
||||
- 'src/main/ai-vault/parsing/session-record-time.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-accumulator.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-agent-parser.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-candidate-parse.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-core-parser-wsl-stall.test.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-injected-title.test.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-jsonl-reader.test.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-jsonl-reader.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-messages.test.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-messages.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-parse-wsl-stall.test.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-record-budget.test.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-recoverable-empty.test.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-text-normalization.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-token-values.ts'
|
||||
- 'src/main/ai-vault/parsing/session-scanner-unlimited-dedup.test.ts'
|
||||
- 'src/main/ai-vault/prompts/session-scanner-first-user-prompt-capture.ts'
|
||||
- 'src/main/ai-vault/prompts/session-scanner-first-user-prompt.test.ts'
|
||||
- 'src/main/ai-vault/prompts/session-scanner-first-user-prompt.ts'
|
||||
- 'src/main/ai-vault/scanner-fixtures/session-scanner-incremental-fixtures.ts'
|
||||
- 'src/main/ai-vault/scanner-fixtures/session-scanner-prime-agent-fixtures.ts'
|
||||
- 'src/main/ai-vault/scanner-fixtures/session-scanner-test-fixtures.ts'
|
||||
- 'src/main/ai-vault/scanners/copilot/session-scanner-copilot-parser.ts'
|
||||
- 'src/main/ai-vault/scanners/opencode/session-scanner-opencode-parser.ts'
|
||||
- 'src/main/ai-vault/scope/session-scanner-scope-discovery.ts'
|
||||
- 'src/main/ai-vault/scope/session-scanner-scope-inventory.test.ts'
|
||||
- 'src/main/ai-vault/scope/session-scanner-scope-inventory.ts'
|
||||
- 'src/main/ai-vault/scope/session-scanner-scope-only.test.ts'
|
||||
- 'src/main/ai-vault/scope/session-scanner-scope-walk.test.ts'
|
||||
- 'src/main/ai-vault/scope/session-scanner-scope-walk.ts'
|
||||
- 'src/main/ai-vault/scope/session-scanner-scope.test.ts'
|
||||
- 'src/main/ai-vault/session-scanner.ts'
|
||||
- 'src/shared/error-message.ts'
|
||||
- 'src/shared/surrogate-safe-text-slice.ts'
|
||||
- 'src/shared/trimmed-string.ts'
|
||||
- 'src/main/ai-vault/scan-lifecycle/ai-vault-scan-cancellation.ts'
|
||||
- 'src/main/ai-vault/scan-service/session-scanner-service-env.ts'
|
||||
- 'src/main/ai-vault/scanners/grok/session-scanner-grok-user-text.ts'
|
||||
- 'src/main/provider-process/provider-json-record.ts'
|
||||
|
||||
@@ -853,8 +853,8 @@ jobs:
|
||||
src/main/pty/shell-startup/zsh-startup-hook-user-config-equivalence.live-shell.test.ts \
|
||||
src/main/runtime/terminal/wait/tui-idle-zsh-preexec-hook-order.live-shell.test.ts \
|
||||
src/main/runtime/agent-session/environment/structured-session-cli-login-shell.live-shell.test.ts \
|
||||
src/main/startup/shell-probe-terminal-detach.live-shell.test.ts \
|
||||
src/main/startup/shell-probe-lifetime.live-shell.test.ts \
|
||||
src/main/startup/shell-environment/shell-probe-terminal-detach.live-shell.test.ts \
|
||||
src/main/startup/shell-environment/shell-probe-lifetime.live-shell.test.ts \
|
||||
src/renderer/src/components/terminal-pane/pty-connection/emulation/fish-color-scheme-child-stdin.node-pty.test.ts \
|
||||
src/shared/fish-wsl-cwd-report.node-pty.test.ts \
|
||||
src/main/wsl/filesystem/wsl-sh-cwd-report.node-pty.test.ts \
|
||||
@@ -1117,7 +1117,6 @@ jobs:
|
||||
src/main/browser/cookies/browser-google-cookie-clear.electron.test.ts
|
||||
src/main/browser/guest-lifecycle/popups/presentation/popup-origin-chrome.electron.test.ts
|
||||
src/main/browser/guest-lifecycle/navigation/browser-link-materialization.electron.test.ts
|
||||
src/main/browser/guest-lifecycle/popups/compatibility/browser-popup-compatibility.electron.test.ts
|
||||
src/main/browser/guest-lifecycle/popups/compatibility/browser-popup-native-compatibility.electron.test.ts
|
||||
src/main/browser/guest-lifecycle/popups/compatibility/browser-popup-background-compatibility.electron.test.ts
|
||||
src/main/browser/extensions/api-runtime/browser-extension-api.electron.test.ts
|
||||
|
||||
@@ -47,8 +47,8 @@ jobs:
|
||||
src/main/ipc/preflight-runnable-local-cli.test.ts
|
||||
src/main/ipc/preflight-wsl-agent-detection.test.ts
|
||||
src/main/ipc/preflight-windows-path-refresh.repro.test.ts
|
||||
src/main/startup/hydrate-shell-path.windows.test.ts
|
||||
src/main/startup/login-shell-environment.test.ts
|
||||
src/main/startup/shell-environment/hydrate-shell-path.windows.test.ts
|
||||
src/main/startup/shell-environment/login-shell-environment.test.ts
|
||||
src/packages/process-host/src/process-tree-termination.test.ts
|
||||
src/packages/process-host/src/run-process.test.ts
|
||||
src/packages/process-host/src/run-process-termination-failure.test.ts
|
||||
|
||||
+1
-1
@@ -308,7 +308,7 @@
|
||||
"ignorePatterns": [
|
||||
"src/main/acp/generated/acp-protocol.generated.ts",
|
||||
"src/shared/rpc-contract/rpc-params-catalog.generated.ts",
|
||||
"src/cli/bundled-skill-guides.ts",
|
||||
"src/cli/skills/bundled-skill-guides.ts",
|
||||
"resources/plugins/declarative/*.mjs",
|
||||
"**/node_modules",
|
||||
"**/dist",
|
||||
|
||||
@@ -6,7 +6,7 @@ import { SignJWT, exportJWK, generateKeyPair, importJWK, type JWK } from 'jose'
|
||||
import nacl from 'tweetnacl'
|
||||
import WebSocket from 'ws'
|
||||
import { RelayControlClient } from '../../../../src/main/runtime/mobile-cloud-relay/relay-control-client'
|
||||
import { CloudRelayTransport } from '../../../../src/main/runtime/rpc/relay-transport'
|
||||
import { CloudRelayTransport } from '../../../../src/main/runtime/rpc/transports/relay-transport'
|
||||
|
||||
export const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms))
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { execSync } from 'node:child_process'
|
||||
import WebSocket from 'ws'
|
||||
import { RelayControlClient } from '../../../../src/main/runtime/mobile-cloud-relay/relay-control-client'
|
||||
import { CloudRelayTransport } from '../../../../src/main/runtime/rpc/relay-transport'
|
||||
import { CloudRelayTransport } from '../../../../src/main/runtime/rpc/transports/relay-transport'
|
||||
|
||||
export const PORT = 8787
|
||||
export const ORIGIN = `http://127.0.0.1:${PORT}`
|
||||
|
||||
@@ -6,7 +6,7 @@ import { SignJWT, type KeyLike } from 'jose'
|
||||
import nacl from 'tweetnacl'
|
||||
import WebSocket from 'ws'
|
||||
import { RelayControlClient } from '../../../../src/main/runtime/mobile-cloud-relay/relay-control-client'
|
||||
import { CloudRelayTransport } from '../../../../src/main/runtime/rpc/relay-transport'
|
||||
import { CloudRelayTransport } from '../../../../src/main/runtime/rpc/transports/relay-transport'
|
||||
|
||||
export const PORT = 8789
|
||||
export const REMOTE = process.env.MVP_URL?.replace(/\/$/, '')
|
||||
|
||||
@@ -9,7 +9,7 @@ import { SignJWT, type KeyLike } from 'jose'
|
||||
import nacl from 'tweetnacl'
|
||||
import WebSocket from 'ws'
|
||||
import { RelayControlClient } from '../../../../src/main/runtime/mobile-cloud-relay/relay-control-client'
|
||||
import { CloudRelayTransport } from '../../../../src/main/runtime/rpc/relay-transport'
|
||||
import { CloudRelayTransport } from '../../../../src/main/runtime/rpc/transports/relay-transport'
|
||||
import { RelayPhoneHelloSchema } from '../../../../src/shared/remote-runtime/relay/mobile-relay-phone-protocol'
|
||||
|
||||
export const DIRECTOR_APP = process.env.DIRECTOR_APP ?? ''
|
||||
|
||||
@@ -16,7 +16,7 @@ import nacl from 'tweetnacl'
|
||||
import pg from 'pg'
|
||||
import WebSocket from 'ws'
|
||||
import { RelayControlClient } from '../../../../src/main/runtime/mobile-cloud-relay/relay-control-client'
|
||||
import { CloudRelayTransport } from '../../../../src/main/runtime/rpc/relay-transport'
|
||||
import { CloudRelayTransport } from '../../../../src/main/runtime/rpc/transports/relay-transport'
|
||||
import { RelayPhoneHelloSchema } from '../../../../src/shared/remote-runtime/relay/mobile-relay-phone-protocol'
|
||||
|
||||
const PORT = 8788
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
type RelayAssignmentMigration
|
||||
} from '../assignment-store.js'
|
||||
import { openRelayDatabase, type RelayDatabase } from '../../database/database.js'
|
||||
import { readRegisteredMigrationInventory } from './registered-migration-inventory.js'
|
||||
|
||||
const databaseUrl = process.env.ORCA_RELAY_TEST_POSTGRES_URL
|
||||
const describePostgres = databaseUrl ? describe : describe.skip
|
||||
@@ -245,39 +244,6 @@ describePostgres('PostgreSQL migration recovery', () => {
|
||||
)
|
||||
}
|
||||
|
||||
it('reaps an abandoned registered migration onto its healthy target', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.releaseActivity(input.identity, input.sourceControlId)
|
||||
await input.store.releaseActivity(input.identity, input.targetControlId)
|
||||
input.advance(
|
||||
ASSIGNMENT_LIMITS.migrationLeaseMs + STRANDED_MIGRATION_ABANDON_MS + 1
|
||||
)
|
||||
|
||||
await expect(input.store.abortExpiredEvacuations()).resolves.toBe(1)
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT assignment.cell_id, assignment.assignment_epoch,
|
||||
migration.completed_at, migration.aborted_at
|
||||
FROM relay_assignments assignment
|
||||
JOIN relay_assignment_migrations migration
|
||||
ON migration.user_id = assignment.user_id
|
||||
AND migration.relay_host_id = assignment.relay_host_id
|
||||
AND migration.assignment_epoch = assignment.assignment_epoch
|
||||
WHERE assignment.user_id = ? AND assignment.relay_host_id = ?`,
|
||||
[input.identity.userId, input.identity.relayHostId]
|
||||
)
|
||||
).toEqual([
|
||||
{
|
||||
cell_id: input.cells.failed.id,
|
||||
assignment_epoch: '2',
|
||||
completed_at: String(
|
||||
100 + ASSIGNMENT_LIMITS.migrationLeaseMs + STRANDED_MIGRATION_ABANDON_MS + 1
|
||||
),
|
||||
aborted_at: null
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('reaps immediately after the retired source has a durable completed fence', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.releaseActivity(input.identity, input.sourceControlId)
|
||||
@@ -309,171 +275,6 @@ describePostgres('PostgreSQL migration recovery', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('reaps immediately after the retired source has an adopted legacy fence', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.releaseActivity(input.identity, input.sourceControlId)
|
||||
await input.store.releaseActivity(input.identity, input.targetControlId)
|
||||
input.advancePastHeartbeat()
|
||||
await input.store.adoptLegacyCellFence(
|
||||
input.cells.source.id,
|
||||
input.cellIncarnation
|
||||
)
|
||||
await input.store.commitLegacyCellFenceAdoption(
|
||||
input.cells.source.id,
|
||||
input.cellIncarnation
|
||||
)
|
||||
input.advance(ASSIGNMENT_LIMITS.migrationLeaseMs + 1)
|
||||
|
||||
expect(
|
||||
(
|
||||
await readRegisteredMigrationInventory(
|
||||
database,
|
||||
100 + 45_001 + ASSIGNMENT_LIMITS.migrationLeaseMs + 1
|
||||
)
|
||||
).abandoned
|
||||
).toBe(1)
|
||||
|
||||
await expect(input.store.abortExpiredEvacuations()).resolves.toBe(1)
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT assignment.cell_id, assignment.assignment_epoch,
|
||||
migration.completed_at, migration.aborted_at
|
||||
FROM relay_assignments assignment
|
||||
JOIN relay_assignment_migrations migration
|
||||
ON migration.user_id = assignment.user_id
|
||||
AND migration.relay_host_id = assignment.relay_host_id
|
||||
AND migration.assignment_epoch = assignment.assignment_epoch
|
||||
WHERE assignment.user_id = ? AND assignment.relay_host_id = ?`,
|
||||
[input.identity.userId, input.identity.relayHostId]
|
||||
)
|
||||
).toEqual([
|
||||
{
|
||||
cell_id: input.cells.failed.id,
|
||||
assignment_epoch: '2',
|
||||
completed_at: String(100 + 45_001 + ASSIGNMENT_LIMITS.migrationLeaseMs + 1),
|
||||
aborted_at: null
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('does not reap after temporary legacy adoption without durable commit', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.releaseActivity(input.identity, input.sourceControlId)
|
||||
await input.store.releaseActivity(input.identity, input.targetControlId)
|
||||
input.advancePastHeartbeat()
|
||||
await input.store.adoptLegacyCellFence(
|
||||
input.cells.source.id,
|
||||
input.cellIncarnation
|
||||
)
|
||||
input.advance(ASSIGNMENT_LIMITS.migrationLeaseMs + 1)
|
||||
|
||||
expect(
|
||||
(
|
||||
await readRegisteredMigrationInventory(
|
||||
database,
|
||||
100 + 45_001 + ASSIGNMENT_LIMITS.migrationLeaseMs + 1
|
||||
)
|
||||
).abandoned
|
||||
).toBe(0)
|
||||
await expect(input.store.abortExpiredEvacuations()).resolves.toBe(0)
|
||||
input.advance(STRANDED_MIGRATION_ABANDON_MS)
|
||||
await expect(input.store.abortExpiredEvacuations()).resolves.toBe(1)
|
||||
})
|
||||
|
||||
it('invalidates an adopted legacy fence when the source heartbeats', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.releaseActivity(input.identity, input.sourceControlId)
|
||||
await input.store.releaseActivity(input.identity, input.targetControlId)
|
||||
input.advancePastHeartbeat()
|
||||
await input.store.adoptLegacyCellFence(
|
||||
input.cells.source.id,
|
||||
input.cellIncarnation
|
||||
)
|
||||
await input.store.commitLegacyCellFenceAdoption(
|
||||
input.cells.source.id,
|
||||
input.cellIncarnation
|
||||
)
|
||||
input.advance(ASSIGNMENT_LIMITS.migrationLeaseMs + 1)
|
||||
await input.heartbeat(input.cells.source)
|
||||
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT cell_id FROM relay_cell_legacy_fence_adoptions WHERE cell_id = ?`,
|
||||
[input.cells.source.id]
|
||||
)
|
||||
).toEqual([])
|
||||
await expect(input.store.abortExpiredEvacuations()).resolves.toBe(0)
|
||||
input.advance(STRANDED_MIGRATION_ABANDON_MS)
|
||||
await expect(input.store.abortExpiredEvacuations()).resolves.toBe(1)
|
||||
})
|
||||
|
||||
it('invalidates an adopted legacy fence when the source restarts', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.releaseActivity(input.identity, input.sourceControlId)
|
||||
await input.store.releaseActivity(input.identity, input.targetControlId)
|
||||
input.advancePastHeartbeat()
|
||||
await input.store.adoptLegacyCellFence(
|
||||
input.cells.source.id,
|
||||
input.cellIncarnation
|
||||
)
|
||||
await input.store.commitLegacyCellFenceAdoption(
|
||||
input.cells.source.id,
|
||||
input.cellIncarnation
|
||||
)
|
||||
input.advance(ASSIGNMENT_LIMITS.migrationLeaseMs + 1)
|
||||
await input.store.recordCellHeartbeat({
|
||||
cellId: input.cells.source.id,
|
||||
cellUrl: input.cells.source.url,
|
||||
cellIncarnation: '99999999-9999-4999-8999-999999999999',
|
||||
startedAt: 51,
|
||||
ready: true,
|
||||
observedRequests: 0
|
||||
})
|
||||
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT cell_id FROM relay_cell_legacy_fence_adoptions WHERE cell_id = ?`,
|
||||
[input.cells.source.id]
|
||||
)
|
||||
).toEqual([])
|
||||
await expect(input.store.abortExpiredEvacuations()).resolves.toBe(0)
|
||||
input.advance(STRANDED_MIGRATION_ABANDON_MS)
|
||||
await expect(input.store.abortExpiredEvacuations()).resolves.toBe(1)
|
||||
})
|
||||
|
||||
it('serializes legacy adoption with a returning source heartbeat', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.releaseActivity(input.identity, input.sourceControlId)
|
||||
await input.store.releaseActivity(input.identity, input.targetControlId)
|
||||
input.advancePastHeartbeat()
|
||||
await input.store.adoptLegacyCellFence(
|
||||
input.cells.source.id,
|
||||
input.cellIncarnation
|
||||
)
|
||||
|
||||
const [commit, heartbeatResult] = await Promise.allSettled([
|
||||
input.store.commitLegacyCellFenceAdoption(
|
||||
input.cells.source.id,
|
||||
input.cellIncarnation
|
||||
),
|
||||
input.heartbeat(input.cells.source)
|
||||
])
|
||||
expect(heartbeatResult.status).toBe('fulfilled')
|
||||
if (commit.status === 'rejected') {
|
||||
expect(commit.reason).toMatchObject({ message: 'legacy_cell_fence_not_active' })
|
||||
}
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT cell_id FROM relay_cell_legacy_fence_adoptions WHERE cell_id = ?`,
|
||||
[input.cells.source.id]
|
||||
)
|
||||
).toEqual([])
|
||||
input.advance(
|
||||
ASSIGNMENT_LIMITS.migrationLeaseMs + STRANDED_MIGRATION_ABANDON_MS + 1
|
||||
)
|
||||
await expect(input.store.abortExpiredEvacuations()).resolves.toBe(1)
|
||||
})
|
||||
|
||||
it('restores the 24-hour guard when the fenced source heartbeats again', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.releaseActivity(input.identity, input.sourceControlId)
|
||||
@@ -495,83 +296,6 @@ describePostgres('PostgreSQL migration recovery', () => {
|
||||
await expect(input.store.abortExpiredEvacuations()).resolves.toBe(1)
|
||||
})
|
||||
|
||||
it('restores the 24-hour guard when the fenced source restarts', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.releaseActivity(input.identity, input.sourceControlId)
|
||||
await input.store.releaseActivity(input.identity, input.targetControlId)
|
||||
input.advancePastHeartbeat()
|
||||
await completeSourceFence(input)
|
||||
input.advance(ASSIGNMENT_LIMITS.migrationLeaseMs + 1)
|
||||
await input.store.recordCellHeartbeat({
|
||||
cellId: input.cells.source.id,
|
||||
cellUrl: input.cells.source.url,
|
||||
cellIncarnation: '99999999-9999-4999-8999-999999999999',
|
||||
startedAt: 51,
|
||||
ready: true,
|
||||
observedRequests: 0
|
||||
})
|
||||
|
||||
await expect(input.store.abortExpiredEvacuations()).resolves.toBe(0)
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT completed_at, aborted_at FROM relay_assignment_migrations
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[input.identity.userId, input.identity.relayHostId]
|
||||
)
|
||||
).toEqual([{ completed_at: null, aborted_at: null }])
|
||||
input.advance(STRANDED_MIGRATION_ABANDON_MS)
|
||||
await expect(input.store.abortExpiredEvacuations()).resolves.toBe(1)
|
||||
})
|
||||
|
||||
it('serializes fenced cleanup with a returning source heartbeat', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.releaseActivity(input.identity, input.sourceControlId)
|
||||
await input.store.releaseActivity(input.identity, input.targetControlId)
|
||||
input.advancePastHeartbeat()
|
||||
await completeSourceFence(input)
|
||||
input.advance(ASSIGNMENT_LIMITS.migrationLeaseMs + 1)
|
||||
|
||||
const [cleanup, heartbeatResult] = await Promise.allSettled([
|
||||
input.store.abortExpiredEvacuations(),
|
||||
input.heartbeat(input.cells.source)
|
||||
])
|
||||
expect(cleanup.status).toBe('fulfilled')
|
||||
expect(heartbeatResult.status).toBe('fulfilled')
|
||||
if (cleanup.status !== 'fulfilled') throw cleanup.reason
|
||||
if (heartbeatResult.status !== 'fulfilled') throw heartbeatResult.reason
|
||||
expect([0, 1]).toContain(cleanup.value)
|
||||
const migrations = await database.query(
|
||||
`SELECT completed_at, aborted_at FROM relay_assignment_migrations
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[input.identity.userId, input.identity.relayHostId]
|
||||
)
|
||||
if (cleanup.value === 1) {
|
||||
expect(migrations[0]?.completed_at).not.toBeNull()
|
||||
} else {
|
||||
expect(migrations).toEqual([{ completed_at: null, aborted_at: null }])
|
||||
input.advance(STRANDED_MIGRATION_ABANDON_MS)
|
||||
await expect(input.store.abortExpiredEvacuations()).resolves.toBe(1)
|
||||
}
|
||||
})
|
||||
|
||||
it('keeps a freshly retired source protected without a durable fence', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.releaseActivity(input.identity, input.sourceControlId)
|
||||
await input.store.releaseActivity(input.identity, input.targetControlId)
|
||||
input.advance(ASSIGNMENT_LIMITS.migrationLeaseMs + 1)
|
||||
|
||||
await expect(input.store.abortExpiredEvacuations()).resolves.toBe(0)
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT completed_at, aborted_at FROM relay_assignment_migrations
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[input.identity.userId, input.identity.relayHostId]
|
||||
)
|
||||
).toEqual([{ completed_at: null, aborted_at: null }])
|
||||
input.advance(STRANDED_MIGRATION_ABANDON_MS)
|
||||
await expect(input.store.abortExpiredEvacuations()).resolves.toBe(1)
|
||||
})
|
||||
|
||||
it('rolls an abandoned disabled target back to its source', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.releaseActivity(input.identity, input.sourceControlId)
|
||||
@@ -606,96 +330,6 @@ describePostgres('PostgreSQL migration recovery', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('serializes cleanup against supersession without reporting a false target', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.releaseActivity(input.identity, input.sourceControlId)
|
||||
await input.store.releaseActivity(input.identity, input.targetControlId)
|
||||
await input.store.setCellEnabled(input.cells.failed.id, false)
|
||||
input.advance(
|
||||
ASSIGNMENT_LIMITS.migrationLeaseMs + STRANDED_MIGRATION_ABANDON_MS + 1
|
||||
)
|
||||
await input.heartbeat(input.cells.source)
|
||||
await input.heartbeat(input.cells.replacement)
|
||||
await input.store.attestCellFence(input.cells.failed.id, input.cellIncarnation)
|
||||
|
||||
const [cleanup, supersession] = await Promise.allSettled([
|
||||
input.store.abortExpiredEvacuations(),
|
||||
input.store.supersedeRegisteredCellEvacuations(
|
||||
input.cells.source.id,
|
||||
input.cells.failed.id,
|
||||
input.cells.replacement.id,
|
||||
100
|
||||
)
|
||||
])
|
||||
expect(cleanup.status).toBe('fulfilled')
|
||||
if (cleanup.status !== 'fulfilled') throw cleanup.reason
|
||||
if (supersession.status === 'fulfilled') {
|
||||
expect([0, 1]).toContain(supersession.value)
|
||||
const assignment = await database.query(
|
||||
`SELECT cell_id FROM relay_assignments WHERE user_id = ?`,
|
||||
[input.identity.userId]
|
||||
)
|
||||
expect(assignment).toEqual([{
|
||||
cell_id:
|
||||
supersession.value === 1
|
||||
? input.cells.replacement.id
|
||||
: input.cells.source.id
|
||||
}])
|
||||
if (supersession.value === 0) expect(cleanup.value).toBeGreaterThanOrEqual(1)
|
||||
} else {
|
||||
expect(cleanup.value).toBeGreaterThanOrEqual(1)
|
||||
expect(supersession.reason).toMatchObject({ message: 'migration_already_superseded' })
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT cell_id FROM relay_assignments WHERE user_id = ?`,
|
||||
[input.identity.userId]
|
||||
)
|
||||
).toEqual([{ cell_id: input.cells.source.id }])
|
||||
}
|
||||
})
|
||||
|
||||
it('completes a registered migration from a dead source idempotently', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.releaseActivity(input.identity, input.sourceControlId)
|
||||
input.advancePastHeartbeat()
|
||||
await input.heartbeat(input.cells.failed)
|
||||
await input.store.attestCellFence(
|
||||
input.cells.source.id,
|
||||
input.cellIncarnation
|
||||
)
|
||||
const completion = {
|
||||
assignmentEpoch: input.migration.assignmentEpoch,
|
||||
sourceCellId: input.cells.source.id,
|
||||
targetCellId: input.cells.failed.id
|
||||
}
|
||||
|
||||
await expect(
|
||||
input.store.cellEvacuationStatus(
|
||||
input.cells.source.id,
|
||||
input.cells.failed.id,
|
||||
true
|
||||
)
|
||||
).resolves.toMatchObject({ inProgress: 0, completed: 1 })
|
||||
await expect(
|
||||
input.store.completeEvacuationFromDeadSource(input.identity, completion)
|
||||
).resolves.toMatchObject({ changed: false })
|
||||
expect(await reservations(input.cells)).toEqual({ source: 0, failed: 1, replacement: 0 })
|
||||
})
|
||||
|
||||
it('requires fence evidence for dead-source completion', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.releaseActivity(input.identity, input.sourceControlId)
|
||||
|
||||
await expect(
|
||||
input.store.completeEvacuationFromDeadSource(input.identity, {
|
||||
assignmentEpoch: input.migration.assignmentEpoch,
|
||||
sourceCellId: input.cells.source.id,
|
||||
targetCellId: input.cells.failed.id
|
||||
})
|
||||
).rejects.toThrow('cell_fence_attestation_missing')
|
||||
expect(await reservations(input.cells)).toEqual({ source: 0, failed: 2, replacement: 0 })
|
||||
})
|
||||
|
||||
it('supersedes a registered migration with exact accounting and idempotency', async () => {
|
||||
const input = await fixture()
|
||||
await database.query(
|
||||
@@ -760,359 +394,6 @@ describePostgres('PostgreSQL migration recovery', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('reconciles durable cell accounting before aggregate supersession', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.setCellEnabled(input.cells.failed.id, false)
|
||||
input.advancePastHeartbeat()
|
||||
await input.heartbeat(input.cells.source)
|
||||
await input.heartbeat(input.cells.replacement)
|
||||
await input.store.attestCellFence(
|
||||
input.cells.failed.id,
|
||||
input.cellIncarnation
|
||||
)
|
||||
await database.query(
|
||||
`UPDATE relay_cells
|
||||
SET reserved_requests = CASE WHEN cell_id = ? THEN 1 ELSE 0 END
|
||||
WHERE cell_id IN (?, ?)`,
|
||||
[input.cells.replacement.id, input.cells.source.id, input.cells.replacement.id]
|
||||
)
|
||||
|
||||
await expect(
|
||||
input.store.supersedeRegisteredCellEvacuations(
|
||||
input.cells.source.id,
|
||||
input.cells.failed.id,
|
||||
input.cells.replacement.id,
|
||||
100
|
||||
)
|
||||
).resolves.toBe(1)
|
||||
expect(await reservations(input.cells)).toEqual({
|
||||
source: 1,
|
||||
failed: 0,
|
||||
replacement: 2
|
||||
})
|
||||
})
|
||||
|
||||
it('rebuilds an expired registered migration lease before supersession', async () => {
|
||||
const input = await fixture()
|
||||
await pinMigration(input, input.migration.assignmentEpoch)
|
||||
await clearActivities(input)
|
||||
await database.query(
|
||||
`UPDATE relay_assignment_migrations SET expires_at = 0
|
||||
WHERE user_id = ? AND relay_host_id = ? AND assignment_epoch = ?`,
|
||||
[input.identity.userId, input.identity.relayHostId, input.migration.assignmentEpoch]
|
||||
)
|
||||
await fenceFailedCell(input)
|
||||
|
||||
await expect(supersedeAggregate(input)).resolves.toBe(1)
|
||||
expect(await reservations(input.cells)).toEqual({
|
||||
source: 0,
|
||||
failed: 0,
|
||||
replacement: 1
|
||||
})
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT assignment_epoch, source_request_units, target_reserved_units, aborted_at
|
||||
FROM relay_assignment_migrations WHERE user_id = ? ORDER BY assignment_epoch`,
|
||||
[input.identity.userId]
|
||||
)
|
||||
).toEqual([
|
||||
{
|
||||
assignment_epoch: '2',
|
||||
source_request_units: '1',
|
||||
target_reserved_units: '2',
|
||||
aborted_at: '45101'
|
||||
},
|
||||
{
|
||||
assignment_epoch: '3',
|
||||
source_request_units: '0',
|
||||
target_reserved_units: '1',
|
||||
aborted_at: null
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('retires an obsolete row without discarding replacement activity', async () => {
|
||||
const input = await fixture()
|
||||
await pinMigration(input, input.migration.assignmentEpoch)
|
||||
await fenceFailedCell(input)
|
||||
await input.store.supersedeRegisteredEvacuation(input.identity, {
|
||||
assignmentEpoch: input.migration.assignmentEpoch,
|
||||
sourceCellId: input.cells.source.id,
|
||||
currentTargetCellId: input.cells.failed.id,
|
||||
replacementTargetCellId: input.cells.replacement.id
|
||||
})
|
||||
await database.query(
|
||||
`UPDATE relay_assignment_migrations SET aborted_at = NULL
|
||||
WHERE user_id = ? AND relay_host_id = ? AND assignment_epoch = ?`,
|
||||
[input.identity.userId, input.identity.relayHostId, input.migration.assignmentEpoch]
|
||||
)
|
||||
const activityBefore = await assignmentActivities(input)
|
||||
|
||||
await expect(supersedeAggregate(input)).resolves.toBe(1)
|
||||
expect(await assignmentActivities(input)).toEqual(activityBefore)
|
||||
expect(await reservations(input.cells)).toEqual({
|
||||
source: 1,
|
||||
failed: 0,
|
||||
replacement: 2
|
||||
})
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT assignment_epoch, aborted_at FROM relay_assignment_migrations
|
||||
WHERE user_id = ? ORDER BY assignment_epoch`,
|
||||
[input.identity.userId]
|
||||
)
|
||||
).toEqual([
|
||||
{ assignment_epoch: '2', aborted_at: '45101' },
|
||||
{ assignment_epoch: '3', aborted_at: null }
|
||||
])
|
||||
})
|
||||
|
||||
it('anchors a newer dormant failed-cell epoch and preserves drain evidence', async () => {
|
||||
const input = await fixture()
|
||||
const drainAttemptId = await pinMigration(input, input.migration.assignmentEpoch)
|
||||
await clearActivities(input)
|
||||
await database.query(
|
||||
`UPDATE relay_assignments SET assignment_epoch = 4
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[input.identity.userId, input.identity.relayHostId]
|
||||
)
|
||||
await database.query(
|
||||
`UPDATE relay_assignment_migrations SET expires_at = 0
|
||||
WHERE user_id = ? AND relay_host_id = ? AND assignment_epoch = ?`,
|
||||
[input.identity.userId, input.identity.relayHostId, input.migration.assignmentEpoch]
|
||||
)
|
||||
await fenceFailedCell(input)
|
||||
|
||||
await expect(supersedeAggregate(input)).resolves.toBe(1)
|
||||
expect(await reservations(input.cells)).toEqual({
|
||||
source: 0,
|
||||
failed: 0,
|
||||
replacement: 1
|
||||
})
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT assignment_epoch, source_request_units, target_reserved_units, aborted_at
|
||||
FROM relay_assignment_migrations WHERE user_id = ? ORDER BY assignment_epoch`,
|
||||
[input.identity.userId]
|
||||
)
|
||||
).toEqual([
|
||||
{
|
||||
assignment_epoch: '2',
|
||||
source_request_units: '1',
|
||||
target_reserved_units: '2',
|
||||
aborted_at: '45101'
|
||||
},
|
||||
{
|
||||
assignment_epoch: '4',
|
||||
source_request_units: '0',
|
||||
target_reserved_units: '1',
|
||||
aborted_at: '45101'
|
||||
},
|
||||
{
|
||||
assignment_epoch: '5',
|
||||
source_request_units: '0',
|
||||
target_reserved_units: '1',
|
||||
aborted_at: null
|
||||
}
|
||||
])
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT assignment_epoch, drain_attempt_id, source_request_units,
|
||||
target_reserved_units
|
||||
FROM relay_post_drain_migration_pins
|
||||
WHERE user_id = ? ORDER BY assignment_epoch`,
|
||||
[input.identity.userId]
|
||||
)
|
||||
).toEqual([
|
||||
{
|
||||
assignment_epoch: '2',
|
||||
drain_attempt_id: drainAttemptId,
|
||||
source_request_units: '1',
|
||||
target_reserved_units: '2'
|
||||
},
|
||||
{
|
||||
assignment_epoch: '4',
|
||||
drain_attempt_id: drainAttemptId,
|
||||
source_request_units: '0',
|
||||
target_reserved_units: '1'
|
||||
},
|
||||
{
|
||||
assignment_epoch: '5',
|
||||
drain_attempt_id: drainAttemptId,
|
||||
source_request_units: '0',
|
||||
target_reserved_units: '1'
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('uses an existing current-epoch migration once when retiring an older row', async () => {
|
||||
const input = await fixture()
|
||||
await pinMigration(input, input.migration.assignmentEpoch)
|
||||
await clearActivities(input)
|
||||
await database.query(
|
||||
`UPDATE relay_assignments SET assignment_epoch = 4
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[input.identity.userId, input.identity.relayHostId]
|
||||
)
|
||||
await database.query(
|
||||
`INSERT INTO relay_assignment_migrations
|
||||
(user_id, relay_host_id, source_cell_id, target_cell_id,
|
||||
previous_epoch, assignment_epoch, source_request_units,
|
||||
target_reserved_units, expires_at, target_registered_at,
|
||||
completed_at, aborted_at, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, 2, 4, 0, 1, 0, 100, NULL, NULL, 100, 100)`,
|
||||
[
|
||||
input.identity.userId,
|
||||
input.identity.relayHostId,
|
||||
input.cells.source.id,
|
||||
input.cells.failed.id
|
||||
]
|
||||
)
|
||||
await database.query(
|
||||
`INSERT INTO relay_assignment_migration_incarnations
|
||||
(user_id, relay_host_id, assignment_epoch, source_cell_incarnation,
|
||||
target_cell_incarnation)
|
||||
VALUES (?, ?, 4, ?, ?)`,
|
||||
[
|
||||
input.identity.userId,
|
||||
input.identity.relayHostId,
|
||||
input.cellIncarnation,
|
||||
input.cellIncarnation
|
||||
]
|
||||
)
|
||||
await pinMigration(input, 4)
|
||||
await fenceFailedCell(input)
|
||||
|
||||
await expect(supersedeAggregate(input)).resolves.toBe(1)
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT assignment_epoch, aborted_at FROM relay_assignment_migrations
|
||||
WHERE user_id = ? ORDER BY assignment_epoch`,
|
||||
[input.identity.userId]
|
||||
)
|
||||
).toEqual([
|
||||
{ assignment_epoch: '2', aborted_at: '45101' },
|
||||
{ assignment_epoch: '4', aborted_at: '45101' },
|
||||
{ assignment_epoch: '5', aborted_at: null }
|
||||
])
|
||||
expect(await reservations(input.cells)).toEqual({
|
||||
source: 0,
|
||||
failed: 0,
|
||||
replacement: 1
|
||||
})
|
||||
})
|
||||
|
||||
it('rejects a newer failed-cell epoch with ambiguous activity', async () => {
|
||||
const input = await fixture()
|
||||
await database.query(
|
||||
`UPDATE relay_assignments SET assignment_epoch = 4
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[input.identity.userId, input.identity.relayHostId]
|
||||
)
|
||||
await fenceFailedCell(input)
|
||||
|
||||
await expect(supersedeAggregate(input)).rejects.toThrow(
|
||||
'migration_activity_topology_mismatch'
|
||||
)
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT assignment_epoch, aborted_at FROM relay_assignment_migrations
|
||||
WHERE user_id = ?`,
|
||||
[input.identity.userId]
|
||||
)
|
||||
).toEqual([{ assignment_epoch: '2', aborted_at: null }])
|
||||
expect(await reservations(input.cells)).toEqual({
|
||||
source: 1,
|
||||
failed: 2,
|
||||
replacement: 0
|
||||
})
|
||||
})
|
||||
|
||||
it('leaves lease repair retryable when supersession later fails', async () => {
|
||||
const input = await fixture(1)
|
||||
await database.query(
|
||||
`DELETE FROM relay_assignment_activity_leases
|
||||
WHERE user_id = ? AND relay_host_id = ? AND activity_kind = 'migration'`,
|
||||
[input.identity.userId, input.identity.relayHostId]
|
||||
)
|
||||
await database.query(
|
||||
`UPDATE relay_assignments SET migration_leases = 0
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[input.identity.userId, input.identity.relayHostId]
|
||||
)
|
||||
await database.query(
|
||||
`UPDATE relay_cells SET reserved_requests = reserved_requests - 1
|
||||
WHERE cell_id = ?`,
|
||||
[input.cells.failed.id]
|
||||
)
|
||||
await database.query(
|
||||
`UPDATE relay_assignment_migrations SET expires_at = 0
|
||||
WHERE user_id = ? AND relay_host_id = ? AND assignment_epoch = ?`,
|
||||
[input.identity.userId, input.identity.relayHostId, input.migration.assignmentEpoch]
|
||||
)
|
||||
await fenceFailedCell(input)
|
||||
|
||||
await expect(supersedeAggregate(input)).rejects.toThrow(
|
||||
'relay_capacity_exhausted'
|
||||
)
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT activity_id FROM relay_assignment_activity_leases
|
||||
WHERE user_id = ? AND activity_kind = 'migration'`,
|
||||
[input.identity.userId]
|
||||
)
|
||||
).toEqual([{ activity_id: 'migration:2' }])
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT aborted_at FROM relay_assignment_migrations
|
||||
WHERE user_id = ? AND assignment_epoch = 2`,
|
||||
[input.identity.userId]
|
||||
)
|
||||
).toEqual([{ aborted_at: null }])
|
||||
|
||||
await database.query(
|
||||
`UPDATE relay_cells SET capacity_requests = 2 WHERE cell_id = ?`,
|
||||
[input.cells.replacement.id]
|
||||
)
|
||||
await expect(supersedeAggregate(input)).resolves.toBe(1)
|
||||
expect(await reservations(input.cells)).toEqual({
|
||||
source: 1,
|
||||
failed: 0,
|
||||
replacement: 2
|
||||
})
|
||||
})
|
||||
|
||||
it('serializes concurrent supersession retries without duplicating capacity', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.setCellEnabled(input.cells.failed.id, false)
|
||||
input.advancePastHeartbeat()
|
||||
await input.heartbeat(input.cells.source)
|
||||
await input.heartbeat(input.cells.replacement)
|
||||
await input.store.attestCellFence(
|
||||
input.cells.failed.id,
|
||||
input.cellIncarnation
|
||||
)
|
||||
const supersession = {
|
||||
assignmentEpoch: input.migration.assignmentEpoch,
|
||||
sourceCellId: input.cells.source.id,
|
||||
currentTargetCellId: input.cells.failed.id,
|
||||
replacementTargetCellId: input.cells.replacement.id
|
||||
}
|
||||
|
||||
const results = await Promise.all([
|
||||
input.store.supersedeRegisteredEvacuation(input.identity, supersession),
|
||||
input.store.supersedeRegisteredEvacuation(input.identity, supersession)
|
||||
])
|
||||
expect(results[0]).toEqual(results[1])
|
||||
expect(await reservations(input.cells)).toEqual({ source: 1, failed: 0, replacement: 2 })
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT COUNT(*) AS count FROM relay_assignment_migrations WHERE user_id = ?`,
|
||||
[input.identity.userId]
|
||||
)
|
||||
).toEqual([{ count: '2' }])
|
||||
})
|
||||
|
||||
it('fails a competing aggregate supersession instead of reporting the wrong target', async () => {
|
||||
const input = await fixture()
|
||||
const alternate = {
|
||||
@@ -1205,153 +486,6 @@ describePostgres('PostgreSQL migration recovery', () => {
|
||||
).toEqual([{ assignment_epoch: '2', aborted_at: null }])
|
||||
})
|
||||
|
||||
it('rolls back supersession when migration request-unit shape drifted', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.setCellEnabled(input.cells.failed.id, false)
|
||||
input.advancePastHeartbeat()
|
||||
await input.heartbeat(input.cells.source)
|
||||
await input.heartbeat(input.cells.replacement)
|
||||
await input.store.attestCellFence(input.cells.failed.id, input.cellIncarnation)
|
||||
await database.query(
|
||||
`UPDATE relay_assignment_activity_leases
|
||||
SET request_units = request_units + 1
|
||||
WHERE user_id = ? AND activity_kind = 'migration'`,
|
||||
[input.identity.userId]
|
||||
)
|
||||
await database.query(
|
||||
`UPDATE relay_cells SET reserved_requests = reserved_requests + 1 WHERE cell_id = ?`,
|
||||
[input.cells.failed.id]
|
||||
)
|
||||
|
||||
await expect(
|
||||
input.store.supersedeRegisteredEvacuation(input.identity, {
|
||||
assignmentEpoch: input.migration.assignmentEpoch,
|
||||
sourceCellId: input.cells.source.id,
|
||||
currentTargetCellId: input.cells.failed.id,
|
||||
replacementTargetCellId: input.cells.replacement.id
|
||||
})
|
||||
).rejects.toThrow('migration_activity_lease_shape_mismatch')
|
||||
expect(await reservations(input.cells)).toEqual({ source: 1, failed: 3, replacement: 0 })
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT cell_id, assignment_epoch FROM relay_assignments WHERE user_id = ?`,
|
||||
[input.identity.userId]
|
||||
)
|
||||
).toEqual([{ cell_id: input.cells.failed.id, assignment_epoch: '2' }])
|
||||
})
|
||||
|
||||
it('rolls back supersession when locked cell reservation accounting drifted', async () => {
|
||||
const input = await fixture()
|
||||
await input.store.setCellEnabled(input.cells.failed.id, false)
|
||||
input.advancePastHeartbeat()
|
||||
await input.heartbeat(input.cells.source)
|
||||
await input.heartbeat(input.cells.replacement)
|
||||
await input.store.attestCellFence(input.cells.failed.id, input.cellIncarnation)
|
||||
await database.query(
|
||||
`UPDATE relay_cells SET reserved_requests = 1 WHERE cell_id = ?`,
|
||||
[input.cells.replacement.id]
|
||||
)
|
||||
|
||||
await expect(
|
||||
input.store.supersedeRegisteredEvacuation(input.identity, {
|
||||
assignmentEpoch: input.migration.assignmentEpoch,
|
||||
sourceCellId: input.cells.source.id,
|
||||
currentTargetCellId: input.cells.failed.id,
|
||||
replacementTargetCellId: input.cells.replacement.id
|
||||
})
|
||||
).rejects.toThrow('migration_cell_reservation_accounting_mismatch')
|
||||
expect(await reservations(input.cells)).toEqual({ source: 1, failed: 2, replacement: 1 })
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT assignment_epoch, aborted_at FROM relay_assignment_migrations
|
||||
WHERE user_id = ?`,
|
||||
[input.identity.userId]
|
||||
)
|
||||
).toEqual([{ assignment_epoch: '2', aborted_at: null }])
|
||||
})
|
||||
|
||||
async function fenceFailedCell(input: RecoveryFixture): Promise<void> {
|
||||
await input.store.setCellEnabled(input.cells.failed.id, false)
|
||||
input.advancePastHeartbeat()
|
||||
await input.heartbeat(input.cells.source)
|
||||
await input.heartbeat(input.cells.replacement)
|
||||
await input.store.attestCellFence(
|
||||
input.cells.failed.id,
|
||||
input.cellIncarnation
|
||||
)
|
||||
}
|
||||
|
||||
async function supersedeAggregate(input: RecoveryFixture): Promise<number> {
|
||||
return await input.store.supersedeRegisteredCellEvacuations(
|
||||
input.cells.source.id,
|
||||
input.cells.failed.id,
|
||||
input.cells.replacement.id,
|
||||
100
|
||||
)
|
||||
}
|
||||
|
||||
async function clearActivities(input: RecoveryFixture): Promise<void> {
|
||||
await database.query(
|
||||
`DELETE FROM relay_assignment_activity_leases
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[input.identity.userId, input.identity.relayHostId]
|
||||
)
|
||||
await database.query(
|
||||
`UPDATE relay_assignments SET reserved_controls = 0, reserved_splices = 0,
|
||||
reserved_invites = 0, pending_installs = 0, pending_confirmations = 0,
|
||||
migration_leases = 0
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[input.identity.userId, input.identity.relayHostId]
|
||||
)
|
||||
await database.query(
|
||||
`UPDATE relay_cells SET reserved_requests = 0
|
||||
WHERE cell_id IN (?, ?, ?)`,
|
||||
[input.cells.source.id, input.cells.failed.id, input.cells.replacement.id]
|
||||
)
|
||||
}
|
||||
|
||||
async function pinMigration(
|
||||
input: RecoveryFixture,
|
||||
assignmentEpoch: number
|
||||
): Promise<string> {
|
||||
const drainAttemptId = `${input.identity.userId}-drain-${assignmentEpoch}`
|
||||
await database.query(
|
||||
`INSERT INTO relay_post_drain_migration_pins
|
||||
(user_id, relay_host_id, assignment_epoch, drain_attempt_id,
|
||||
source_cell_id, source_cell_incarnation, target_cell_id,
|
||||
target_cell_incarnation, source_request_units, target_reserved_units,
|
||||
pinned_at)
|
||||
SELECT migration.user_id, migration.relay_host_id,
|
||||
migration.assignment_epoch, ?, migration.source_cell_id,
|
||||
incarnation.source_cell_incarnation, migration.target_cell_id,
|
||||
incarnation.target_cell_incarnation, migration.source_request_units,
|
||||
migration.target_reserved_units, 100
|
||||
FROM relay_assignment_migrations migration
|
||||
JOIN relay_assignment_migration_incarnations incarnation
|
||||
ON incarnation.user_id = migration.user_id
|
||||
AND incarnation.relay_host_id = migration.relay_host_id
|
||||
AND incarnation.assignment_epoch = migration.assignment_epoch
|
||||
WHERE migration.user_id = ? AND migration.relay_host_id = ?
|
||||
AND migration.assignment_epoch = ?`,
|
||||
[
|
||||
drainAttemptId,
|
||||
input.identity.userId,
|
||||
input.identity.relayHostId,
|
||||
assignmentEpoch
|
||||
]
|
||||
)
|
||||
return drainAttemptId
|
||||
}
|
||||
|
||||
async function assignmentActivities(input: RecoveryFixture): Promise<unknown[]> {
|
||||
return await database.query(
|
||||
`SELECT activity_id, activity_kind, cell_id, request_units
|
||||
FROM relay_assignment_activity_leases
|
||||
WHERE user_id = ? AND relay_host_id = ? ORDER BY activity_id`,
|
||||
[input.identity.userId, input.identity.relayHostId]
|
||||
)
|
||||
}
|
||||
|
||||
async function reservations(cells: RecoveryFixture['cells']): Promise<Record<string, number>> {
|
||||
const rows = await database.query(
|
||||
`SELECT cell_id, reserved_requests FROM relay_cells
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -111,25 +111,6 @@ function seated(epoch: number, joinedAt = 0) {
|
||||
|
||||
describe('reserve assignment on a director', () => {
|
||||
|
||||
it('reads what each cell acts on: a tripped dead-man is db, a flip back still leasing is reserve', async () => {
|
||||
const tripped = setup({
|
||||
feeds: [feed('c1', { admitModeEffective: 'db' }), feed('c2', { admitModeEffective: 'db' })]
|
||||
})
|
||||
expect(await tripped.assignment.plan(HOST, { reconnect: false, region: US })).toEqual({ kind: 'database' })
|
||||
const leasing = setup({ feeds: [feed('c1', { admitMode: 'db', admitModeEffective: 'reserve' }), feed('c2')] })
|
||||
expect(leasing.directory.admitModeOf('c1')).toBe('reserve')
|
||||
// Raw db must immediately stop booking/pacing even while effective mode stays reserve during re-registration.
|
||||
const reregistering = setup({
|
||||
feeds: [
|
||||
feed('c1', { admitModeEffective: 'reserve', admitModeRaw: 'db' }),
|
||||
feed('c2', { admitModeEffective: 'reserve', admitModeRaw: 'db' })
|
||||
]
|
||||
})
|
||||
expect(await reregistering.assignment.plan(HOST, { reconnect: false, region: US })).toEqual({ kind: 'database' })
|
||||
expect(reregistering.reserved).toEqual([])
|
||||
expect(reregistering.directory.admitModeOf('c1')).toBe('reserve')
|
||||
})
|
||||
|
||||
it('before every live cell has answered, holds back only hosts that may be on an unheard cell', async () => {
|
||||
const cells = cellList(['c1', 'c2'])
|
||||
const onUnheard = { ...HOST, relayHostId: 'qrstuvwxyzabcdef' }
|
||||
@@ -153,18 +134,6 @@ describe('reserve assignment on a director', () => {
|
||||
expect((await gated.assignment.plan(onUnheard, { reconnect: true, region: US })).kind).not.toBe('retry')
|
||||
})
|
||||
|
||||
it('answers a reconnect from memory at the same epoch with no booking and no database read', async () => {
|
||||
const row = vi.fn(async () => null)
|
||||
const { assignment, reserved } = setup({
|
||||
feeds: [feed('c1', { full: [seated(7)] }), feed('c2')],
|
||||
row
|
||||
})
|
||||
const plan = await assignment.plan(HOST, { reconnect: true, region: US })
|
||||
expect(plan).toMatchObject({ kind: 'answer', lane: 'sticky', assignment: { cellId: 'c1', assignmentEpoch: 7 } })
|
||||
expect(reserved).toEqual([])
|
||||
expect(row).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('re-books a host on a cell that restarted since its seat, and only then answers it', async () => {
|
||||
const { assignment, directory, reserved, now } = setup({
|
||||
feeds: [feed('c1', { full: [seated(7)] }), feed('c2')]
|
||||
@@ -198,57 +167,6 @@ describe('reserve assignment on a director', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('never sends a drained or demoted host back, and books it elsewhere above every known epoch', async () => {
|
||||
const { assignment, directory, reserved, now } = setup()
|
||||
directory.apply(
|
||||
'c1',
|
||||
feed('c1', {
|
||||
full: undefined,
|
||||
seq: 3,
|
||||
changes: [
|
||||
{ seq: 2, kind: 'join', ...HOST, epoch: 7, generation: 1, at: 1 },
|
||||
{ seq: 3, kind: 'leave', ...HOST, epoch: 7, generation: 1, closeCode: 4503, at: 2 }
|
||||
]
|
||||
}),
|
||||
now.value,
|
||||
now.value
|
||||
)
|
||||
const plan = await assignment.plan(HOST, { reconnect: true, region: US })
|
||||
expect(plan).toMatchObject({
|
||||
kind: 'answer',
|
||||
lane: 'placement',
|
||||
assignment: { assignmentEpoch: 8 }
|
||||
})
|
||||
expect(reserved.length).toBeGreaterThan(0)
|
||||
expect(reserved.every((call) => !call.sticky && call.epoch === 8)).toBe(true)
|
||||
})
|
||||
|
||||
it('leaves a cell without a feed (c17/c18) on today’s path without starving the reserve pool', async () => {
|
||||
const cells = cellList(['c1', 'c2', 'c17'])
|
||||
let rowOnOld = false
|
||||
const { assignment, directory, reserved, now } = setup({
|
||||
cells,
|
||||
feeds: [feed('c1'), feed('c2', { admitMode: 'db' })],
|
||||
row: async () => (rowOnOld ? { cellId: 'c17', assignmentEpoch: 5 } : null)
|
||||
})
|
||||
directory.markNoFeed('c17', now.value)
|
||||
expect(directory.isComplete()).toBe(true)
|
||||
// An old image reports no ceiling; counting it as a database cell would zero the share.
|
||||
expect(await assignment.plan(HOST, { reconnect: false, region: US })).toMatchObject({
|
||||
kind: 'answer',
|
||||
lane: 'placement',
|
||||
assignment: { cellId: 'c1' }
|
||||
})
|
||||
expect(reserved.map((call) => call.cellId)).not.toContain('c17')
|
||||
rowOnOld = true
|
||||
expect(
|
||||
await assignment.plan({ ...HOST, relayHostId: 'qrstuvwxyzabcdef' }, { reconnect: true, region: US })
|
||||
).toMatchObject({ kind: 'database', epochFloor: 5 })
|
||||
directory.markNoFeed('c1', now.value)
|
||||
expect(directory.cellState('c1')?.ceiling).toBeUndefined()
|
||||
expect(assignment.placementCells().find((cell) => cell.cellId === 'c1')?.general).toBe(false)
|
||||
})
|
||||
|
||||
it('reads the row once for a host the map never saw, and refuses it while the database is down', async () => {
|
||||
const down = setup({ row: async () => Promise.reject(new Error('timeout')) })
|
||||
expect(await down.assignment.plan(HOST, { reconnect: false, region: US })).toMatchObject({
|
||||
@@ -318,95 +236,6 @@ describe('reserve assignment on a director', () => {
|
||||
}
|
||||
})
|
||||
|
||||
describe('for a share-draw loser', () => {
|
||||
const ASIA = 'asia-east2' as const
|
||||
const OTHER = { ...HOST, relayHostId: 'qrstuvwxyzabcdef' }
|
||||
const setupAsia = (reserveCell = feed('c1'), reserve?: (cellId: string) => ReserveAttempt) =>
|
||||
setup({
|
||||
...(reserve ? { reserve } : {}),
|
||||
cells: [...cellList(['c1', 'c2'], ASIA), ...cellList(['c3'])],
|
||||
feeds: [
|
||||
reserveCell,
|
||||
// Database room far above the reserve cell's, so the 0.25 draw loses.
|
||||
feed('c2', {
|
||||
admitMode: 'db',
|
||||
counts: { seats: 0, controls: 0, bookings: 0, units: 0, ceiling: 5_000 }
|
||||
}),
|
||||
feed('c3')
|
||||
]
|
||||
})
|
||||
const regionReserveOf = async (assignment: ReserveAssignment, identity = HOST) => {
|
||||
const plan = await assignment.plan(identity, { reconnect: false, region: ASIA })
|
||||
expect(plan).toMatchObject({ kind: 'database', epochFloor: 0 })
|
||||
return plan.kind === 'database' ? plan.regionReserve : undefined
|
||||
}
|
||||
|
||||
it('offers the reserve cell in its region only, only while it has a seat', async () => {
|
||||
const { assignment, reserved, directory, now } = setupAsia()
|
||||
const regionReserve = await regionReserveOf(assignment)
|
||||
expect(reserved).toEqual([])
|
||||
await expect(regionReserve?.()).resolves.toMatchObject({ cellId: 'c1', region: ASIA })
|
||||
expect(reserved.map((call) => call.cellId)).toEqual(['c1'])
|
||||
const full = feed('c1', { counts: { seats: 500, controls: 500, bookings: 0, units: 500, ceiling: 500 } })
|
||||
directory.apply('c1', full, now.value, now.value)
|
||||
expect(await regionReserveOf(assignment, OTHER)).toBeUndefined()
|
||||
expect(reserved.map((call) => call.cellId)).toEqual(['c1'])
|
||||
})
|
||||
|
||||
it('paces when the reserve cell has seats but no intake budget, rather than give up the region', async () => {
|
||||
const { assignment, reserved } = setupAsia(feed('c1', { intake: { perSec: 1, burst: 20, tokens: 0 } }))
|
||||
const regionReserve = await regionReserveOf(assignment)
|
||||
await expect(regionReserve?.()).rejects.toBeInstanceOf(ReservePaceError)
|
||||
expect(reserved).toEqual([])
|
||||
})
|
||||
|
||||
it('gives the region up when the reserve cell refuses with a seat still on the map', async () => {
|
||||
for (const outcome of ['full', 'unreachable']) {
|
||||
const { assignment, reserved } = setupAsia(feed('c1'), (cellId) =>
|
||||
cellId === 'c1' ? { outcome } : { outcome: 'ok' }
|
||||
)
|
||||
const regionReserve = await regionReserveOf(assignment)
|
||||
// Null sends the host to the database lane's cross-region fallback, not a 1 s retry.
|
||||
await expect(regionReserve?.()).resolves.toBeNull()
|
||||
expect(reserved.map((call) => call.cellId)).toEqual(['c1'])
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('for a region-correction request', () => {
|
||||
const request = { reconnect: true, region: US, regionCorrection: true }
|
||||
|
||||
it('leaves the answer to the database lane, offering only the in-region reserve fallback and the spill', async () => {
|
||||
const row = vi.fn(async () => null)
|
||||
// A memory answer would skip the window exchange; the share draw is not offered either.
|
||||
const { assignment, reserved } = setup({ feeds: [feed('c1', { full: [seated(7)] }), feed('c2')], row })
|
||||
const plan = await assignment.plan(HOST, request)
|
||||
expect(plan).toEqual({
|
||||
kind: 'database',
|
||||
regionReserve: expect.any(Function),
|
||||
reserveSpill: expect.any(Function)
|
||||
})
|
||||
expect(reserved).toEqual([])
|
||||
expect(row).not.toHaveBeenCalled()
|
||||
await expect(plan.kind === 'database' ? plan.regionReserve?.() : null).resolves.toMatchObject({
|
||||
assignmentEpoch: 8
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps today’s path for a host the map never saw, without reading its row, but may spill', async () => {
|
||||
const row = vi.fn(async () => ({ cellId: 'c1', assignmentEpoch: 3 }))
|
||||
const { assignment, reserved } = setup({ row })
|
||||
const plan = await assignment.plan(HOST, request)
|
||||
expect(plan).toEqual({ kind: 'database', reserveSpill: expect.any(Function) })
|
||||
expect(row).not.toHaveBeenCalled()
|
||||
expect(reserved).toEqual([])
|
||||
await expect(
|
||||
plan.kind === 'database' ? plan.reserveSpill?.({ skipOwnRegion: false, rowEpoch: 3 }) : null
|
||||
).resolves.toMatchObject({ assignmentEpoch: 4 })
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
describe('after the database lane found no cell anywhere', () => {
|
||||
const ASIA = 'asia-east2' as const
|
||||
const paced = { intake: { perSec: 1, burst: 20, tokens: 0 } }
|
||||
@@ -428,31 +257,6 @@ describe('reserve assignment on a director', () => {
|
||||
return plan.kind === 'database' ? plan.reserveSpill : undefined
|
||||
}
|
||||
|
||||
it('books its own region first, minting above the row the database lane read', async () => {
|
||||
const harness = setupSpill({})
|
||||
const spill = await spillOf(harness)
|
||||
await expect(spill?.({ skipOwnRegion: false, rowEpoch: 9 })).resolves.toMatchObject({
|
||||
cellId: 'asia-r',
|
||||
region: ASIA,
|
||||
assignmentEpoch: 10
|
||||
})
|
||||
expect(harness.reserved).toEqual([{ cellId: 'asia-r', epoch: 10, sticky: false, dryRun: false }])
|
||||
})
|
||||
|
||||
it('books the other region when its own is full, or already tried', async () => {
|
||||
const full = setupSpill(fullCounts)
|
||||
await expect((await spillOf(full))?.({ skipOwnRegion: false, rowEpoch: 0 })).resolves.toMatchObject({
|
||||
cellId: 'us-r',
|
||||
region: US,
|
||||
assignmentEpoch: 5
|
||||
})
|
||||
const tried = setupSpill({})
|
||||
await expect((await spillOf(tried))?.({ skipOwnRegion: true, rowEpoch: 0 })).resolves.toMatchObject({
|
||||
cellId: 'us-r'
|
||||
})
|
||||
expect(tried.reserved.map((call) => call.cellId)).toEqual(['us-r'])
|
||||
})
|
||||
|
||||
it('tries the other region after a pace, and answers the pace only if nothing places', async () => {
|
||||
const abroad = setupSpill(paced)
|
||||
await expect((await spillOf(abroad))?.({ skipOwnRegion: false, rowEpoch: 0 })).resolves.toMatchObject({
|
||||
@@ -464,39 +268,10 @@ describe('reserve assignment on a director', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('returns null with no reserve seat anywhere, so the refusal stands', async () => {
|
||||
const harness = setupSpill(fullCounts, fullCounts)
|
||||
await expect((await spillOf(harness))?.({ skipOwnRegion: false, rowEpoch: 0 })).resolves.toBeNull()
|
||||
expect(harness.reserved).toEqual([])
|
||||
})
|
||||
|
||||
it('is not offered while the map is incomplete', async () => {
|
||||
const gated = setup({
|
||||
cells: [...cellList(['asia-r', 'asia-db'], ASIA), ...cellList(['us-r'])],
|
||||
feeds: [feed('asia-r'), feed('asia-db', { admitMode: 'db', full: [seated(4)] })],
|
||||
startedAt: 100_500
|
||||
})
|
||||
const plan = await gated.assignment.plan(HOST, { reconnect: true, region: ASIA })
|
||||
expect(plan).toMatchObject({ kind: 'database' })
|
||||
expect(plan.kind === 'database' && plan.reserveSpill).toBeUndefined()
|
||||
const correction = await gated.assignment.plan(HOST, { reconnect: true, region: ASIA, regionCorrection: true })
|
||||
expect(correction).toEqual({ kind: 'database' })
|
||||
})
|
||||
|
||||
it('answers the shortest pace when every region paces', async () => {
|
||||
const harness = setupSpill(paced, { intake: { perSec: 2, burst: 20, tokens: 0 } })
|
||||
const spill = await spillOf(harness)
|
||||
// Asia refills its token in 4 s, US in 2 s.
|
||||
await expect(spill?.({ skipOwnRegion: false, rowEpoch: 0 })).rejects.toSatisfy(
|
||||
(error) => error instanceof ReservePaceError && error.retryAfterSeconds === 2
|
||||
)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
describe('rehome on reconnect', () => {
|
||||
const ASIA = 'asia-east2' as const
|
||||
const OTHER = { ...HOST, relayHostId: 'qrstuvwxyzabcdef' }
|
||||
const ask = { reconnect: true, region: ASIA, preferred: true }
|
||||
// 2,000 controls on the US cell refill its move budget once a minute.
|
||||
const usCounts = { counts: { seats: 1, controls: 2_000, bookings: 0, units: 1, ceiling: 4_000 } }
|
||||
@@ -546,107 +321,6 @@ describe('reserve assignment on a director', () => {
|
||||
expect(demoted).toEqual([{ cellId: 'us-r', epoch: 5, joinedAt: 1_000 }])
|
||||
})
|
||||
|
||||
it('answers a region-correction request on the rehome lane', async () => {
|
||||
const { assignment, warm } = setupRehome()
|
||||
await warm()
|
||||
expect(await assignment.plan(HOST, { ...ask, regionCorrection: true })).toMatchObject({
|
||||
kind: 'answer',
|
||||
lane: 'rehome'
|
||||
})
|
||||
})
|
||||
|
||||
it('moves no one into Asia at 98% full, or anywhere under 10% free', async () => {
|
||||
for (const share of [0.98, 0.91]) {
|
||||
const { assignment, reserved, warm } = setupRehome({ asia: asiaFull(share) })
|
||||
await warm()
|
||||
expect(await assignment.plan(HOST, ask), String(share)).toMatchObject({
|
||||
kind: 'answer',
|
||||
lane: 'sticky',
|
||||
assignment: { cellId: 'us-r' }
|
||||
})
|
||||
expect(reserved.filter((call) => call.cellId === 'asia-r')).toEqual([])
|
||||
}
|
||||
const { assignment, warm } = setupRehome({ asia: asiaFull(0.9) })
|
||||
await warm()
|
||||
expect(await assignment.plan(HOST, ask)).toMatchObject({ lane: 'rehome' })
|
||||
})
|
||||
|
||||
// 10% rehome headroom above the 0% spill line prevents spilled hosts bouncing back.
|
||||
it('keeps a gap above the spill line: 5% free takes placements, not rehomes', async () => {
|
||||
const { assignment, warm } = setupRehome({ asia: asiaFull(0.95) })
|
||||
await warm()
|
||||
expect(await assignment.plan(HOST, ask)).toMatchObject({ lane: 'sticky', assignment: { cellId: 'us-r' } })
|
||||
expect(await assignment.plan(OTHER, { reconnect: false, region: ASIA })).toMatchObject({
|
||||
lane: 'placement',
|
||||
assignment: { cellId: 'asia-r' }
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps today’s answer when any rule fails', async () => {
|
||||
const sticky = { kind: 'answer', lane: 'sticky', assignment: { cellId: 'us-r' } }
|
||||
const unhinted = setupRehome()
|
||||
await unhinted.warm()
|
||||
expect(await unhinted.assignment.plan(HOST, { ...ask, preferred: false })).toMatchObject(sticky)
|
||||
const off = setupRehome({ percent: 0 })
|
||||
await off.warm()
|
||||
expect(await off.assignment.plan(HOST, ask)).toMatchObject(sticky)
|
||||
const closed = setupRehome({ switchOpen: false })
|
||||
await closed.warm()
|
||||
expect(await closed.assignment.plan(HOST, ask)).toMatchObject(sticky)
|
||||
const cold = setupRehome()
|
||||
expect(await cold.assignment.plan(HOST, ask)).toMatchObject(sticky)
|
||||
const sameRegion = setupRehome()
|
||||
await sameRegion.warm()
|
||||
expect(await sameRegion.assignment.plan(HOST, { ...ask, region: US })).toMatchObject(sticky)
|
||||
})
|
||||
|
||||
it('never runs for a fresh ask, an unknown host, a database-mode source, or an incomplete map', async () => {
|
||||
const fresh = setupRehome()
|
||||
await fresh.warm()
|
||||
expect(await fresh.assignment.plan(HOST, { ...ask, reconnect: false })).toMatchObject({ lane: 'placement' })
|
||||
expect(await fresh.assignment.plan(OTHER, ask)).toMatchObject({ kind: 'answer', lane: 'placement' })
|
||||
const onDatabase = setup({
|
||||
cells: [...cellList(['us-db']), ...cellList(['asia-r'], ASIA)],
|
||||
feeds: [feed('us-db', { admitMode: 'db', ...usCounts, full: [seated(5, 1_000)] }), feed('asia-r', asiaFull(0.5))],
|
||||
rehome: new ReserveRehome({ percent: 100, switchOpen: () => true })
|
||||
})
|
||||
expect(await onDatabase.assignment.plan(HOST, ask)).toMatchObject({ kind: 'database' })
|
||||
const gated = setup({
|
||||
cells: [...cellList(['us-r']), ...cellList(['asia-r', 'asia-unheard'], ASIA)],
|
||||
feeds: [feed('us-r', { ...usCounts, full: [seated(5, 1_000)] }), feed('asia-r', asiaFull(0.5))],
|
||||
startedAt: 100_500,
|
||||
rehome: new ReserveRehome({ percent: 100, switchOpen: () => true })
|
||||
})
|
||||
expect(await gated.assignment.plan(HOST, ask)).toMatchObject({ lane: 'sticky' })
|
||||
expect(gated.reserved).toEqual([])
|
||||
})
|
||||
|
||||
it('falls through to the sticky answer when the rehome booking is paced', async () => {
|
||||
const { assignment, reserved, warm } = setupRehome({
|
||||
reserve: (cellId) => (cellId === 'asia-r' ? { outcome: 'intake' } : { outcome: 'ok' })
|
||||
})
|
||||
await warm()
|
||||
expect(await assignment.plan(HOST, ask)).toMatchObject({ kind: 'answer', lane: 'sticky' })
|
||||
expect(reserved.map((call) => call.cellId)).toEqual(['asia-r'])
|
||||
})
|
||||
|
||||
it('leaves a host another install keeps dropping', async () => {
|
||||
const { assignment, directory, now, warm } = setupRehome()
|
||||
await warm()
|
||||
directory.apply(
|
||||
'us-r',
|
||||
feed('us-r', {
|
||||
...usCounts,
|
||||
full: undefined,
|
||||
seq: 3,
|
||||
changes: [{ seq: 3, kind: 'leave', ...HOST, epoch: 4, generation: 1, closeCode: 4408, at: now.value - 1 }]
|
||||
}),
|
||||
now.value,
|
||||
now.value
|
||||
)
|
||||
expect(await assignment.plan(HOST, ask)).toMatchObject({ lane: 'sticky' })
|
||||
})
|
||||
|
||||
it('falls through to the sticky answer when the booking is refused, and gives the move back', async () => {
|
||||
let refuse = true
|
||||
const { assignment, warm } = setupRehome({
|
||||
@@ -657,52 +331,6 @@ describe('reserve assignment on a director', () => {
|
||||
refuse = false
|
||||
expect(await assignment.plan(HOST, ask)).toMatchObject({ lane: 'rehome' })
|
||||
})
|
||||
|
||||
it('moves one host per source budget a minute, and logs moves and skips per region pair', async () => {
|
||||
const lines: Record<string, unknown>[] = []
|
||||
const { assignment, now, warm } = setupRehome({
|
||||
usSeats: [seated(5, 1_000), { ...OTHER, epoch: 5, generation: 1, state: 'active', joinedAt: 1_000 }],
|
||||
log: (line) => lines.push(JSON.parse(line))
|
||||
})
|
||||
await warm()
|
||||
expect(await assignment.plan(HOST, ask)).toMatchObject({ lane: 'rehome' })
|
||||
expect(await assignment.plan(OTHER, ask)).toMatchObject({ lane: 'sticky' })
|
||||
now.value += 60_000
|
||||
await assignment.plan({ ...HOST, relayHostId: 'flushflushflush1' }, ask)
|
||||
expect(lines.filter((line) => line.event === 'orca_relay_reserve_rehome')).toEqual([
|
||||
{ event: 'orca_relay_reserve_rehome', fromRegion: US, toRegion: ASIA, count: 0, skippedByRule: { 'source-budget': 1 } },
|
||||
{ event: 'orca_relay_reserve_rehome', fromRegion: US, toRegion: ASIA, count: 1, skippedByRule: { 'source-budget': 1 } }
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
it('paces with Retry-After when every reserve cell is out of budget and no database cell exists', async () => {
|
||||
const { assignment } = setup({ reserve: () => ({ outcome: 'intake' }) })
|
||||
await expect(assignment.plan(HOST, { reconnect: false, region: US })).rejects.toMatchObject({
|
||||
message: 'reserve_cells_paced',
|
||||
retryAfterSeconds: expect.any(Number)
|
||||
})
|
||||
})
|
||||
|
||||
it('tells the old reserve seat to go when it books the host elsewhere, naming that seat exactly', async () => {
|
||||
const { assignment, directory, demoted, now } = setup({
|
||||
feeds: [feed('c1', { full: [seated(5, 1_000)] }), feed('c2')],
|
||||
reserve: (cellId) => (cellId === 'c1' ? { outcome: 'full' } : { outcome: 'ok' })
|
||||
})
|
||||
// The host left c1 for a reason that moves it: its next placement is fresh, above 5.
|
||||
directory.apply(
|
||||
'c1',
|
||||
feed('c1', {
|
||||
full: undefined,
|
||||
seq: 2,
|
||||
changes: [{ seq: 2, kind: 'drain-only', ...HOST, epoch: 5, generation: 1, at: 2 }]
|
||||
}),
|
||||
now.value,
|
||||
now.value
|
||||
)
|
||||
const plan = await assignment.plan(HOST, { reconnect: true, region: US })
|
||||
expect(plan).toMatchObject({ kind: 'answer', lane: 'placement', assignment: { assignmentEpoch: 6 } })
|
||||
expect(demoted).toEqual([{ cellId: 'c1', epoch: 5, joinedAt: 1_000 }])
|
||||
})
|
||||
|
||||
// A half-open seat missed by the booking map must be demoted by the feed, before its 75s silence close.
|
||||
@@ -714,91 +342,4 @@ describe('reserve assignment on a director', () => {
|
||||
directory.apply('c1', feed('c1', { full: [seated(5, 1_000)] }), now.value, now.value)
|
||||
expect(demoted).toEqual([{ cellId: 'c1', epoch: 5, joinedAt: 1_000 }])
|
||||
})
|
||||
|
||||
it('answers a reconnect at the newest epoch even when an older epoch joined later', async () => {
|
||||
const { assignment, reserved } = setup({
|
||||
feeds: [feed('c1', { full: [seated(6, 1_000)] }), feed('c2', { full: [seated(5, 3_000)] })]
|
||||
})
|
||||
expect(await assignment.plan(HOST, { reconnect: true, region: US })).toMatchObject({
|
||||
kind: 'answer',
|
||||
lane: 'sticky',
|
||||
assignment: { cellId: 'c1', assignmentEpoch: 6 }
|
||||
})
|
||||
expect(reserved).toEqual([])
|
||||
})
|
||||
|
||||
it('in dry run only asks a cell to check a booking, and never changes the answer', async () => {
|
||||
const { assignment, reserved } = setup({ mode: 'dry-run' })
|
||||
const plan = await assignment.plan(HOST, { reconnect: false, region: US })
|
||||
expect(plan.kind).toBe('database')
|
||||
expect(plan.kind === 'database' && (await plan.placeFresh?.())).toBeNull()
|
||||
expect(reserved).toMatchObject([{ dryRun: true }])
|
||||
})
|
||||
|
||||
describe('when a cell answers a demotion', () => {
|
||||
const outcomes = (lines: string[]) =>
|
||||
lines
|
||||
.map((line) => JSON.parse(line))
|
||||
.filter((entry) => entry.event === 'orca_relay_reserve_demote_outcome')
|
||||
|
||||
it('logs the answer by host digest and leaves the seat to the feed', async () => {
|
||||
const lines: string[] = []
|
||||
const logged = Promise.withResolvers<void>()
|
||||
const { assignment, directory } = setup({
|
||||
feeds: [feed('c1', { full: [seated(10, 1_000)] }), feed('c2')],
|
||||
demote: () => 'not-seated',
|
||||
log: (line) => {
|
||||
lines.push(line)
|
||||
if (JSON.parse(line).event === 'orca_relay_reserve_demote_outcome') {
|
||||
logged.resolve()
|
||||
}
|
||||
}
|
||||
})
|
||||
assignment.demoteSeat({ ...HOST, cellId: 'c1', epoch: 10, joinedAt: 1_000 }, 'reconcile')
|
||||
await logged.promise
|
||||
expect(outcomes(lines)).toMatchObject([
|
||||
{ via: 'reconcile', cellId: 'c1', epoch: 10, outcome: 'not-seated' }
|
||||
])
|
||||
expect(outcomes(lines)[0].relayHostIdDigest).toMatch(/^[0-9a-f]{12}$/)
|
||||
expect(lines.join('\n')).not.toContain(HOST.relayHostId)
|
||||
expect(directory.seatsOnCell('c1')).toHaveLength(1)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
describe('for a host re-asking off a draining cell', () => {
|
||||
const events = (lines: string[], event: string) =>
|
||||
lines.map((line) => JSON.parse(line)).filter((entry) => entry.event === event)
|
||||
|
||||
it('marks its pace as the drain’s, on the reserve lane, in the region fallback and in the spill', async () => {
|
||||
const { assignment } = setup({
|
||||
feeds: [feed('c1', { draining: true, full: [seated(7)] }), feed('c2')],
|
||||
reserve: () => ({ outcome: 'intake' })
|
||||
})
|
||||
await expect(assignment.plan(HOST, { reconnect: true, region: US })).rejects.toMatchObject({ drained: true })
|
||||
const plan = await assignment.plan(HOST, { reconnect: true, region: US, regionCorrection: true })
|
||||
await expect(plan.kind === 'database' ? plan.regionReserve?.() : null).rejects.toMatchObject({ drained: true })
|
||||
await expect(
|
||||
plan.kind === 'database' ? plan.reserveSpill?.({ skipOwnRegion: false, rowEpoch: 0 }) : null
|
||||
).rejects.toMatchObject({ drained: true })
|
||||
})
|
||||
|
||||
it('leaves every other host as today: no drain count, and a plain pace', async () => {
|
||||
const lines: string[] = []
|
||||
const { assignment } = setup({ feeds: [feed('c1', { full: [seated(7)] }), feed('c2')], log: (line) => lines.push(line) })
|
||||
const paced = setup({
|
||||
feeds: [feed('c1', { full: [seated(7)] }), feed('c2', { draining: true, full: [seated(6)] })],
|
||||
reserve: () => ({ outcome: 'intake' })
|
||||
})
|
||||
expect(await assignment.plan({ ...HOST, relayHostId: 'qrstuvwxyzabcdef' }, { reconnect: false, region: US })).toMatchObject({
|
||||
kind: 'answer',
|
||||
lane: 'placement'
|
||||
})
|
||||
await expect(
|
||||
paced.assignment.plan(HOST, { reconnect: false, region: US })
|
||||
).rejects.toMatchObject({ drained: false })
|
||||
expect(events(lines, 'orca_relay_reserve_drain_replaced')).toEqual([])
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -345,305 +345,6 @@ describePostgres('PostgreSQL transaction recovery', () => {
|
||||
warn.mockRestore()
|
||||
}, 10_000)
|
||||
|
||||
it('defers assignment around a released-cell activity transaction', async () => {
|
||||
const now = 1_100_000_000_000
|
||||
const identity = { userId: 'released-order-user', relayHostId: 'releasedorder001' }
|
||||
const cellId = 'released-order-cell'
|
||||
const activityId = 'splice:released-order'
|
||||
await database.query(
|
||||
`DELETE FROM relay_assignment_activity_leases WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
await database.query(`DELETE FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`, [
|
||||
identity.userId,
|
||||
identity.relayHostId
|
||||
])
|
||||
const seedStore = new RelayAssignmentStore(database, () => now)
|
||||
await seedStore.reconcileCells([
|
||||
{ id: cellId, url: 'https://released-order.example.com', capacityRequests: 100 }
|
||||
])
|
||||
const assignment = await seedStore.assign(identity)
|
||||
await seedStore.acquireActivity(identity, { activityId, kind: 'splice', cellId })
|
||||
|
||||
const assignmentLocked = signal()
|
||||
const legacyCellLocked = signal()
|
||||
let gateFirstAssignmentAttempt = true
|
||||
const directorDatabase = new TransactionProbeDatabase(database, async (phase, sql) => {
|
||||
if (
|
||||
gateFirstAssignmentAttempt &&
|
||||
phase === 'after' &&
|
||||
sql.includes('FROM relay_assignments')
|
||||
) {
|
||||
gateFirstAssignmentAttempt = false
|
||||
assignmentLocked.resolve()
|
||||
await legacyCellLocked.promise
|
||||
}
|
||||
})
|
||||
const directorStore = new RelayAssignmentStore(directorDatabase, () => now)
|
||||
const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined)
|
||||
|
||||
const directorAssign = directorStore.assign(identity)
|
||||
await assignmentLocked.promise
|
||||
let legacyAttempts = 0
|
||||
const legacyRelease = database.transaction(async (transaction) => {
|
||||
legacyAttempts++
|
||||
const lease = (
|
||||
await transaction.queryLocked(
|
||||
`SELECT * FROM relay_assignment_activity_leases
|
||||
WHERE user_id = ? AND relay_host_id = ? AND activity_id = ?`,
|
||||
[identity.userId, identity.relayHostId, activityId]
|
||||
)
|
||||
)[0]
|
||||
if (!lease) return
|
||||
await transaction.queryLocked(`SELECT * FROM relay_cells WHERE cell_id = ?`, [cellId])
|
||||
legacyCellLocked.resolve()
|
||||
await transaction.query(
|
||||
`UPDATE relay_cells SET reserved_requests = reserved_requests - 2 WHERE cell_id = ?`,
|
||||
[cellId]
|
||||
)
|
||||
await transaction.query(
|
||||
`DELETE FROM relay_assignment_activity_leases
|
||||
WHERE user_id = ? AND relay_host_id = ? AND activity_id = ?`,
|
||||
[identity.userId, identity.relayHostId, activityId]
|
||||
)
|
||||
await transaction.query(
|
||||
`UPDATE relay_assignments SET reserved_splices = reserved_splices - 1
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
})
|
||||
|
||||
await Promise.all([directorAssign, legacyRelease])
|
||||
|
||||
expect(directorDatabase.attempts).toBe(2)
|
||||
expect(legacyAttempts).toBe(1)
|
||||
expect(warn).not.toHaveBeenCalledWith(
|
||||
expect.stringContaining('orca_relay_postgres_transaction_retry')
|
||||
)
|
||||
expect(warn).not.toHaveBeenCalledWith(
|
||||
expect.stringContaining('orca_relay_postgres_transaction_exhausted')
|
||||
)
|
||||
await expect(seedStore.resolve(identity)).resolves.toMatchObject({
|
||||
cellId,
|
||||
assignmentEpoch: assignment.assignmentEpoch
|
||||
})
|
||||
const state = await database.query(
|
||||
`SELECT assignment.reserved_controls, assignment.reserved_splices,
|
||||
cell.reserved_requests
|
||||
FROM relay_assignments assignment
|
||||
JOIN relay_cells cell ON cell.cell_id = assignment.cell_id
|
||||
WHERE assignment.user_id = ? AND assignment.relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
expect(state).toEqual([
|
||||
{ reserved_controls: '1', reserved_splices: '0', reserved_requests: '1' }
|
||||
])
|
||||
warn.mockRestore()
|
||||
}, 15_000)
|
||||
|
||||
it('renews an existing control without waiting on a legacy cell lock', async () => {
|
||||
const now = 1_150_000_000_000
|
||||
const identity = { userId: 'sustained-lock-user', relayHostId: 'sustainedlock01' }
|
||||
const cell = {
|
||||
id: 'sustained-lock-cell',
|
||||
url: 'https://sustained-lock.example.com',
|
||||
capacityRequests: 100
|
||||
}
|
||||
const seedStore = new RelayAssignmentStore(database, () => now)
|
||||
await seedStore.reconcileCells([cell])
|
||||
await seedStore.assign(identity)
|
||||
|
||||
const legacyCellLocked = signal()
|
||||
const releaseLegacyCell = signal()
|
||||
const legacyTransaction = database.transaction(async (transaction) => {
|
||||
await transaction.queryLocked(`SELECT * FROM relay_cells WHERE cell_id = ?`, [cell.id])
|
||||
legacyCellLocked.resolve()
|
||||
await releaseLegacyCell.promise
|
||||
})
|
||||
await legacyCellLocked.promise
|
||||
|
||||
let inventoryAttempts = 0
|
||||
const assignmentDatabase = new TransactionProbeDatabase(
|
||||
database,
|
||||
async (phase, sql) => {
|
||||
if (phase !== 'before' || !sql.includes('FROM relay_cells ORDER BY')) return
|
||||
inventoryAttempts++
|
||||
}
|
||||
)
|
||||
const assignmentStore = new RelayAssignmentStore(assignmentDatabase, () => now)
|
||||
const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined)
|
||||
|
||||
await expect(assignmentStore.assign(identity)).resolves.toMatchObject({
|
||||
cellId: cell.id
|
||||
})
|
||||
releaseLegacyCell.resolve()
|
||||
await expect(legacyTransaction).resolves.toBeUndefined()
|
||||
expect(inventoryAttempts).toBe(0)
|
||||
expect(warn).not.toHaveBeenCalledWith(
|
||||
expect.stringContaining('orca_relay_postgres_transaction_retry')
|
||||
)
|
||||
warn.mockRestore()
|
||||
}, 15_000)
|
||||
|
||||
it('retries a new sticky control without forming a legacy cell-first deadlock', async () => {
|
||||
const now = 1_175_000_000_000
|
||||
const identity = {
|
||||
userId: 'sticky-cell-contention-user',
|
||||
relayHostId: 'stickycellwait1'
|
||||
}
|
||||
const cell = {
|
||||
id: 'sticky-cell-contention-cell',
|
||||
url: 'https://sticky-cell-contention.example.com',
|
||||
capacityRequests: 100
|
||||
}
|
||||
const seedStore = new RelayAssignmentStore(database, () => now)
|
||||
await seedStore.reconcileCells([cell])
|
||||
await seedStore.assign(identity)
|
||||
await seedStore.changeActivity(identity, 'migration', 1)
|
||||
// Drops the grant's pending lease too: a sticky control the rows do not
|
||||
// show is what sends the retry through the NOWAIT cell lock.
|
||||
await seedStore.releaseActivity(identity, 'control-pending:1')
|
||||
|
||||
const legacyCellLocked = signal()
|
||||
const directorAssignmentLocked = signal()
|
||||
const legacyTransaction = database.transaction(async (transaction) => {
|
||||
await transaction.queryLocked(`SELECT * FROM relay_cells WHERE cell_id = ?`, [cell.id])
|
||||
legacyCellLocked.resolve()
|
||||
await directorAssignmentLocked.promise
|
||||
await transaction.queryLocked(
|
||||
`SELECT * FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
})
|
||||
await legacyCellLocked.promise
|
||||
|
||||
let signalFirstAttempt = true
|
||||
const directorLockOrder: string[] = []
|
||||
const assignmentDatabase = new TransactionProbeDatabase(database, async (phase, sql) => {
|
||||
if (phase === 'before') {
|
||||
// Only locked statements reach this hook, so classifying the pin read
|
||||
// is what proves it stays unlocked: if it ever grows a FOR UPDATE it
|
||||
// shows up in the order below instead of silently joining the queue.
|
||||
if (sql.includes('SELECT cell_id FROM relay_assignments')) {
|
||||
directorLockOrder.push('pin-read')
|
||||
} else if (sql.includes('FROM relay_assignments WHERE user_id = ?')) {
|
||||
directorLockOrder.push('assignment')
|
||||
} else if (sql.includes('FROM relay_assignment_activity_leases')) {
|
||||
directorLockOrder.push('activity')
|
||||
} else if (sql.includes('FROM relay_cells ORDER BY')) {
|
||||
directorLockOrder.push('cell-inventory')
|
||||
} else if (sql.includes('FROM relay_cells WHERE cell_id IN')) {
|
||||
directorLockOrder.push('cell-rows')
|
||||
} else if (sql.includes('FROM relay_cells WHERE cell_id = ?')) {
|
||||
directorLockOrder.push('cell')
|
||||
}
|
||||
}
|
||||
if (
|
||||
signalFirstAttempt &&
|
||||
phase === 'after' &&
|
||||
sql.includes('FROM relay_assignments WHERE user_id = ?')
|
||||
) {
|
||||
signalFirstAttempt = false
|
||||
directorAssignmentLocked.resolve()
|
||||
}
|
||||
})
|
||||
const store = new RelayAssignmentStore(assignmentDatabase, () => now)
|
||||
|
||||
await expect(store.assign(identity)).resolves.toMatchObject({
|
||||
cellId: cell.id,
|
||||
assignmentEpoch: 1
|
||||
})
|
||||
await expect(legacyTransaction).resolves.toBeUndefined()
|
||||
expect(assignmentDatabase.attempts).toBe(2)
|
||||
// The retry still takes a cell row before the assignment row — the order
|
||||
// that avoids the legacy cycle — but only the pinned row, never the
|
||||
// inventory.
|
||||
expect(directorLockOrder).toEqual([
|
||||
'assignment',
|
||||
'activity',
|
||||
'cell',
|
||||
'cell-rows',
|
||||
'assignment',
|
||||
'activity'
|
||||
])
|
||||
const state = await database.query(
|
||||
`SELECT assignment.reserved_controls, assignment.migration_leases,
|
||||
cell.reserved_requests
|
||||
FROM relay_assignments assignment
|
||||
JOIN relay_cells cell ON cell.cell_id = assignment.cell_id
|
||||
WHERE assignment.user_id = ? AND assignment.relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
expect(state).toEqual([
|
||||
{ reserved_controls: '1', migration_leases: '1', reserved_requests: '2' }
|
||||
])
|
||||
}, 15_000)
|
||||
|
||||
it('serializes normalized assignment and activity release without a retry', async () => {
|
||||
const now = 1_200_000_000_000
|
||||
const identity = { userId: 'normalized-order-user', relayHostId: 'normalizedorder1' }
|
||||
const cellId = 'normalized-order-cell'
|
||||
const activityId = 'splice:normalized-order'
|
||||
await database.query(
|
||||
`DELETE FROM relay_assignment_activity_leases WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
await database.query(`DELETE FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`, [
|
||||
identity.userId,
|
||||
identity.relayHostId
|
||||
])
|
||||
const seedStore = new RelayAssignmentStore(database, () => now)
|
||||
await seedStore.reconcileCells([
|
||||
{ id: cellId, url: 'https://normalized-order.example.com', capacityRequests: 100 }
|
||||
])
|
||||
await seedStore.assign(identity)
|
||||
await seedStore.acquireActivity(identity, { activityId, kind: 'splice', cellId })
|
||||
|
||||
const assignmentLocked = signal()
|
||||
const releaseReachedAssignment = signal()
|
||||
const continueAssignment = signal()
|
||||
let gateFirstAssignmentAttempt = true
|
||||
const assignDatabase = new TransactionProbeDatabase(database, async (phase, sql) => {
|
||||
if (
|
||||
gateFirstAssignmentAttempt &&
|
||||
phase === 'after' &&
|
||||
sql.includes('FROM relay_assignments')
|
||||
) {
|
||||
gateFirstAssignmentAttempt = false
|
||||
assignmentLocked.resolve()
|
||||
await continueAssignment.promise
|
||||
}
|
||||
})
|
||||
const releaseDatabase = new TransactionProbeDatabase(database, async (phase, sql) => {
|
||||
if (phase === 'before' && sql.includes('FROM relay_assignments')) {
|
||||
releaseReachedAssignment.resolve()
|
||||
}
|
||||
})
|
||||
const assignStore = new RelayAssignmentStore(assignDatabase, () => now)
|
||||
const releaseStore = new RelayAssignmentStore(releaseDatabase, () => now)
|
||||
|
||||
const assign = assignStore.assign(identity)
|
||||
await assignmentLocked.promise
|
||||
const release = releaseStore.releaseActivity(identity, activityId)
|
||||
await releaseReachedAssignment.promise
|
||||
continueAssignment.resolve()
|
||||
await Promise.all([assign, release])
|
||||
|
||||
expect(assignDatabase.attempts).toBe(1)
|
||||
expect(releaseDatabase.attempts).toBe(1)
|
||||
const state = await database.query(
|
||||
`SELECT assignment.reserved_controls, assignment.reserved_splices,
|
||||
cell.reserved_requests
|
||||
FROM relay_assignments assignment
|
||||
JOIN relay_cells cell ON cell.cell_id = assignment.cell_id
|
||||
WHERE assignment.user_id = ? AND assignment.relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
expect(state).toEqual([
|
||||
{ reserved_controls: '1', reserved_splices: '0', reserved_requests: '1' }
|
||||
])
|
||||
}, 15_000)
|
||||
|
||||
it('takes the shared cell lock only for the final atomic activity write', async () => {
|
||||
const now = 1_250_000_000_000
|
||||
const cell = {
|
||||
@@ -734,84 +435,6 @@ describePostgres('PostgreSQL transaction recovery', () => {
|
||||
])
|
||||
}, 15_000)
|
||||
|
||||
it('reconciles drift under the assignment-first lock order while activity waits', async () => {
|
||||
const now = 1_300_000_000_000
|
||||
const cells = [
|
||||
{ id: 'reconcile-cell-a', url: 'https://reconcile-a.example.com', capacityRequests: 100 },
|
||||
{ id: 'reconcile-cell-b', url: 'https://reconcile-b.example.com', capacityRequests: 100 }
|
||||
]
|
||||
const identities = Array.from({ length: 12 }, (_, index) => ({
|
||||
userId: `reconcile-user-${index}`,
|
||||
relayHostId: `reconcilehost${String(index).padStart(4, '0')}`
|
||||
}))
|
||||
const seedStore = new RelayAssignmentStore(database, () => now)
|
||||
await seedStore.reconcileCells(cells)
|
||||
for (const identity of identities) await seedStore.assign(identity)
|
||||
await database.query(
|
||||
`UPDATE relay_assignments SET reserved_controls = 7, reserved_splices = 5
|
||||
WHERE user_id LIKE 'reconcile-user-%'`
|
||||
)
|
||||
await database.query(
|
||||
`UPDATE relay_cells SET reserved_requests = 42
|
||||
WHERE cell_id IN (?, ?)`,
|
||||
['reconcile-cell-a', 'reconcile-cell-b']
|
||||
)
|
||||
|
||||
const assignmentsLocked = signal()
|
||||
const activityReachedAssignment = signal()
|
||||
const continueReconciliation = signal()
|
||||
let gateReconciliation = true
|
||||
const reconcileDatabase = new TransactionProbeDatabase(database, async (phase, sql) => {
|
||||
if (
|
||||
gateReconciliation &&
|
||||
phase === 'after' &&
|
||||
sql.includes('SELECT assignment.* FROM relay_assignments assignment')
|
||||
) {
|
||||
gateReconciliation = false
|
||||
assignmentsLocked.resolve()
|
||||
await continueReconciliation.promise
|
||||
}
|
||||
})
|
||||
const activityDatabase = new TransactionProbeDatabase(database, async (phase, sql) => {
|
||||
if (phase === 'before' && sql.includes('FROM relay_assignments WHERE user_id')) {
|
||||
activityReachedAssignment.resolve()
|
||||
}
|
||||
})
|
||||
const reconcileStore = new RelayAssignmentStore(reconcileDatabase, () => now)
|
||||
const activityStore = new RelayAssignmentStore(activityDatabase, () => now)
|
||||
|
||||
const reconciliation = reconcileStore.cellEvacuationStatus(
|
||||
'reconcile-cell-a',
|
||||
'reconcile-cell-b',
|
||||
true
|
||||
)
|
||||
await assignmentsLocked.promise
|
||||
const activity = activityStore.acquireActivity(identities[0]!, {
|
||||
activityId: 'splice:reconcile',
|
||||
kind: 'splice',
|
||||
cellId: 'reconcile-cell-a'
|
||||
})
|
||||
await activityReachedAssignment.promise
|
||||
continueReconciliation.resolve()
|
||||
await Promise.all([reconciliation, activity])
|
||||
|
||||
expect(reconcileDatabase.attempts).toBe(1)
|
||||
expect(activityDatabase.attempts).toBe(1)
|
||||
const reservations = await database.query(
|
||||
`SELECT cell.cell_id, cell.reserved_requests,
|
||||
COALESCE(SUM(lease.request_units), 0) AS lease_units
|
||||
FROM relay_cells cell
|
||||
LEFT JOIN relay_assignment_activity_leases lease ON lease.cell_id = cell.cell_id
|
||||
WHERE cell.cell_id IN (?, ?)
|
||||
GROUP BY cell.cell_id, cell.reserved_requests ORDER BY cell.cell_id`,
|
||||
['reconcile-cell-a', 'reconcile-cell-b']
|
||||
)
|
||||
expect(reservations).toEqual([
|
||||
{ cell_id: 'reconcile-cell-a', reserved_requests: '8', lease_units: '8' },
|
||||
{ cell_id: 'reconcile-cell-b', reserved_requests: '6', lease_units: '6' }
|
||||
])
|
||||
}, 15_000)
|
||||
|
||||
it('keeps a unit placed between reconciliation reading leases and locking cells', async () => {
|
||||
const now = 1_350_000_000_000
|
||||
const cells = [
|
||||
@@ -945,529 +568,4 @@ describePostgres('PostgreSQL transaction recovery', () => {
|
||||
).resolves.toMatchObject({ inProgress: 0 })
|
||||
}, 15_000)
|
||||
|
||||
it('defers completion instead of deadlocking with a legacy cell-first lock', async () => {
|
||||
const now = 1_500_000_000_000
|
||||
const identity = {
|
||||
userId: 'completion-contention-user',
|
||||
relayHostId: 'completionwait01'
|
||||
}
|
||||
const sourceCell = {
|
||||
id: 'completion-contention-source',
|
||||
url: 'https://completion-contention-source.example.com',
|
||||
capacityRequests: 100
|
||||
}
|
||||
const targetCell = {
|
||||
id: 'completion-contention-target',
|
||||
url: 'https://completion-contention-target.example.com',
|
||||
capacityRequests: 100
|
||||
}
|
||||
const store = new RelayAssignmentStore(database, () => now, {
|
||||
requireLiveCells: true
|
||||
})
|
||||
await store.reconcileCells([sourceCell, targetCell])
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: sourceCell.id,
|
||||
cellUrl: sourceCell.url,
|
||||
cellIncarnation: '11111111-1111-4111-8111-111111111111',
|
||||
startedAt: now - 100,
|
||||
ready: true,
|
||||
observedRequests: 0
|
||||
})
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: targetCell.id,
|
||||
cellUrl: targetCell.url,
|
||||
cellIncarnation: '22222222-2222-4222-8222-222222222222',
|
||||
startedAt: now - 100,
|
||||
ready: true,
|
||||
observedRequests: 0
|
||||
})
|
||||
const assignment = await store.assign(identity)
|
||||
const sourceControl = await store.activateControl(identity, {
|
||||
cellId: sourceCell.id,
|
||||
assignmentEpoch: assignment.assignmentEpoch,
|
||||
generation: 1
|
||||
})
|
||||
const migration = await store.startEvacuation(identity, targetCell.id)
|
||||
await store.activateControl(identity, {
|
||||
cellId: targetCell.id,
|
||||
assignmentEpoch: migration.assignmentEpoch,
|
||||
generation: 1
|
||||
})
|
||||
await store.markMigrationTargetRegistered(identity, {
|
||||
cellId: targetCell.id,
|
||||
assignmentEpoch: migration.assignmentEpoch
|
||||
})
|
||||
await store.releaseActivity(identity, sourceControl)
|
||||
await store.setCellEnabled(sourceCell.id, false)
|
||||
|
||||
const legacyCellLocked = signal()
|
||||
const completionAssignmentLocked = signal()
|
||||
const legacyTransaction = database.transaction(async (transaction) => {
|
||||
await transaction.queryLocked(`SELECT * FROM relay_cells WHERE cell_id = ?`, [
|
||||
sourceCell.id
|
||||
])
|
||||
legacyCellLocked.resolve()
|
||||
await completionAssignmentLocked.promise
|
||||
await transaction.queryLocked(
|
||||
`SELECT * FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
})
|
||||
await legacyCellLocked.promise
|
||||
|
||||
let signalCompletion = true
|
||||
const completionDatabase = new TransactionProbeDatabase(
|
||||
database,
|
||||
async (phase, sql) => {
|
||||
if (
|
||||
signalCompletion &&
|
||||
phase === 'after' &&
|
||||
sql.includes('FROM relay_assignments WHERE user_id')
|
||||
) {
|
||||
signalCompletion = false
|
||||
completionAssignmentLocked.resolve()
|
||||
}
|
||||
}
|
||||
)
|
||||
const completionStore = new RelayAssignmentStore(completionDatabase, () => now, {
|
||||
requireLiveCells: true
|
||||
})
|
||||
const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined)
|
||||
|
||||
await expect(completionStore.completeReadyEvacuations()).resolves.toBe(0)
|
||||
await expect(legacyTransaction).resolves.toBeUndefined()
|
||||
expect(warn).not.toHaveBeenCalledWith(
|
||||
expect.stringContaining('orca_relay_postgres_transaction_retry')
|
||||
)
|
||||
await expect(store.completeReadyEvacuations()).resolves.toBe(1)
|
||||
}, 15_000)
|
||||
|
||||
it('normalizes persistent dead-source inventory contention', async () => {
|
||||
let now = 1_550_000_000_000
|
||||
const identity = {
|
||||
userId: 'dead-source-contention-user',
|
||||
relayHostId: 'deadsourcewait01'
|
||||
}
|
||||
const secondIdentity = {
|
||||
userId: identity.userId,
|
||||
relayHostId: 'deadsourcewait02'
|
||||
}
|
||||
const sourceCell = {
|
||||
id: 'dead-source-contention-source',
|
||||
url: 'https://dead-source-contention-source.example.com',
|
||||
capacityRequests: 100
|
||||
}
|
||||
const targetCell = {
|
||||
id: 'dead-source-contention-target',
|
||||
url: 'https://dead-source-contention-target.example.com',
|
||||
capacityRequests: 100
|
||||
}
|
||||
const sourceIncarnation = '11111111-1111-4111-8111-111111111111'
|
||||
const targetIncarnation = '22222222-2222-4222-8222-222222222222'
|
||||
const store = new RelayAssignmentStore(database, () => now, {
|
||||
requireLiveCells: true
|
||||
})
|
||||
await store.reconcileCells([sourceCell, targetCell])
|
||||
await store.setCellEnabled(targetCell.id, false)
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: sourceCell.id,
|
||||
cellUrl: sourceCell.url,
|
||||
cellIncarnation: sourceIncarnation,
|
||||
startedAt: now - 100,
|
||||
ready: true,
|
||||
observedRequests: 0
|
||||
})
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: targetCell.id,
|
||||
cellUrl: targetCell.url,
|
||||
cellIncarnation: targetIncarnation,
|
||||
startedAt: now - 100,
|
||||
ready: true,
|
||||
observedRequests: 0
|
||||
})
|
||||
const assignment = await store.assign(identity)
|
||||
const sourceControl = await store.activateControl(identity, {
|
||||
cellId: sourceCell.id,
|
||||
assignmentEpoch: assignment.assignmentEpoch,
|
||||
generation: 1
|
||||
})
|
||||
await store.setCellEnabled(targetCell.id, true)
|
||||
const migration = await store.startEvacuation(identity, targetCell.id)
|
||||
await store.activateControl(identity, {
|
||||
cellId: targetCell.id,
|
||||
assignmentEpoch: migration.assignmentEpoch,
|
||||
generation: 1
|
||||
})
|
||||
await store.markMigrationTargetRegistered(identity, {
|
||||
cellId: targetCell.id,
|
||||
assignmentEpoch: migration.assignmentEpoch
|
||||
})
|
||||
await store.releaseActivity(identity, sourceControl)
|
||||
const secondAssignment = await store.assign(secondIdentity)
|
||||
expect(secondAssignment.cellId).toBe(sourceCell.id)
|
||||
const secondSourceControl = await store.activateControl(secondIdentity, {
|
||||
cellId: sourceCell.id,
|
||||
assignmentEpoch: secondAssignment.assignmentEpoch,
|
||||
generation: 1
|
||||
})
|
||||
const secondMigration = await store.startEvacuation(secondIdentity, targetCell.id)
|
||||
await store.activateControl(secondIdentity, {
|
||||
cellId: targetCell.id,
|
||||
assignmentEpoch: secondMigration.assignmentEpoch,
|
||||
generation: 1
|
||||
})
|
||||
await store.markMigrationTargetRegistered(secondIdentity, {
|
||||
cellId: targetCell.id,
|
||||
assignmentEpoch: secondMigration.assignmentEpoch
|
||||
})
|
||||
await store.releaseActivity(secondIdentity, secondSourceControl)
|
||||
await store.setCellEnabled(sourceCell.id, false)
|
||||
now += 45_001
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: targetCell.id,
|
||||
cellUrl: targetCell.url,
|
||||
cellIncarnation: targetIncarnation,
|
||||
startedAt: now - 45_101,
|
||||
ready: true,
|
||||
observedRequests: 0
|
||||
})
|
||||
await store.attestCellFence(sourceCell.id, sourceIncarnation)
|
||||
|
||||
const legacyCellLocked = signal()
|
||||
const completionAssignmentLocked = signal()
|
||||
const legacyTransaction = database.transaction(async (transaction) => {
|
||||
await transaction.queryLocked(`SELECT * FROM relay_cells WHERE cell_id = ?`, [
|
||||
sourceCell.id
|
||||
])
|
||||
legacyCellLocked.resolve()
|
||||
await completionAssignmentLocked.promise
|
||||
await transaction.queryLocked(
|
||||
`SELECT * FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
})
|
||||
await legacyCellLocked.promise
|
||||
|
||||
let signalCompletion = true
|
||||
const fallbackInventoryLocked = signal()
|
||||
const freshAssignmentLocked = signal()
|
||||
const persistentInventoryLocked = signal()
|
||||
let releasePersistentInventory = false
|
||||
const completionDatabase = new TransactionProbeDatabase(
|
||||
database,
|
||||
async (phase, sql) => {
|
||||
if (
|
||||
signalCompletion &&
|
||||
phase === 'after' &&
|
||||
sql.includes('FROM relay_assignments WHERE user_id')
|
||||
) {
|
||||
signalCompletion = false
|
||||
completionAssignmentLocked.resolve()
|
||||
} else if (
|
||||
phase === 'after' &&
|
||||
sql.trim() === 'SELECT * FROM relay_cells ORDER BY cell_id ASC'
|
||||
) {
|
||||
fallbackInventoryLocked.resolve()
|
||||
await freshAssignmentLocked.promise
|
||||
}
|
||||
}
|
||||
)
|
||||
const completionStore = new RelayAssignmentStore(completionDatabase, () => now, {
|
||||
requireLiveCells: true
|
||||
})
|
||||
const freshAssignmentTransaction = database.transaction(async (transaction) => {
|
||||
await fallbackInventoryLocked.promise
|
||||
await transaction.queryLocked(
|
||||
`SELECT * FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
freshAssignmentLocked.resolve()
|
||||
await transaction.queryLocked(`SELECT * FROM relay_cells ORDER BY cell_id ASC`)
|
||||
persistentInventoryLocked.resolve()
|
||||
while (!releasePersistentInventory) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 250))
|
||||
await transaction.query(`SELECT 1`)
|
||||
}
|
||||
})
|
||||
|
||||
const completion = completionStore.cellEvacuationStatus(
|
||||
sourceCell.id,
|
||||
targetCell.id,
|
||||
true
|
||||
)
|
||||
await persistentInventoryLocked.promise
|
||||
await expect(
|
||||
completion
|
||||
).resolves.toMatchObject({ inProgress: 2, completed: 0, blocked: 2 })
|
||||
await expect(legacyTransaction).resolves.toBeUndefined()
|
||||
releasePersistentInventory = true
|
||||
await expect(freshAssignmentTransaction).resolves.toBeUndefined()
|
||||
await expect(
|
||||
store.cellEvacuationStatus(sourceCell.id, targetCell.id, true)
|
||||
).resolves.toMatchObject({ inProgress: 0, completed: 2, blocked: 0 })
|
||||
}, 25_000)
|
||||
|
||||
it('defers expired lease cleanup around a legacy cell-first lock', async () => {
|
||||
const now = 1_600_000_000_000
|
||||
const identity = {
|
||||
userId: 'lease-contention-user',
|
||||
relayHostId: 'leasecontention1'
|
||||
}
|
||||
const cell = {
|
||||
id: 'lease-contention-cell',
|
||||
url: 'https://lease-contention-cell.example.com',
|
||||
capacityRequests: 100
|
||||
}
|
||||
const store = new RelayAssignmentStore(database, () => now)
|
||||
await store.reconcileCells([cell])
|
||||
await store.assign(identity)
|
||||
await database.query(
|
||||
`UPDATE relay_assignment_activity_leases SET expires_at = ?
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[now - 1, identity.userId, identity.relayHostId]
|
||||
)
|
||||
|
||||
const legacyCellLocked = signal()
|
||||
const cleanupAssignmentLocked = signal()
|
||||
const legacyTransaction = database.transaction(async (transaction) => {
|
||||
await transaction.queryLocked(`SELECT * FROM relay_cells WHERE cell_id = ?`, [cell.id])
|
||||
legacyCellLocked.resolve()
|
||||
await cleanupAssignmentLocked.promise
|
||||
await transaction.queryLocked(
|
||||
`SELECT * FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
})
|
||||
await legacyCellLocked.promise
|
||||
|
||||
let signalCleanup = true
|
||||
const cleanupDatabase = new TransactionProbeDatabase(database, async (phase, sql) => {
|
||||
if (
|
||||
signalCleanup &&
|
||||
phase === 'after' &&
|
||||
sql.includes('FROM relay_assignments WHERE user_id')
|
||||
) {
|
||||
signalCleanup = false
|
||||
cleanupAssignmentLocked.resolve()
|
||||
}
|
||||
})
|
||||
const cleanupStore = new RelayAssignmentStore(cleanupDatabase, () => now)
|
||||
const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined)
|
||||
|
||||
await expect(cleanupStore.releaseExpiredActivityLeases()).resolves.toBe(0)
|
||||
await expect(legacyTransaction).resolves.toBeUndefined()
|
||||
expect(cleanupDatabase.attempts).toBe(1)
|
||||
expect(warn).not.toHaveBeenCalledWith(
|
||||
expect.stringContaining('orca_relay_postgres_transaction_retry')
|
||||
)
|
||||
await expect(store.releaseExpiredActivityLeases()).resolves.toBe(1)
|
||||
}, 15_000)
|
||||
|
||||
it('skips an expired lease when another director owns its assignment lock', async () => {
|
||||
const now = 1_650_000_000_000
|
||||
const identity = {
|
||||
userId: 'lease-assignment-contention-user',
|
||||
relayHostId: 'leaseassignment1'
|
||||
}
|
||||
const cell = {
|
||||
id: 'lease-assignment-contention-cell',
|
||||
url: 'https://lease-assignment-contention-cell.example.com',
|
||||
capacityRequests: 100
|
||||
}
|
||||
const store = new RelayAssignmentStore(database, () => now)
|
||||
await store.reconcileCells([cell])
|
||||
await store.assign(identity)
|
||||
await database.query(
|
||||
`UPDATE relay_assignment_activity_leases SET expires_at = ?
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[now - 1, identity.userId, identity.relayHostId]
|
||||
)
|
||||
|
||||
const assignmentLocked = signal()
|
||||
const releaseAssignment = signal()
|
||||
const legacyTransaction = database.transaction(async (transaction) => {
|
||||
await transaction.queryLocked(
|
||||
`SELECT * FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
assignmentLocked.resolve()
|
||||
await releaseAssignment.promise
|
||||
})
|
||||
await assignmentLocked.promise
|
||||
|
||||
const cleanupDatabase = new TransactionProbeDatabase(database, async () => undefined)
|
||||
const cleanupStore = new RelayAssignmentStore(cleanupDatabase, () => now)
|
||||
const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined)
|
||||
|
||||
await expect(cleanupStore.releaseExpiredActivityLeases()).resolves.toBe(0)
|
||||
expect(cleanupDatabase.attempts).toBe(1)
|
||||
expect(warn).not.toHaveBeenCalledWith(
|
||||
expect.stringContaining('orca_relay_postgres_transaction_retry')
|
||||
)
|
||||
warn.mockRestore()
|
||||
|
||||
releaseAssignment.resolve()
|
||||
await expect(legacyTransaction).resolves.toBeUndefined()
|
||||
await expect(store.releaseExpiredActivityLeases()).resolves.toBe(1)
|
||||
}, 15_000)
|
||||
|
||||
it('defers aggregate expiry cleanup around a legacy cell-first lock', async () => {
|
||||
const now = 1_700_000_000_000
|
||||
const identity = {
|
||||
userId: 'aggregate-contention-user',
|
||||
relayHostId: 'aggregatewait01'
|
||||
}
|
||||
const cell = {
|
||||
id: 'aggregate-contention-cell',
|
||||
url: 'https://aggregate-contention-cell.example.com',
|
||||
capacityRequests: 100
|
||||
}
|
||||
const store = new RelayAssignmentStore(database, () => now)
|
||||
await store.reconcileCells([cell])
|
||||
await store.assign(identity)
|
||||
await database.query(
|
||||
`DELETE FROM relay_assignment_activity_leases
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
await database.query(
|
||||
`UPDATE relay_assignments SET lease_expires_at = ?
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[now - 1, identity.userId, identity.relayHostId]
|
||||
)
|
||||
|
||||
const legacyCellLocked = signal()
|
||||
const cleanupAssignmentsLocked = signal()
|
||||
const legacyTransaction = database.transaction(async (transaction) => {
|
||||
await transaction.queryLocked(`SELECT * FROM relay_cells WHERE cell_id = ?`, [cell.id])
|
||||
legacyCellLocked.resolve()
|
||||
await cleanupAssignmentsLocked.promise
|
||||
await transaction.queryLocked(
|
||||
`SELECT * FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
})
|
||||
await legacyCellLocked.promise
|
||||
|
||||
let signalCleanup = true
|
||||
const cleanupDatabase = new TransactionProbeDatabase(database, async (phase, sql) => {
|
||||
if (
|
||||
signalCleanup &&
|
||||
phase === 'after' &&
|
||||
sql.includes('FROM relay_assignments WHERE lease_expires_at')
|
||||
) {
|
||||
signalCleanup = false
|
||||
cleanupAssignmentsLocked.resolve()
|
||||
}
|
||||
})
|
||||
const cleanupStore = new RelayAssignmentStore(cleanupDatabase, () => now)
|
||||
const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined)
|
||||
|
||||
await expect(cleanupStore.releaseExpiredActivity()).resolves.toBe(0)
|
||||
await expect(legacyTransaction).resolves.toBeUndefined()
|
||||
expect(cleanupDatabase.attempts).toBe(1)
|
||||
expect(warn).not.toHaveBeenCalledWith(
|
||||
expect.stringContaining('orca_relay_postgres_transaction_retry')
|
||||
)
|
||||
await expect(store.releaseExpiredActivity()).resolves.toBe(1)
|
||||
}, 15_000)
|
||||
|
||||
it('defers aggregate expiry before waiting on a legacy assignment row', async () => {
|
||||
const now = 1_700_000_000_000
|
||||
const identity = {
|
||||
userId: 'aggregate-contention-user',
|
||||
relayHostId: 'aggregatewait01'
|
||||
}
|
||||
const cell = {
|
||||
id: 'aggregate-contention-cell',
|
||||
url: 'https://aggregate-contention-cell.example.com',
|
||||
capacityRequests: 100
|
||||
}
|
||||
const store = new RelayAssignmentStore(database, () => now)
|
||||
await store.reconcileCells([cell])
|
||||
await store.assign(identity)
|
||||
await database.query(
|
||||
`DELETE FROM relay_assignment_activity_leases
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
await database.query(
|
||||
`UPDATE relay_assignments SET lease_expires_at = ?
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[now - 1, identity.userId, identity.relayHostId]
|
||||
)
|
||||
|
||||
const legacyAssignmentLocked = signal()
|
||||
const releaseLegacyAssignment = signal()
|
||||
const legacyTransaction = database.transaction(async (transaction) => {
|
||||
await transaction.queryLocked(
|
||||
`SELECT * FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
legacyAssignmentLocked.resolve()
|
||||
await releaseLegacyAssignment.promise
|
||||
})
|
||||
await legacyAssignmentLocked.promise
|
||||
|
||||
const timedOut = Symbol('timed-out')
|
||||
const cleanup = store.releaseExpiredActivity()
|
||||
const result = await Promise.race([
|
||||
cleanup,
|
||||
new Promise<typeof timedOut>((resolve) => {
|
||||
setTimeout(() => resolve(timedOut), 750)
|
||||
})
|
||||
])
|
||||
releaseLegacyAssignment.resolve()
|
||||
await legacyTransaction
|
||||
if (result === timedOut) await cleanup
|
||||
|
||||
expect(result).toBe(0)
|
||||
await expect(store.releaseExpiredActivity()).resolves.toBe(1)
|
||||
}, 15_000)
|
||||
|
||||
it('keeps concurrent dormant reassignments capacity-consistent', async () => {
|
||||
const now = 1_000_000_000_000
|
||||
const serializedDatabase = new TransactionProbeDatabase(database, async () => undefined)
|
||||
const store = new RelayAssignmentStore(serializedDatabase, () => now)
|
||||
await database.query(
|
||||
`DELETE FROM relay_assignment_activity_leases WHERE user_id LIKE 'postgres-user-%'`
|
||||
)
|
||||
await database.query(`DELETE FROM relay_assignments WHERE user_id LIKE 'postgres-user-%'`)
|
||||
await database.query(`DELETE FROM relay_cells WHERE cell_id IN (?, ?, ?)`, [
|
||||
'cell-a',
|
||||
'cell-b',
|
||||
'cell-c'
|
||||
])
|
||||
await store.reconcileCells([
|
||||
{ id: 'cell-a', url: 'https://cell-a.example.com', capacityRequests: 100 },
|
||||
{ id: 'cell-b', url: 'https://cell-b.example.com', capacityRequests: 100 },
|
||||
{ id: 'cell-c', url: 'https://cell-c.example.com', capacityRequests: 100 }
|
||||
])
|
||||
const identities = Array.from({ length: 30 }, (_, index) => ({
|
||||
userId: `postgres-user-${index}`,
|
||||
relayHostId: `postgreshost${String(index).padStart(5, '0')}`
|
||||
}))
|
||||
await Promise.all(identities.map(async (identity) => await store.assign(identity)))
|
||||
|
||||
await database.query(`DELETE FROM relay_assignment_activity_leases`)
|
||||
await database.query(
|
||||
`UPDATE relay_assignments SET lease_expires_at = ?, last_activity_at = ?,
|
||||
reserved_controls = 0, reserved_splices = 0, reserved_invites = 0,
|
||||
pending_installs = 0, pending_confirmations = 0, migration_leases = 0`,
|
||||
[0, 0]
|
||||
)
|
||||
await database.query(`UPDATE relay_cells SET reserved_requests = 0`)
|
||||
|
||||
await Promise.all(identities.map(async (identity) => await store.assign(identity)))
|
||||
|
||||
const reservations = await database.query(
|
||||
`SELECT cell_id, reserved_requests FROM relay_cells ORDER BY cell_id`
|
||||
)
|
||||
expect(reservations).toEqual([
|
||||
{ cell_id: 'cell-a', reserved_requests: '10' },
|
||||
{ cell_id: 'cell-b', reserved_requests: '10' },
|
||||
{ cell_id: 'cell-c', reserved_requests: '10' }
|
||||
])
|
||||
}, 10_000)
|
||||
|
||||
})
|
||||
|
||||
@@ -50,35 +50,4 @@ describe('hello and replies', () => {
|
||||
expect(hello.features).toEqual(['answer', 'future-feature'])
|
||||
expect(hello.sources).toEqual(['slack', 'future-source'])
|
||||
})
|
||||
|
||||
it('caps a hello at maxHelloProjects projects with short display strings', () => {
|
||||
const project = (name: string) => ({
|
||||
placeId: 'pl_1',
|
||||
name,
|
||||
kind: 'folder',
|
||||
where: { kind: 'local' }
|
||||
})
|
||||
const hello = (projects: unknown[]) =>
|
||||
ConnectorHelloRequestSchema.safeParse({
|
||||
v: 1,
|
||||
contract: 1,
|
||||
orcaVersion: '1.4.230',
|
||||
platform: 'linux',
|
||||
runtime: 'desktop',
|
||||
hostName: 'build-box',
|
||||
agents: ['claude'],
|
||||
promptKinds: [],
|
||||
features: [],
|
||||
sources: ['slack'],
|
||||
projects
|
||||
}).success
|
||||
const longest = 'x'.repeat(CONNECTOR_LIMITS.maxDisplayTextLength)
|
||||
expect(
|
||||
hello(Array.from({ length: CONNECTOR_LIMITS.maxHelloProjects }, () => project(longest)))
|
||||
).toBe(true)
|
||||
expect(hello([project(`${longest}x`)])).toBe(false)
|
||||
expect(
|
||||
hello(Array.from({ length: CONNECTOR_LIMITS.maxHelloProjects + 1 }, () => project('orca')))
|
||||
).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { HostHelloAckSchema } from './control-messages.js'
|
||||
import { isTrustedNewerMove, RelayMovedSchema } from './director-messages.js'
|
||||
import {
|
||||
buildHostChallengePlaintext,
|
||||
buildHostProofMacInput,
|
||||
@@ -8,29 +6,6 @@ import {
|
||||
} from './host-proof-transcript.js'
|
||||
|
||||
describe('relay protocol contract', () => {
|
||||
|
||||
it('accepts moves only from the configured director at a strictly newer epoch', () => {
|
||||
const move = RelayMovedSchema.parse({
|
||||
v: 1,
|
||||
cellUrl: 'https://relay-c2.onorca.dev',
|
||||
assignmentEpoch: 4
|
||||
})
|
||||
const base = {
|
||||
configuredDirectorOrigin: 'https://relay.onorca.dev',
|
||||
currentAssignmentEpoch: 3,
|
||||
move
|
||||
}
|
||||
expect(isTrustedNewerMove({ ...base, sourceOrigin: 'https://relay.onorca.dev' })).toBe(true)
|
||||
expect(isTrustedNewerMove({ ...base, sourceOrigin: move.cellUrl })).toBe(false)
|
||||
expect(
|
||||
isTrustedNewerMove({
|
||||
...base,
|
||||
sourceOrigin: 'https://relay.onorca.dev',
|
||||
currentAssignmentEpoch: 4
|
||||
})
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it('locks the complete host key-possession transcript', () => {
|
||||
const transcript = buildHostProofTranscript({
|
||||
relayOrigin: 'https://relay.onorca.dev',
|
||||
@@ -89,29 +64,3 @@ describe('relay protocol contract', () => {
|
||||
).toThrow('challengeNonce must be 24 bytes')
|
||||
})
|
||||
})
|
||||
|
||||
describe('pending connection details capability', () => {
|
||||
it('reads a pending entry with or without the stated kind and device', () => {
|
||||
const ack = {
|
||||
v: 1 as const,
|
||||
generation: 3,
|
||||
controlResumeSecret: 'R'.repeat(43),
|
||||
leaseExpiresAt: 1_800_000_000_000,
|
||||
activeConnIds: []
|
||||
}
|
||||
const identifiers = { connId: 'conn-1', connTicket: 'T'.repeat(43) }
|
||||
expect(HostHelloAckSchema.safeParse({ ...ack, pendingConns: [identifiers] }).success).toBe(true)
|
||||
expect(
|
||||
HostHelloAckSchema.safeParse({
|
||||
...ack,
|
||||
pendingConns: [{ ...identifiers, kind: 'resume', relayDeviceId: 'device-1' }]
|
||||
}).success
|
||||
).toBe(true)
|
||||
expect(
|
||||
HostHelloAckSchema.safeParse({
|
||||
...ack,
|
||||
pendingConns: [{ ...identifiers, reservationId: 'injected' }]
|
||||
}).success
|
||||
).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -2,22 +2,9 @@ import { describe, expect, it } from 'vitest'
|
||||
import { IdleRegionalRehomeResponseSchema } from './idle-regional-rehome.js'
|
||||
|
||||
describe('idle regional rehome response', () => {
|
||||
it('accepts a source cell that has never heard of the reason field', () => {
|
||||
expect(IdleRegionalRehomeResponseSchema.parse({ v: 1, outcome: 'deferred' })).toEqual({
|
||||
v: 1,
|
||||
outcome: 'deferred'
|
||||
})
|
||||
})
|
||||
|
||||
it('reads a reason it does not know as absent instead of failing the response', () => {
|
||||
expect(
|
||||
IdleRegionalRehomeResponseSchema.parse({ v: 1, outcome: 'deferred', reason: 'from-a-newer-cell' })
|
||||
).toEqual({ v: 1, outcome: 'deferred' })
|
||||
})
|
||||
|
||||
it('drops a field added after this decoder shipped', () => {
|
||||
expect(
|
||||
IdleRegionalRehomeResponseSchema.parse({ v: 1, outcome: 'committed', movedAt: 17 })
|
||||
).toEqual({ v: 1, outcome: 'committed' })
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,53 +1,9 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { hasAdmissionCapacity } from './admission-budgets.js'
|
||||
import { decideResumeCommit, TokenFamilySchema } from './persistence-invariants.js'
|
||||
|
||||
const HASH = 'abcdefghijklmnopqrstuvwxyzABCDEFGH012345678'
|
||||
|
||||
describe('relay persistence invariants', () => {
|
||||
it('admits pre-auth sockets only outside every reserved budget', () => {
|
||||
expect(
|
||||
hasAdmissionCapacity({
|
||||
totalRequests: 649,
|
||||
preAuthConnections: 44,
|
||||
sourcePreAuthConnections: 3
|
||||
})
|
||||
).toBe(true)
|
||||
expect(
|
||||
hasAdmissionCapacity({
|
||||
totalRequests: 650,
|
||||
preAuthConnections: 0,
|
||||
sourcePreAuthConnections: 0
|
||||
})
|
||||
).toBe(false)
|
||||
expect(
|
||||
hasAdmissionCapacity({
|
||||
totalRequests: 0,
|
||||
preAuthConnections: 45,
|
||||
sourcePreAuthConnections: 0
|
||||
})
|
||||
).toBe(false)
|
||||
expect(
|
||||
hasAdmissionCapacity({ totalRequests: 0, preAuthConnections: 0, sourcePreAuthConnections: 4 })
|
||||
).toBe(false)
|
||||
expect(
|
||||
hasAdmissionCapacity({
|
||||
totalRequests: 2_899,
|
||||
preAuthConnections: 0,
|
||||
sourcePreAuthConnections: 0,
|
||||
totalRequestCeiling: 2_900
|
||||
})
|
||||
).toBe(true)
|
||||
expect(
|
||||
hasAdmissionCapacity({
|
||||
totalRequests: 2_900,
|
||||
preAuthConnections: 0,
|
||||
sourcePreAuthConnections: 0,
|
||||
totalRequestCeiling: 2_900
|
||||
})
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it('makes commit-time current, grace, retired, expired, and revoked outcomes exact', () => {
|
||||
const family = TokenFamilySchema.parse({
|
||||
currentVersion: 3,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BOOTSTRAP_FATAL_EXIT_GUARD_KEY } from '../../src/main/startup/bootstrap-fatal-exit-guard'
|
||||
import { BOOTSTRAP_FATAL_EXIT_GUARD_KEY } from '../../src/main/startup/process-failure/bootstrap-fatal-exit-guard'
|
||||
export const BOOTSTRAP_FATAL_LOG_ENV_VAR = 'ORCA_BOOTSTRAP_FATAL_LOG'
|
||||
export const BOOTSTRAP_FATAL_LOG_FILE_NAME = 'bootstrap-fatal.log'
|
||||
const BOOTSTRAP_FATAL_LOG_MAX_BYTES = 262_144
|
||||
|
||||
@@ -11,7 +11,9 @@ export const CLI_MAIN_ENTRY_NAMES = [
|
||||
'filesystem/macos-tree-clone',
|
||||
'orcad/orcad-stale-lock-reclaim',
|
||||
'orcad/orcad-host-identity-reset',
|
||||
'plugins/plugin-authoring-checks',
|
||||
'plugins/plugin-artifact-validation',
|
||||
'plugins/plugin-content-hash',
|
||||
'plugins/plugin-catalog-release-entry',
|
||||
// `orca vm env doctor` runs its checks in the CLI process.
|
||||
'environment-doctor/environment-doctor',
|
||||
'environment-doctor/environment-doctor-host',
|
||||
@@ -25,5 +27,5 @@ export const CLI_MAIN_ENTRY_NAMES = [
|
||||
'persistence/profile-state/recovery/profile-state-recovery-command',
|
||||
'persistence/profile-state/legacy-json/profile-state-export-path',
|
||||
'persistence/profile-state/legacy-json/profile-state-recovery',
|
||||
'startup/http1-compatibility-marker'
|
||||
'startup/network-compatibility/http1-compatibility-marker'
|
||||
] as const
|
||||
|
||||
@@ -32,18 +32,11 @@ fi
|
||||
|
||||
case "$case_name" in
|
||||
# The bundled launcher must stay in Electron's node mode.
|
||||
nofuse-userns-bundled-help) command=("$launcher" --help) ;;
|
||||
nofuse-userns-bundled-version) command=("$launcher" --version) ;;
|
||||
nofuse-userns-bundled-status) command=("$launcher" status) ;;
|
||||
nofuse-userns-bundled-skills) command=("$launcher" skills --help) ;;
|
||||
nofuse-userns-bundled-worktree) command=("$launcher" worktree list) ;;
|
||||
# Direct binaries must hand off before Ozone initializes.
|
||||
nofuse-nosandbox-direct-binary-skills)
|
||||
command=("$extracted_root/orca-ide" --no-sandbox skills --help)
|
||||
;;
|
||||
nofuse-nosandbox-direct-binary-gui)
|
||||
command=("$extracted_root/orca-ide" --no-sandbox)
|
||||
;;
|
||||
stale-display-nosandbox-direct-binary-gui)
|
||||
command=("$extracted_root/orca-ide" --no-sandbox)
|
||||
;;
|
||||
@@ -62,15 +55,6 @@ if ((status == 124)); then
|
||||
exit 94
|
||||
fi
|
||||
|
||||
if [[ "$case_name" == nofuse-userns-bundled-version ]]; then
|
||||
version_file="$extracted_root/resources/app.asar.unpacked/out/package.json"
|
||||
expected_version=$(sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$version_file")
|
||||
if [[ -z "$expected_version" || "$output" != "$expected_version" ]]; then
|
||||
output="VERSION_MISMATCH expected=${expected_version:-missing} got=$output"
|
||||
status=93
|
||||
fi
|
||||
fi
|
||||
|
||||
# Shell signal exits are reported as 128 plus the signal number.
|
||||
if ((status >= 128)); then
|
||||
echo "CRASHED status=$status case=$case_name"
|
||||
|
||||
@@ -348,14 +348,16 @@ module.exports = {
|
||||
'out/main/filesystem/macos-tree-clone.js',
|
||||
'out/main/orca-profiles/profile-index-store.js',
|
||||
'out/main/persistence/profile-state/**',
|
||||
'out/main/plugins/plugin-authoring-checks.js',
|
||||
'out/main/plugins/plugin-artifact-validation.js',
|
||||
'out/main/plugins/plugin-content-hash.js',
|
||||
'out/main/plugins/plugin-catalog-release-entry.js',
|
||||
'out/main/environment-doctor/environment-doctor.js',
|
||||
'out/main/environment-doctor/environment-doctor-host.js',
|
||||
// `orca plugin test` and `orca plugin check` load the runtime, kit and hooks in Node.
|
||||
'resources/plugins/declarative/*.mjs',
|
||||
'out/main/skills/bundled-skill-install/bundled-skill-local-host.js',
|
||||
'out/main/skills/bundled-skill-install/bundled-skill-installation.js',
|
||||
'out/main/startup/http1-compatibility-marker.js',
|
||||
'out/main/startup/network-compatibility/http1-compatibility-marker.js',
|
||||
'out/main/daemon-entry.js',
|
||||
'out/main/session-scanner-service-entry.js',
|
||||
'out/main/wsl-transcript-fs-process-entry.js',
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
1 test-no-in-test-import-actual:src/main/speech/openai-api-key-store.test.ts
|
||||
5 test-no-in-test-import-actual:src/main/ssh/config/ssh-config-loader-regression.test.ts
|
||||
2 test-no-in-test-import-actual:src/main/ssh/connection/ssh-connection-auth-fallback.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/window/dropped-path-preparation.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/window/file-drop/dropped-path-preparation.test.ts
|
||||
2 test-no-in-test-import-actual:src/main/workspace-hooks/hooks-runner.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/workspaces/removal/local-worktree-removal-recovery.test.ts
|
||||
1 test-no-in-test-import-actual:src/renderer/src/components/terminal-pane/pty-connection/notifications/pty-connection-hook-idle-arbitration.test.ts
|
||||
@@ -46,14 +46,13 @@
|
||||
1 test-no-polling-loop:src/main/pty/process-retirement/posix-pty-process-groups.integration.test.ts
|
||||
1 test-no-polling-loop:src/main/pty/process-retirement/windows-live-tree-kill.win32.test.ts
|
||||
1 test-no-polling-loop:src/main/runtime/orchestration/mailbox/terminal-pointer/orchestration-codex-real-pty.integration.test.ts
|
||||
1 test-no-polling-loop:src/main/runtime/rpc/methods/agent-launch/agent-launch-restart-replay.test.ts
|
||||
1 test-no-polling-loop:src/main/runtime/rpc/server/remote-runtime-request-connection.integration.test.ts
|
||||
3 test-no-polling-loop:src/main/skills/install/skill-bundle-process-termination.integration.test.ts
|
||||
2 test-no-polling-loop:src/main/skills/runtime-upload/skill-upload-process-restart.integration.test.ts
|
||||
1 test-no-polling-loop:src/main/ssh/connection/ssh-connection-host-key-store-wiring.test.ts
|
||||
1 test-no-polling-loop:src/main/ssh/legacy-relay/endpoints/ssh-relay-endpoint-incumbent-shell.integration.test.ts
|
||||
2 test-no-polling-loop:src/main/startup/gpu-lifecycle-install-dir-acl-guard.test.ts
|
||||
1 test-no-polling-loop:src/main/startup/run-electron-vite-dev.test.ts
|
||||
2 test-no-polling-loop:src/main/startup/gpu-recovery/gpu-lifecycle-install-dir-acl-guard.test.ts
|
||||
1 test-no-polling-loop:config/scripts/development/launch/run-electron-vite-dev.test.ts
|
||||
2 test-no-polling-loop:src/main/windows/windows-host-job.win32.test.ts
|
||||
1 test-no-polling-loop:src/main/windows/windows-pty-job.win32.test.ts
|
||||
1 test-no-polling-loop:src/main/worker-thread-child-process/worker-thread-child-process.test.ts
|
||||
@@ -186,18 +185,12 @@
|
||||
5 test-no-real-time-wait:src/main/pty/process-retirement/windows-live-tree-kill.win32.test.ts
|
||||
1 test-no-real-time-wait:src/main/runtime/agent-session/structured-agent-session-legacy-send-behind-command.test.ts
|
||||
3 test-no-real-time-wait:src/main/runtime/orchestration/mailbox/terminal-pointer/orchestration-codex-real-pty.integration.test.ts
|
||||
1 test-no-real-time-wait:src/main/runtime/rpc/methods/agent-launch/agent-launch-restart-replay.test.ts
|
||||
1 test-no-real-time-wait:src/main/runtime/rpc/server/remote-runtime-request-connection.integration.test.ts
|
||||
1 test-no-real-time-wait:src/main/runtime/rpc/server/runtime-rpc-long-poll-transport.test.ts
|
||||
1 test-no-real-time-wait:src/main/runtime/rpc/terminal-subscribe-admission.test.ts
|
||||
1 test-no-real-time-wait:src/main/runtime/rpc/terminal-subscribe-mounted-pane.test.ts
|
||||
3 test-no-real-time-wait:src/main/runtime/rpc/terminal-subscribe-reconnect-rebind.test.ts
|
||||
1 test-no-real-time-wait:src/main/runtime/rpc/ws-transport.test.ts
|
||||
1 test-no-real-time-wait:src/main/runtime/rpc/terminal/terminal-subscribe-mounted-pane.test.ts
|
||||
1 test-no-real-time-wait:src/main/runtime/terminal/recovery/layout-command-pane-starts-layout-owner.test.ts
|
||||
1 test-no-real-time-wait:src/main/runtime/terminal/recovery/restored-pane-start-cli-handles.test.ts
|
||||
1 test-no-real-time-wait:src/main/runtime/terminal/wait/launched-agent-crash-guard.live-shell.test.ts
|
||||
1 test-no-real-time-wait:src/main/runtime/terminal/wait/launched-agent-shell-handoff-readiness.test.ts
|
||||
2 test-no-real-time-wait:src/main/runtime/terminal/wait/tui-idle-name-only-real-pty.integration.test.ts
|
||||
1 test-no-real-time-wait:src/main/runtime/workspaces/removal/owned-session-teardown-policy.test.ts
|
||||
3 test-no-real-time-wait:src/main/runtime/workspaces/removal/worktree-teardown-unstopped-pty.test.ts
|
||||
1 test-no-real-time-wait:src/main/skills/cloud/skill-cloud-direct-upload.test.ts
|
||||
@@ -205,12 +198,10 @@
|
||||
2 test-no-real-time-wait:src/main/skills/runtime-upload/skill-upload-process-restart.integration.test.ts
|
||||
1 test-no-real-time-wait:src/main/ssh/connection/ssh-connection-host-key-store-wiring.test.ts
|
||||
1 test-no-real-time-wait:src/main/ssh/legacy-relay/endpoints/ssh-relay-endpoint-incumbent-shell.integration.test.ts
|
||||
2 test-no-real-time-wait:src/main/startup/gpu-lifecycle-install-dir-acl-guard.test.ts
|
||||
3 test-no-real-time-wait:src/main/startup/run-electron-vite-dev.test.ts
|
||||
2 test-no-real-time-wait:src/main/startup/windows-install-dir-acl-recovery.test.ts
|
||||
2 test-no-real-time-wait:src/main/startup/gpu-recovery/gpu-lifecycle-install-dir-acl-guard.test.ts
|
||||
3 test-no-real-time-wait:config/scripts/development/launch/run-electron-vite-dev.test.ts
|
||||
1 test-no-real-time-wait:src/main/updater/lifecycle/serve-supervisor-install-park.test.ts
|
||||
1 test-no-real-time-wait:src/main/updater/updater.quit-and-install.test.ts
|
||||
1 test-no-real-time-wait:src/main/window/main-window-updater-deferred-setup.test.ts
|
||||
1 test-no-real-time-wait:src/main/updater/lifecycle/main-window-updater-deferred-setup.test.ts
|
||||
3 test-no-real-time-wait:src/main/windows/windows-host-job.win32.test.ts
|
||||
1 test-no-real-time-wait:src/main/windows/windows-process-tree-command-line-patch.test.ts
|
||||
2 test-no-real-time-wait:src/main/windows/windows-pty-job.win32.test.ts
|
||||
@@ -303,7 +294,7 @@
|
||||
1 test-no-real-time-wait:tests/e2e/markdown-table-row-backspace.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/native-chat-history-prepend-anchor.spec.ts
|
||||
3 test-no-real-time-wait:tests/e2e/notification-sound-replay.spec.ts
|
||||
5 test-no-real-time-wait:tests/e2e/orchestration-idle-mail-delivery.spec.ts
|
||||
4 test-no-real-time-wait:tests/e2e/orchestration-idle-mail-delivery.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/orchestration-idle-mail-restore.spec.ts
|
||||
4 test-no-real-time-wait:tests/e2e/paced-terminal-typing.ts
|
||||
1 test-no-real-time-wait:tests/e2e/paired-client-hosted-browser-double-restart.spec.ts
|
||||
@@ -414,7 +405,6 @@
|
||||
2 test-no-wall-clock:src/main/ai-vault/scanners/cursor/session-scanner-cursor-chat-meta.test.ts
|
||||
1 test-no-wall-clock:src/main/ai-vault/scanners/devin/session-scanner-devin-db.test.ts
|
||||
2 test-no-wall-clock:src/main/ai-vault/scanners/grok/session-scanner-grok-parser.test.ts
|
||||
1 test-no-wall-clock:src/main/ai-vault/scanners/kimi/session-scanner-kimi-parser.test.ts
|
||||
1 test-no-wall-clock:src/main/ai-vault/scanners/opencode/reader-transport/session-scanner-opencode-sqlite-process.test.ts
|
||||
2 test-no-wall-clock:src/main/ai-vault/scanners/opencode/session-scanner-opencode-parser.test.ts
|
||||
2 test-no-wall-clock:src/main/antigravity/posix-hook-invocation.test.ts
|
||||
@@ -437,19 +427,15 @@
|
||||
2 test-no-wall-clock:src/main/external-conversations/external-conversation-cancel-settlement.test.ts
|
||||
3 test-no-wall-clock:src/main/external-conversations/external-conversation-cancel.test.ts
|
||||
2 test-no-wall-clock:src/main/git/command-runner/host-routing/git-command-resolution-windows-checkout.test.ts
|
||||
2 test-no-wall-clock:src/main/git/command-runner/hosted-cli/runner-gh-account-binding.test.ts
|
||||
1 test-no-wall-clock:src/main/git/command-runner/hosted-cli/runner-gh-account-binding.test.ts
|
||||
1 test-no-wall-clock:src/main/git/refs/maintenance/pack-refs-lock-ownership.test.ts
|
||||
2 test-no-wall-clock:src/main/git/refs/maintenance/repo-ref-maintenance-real-git.test.ts
|
||||
1 test-no-wall-clock:src/main/git/source-control/blob-absence-real-git.test.ts
|
||||
2 test-no-wall-clock:src/main/git/worktrees/catalog/worktree-created-description-real-git.test.ts
|
||||
3 test-no-wall-clock:src/main/github/pr-refresh-coordinator-active-visible-priority.test.ts
|
||||
8 test-no-wall-clock:src/main/github/pr-refresh-coordinator-alias-coalescing.test.ts
|
||||
5 test-no-wall-clock:src/main/github/pr-refresh-coordinator-completion-order.test.ts
|
||||
3 test-no-wall-clock:src/main/github/pr-refresh-coordinator-foreground-pacing.test.ts
|
||||
3 test-no-wall-clock:src/main/github/pr-refresh-coordinator-refresh-events.test.ts
|
||||
4 test-no-wall-clock:src/main/github/pr-refresh-coordinator-visibility-policy.test.ts
|
||||
3 test-no-wall-clock:src/main/github/pr-refresh-coordinator-visible-follow-up.test.ts
|
||||
4 test-no-wall-clock:src/main/github/pr-refresh-queue-growth-bound.test.ts
|
||||
3 test-no-wall-clock:src/main/github/pull-requests/refresh/pr-refresh-coordinator-active-visible-priority.test.ts
|
||||
8 test-no-wall-clock:src/main/github/pull-requests/refresh/pr-refresh-coordinator-alias-coalescing.test.ts
|
||||
3 test-no-wall-clock:src/main/github/pull-requests/refresh/pr-refresh-coordinator-completion-order.test.ts
|
||||
2 test-no-wall-clock:src/main/github/pull-requests/refresh/pr-refresh-queue-growth-bound.test.ts
|
||||
2 test-no-wall-clock:src/main/grok/grok-hook-stdin-no-eof.test.ts
|
||||
3 test-no-wall-clock:src/main/ipc/runtime-environments/runtime-environment-request-connections.test.ts
|
||||
1 test-no-wall-clock:src/main/ipc/terminal-render-desync-evidence.test.ts
|
||||
@@ -499,14 +485,13 @@
|
||||
1 test-no-wall-clock:src/main/runtime/push/push-unpair-persistence.test.ts
|
||||
1 test-no-wall-clock:src/main/runtime/rpc/methods/agent-launch/agent-launch-prestart-failure.test.ts
|
||||
1 test-no-wall-clock:src/main/runtime/rpc/methods/agent-launch/agent-launch-replay.test.ts
|
||||
2 test-no-wall-clock:src/main/runtime/rpc/methods/agent-launch/agent-launch-restart-replay.test.ts
|
||||
1 test-no-wall-clock:src/main/runtime/rpc/methods/orchestration/federation/federation-output.test.ts
|
||||
2 test-no-wall-clock:src/main/runtime/rpc/methods/orchestration/worker/fleet-status-observed-identity.test.ts
|
||||
1 test-no-wall-clock:src/main/runtime/rpc/methods/orchestration/worker/worker-interactive-wait.test.ts
|
||||
1 test-no-wall-clock:src/main/runtime/rpc/methods/orchestration/worker/worker-output.test.ts
|
||||
2 test-no-wall-clock:src/main/runtime/rpc/server/remote-runtime-request-connection.integration.test.ts
|
||||
2 test-no-wall-clock:src/main/runtime/rpc/server/runtime-rpc-pairing-mode-persistence.test.ts
|
||||
7 test-no-wall-clock:src/main/runtime/rpc/server/runtime-rpc-relay-pairing.test.ts
|
||||
6 test-no-wall-clock:src/main/runtime/rpc/server/runtime-rpc-relay-pairing.test.ts
|
||||
1 test-no-wall-clock:src/main/runtime/session-construction/agent-session/orca-runtime-agent-session-operation.test.ts
|
||||
1 test-no-wall-clock:src/main/runtime/session-construction/agent-session/remote-agent-session-host-authority.integration.test.ts
|
||||
1 test-no-wall-clock:src/main/runtime/terminal/adoption/terminal-subscriber-driven-daemon-attach.test.ts
|
||||
@@ -515,7 +500,6 @@
|
||||
3 test-no-wall-clock:src/main/runtime/terminal/query/orca-runtime-codex-idle-title-chat-address.test.ts
|
||||
1 test-no-wall-clock:src/main/runtime/terminal/recovery/terminal-pane-recovery-liveness-gate.test.ts
|
||||
16 test-no-wall-clock:src/main/runtime/terminal/wait/tui-idle-hook-lane-runtime.test.ts
|
||||
4 test-no-wall-clock:src/main/runtime/terminal/wait/tui-idle-name-only-real-pty.integration.test.ts
|
||||
1 test-no-wall-clock:src/main/runtime/workspaces/process-listing/runtime-worktree-structured-agent-rows-liveness.test.ts
|
||||
1 test-no-wall-clock:src/main/runtime/workspaces/removal/owned-session-teardown-policy.test.ts
|
||||
6 test-no-wall-clock:src/main/skills/install/skill-bundle-process-termination.integration.test.ts
|
||||
@@ -528,12 +512,9 @@
|
||||
2 test-no-wall-clock:src/main/skills/transaction-state/skill-transaction-startup-recovery.test.ts
|
||||
4 test-no-wall-clock:src/main/sqlite/sync-database.test.ts
|
||||
4 test-no-wall-clock:src/main/ssh/remote-exec/ssh-remote-commands.test.ts
|
||||
2 test-no-wall-clock:src/main/star-nag/service-direct-star.test.ts
|
||||
3 test-no-wall-clock:src/main/star-nag/service-threshold-prompt.test.ts
|
||||
1 test-no-wall-clock:src/main/startup/gpu-lifecycle-install-dir-acl-guard.test.ts
|
||||
1 test-no-wall-clock:src/main/startup/login-shell-environment.test.ts
|
||||
2 test-no-wall-clock:src/main/startup/run-electron-vite-dev.test.ts
|
||||
13 test-no-wall-clock:src/main/startup/windows-install-dir-acl-recovery.test.ts
|
||||
2 test-no-wall-clock:config/scripts/development/launch/run-electron-vite-dev.test.ts
|
||||
1 test-no-wall-clock:src/main/startup/shell-environment/login-shell-environment.test.ts
|
||||
2 test-no-wall-clock:src/main/startup/windows-install-permissions/windows-install-dir-acl-recovery.test.ts
|
||||
4 test-no-wall-clock:src/main/updater/lifecycle/serve-supervisor-install-park.test.ts
|
||||
1 test-no-wall-clock:src/main/window/desktop-integration/macos-press-and-hold-default.defaults-domain.test.ts
|
||||
2 test-no-wall-clock:src/main/windows/windows-host-job.win32.test.ts
|
||||
@@ -547,7 +528,6 @@
|
||||
3 test-no-wall-clock:src/renderer/src/components/activity/activity-auto-mark-read-loop.react185.test.tsx
|
||||
2 test-no-wall-clock:src/renderer/src/components/artifacts/ArtifactCollection.test.tsx
|
||||
1 test-no-wall-clock:src/renderer/src/components/browser-pane/assemble-chrome/browser-workspace-pane.adoption-chrome.test.tsx
|
||||
3 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/turns/NativeChatResolvedView.turn-status.test.tsx
|
||||
2 test-no-wall-clock:src/renderer/src/components/native-chat/tools/tasks/NativeChatStructuredSessionStatus.test.tsx
|
||||
1 test-no-wall-clock:src/renderer/src/components/sidebar/workspace-card/review/use-workspace-reference-details.test.tsx
|
||||
1 test-no-wall-clock:src/renderer/src/components/sidebar/worktree-list/listing/WorktreeList.lineage-agent-expansion-coupling.test.tsx
|
||||
@@ -578,9 +558,9 @@
|
||||
4 test-no-wall-clock:tests/e2e/cross-version-wire/release-checkout.unit.test.ts
|
||||
2 test-no-wall-clock:tests/e2e/cross-version-wire/release-source-retention.unit.test.ts
|
||||
1 test-no-wall-clock:tests/e2e/host-cold-park-remote-subscriber.unit.test.ts
|
||||
1 test-timeout-needs-reason:src/cli/agent-launch-process.test.ts
|
||||
1 test-timeout-needs-reason:src/cli/agents/agent-launch-process.test.ts
|
||||
1 test-timeout-needs-reason:src/cli/runtime/serve-pid1-init-reaper.test.ts
|
||||
1 test-timeout-needs-reason:src/cli/skills-install.test.ts
|
||||
1 test-timeout-needs-reason:src/cli/skills/skills-install.test.ts
|
||||
2 test-timeout-needs-reason:src/main/acp/journal/acp-structured-broken-stream.test.ts
|
||||
4 test-timeout-needs-reason:src/main/agent-hooks/server/testing/http/server-transport-interference.test.ts
|
||||
1 test-timeout-needs-reason:src/main/agent-hooks/wsl-relay/testing/wsl-hook-relay-live.integration.test.ts
|
||||
@@ -598,7 +578,6 @@
|
||||
1 test-timeout-needs-reason:src/main/browser/guest-lifecycle/find/browser-find-frame-traversal.electron.test.ts
|
||||
1 test-timeout-needs-reason:src/main/browser/identity/wire-probes/browser-session-ua-wire-identity-cross-context.electron.test.ts
|
||||
1 test-timeout-needs-reason:src/main/browser/identity/wire-probes/browser-session-ua-wire-identity.electron.test.ts
|
||||
1 test-timeout-needs-reason:src/main/claude/child-process/claude-agent-sdk-exit-proof.test.ts
|
||||
2 test-timeout-needs-reason:src/main/codex/app-server/codex-app-server-teardown.integration.test.ts
|
||||
1 test-timeout-needs-reason:src/main/codex/hooks/installation/hook-service-legacy-cleanup.test.ts
|
||||
1 test-timeout-needs-reason:src/main/codex/structured/catalog/codex-model-catalog-probe.test.ts
|
||||
@@ -641,20 +620,17 @@
|
||||
1 test-timeout-needs-reason:src/main/runtime/mobile-cloud-relay/mobile-relay-e2ee.integration.test.ts
|
||||
1 test-timeout-needs-reason:src/main/runtime/rpc/server/orchestration-cli-subprocess.test.ts
|
||||
2 test-timeout-needs-reason:src/main/runtime/rpc/server/remote-runtime-request-connection.integration.test.ts
|
||||
1 test-timeout-needs-reason:src/main/runtime/rpc/ws-transport.test.ts
|
||||
1 test-timeout-needs-reason:src/main/runtime/session-construction/agent-session/remote-agent-session-host-authority.integration.test.ts
|
||||
1 test-timeout-needs-reason:src/main/runtime/terminal/launch/qoder-mobile-resume-adoption.test.ts
|
||||
2 test-timeout-needs-reason:src/main/runtime/terminal/wait/launched-agent-crash-guard.live-shell.test.ts
|
||||
3 test-timeout-needs-reason:src/main/runtime/terminal/wait/terminal-interactive-wait-visibility.test.ts
|
||||
2 test-timeout-needs-reason:src/main/runtime/terminal/wait/terminal-interactive-wait-visibility.test.ts
|
||||
1 test-timeout-needs-reason:src/main/runtime/terminal/wait/terminal-wait-name-only-idle.test.ts
|
||||
4 test-timeout-needs-reason:src/main/runtime/terminal/wait/tui-idle-hook-lane-runtime.test.ts
|
||||
3 test-timeout-needs-reason:src/main/runtime/terminal/wait/tui-idle-name-only-real-pty.integration.test.ts
|
||||
1 test-timeout-needs-reason:src/main/skills/install/skill-bundle-process-termination.integration.test.ts
|
||||
1 test-timeout-needs-reason:src/main/sqlite/sync-database-concurrent-backup.test.ts
|
||||
2 test-timeout-needs-reason:src/main/ssh/connection/ssh-connection-sftp-wire.test.ts
|
||||
2 test-timeout-needs-reason:src/main/ssh/system-transport/forwarding/system-ssh-forward-process-real-openssh.test.ts
|
||||
2 test-timeout-needs-reason:src/main/startup/single-instance-lock-exit.electron.test.ts
|
||||
1 test-timeout-needs-reason:src/main/window/renderer-publication-throttle.electron.test.ts
|
||||
1 test-timeout-needs-reason:src/main/window/visibility/renderer-publication-throttle.electron.test.ts
|
||||
1 test-timeout-needs-reason:src/main/windows/windows-administrator-restart.win32.test.ts
|
||||
1 test-timeout-needs-reason:src/main/windows/windows-host-job.win32.test.ts
|
||||
1 test-timeout-needs-reason:src/main/windows/windows-msys-job.win32.test.ts
|
||||
@@ -725,7 +701,7 @@
|
||||
1 test-timeout-needs-reason:tests/e2e/markdown-review-selection-performance.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/mobile-subscribe-idle-hidden-pane-fit.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/orcad-serve-open-url-on-desktop.spec.ts
|
||||
10 test-timeout-needs-reason:tests/e2e/orchestration-idle-mail-delivery.spec.ts
|
||||
9 test-timeout-needs-reason:tests/e2e/orchestration-idle-mail-delivery.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/orchestration-idle-mail-restore.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/orchestration-legacy-worker-missing-terminal-recovery.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/orchestration-worker-settlement-release-cli.spec.ts
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@
|
||||
"src/**/*-electron-fixture.ts",
|
||||
"src/**/*-test-fixture.ts",
|
||||
"src/**/*.test-fixture.{ts,tsx}",
|
||||
"src/main/runtime/rpc/rpc-params-type-parity.ts",
|
||||
"src/main/runtime/rpc/dispatch/rpc-params-type-parity.ts",
|
||||
"src/main/runtime/rpc/methods/client-state/ui-state-schema-parity-checks.ts",
|
||||
"src/renderer/src/components/editor/monaco-internal-test-module-types.ts",
|
||||
"mobile/**/*.{ts,tsx}",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Legacy synchronous atomics uses per file; counts may only go DOWN.
|
||||
# Only explicit worker/utility entry files are exempt; their imports remain guarded.
|
||||
1 src/main/runtime/rpc/server/pairing/device-registry-disk-merge.ts
|
||||
1 src/main/startup/ensure-virtual-display.ts
|
||||
1 src/main/startup/linux-display/ensure-virtual-display.ts
|
||||
1 src/shared/windows-retry-file-operations.ts
|
||||
1 src/shared/windows-transient-lock-removal.ts
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Legacy synchronous compression uses per file; counts may only go DOWN.
|
||||
# Only explicit worker/utility entry files are exempt; their imports remain guarded.
|
||||
1 src/main/browser/extensions/actions/browser-extension-action-icon.ts
|
||||
1 src/main/runtime/rpc/mobile-e2ee-v2-compressed-frame.ts
|
||||
1 src/main/runtime/rpc/mobile/e2ee/mobile-e2ee-v2-compressed-frame.ts
|
||||
1 src/main/ssh/remote-exec/ssh-posix-command-wrapper.ts
|
||||
2 src/main/ssh/remote-exec/ssh-remote-powershell.ts
|
||||
1 src/shared/remote-runtime/e2ee/node/paired-e2ee-node-compressed-frame.ts
|
||||
|
||||
@@ -119,7 +119,6 @@
|
||||
1 src/main/codex-accounts/managed-homes/guest-codex-account-homes.ts
|
||||
6 src/main/codex-accounts/managed-homes/host-codex-managed-home-ownership.ts
|
||||
2 src/main/codex-accounts/runtime-home/legacy-host/legacy-shared-auth-migration.ts
|
||||
21 src/main/codex-accounts/legacy-wsl-auth-drain/legacy-wsl-runtime-auth-drain-recovery-script-harness.ts
|
||||
36 src/main/codex-accounts/legacy-wsl-auth-drain/legacy-wsl-runtime-auth-drain-script-harness.ts
|
||||
6 src/main/codex-accounts/legacy-wsl-auth-drain/legacy-wsl-runtime-auth-drain-script-interference-shims.ts
|
||||
1 src/main/codex-accounts/credentials/managed-codex-auth-readiness.ts
|
||||
@@ -489,8 +488,8 @@
|
||||
3 src/main/runtime/rpc/server/pairing/e2ee-keypair.ts
|
||||
3 src/main/runtime/rpc/server/runtime-metadata.ts
|
||||
2 src/main/runtime/rpc/server/runtime-rpc-socket-metadata.ts
|
||||
5 src/main/runtime/rpc/unix-socket-transport.ts
|
||||
3 src/main/runtime/rpc/ws-fallback-port-store.ts
|
||||
5 src/main/runtime/rpc/transports/unix-socket-transport.ts
|
||||
3 src/main/runtime/rpc/transports/websocket/ws-fallback-port-store.ts
|
||||
2 src/main/runtime/terminal/launch/claude-agent-teams-shim-env.ts
|
||||
1 src/main/runtime/workspaces/persisted-surfaces/crew-operations.ts
|
||||
1 src/main/server/serve-pairing-output.ts
|
||||
@@ -516,24 +515,24 @@
|
||||
3 src/main/ssh/system-transport/file-transfer/system-ssh-sftp-transfer.ts
|
||||
3 src/main/ssh/system-transport/ssh-control-socket.ts
|
||||
3 src/main/ssh/system-transport/system-ssh-binary.ts
|
||||
3 src/main/startup/cli-launch-redirect.ts
|
||||
3 src/main/startup/cli-launch/cli-launch-redirect.ts
|
||||
2 src/main/startup/configure-process.ts
|
||||
4 src/main/startup/gpu-fallback-marker.ts
|
||||
2 src/main/startup/http1-compatibility-marker.ts
|
||||
5 src/main/startup/http1-compatibility-profile-state.ts
|
||||
1 src/main/startup/linux-dev-shm-policy.ts
|
||||
4 src/main/startup/linux-realtime-scheduling-guard.ts
|
||||
1 src/main/startup/linux-rttime-limit.ts
|
||||
2 src/main/startup/profile-state-recovery-preflight.ts
|
||||
1 src/main/startup/startup-diagnostics.ts
|
||||
1 src/main/startup/windows-app-data-path.ts
|
||||
5 src/main/startup/windows-install-dir-acl-poison-marker.ts
|
||||
1 src/main/startup/windows-install-dir-acl-probe.ts
|
||||
1 src/main/startup/windows-install-dir-package-acl-grant.ts
|
||||
4 src/main/startup/windows-install-dir-package-acl-repair.ts
|
||||
3 src/main/startup/windows-renderer-runtime-files.ts
|
||||
3 src/main/startup/windows-user-data-acl.ts
|
||||
6 src/main/startup/x-display-artifacts.ts
|
||||
4 src/main/startup/gpu-recovery/gpu-fallback-marker.ts
|
||||
2 src/main/startup/network-compatibility/http1-compatibility-marker.ts
|
||||
5 src/main/startup/network-compatibility/http1-compatibility-profile-state.ts
|
||||
1 src/main/startup/linux-runtime/linux-dev-shm-policy.ts
|
||||
4 src/main/startup/linux-runtime/linux-realtime-scheduling-guard.ts
|
||||
1 src/main/startup/linux-runtime/linux-rttime-limit.ts
|
||||
2 src/main/startup/profile-startup/profile-state-recovery-preflight.ts
|
||||
1 src/main/startup/diagnostics/startup-diagnostics.ts
|
||||
1 src/main/startup/windows-startup/windows-app-data-path.ts
|
||||
5 src/main/startup/windows-install-permissions/windows-install-dir-acl-poison-marker.ts
|
||||
1 src/main/startup/windows-install-permissions/windows-install-dir-acl-probe.ts
|
||||
1 src/main/startup/windows-install-permissions/windows-install-dir-package-acl-grant.ts
|
||||
4 src/main/startup/windows-install-permissions/windows-install-dir-package-acl-repair.ts
|
||||
3 src/main/startup/windows-startup/windows-renderer-runtime-files.ts
|
||||
3 src/main/startup/windows-startup/windows-user-data-acl.ts
|
||||
6 src/main/startup/linux-display/x-display-artifacts.ts
|
||||
2 src/main/stats/stats-file-loader.ts
|
||||
2 src/main/text-generation/source-control-prompt-files.ts
|
||||
1 src/main/updater/lifecycle/windows-update-install-directory.ts
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
1 src/main/browser/network/egress/browser-route-egress-electron-launch.ts
|
||||
1 src/main/browser/routing/partitions/browser-route-partition-binding-store.ts
|
||||
1 src/main/claude-accounts/runtime-auth-service.ts
|
||||
2 src/main/codex-accounts/legacy-wsl-auth-drain/legacy-wsl-runtime-auth-drain-recovery-script-harness.ts
|
||||
2 src/main/codex-accounts/legacy-wsl-auth-drain/legacy-wsl-runtime-auth-drain-script-harness.ts
|
||||
1 src/main/codex-accounts/runtime-home/routing/runtime-home-service-home-routing.ts
|
||||
1 src/main/codex-accounts/runtime-home/wsl/runtime-home-service-wsl.ts
|
||||
@@ -37,8 +36,8 @@
|
||||
1 src/main/pty/shell-startup/pwsh.ts
|
||||
2 src/main/pty/shell-startup/zsh-startup-hook-pty-harness.ts
|
||||
1 src/main/runtime/integrations/skill/runtime-skill-install-authority.ts
|
||||
2 src/main/startup/cli-launch-redirect.ts
|
||||
1 src/main/startup/linux-secret-service-probe.ts
|
||||
2 src/main/startup/cli-launch/cli-launch-redirect.ts
|
||||
1 src/main/startup/linux-runtime/linux-secret-service-probe.ts
|
||||
2 src/main/window/desktop-integration/macos-press-and-hold-default.ts
|
||||
1 src/main/workspace-hooks/worktree-runner-script.ts
|
||||
3 src/main/wsl/discovery/distro-catalog.ts
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
; WSL host sees nothing here. These are the folders Electron's userData (app.getName()) can be, as the
|
||||
; deleteAppData step lists them; a custom --user-data-dir can't be known here.
|
||||
; Sync the flags with WSL_HOLDER_UNINSTALL_FLAG and WSL_SERVER_UNINSTALL_FLAG in
|
||||
; src/main/startup/wsl-holder-uninstall-preflight.ts.
|
||||
; src/main/startup/uninstall/wsl-holder-uninstall-preflight.ts.
|
||||
${if} $installMode == "all"
|
||||
SetShellVarContext current
|
||||
${endIf}
|
||||
@@ -114,7 +114,7 @@
|
||||
; app, but once that folder is removed every agent fails a hook per event, so the last Orca for
|
||||
; this user takes the entries out. Another install, or an unreadable registry, keeps them.
|
||||
; Best effort: the exit code never blocks uninstall.
|
||||
; Sync the flag with AGENT_HOOKS_UNINSTALL_FLAG in src/main/startup/agent-hooks-uninstall-preflight.ts.
|
||||
; Sync the flag with AGENT_HOOKS_UNINSTALL_FLAG in src/main/startup/uninstall/agent-hooks-uninstall-preflight.ts.
|
||||
!insertmacro ORCA_OTHER_INSTALL_STATE $1
|
||||
${if} $1 == "none"
|
||||
nsExec::Exec '"$INSTDIR\${APP_EXECUTABLE_FILENAME}" --orca-uninstall-remove-agent-hooks'
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
# Existing production source files importing child_process at runtime outside @orca/process-host.
|
||||
# Migration debt: this list may only shrink; new callers use the package public API.
|
||||
src/cli/handlers/core.ts
|
||||
src/cli/handlers/interactive-login-interruption.ts
|
||||
src/cli/runtime/cli-lifecycle-handlers.ts
|
||||
src/cli/accounts/interactive-login-interruption.ts
|
||||
src/cli/runtime/launch.ts
|
||||
src/main/agent-hooks/installation/locking/managed-hook-owner-identity.ts
|
||||
src/main/ai-vault/scan-service/session-scanner-service-spawn.ts
|
||||
@@ -11,7 +11,6 @@ src/main/automations/precheck-runner.ts
|
||||
src/main/browser/agent-browser/helper-process/agent-browser-bridge-execution.ts
|
||||
src/main/browser/agent-browser/helper-process/agent-browser-bridge-raw-process.ts
|
||||
src/main/browser/network/egress/browser-route-egress-electron-launch.ts
|
||||
src/main/codex-accounts/legacy-wsl-auth-drain/legacy-wsl-runtime-auth-drain-recovery-script-harness.ts
|
||||
src/main/codex-accounts/legacy-wsl-auth-drain/legacy-wsl-runtime-auth-drain-script-harness.ts
|
||||
src/main/codex-accounts/service.ts
|
||||
src/main/computer/desktop-script/desktop-script-provider-bridge.ts
|
||||
@@ -36,7 +35,7 @@ src/main/git/command-runner/process-capture/spawn-command-capture.ts
|
||||
src/main/git/command-runner/process-capture/spawned-command-tree-kill.ts
|
||||
src/main/git/command-runner/host-routing/wsl-aware-spawn.ts
|
||||
src/main/git/command-runner/host-routing/wsl-git-read-environment.ts
|
||||
src/main/github/gh-utils.ts
|
||||
src/main/github/execution/github-legacy-command.ts
|
||||
src/main/workspace-hooks/hooks.ts
|
||||
src/main/ipc/developer-permissions.ts
|
||||
src/main/ipc/filesystem/watcher-process/child-lifecycle/parcel-watcher-child-launch.ts
|
||||
@@ -57,7 +56,6 @@ src/main/network/macos-tailscale-dns-diagnostic.ts
|
||||
src/main/plugins/workers/parent-process/plugin-host-process.ts
|
||||
src/main/plugins/catalog/plugin-private-marketplace-ssh-shim.cjs
|
||||
src/main/ports/port-scan-command-execution.ts
|
||||
src/main/providers/macos-login-session-pty-probe.ts
|
||||
src/main/providers/process-cwd.ts
|
||||
src/main/pty/process-retirement/pty-descendant-fresh-table.ts
|
||||
src/main/rate-limits/providers/gemini/gemini-cli-oauth-extractor.ts
|
||||
@@ -67,7 +65,7 @@ src/main/ssh/system-transport/ssh-proxy-command.ts
|
||||
src/main/ssh/system-transport/system-ssh-command.ts
|
||||
src/main/ssh/system-transport/forwarding/system-ssh-dynamic-forward-process.ts
|
||||
src/main/ssh/system-transport/file-transfer/system-ssh-file-transfer.ts
|
||||
src/main/startup/ensure-virtual-display.ts
|
||||
src/main/startup/linux-display/ensure-virtual-display.ts
|
||||
src/main/pty/process-retirement/windows-process-tree-kill.ts
|
||||
src/main/pty/shell-startup/zsh-startup-hook-pty-harness.ts
|
||||
src/shared/ephemeral-vm-recipe-process.ts
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# collector (file-wide). Not counted: destructuring off a global object, a self-rescheduling setTimeout (it must back off or pause while hidden).
|
||||
# This is a RATCHET: counts may only go DOWN.
|
||||
# Prune after removing intervals: pnpm check:recurring-timer-ratchet --prune
|
||||
1 src/cli/handlers/orchestration/check-keepalive.ts
|
||||
1 src/cli/orchestration/messages/check-keepalive.ts
|
||||
1 src/cli/runtime/mac-app-update-bundle.ts
|
||||
1 src/cli/runtime/serve-supervised-service.ts
|
||||
1 src/main/agent-hooks/server/server-opencode-binder.ts
|
||||
@@ -51,10 +51,10 @@
|
||||
1 src/main/runtime/mobile-cloud-relay/desktop-relay-service.ts
|
||||
3 src/main/runtime/mobile-cloud-relay/relay-control-liveness.ts
|
||||
1 src/main/runtime/rpc/methods/orchestration/messaging/check-run.ts
|
||||
1 src/main/runtime/rpc/mobile-socket-wiring.ts
|
||||
1 src/main/runtime/rpc/remote-runtime-server-heartbeat.ts
|
||||
1 src/main/runtime/rpc/mobile/mobile-socket-wiring.ts
|
||||
1 src/main/runtime/rpc/transports/websocket/remote-runtime-server-heartbeat.ts
|
||||
1 src/main/runtime/rpc/server/runtime-metadata-ownership-watch.ts
|
||||
1 src/main/runtime/rpc/unix-socket-transport.ts
|
||||
1 src/main/runtime/rpc/transports/unix-socket-transport.ts
|
||||
1 src/main/runtime/sidebar-inputs/paired-server-rows-producer.ts
|
||||
1 src/main/runtime/terminal/input/agent-prompt-permission-hold.ts
|
||||
1 src/main/runtime/terminal/output/terminal-derived-agent-facts.ts
|
||||
@@ -64,8 +64,8 @@
|
||||
1 src/main/ssh/port-forwarding/ssh-tcp-forwarding-probe.ts
|
||||
1 src/main/ssh/protocol/ssh-channel-multiplexer.ts
|
||||
1 src/main/startup/configure-process.ts
|
||||
1 src/main/startup/event-loop-stall-probe.ts
|
||||
1 src/main/startup/synthetic-title-runtime.ts
|
||||
1 src/main/startup/diagnostics/event-loop-stall-probe.ts
|
||||
1 src/main/startup/main-window/synthetic-title-runtime.ts
|
||||
1 src/main/telemetry/wsl-usage-reporter.ts
|
||||
1 src/main/wsl/host-lifecycle/wsl-hosts-policy-live-update.ts
|
||||
1 src/main/wsl/orcad/wsl-orcad-connect-stop-fence.ts
|
||||
|
||||
+286
-259
File diff suppressed because one or more lines are too long
@@ -2,7 +2,7 @@
|
||||
# This is a RATCHET: counts may only go DOWN. Resolve the host instead (see fix text).
|
||||
# A lower bound: destructured and differently named rows are not counted.
|
||||
# Prune after a fix: pnpm check:repo-host-read-ratchet --prune
|
||||
1 src/main/github/account-binding-required-host.ts
|
||||
1 src/main/github/accounts/account-binding-required-host.ts
|
||||
3 src/main/ipc/ephemeral-vm-recipe-context.ts
|
||||
2 src/main/ipc/filesystem/filesystem-source-control-ai-targets.ts
|
||||
1 src/main/ipc/folder-repo-git-upgrade.ts
|
||||
@@ -13,7 +13,6 @@
|
||||
1 src/main/ipc/source-control/github-work-item-args.ts
|
||||
1 src/main/ipc/source-control/gitlab-repo-access.ts
|
||||
2 src/main/ipc/workspace-cleanup/workspace-cleanup-candidate.ts
|
||||
1 src/main/ipc/workspace-cleanup/workspace-cleanup-disconnected-ssh.ts
|
||||
1 src/main/ipc/worktrees-test-metadata-pruning-store.ts
|
||||
1 src/main/ipc/worktrees/listing/authoritative-local-worktree-metadata-pruning.ts
|
||||
1 src/main/ipc/worktrees/listing/register-host-catalog-handlers.ts
|
||||
@@ -47,7 +46,7 @@
|
||||
1 src/main/workspaces/space-analysis/workspace-space-worktree-row.ts
|
||||
1 src/shared/endpoint-catalog-adoption.ts
|
||||
1 src/shared/folder-workspaces/folder-workspace-execution-host.ts
|
||||
1 src/shared/github/github-cache-key.ts
|
||||
1 src/shared/github/cache/github-cache-key.ts
|
||||
1 src/shared/new-workspace-dialog-repo.ts
|
||||
1 src/shared/sidebar-list/workspace-review-facts.ts
|
||||
1 src/shared/workspace-session/workspace-session-terminal-buffers.ts
|
||||
|
||||
@@ -224,7 +224,6 @@
|
||||
"config/scripts/release/versioning/release-rc-history.test.mjs": 230,
|
||||
"config/scripts/release/workflow-contracts/release-windows-signing-gate.test.mjs": 102,
|
||||
"config/scripts/static-analysis/oxlint-contracts/renderer-scrollbar-style-plugin.test.mjs": 234,
|
||||
"config/scripts/static-analysis/renderer-styles/renderer-tailwind-sources.test.mjs": 289,
|
||||
"config/scripts/desktop-distribution/nsis/replace-cached-nsis-elevate.test.mjs": 1258,
|
||||
"config/scripts/ci/workflow-contracts/required-pr-check-name.test.mjs": 1266,
|
||||
"config/scripts/archives/seven-zip/resolve-7za-path.test.mjs": 1391,
|
||||
@@ -306,7 +305,6 @@
|
||||
"src/cli/command-suggestion-destructive-families.test.ts": 226,
|
||||
"src/cli/command-suggestion.test.ts": 68,
|
||||
"src/cli/computer-tree-query.test.ts": 79,
|
||||
"src/cli/format-recovery.test.ts": 413,
|
||||
"src/cli/format.test.ts": 446,
|
||||
"src/cli/handlers/account.test.ts": 849,
|
||||
"src/cli/handlers/agent-hooks.test.ts": 1702,
|
||||
@@ -1271,7 +1269,6 @@
|
||||
"src/main/codex/hooks/definitions/codex-real-home-hook-key-spellings.test.ts": 408,
|
||||
"src/main/codex/hooks/reconciliation/codex-real-home-hook-removal.test.ts": 388,
|
||||
"src/main/codex/configuration/homes/codex-real-home-path.test.ts": 76,
|
||||
"src/main/codex/hooks/reconciliation/codex-real-home-shared-entry.test.ts": 641,
|
||||
"src/main/codex/history/backfill/codex-session-backfill.test.ts": 310,
|
||||
"src/main/codex/history/bridges/codex-session-bridge.test.ts": 118,
|
||||
"src/main/codex/history/index/codex-session-index-heal-state.test.ts": 363,
|
||||
@@ -1361,7 +1358,6 @@
|
||||
"src/main/codex/hooks/installation/hook-service-managed-codex-hashes.test.ts": 1048,
|
||||
"src/main/codex/hooks/installation/hook-service-managed-install.test.ts": 492,
|
||||
"src/main/codex/hooks/installation/hook-service-runtime-trust-repair.test.ts": 475,
|
||||
"src/main/codex/hooks/installation/hook-service-trust-grant.test.ts": 318,
|
||||
"src/main/codex/hooks/installation/hook-service-user-hook-mirroring.test.ts": 596,
|
||||
"src/main/codex/hooks/installation/hook-service-user-hook-trust-spellings.test.ts": 657,
|
||||
"src/main/codex/hooks/installation/hook-service-windows-key-spellings.test.ts": 461,
|
||||
@@ -1933,7 +1929,7 @@
|
||||
"src/main/host/secret-protection-report.test.ts": 59,
|
||||
"src/main/i18n/main-i18n-lazy-locale.test.ts": 518,
|
||||
"src/main/i18n/system-language.test.ts": 358,
|
||||
"src/main/media/image-file-signature.test.ts": 47,
|
||||
"src/shared/image-file-signature.test.ts": 47,
|
||||
"src/main/credentials/integration-state-file-cache.test.ts": 47,
|
||||
"src/main/credentials/integration-token-file-cache.test.ts": 152,
|
||||
"src/main/ipc/account-sign-in-link-opener.test.ts": 128,
|
||||
@@ -3052,7 +3048,6 @@
|
||||
"src/main/runtime/browser/client-pages/orca-runtime-browser-ghost-session-row-close.test.ts": 640,
|
||||
"src/main/runtime/browser/screencast/orca-runtime-browser-screencast-e2ee-backlog.test.ts": 659,
|
||||
"src/main/runtime/browser/screencast/orca-runtime-browser-screencast-fanout.test.ts": 607,
|
||||
"src/main/runtime/browser/screencast/orca-runtime-browser-screencast-pending-frame-retry.test.ts": 595,
|
||||
"src/main/runtime/browser/client-pages/orca-runtime-browser.test.ts": 682,
|
||||
"src/main/runtime/terminal/query/orca-runtime-codex-idle-title-chat-address.test.ts": 5781,
|
||||
"src/main/runtime/terminal/surface/orca-runtime-cold-restore-terminal-membership-layout-owner.test.ts": 4130,
|
||||
@@ -3238,7 +3233,6 @@
|
||||
"src/main/runtime/rpc/e2ee-channel-text-backpressure.test.ts": 204,
|
||||
"src/main/runtime/rpc/e2ee-channel-v2.test.ts": 287,
|
||||
"src/main/runtime/rpc/e2ee-channel.test.ts": 539,
|
||||
"src/main/runtime/rpc/e2ee-crypto.test.ts": 121,
|
||||
"src/main/runtime/rpc/methods/accounts/accounts.test.ts": 161,
|
||||
"src/main/runtime/rpc/methods/agent-launch/agent-launch-at-rest.test.ts": 4936,
|
||||
"src/main/runtime/rpc/methods/agent-launch/agent-launch-caller-selection.test.ts": 1680,
|
||||
@@ -3396,7 +3390,6 @@
|
||||
"src/main/runtime/rpc/mobile-e2ee-v2-compressed-frame.test.ts": 75,
|
||||
"src/main/runtime/rpc/mobile-e2ee-v2-desktop-session.test.ts": 98,
|
||||
"src/main/runtime/rpc/mobile-socket-wiring.test.ts": 312,
|
||||
"src/main/runtime/rpc/orcad-feature-readiness.test.ts": 40,
|
||||
"src/main/runtime/rpc/orchestration-11745-regression-verification.test.ts": 22874,
|
||||
"src/main/runtime/rpc/orchestration-check-wait-session.test.ts": 5096,
|
||||
"src/main/runtime/rpc/orchestration-commit-notify-characterization.test.ts": 5702,
|
||||
@@ -3426,7 +3419,6 @@
|
||||
"src/main/runtime/rpc/remote-runtime-server-heartbeat-missed-probe-tolerance.test.ts": 59,
|
||||
"src/main/runtime/rpc/remote-runtime-server-heartbeat.test.ts": 60,
|
||||
"src/main/runtime/rpc/repo-add-cli.integration.test.ts": 1603,
|
||||
"src/main/runtime/rpc/runtime-client-capabilities.test.ts": 43,
|
||||
"src/main/runtime/rpc/runtime-source-admission.test.ts": 909,
|
||||
"src/main/runtime/rpc/shadowed-port-probe.test.ts": 99,
|
||||
"src/main/runtime/rpc/static-web-client-handler-stream.test.ts": 1823,
|
||||
@@ -3471,7 +3463,6 @@
|
||||
"src/main/runtime/rpc/unix-socket-transport.test.ts": 79,
|
||||
"src/main/runtime/rpc/unpaired-device-auth-throttle.test.ts": 42,
|
||||
"src/main/runtime/rpc/web-session-pairing.test.ts": 402,
|
||||
"src/main/runtime/rpc/workspace-creator-context.test.ts": 40,
|
||||
"src/main/runtime/rpc/worktree-removal-marker-projection.test.ts": 497,
|
||||
"src/main/runtime/rpc/worktree-rm-cli.integration.test.ts": 6876,
|
||||
"src/main/runtime/rpc/ws-empty-payload-frame-write.test.ts": 117,
|
||||
@@ -3908,7 +3899,6 @@
|
||||
"src/main/startup/configure-process.test.ts": 255,
|
||||
"src/main/startup/e2e-external-open-guard.test.ts": 44,
|
||||
"src/main/startup/e2e-spawn-log-env.test.ts": 89,
|
||||
"src/main/startup/ensure-virtual-display.test.ts": 135,
|
||||
"src/main/startup/first-window-startup-services.test.ts": 54,
|
||||
"src/main/startup/gpu-fallback-marker.test.ts": 61,
|
||||
"src/main/startup/gpu-lifecycle-install-dir-acl-guard.test.ts": 641,
|
||||
@@ -4067,7 +4057,6 @@
|
||||
"src/main/window/renderer-recovery-reload-watchdog.test.ts": 69,
|
||||
"src/main/window/runtime-renderer-notification-sender.test.ts": 54,
|
||||
"src/main/window/runtime-window-lifecycle-terminal-reveal.test.ts": 100,
|
||||
"src/main/window/runtime-window-pane-title-notification.test.ts": 97,
|
||||
"src/main/window/session-tab-close-request-relay.test.ts": 74,
|
||||
"src/main/window/terminal-tab-close-request-relay.test.ts": 64,
|
||||
"src/main/window/updater-package-recovery-ipc.test.ts": 169,
|
||||
@@ -6177,7 +6166,6 @@
|
||||
"src/shared/agent-status/process/agent-process-presence-platform.test.ts": 64,
|
||||
"src/shared/agent-launch/startup/agent-prompt-injection.test.ts": 88,
|
||||
"src/shared/agent-scratch-worktrees.test.ts": 61,
|
||||
"src/shared/agent-session/agent-message-display-text.test.ts": 147,
|
||||
"src/shared/agent-session/agent-session-approval-blocked-path.test.ts": 49,
|
||||
"src/shared/agent-session/agent-session-attachments.test.ts": 46,
|
||||
"src/shared/agent-session/agent-session-context-clear.test.ts": 222,
|
||||
@@ -6245,7 +6233,6 @@
|
||||
"src/shared/agent-status/transport/agent-status-osc.test.ts": 104,
|
||||
"src/shared/agent-status/store/agent-status-store-reopen.test.ts": 199,
|
||||
"src/shared/agent-status/title/agent-status-tracker-program-activity.test.ts": 77,
|
||||
"src/shared/agent-launch/startup/agent-tui-input-clear.test.ts": 57,
|
||||
"src/shared/ai-vault/resume/ai-vault-resume-command.test.ts": 70,
|
||||
"src/shared/ai-vault/resume/ai-vault-resume-target.test.ts": 85,
|
||||
"src/shared/ai-vault/scanning/ai-vault-scope-paths.test.ts": 73,
|
||||
@@ -6256,7 +6243,6 @@
|
||||
"src/shared/ai-vault/session-display/ai-vault-session-filters.test.ts": 176,
|
||||
"src/shared/ai-vault/resume/ai-vault-ssh-resume-target.test.ts": 84,
|
||||
"src/shared/ansi-escape-sequences-consumers.test.ts": 140,
|
||||
"src/shared/ansi-escape-sequences.test.ts": 289,
|
||||
"src/shared/antigravity-generation-plan.test.ts": 122,
|
||||
"src/shared/automatic-work-run-marker.test.ts": 93,
|
||||
"src/shared/automation-cron-dialect.test.ts": 65,
|
||||
@@ -6289,7 +6275,6 @@
|
||||
"src/shared/claude-background-task-status.test.ts": 315,
|
||||
"src/shared/claude-model-list-probe.test.ts": 55,
|
||||
"src/shared/claude-shell-function.test.ts": 220,
|
||||
"src/shared/cli-runtime-pairing-inputs.test.ts": 64,
|
||||
"src/shared/cloud-service-url.test.ts": 37,
|
||||
"src/shared/coalescing-keyed-runner.test.ts": 119,
|
||||
"src/shared/codebuddy-agent.test.ts": 301,
|
||||
@@ -6324,14 +6309,12 @@
|
||||
"src/shared/ephemeral-vm-recipe-checkout-mode.test.ts": 106,
|
||||
"src/shared/ephemeral-vm-recipe-output-capture.test.ts": 287,
|
||||
"src/shared/ephemeral-vm-recipe-process.test.ts": 198,
|
||||
"src/shared/ephemeral-vm-recipe-repo-url.test.ts": 56,
|
||||
"src/shared/ephemeral-vm-recipes.test.ts": 160,
|
||||
"src/shared/ephemeral-vm-runtime-store-rollback.test.ts": 321,
|
||||
"src/shared/ephemeral-vm-runtime-store.test.ts": 195,
|
||||
"src/shared/execution-host-registry-shared-control-connect.test.ts": 160,
|
||||
"src/shared/execution-host-registry.test.ts": 169,
|
||||
"src/shared/execution-host.test.ts": 56,
|
||||
"src/shared/external-automation-jobs-file.test.ts": 72,
|
||||
"src/shared/external-worktree-inbox.test.ts": 69,
|
||||
"src/shared/feature-education-telemetry.test.ts": 36,
|
||||
"src/shared/feature-tips.test.ts": 54,
|
||||
@@ -6430,7 +6413,6 @@
|
||||
"src/shared/keybindings-digit-index.test.ts": 110,
|
||||
"src/shared/keybindings-double-tap.test.ts": 92,
|
||||
"src/shared/keybindings-keyboard-layout.test.ts": 86,
|
||||
"src/shared/keybindings-parse-cache.test.ts": 61,
|
||||
"src/shared/keybindings-parsing.test.ts": 86,
|
||||
"src/shared/keybindings-unassigned-actions.test.ts": 73,
|
||||
"src/shared/kiro-home.test.ts": 39,
|
||||
@@ -6568,7 +6550,6 @@
|
||||
"src/shared/opencode-tui-plugin-install.test.ts": 82,
|
||||
"src/shared/openssh-default-shell.test.ts": 54,
|
||||
"src/shared/orca-browser-cli-commands.test.ts": 59,
|
||||
"src/shared/orca-cli-command-name.test.ts": 41,
|
||||
"src/shared/orca-hook-setup-config.test.ts": 38,
|
||||
"src/shared/orca-session-address.test.ts": 154,
|
||||
"src/shared/orca-yaml-alias-bounds.test.ts": 425,
|
||||
@@ -6737,7 +6718,6 @@
|
||||
"src/shared/remote-runtime/requests/remote-runtime-subscription-frame-router.test.ts": 143,
|
||||
"src/shared/remote-runtime/requests/remote-runtime-subscription-request.test.ts": 646,
|
||||
"src/shared/renderer-restart-preparation.test.ts": 197,
|
||||
"src/shared/repo-display-labels.test.ts": 57,
|
||||
"src/shared/repo-host-identity.test.ts": 45,
|
||||
"src/shared/repo-icon.test.ts": 82,
|
||||
"src/shared/repo-pack-index-scheduling.test.ts": 67,
|
||||
@@ -6841,7 +6821,6 @@
|
||||
"src/shared/terminal/protocol/queries/terminal-color-scheme-protocol.test.ts": 39,
|
||||
"src/shared/terminal/input/terminal-composer-draft.test.ts": 73,
|
||||
"src/shared/terminal/links/terminal-file-uri-link.test.ts": 51,
|
||||
"src/shared/terminal/links/terminal-file-url-target.test.ts": 47,
|
||||
"src/shared/terminal/links/terminal-github-pr-link-detector.test.ts": 61,
|
||||
"src/shared/terminal/links/terminal-http-url-extraction.test.ts": 42,
|
||||
"src/shared/terminal/input/terminal-input.test.ts": 85,
|
||||
@@ -6917,7 +6896,6 @@
|
||||
"src/shared/workspace-attachments/workspace-attachment-origins.test.ts": 42,
|
||||
"src/shared/workspace-attachments/workspace-attachments.test.ts": 204,
|
||||
"src/shared/workspace-cleanup/workspace-cleanup-browse-state-persistence.test.ts": 55,
|
||||
"src/shared/workspace-last-active-switch-on.test.ts": 52,
|
||||
"src/shared/workspace-layout/old-client/old-client-method-translation.test.ts": 352,
|
||||
"src/shared/workspace-layout/old-client/old-client-pane-layout-translation.test.ts": 363,
|
||||
"src/shared/workspace-layout/old-client/old-client-session-tabs-projection-owned-editor.test.ts": 178,
|
||||
@@ -7030,7 +7008,6 @@
|
||||
"src/wsl-guest/wsl-install-plugins-handler.test.ts": 283,
|
||||
"tests/e2e/SmartWorkspaceSourceResultList.linear-auth.unit.test.ts": 1976,
|
||||
"tests/e2e/SmartWorkspaceSourceResultList.linear-read-error.unit.test.ts": 3757,
|
||||
"tests/e2e/agent-launch-cli.unit.test.ts": 2379,
|
||||
"tests/e2e/agent-launch-setup-choice.unit.test.ts": 2657,
|
||||
"tests/e2e/ai-vault-manual-name-clear.unit.test.ts": 21206,
|
||||
"tests/e2e/automation-chat-reopen.unit.test.ts": 6262,
|
||||
|
||||
@@ -84,7 +84,7 @@ const NON_UNIT_TEST_RUNNERS = [
|
||||
// `orca plugin test` runs every example's own tests in Node; the unit test drives it.
|
||||
name: 'example plugin tests (orca plugin test)',
|
||||
include: ['examples/plugins/*/src/**/*.test.ts', 'examples/plugins/*/src/**/*.test.tsx'],
|
||||
sources: ['src/cli/plugin-authoring/plugin-test-runner.test.ts'],
|
||||
sources: ['src/cli/plugins/authoring/plugin-test-runner.test.ts'],
|
||||
mirrors: ['readdirSync(EXAMPLES)']
|
||||
},
|
||||
{
|
||||
|
||||
@@ -37,8 +37,8 @@ export const UNIT_EXCLUDE = [
|
||||
'src/main/pty/shell-startup/zsh-startup-hook-user-config-equivalence.live-shell.test.ts',
|
||||
'src/main/runtime/terminal/wait/tui-idle-zsh-preexec-hook-order.live-shell.test.ts',
|
||||
'src/main/runtime/agent-session/environment/structured-session-cli-login-shell.live-shell.test.ts',
|
||||
'src/main/startup/shell-probe-terminal-detach.live-shell.test.ts',
|
||||
'src/main/startup/shell-probe-lifetime.live-shell.test.ts',
|
||||
'src/main/startup/shell-environment/shell-probe-terminal-detach.live-shell.test.ts',
|
||||
'src/main/startup/shell-environment/shell-probe-lifetime.live-shell.test.ts',
|
||||
'src/renderer/src/components/terminal-pane/pty-connection/emulation/fish-color-scheme-child-stdin.node-pty.test.ts',
|
||||
'src/shared/fish-wsl-cwd-report.node-pty.test.ts',
|
||||
'src/main/wsl/filesystem/wsl-sh-cwd-report.node-pty.test.ts',
|
||||
@@ -52,7 +52,6 @@ export const UNIT_EXCLUDE = [
|
||||
'src/main/browser/guest-lifecycle/popups/presentation/popup-origin-chrome.electron.test.ts',
|
||||
'src/main/browser/guest-lifecycle/navigation/browser-link-materialization.electron.test.ts',
|
||||
'src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts',
|
||||
'src/main/browser/guest-lifecycle/popups/compatibility/browser-popup-compatibility.electron.test.ts',
|
||||
'src/main/browser/guest-lifecycle/popups/compatibility/browser-popup-native-compatibility.electron.test.ts',
|
||||
'src/main/browser/guest-lifecycle/popups/compatibility/browser-popup-background-compatibility.electron.test.ts',
|
||||
'src/main/browser/extensions/api-runtime/browser-extension-api.electron.test.ts',
|
||||
|
||||
+9
-3
@@ -183,7 +183,9 @@ describe('run-electron-vite-dev', () => {
|
||||
const tempDir = mkdtempSync(join(tmpdir(), 'orca-dev-wrapper-'))
|
||||
const pidFile = join(tempDir, 'grandchild.pid')
|
||||
const wrapperPath = resolve('config/scripts/development/launch/run-electron-vite-dev.mjs')
|
||||
const fakeCliPath = resolve('src/main/startup/__fixtures__/fake-electron-vite-dev-cli.mjs')
|
||||
const fakeCliPath = resolve(
|
||||
'config/scripts/development/launch/fixtures/fake-electron-vite-dev-cli.mjs'
|
||||
)
|
||||
|
||||
const wrapper = spawn(process.execPath, [wrapperPath], {
|
||||
cwd: resolve('.'),
|
||||
@@ -228,7 +230,9 @@ describe('run-electron-vite-dev', () => {
|
||||
async () => {
|
||||
const tempDir = mkdtempSync(join(tmpdir(), 'orca-dev-wrapper-'))
|
||||
const wrapperPath = resolve('config/scripts/development/launch/run-electron-vite-dev.mjs')
|
||||
const fakeCliPath = resolve('src/main/startup/__fixtures__/fake-electron-vite-dev-cli.mjs')
|
||||
const fakeCliPath = resolve(
|
||||
'config/scripts/development/launch/fixtures/fake-electron-vite-dev-cli.mjs'
|
||||
)
|
||||
const baseEnv = devWrapperTestEnv({
|
||||
ORCA_ELECTRON_VITE_CLI: fakeCliPath,
|
||||
ORCA_SKIP_DEV_CLI_PREPARE: '1',
|
||||
@@ -302,7 +306,9 @@ describe('run-electron-vite-dev', () => {
|
||||
const pidFile = join(tempDir, 'grandchild.pid')
|
||||
const envFile = join(tempDir, 'env.json')
|
||||
const wrapperPath = resolve('config/scripts/development/launch/run-electron-vite-dev.mjs')
|
||||
const fakeCliPath = resolve('src/main/startup/__fixtures__/fake-electron-vite-dev-cli.mjs')
|
||||
const fakeCliPath = resolve(
|
||||
'config/scripts/development/launch/fixtures/fake-electron-vite-dev-cli.mjs'
|
||||
)
|
||||
|
||||
const { wrapper, readOutput } = spawnDevWrapper(
|
||||
[wrapperPath, '--remote-debugging-port=9448'],
|
||||
@@ -4715,21 +4715,9 @@
|
||||
"auto.components.settings.ZcodePlanAccountsSection.detailsUnavailable": {
|
||||
"ko": "요금제 자격 증명 세부 정보는 Orca를 실행 중인 컴퓨터에서만 볼 수 있습니다."
|
||||
},
|
||||
"accounts.antigravity.signIn": {
|
||||
"ko": "이 호스트에서 agy를 실행하고 브라우저 로그인을 완료한 후 현재 계정을 저장하세요. 다른 계정을 추가하려면 agy에서 /logout 명령을 실행하고 다시 로그인하세요."
|
||||
},
|
||||
"accounts.antigravity.signedOut": {
|
||||
"ko": "로그인된 agy 자체 계정이 없습니다."
|
||||
},
|
||||
"accounts.antigravity.changed": {
|
||||
"ko": "agy 자체 계정이 변경되었습니다. agy를 시작하기 전에 저장된 계정을 다시 선택하세요."
|
||||
},
|
||||
"accounts.antigravity.save": {
|
||||
"ko": "현재 계정 저장"
|
||||
},
|
||||
"accounts.antigravity.sessions": {
|
||||
"ko": "선택한 계정은 이 호스트의 새 agy 세션에 적용됩니다. 기존 세션은 이전 계정을 계속 사용할 수 있습니다."
|
||||
},
|
||||
"accounts.antigravity.keyword.antigravity": {
|
||||
"ko": "antigravity"
|
||||
},
|
||||
|
||||
-4
@@ -30,10 +30,6 @@ describe('native dialog localization coverage', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('does not change the existing renderer scan by default', () => {
|
||||
expect(collectLocalizationCandidates(path, source, '/repo')).toEqual([])
|
||||
})
|
||||
|
||||
it('fails the opt-in check for a new native dialog literal', async () => {
|
||||
const root = await mkdtemp(join(tmpdir(), 'orca-native-localization-'))
|
||||
const report = vi.spyOn(console, 'error').mockImplementation(() => {})
|
||||
|
||||
@@ -236,20 +236,6 @@ for (const engine of ['chromium', 'webkit']) {
|
||||
expect(sealed.reported.join(' ')).not.toContain('script-src')
|
||||
}, 180_000)
|
||||
|
||||
it('loads the artifact https images the directive admits, and still refuses its font', async (ctx) => {
|
||||
// Await both images explicitly; bounded settle once observed background before element on loaded Chrome.
|
||||
const read = await open(browser(), {
|
||||
assets: assetServer.origin,
|
||||
frameReady: 'images',
|
||||
signal: ctx.signal
|
||||
})
|
||||
expect(read.pixel).toBe(ARTIFACT_RGB)
|
||||
// img-src governs CSS background and img element; require both requests.
|
||||
expect([...read.secureHits].sort()).toEqual(['/css-bg.png', '/img.png'])
|
||||
// Same HTTPS origin still cannot load font; img-src admission must not widen font-src.
|
||||
expect(read.secureHits).not.toContain('/probe.woff2')
|
||||
}, 120_000)
|
||||
|
||||
it('sends no referrer with an admitted https image, which is the shell header doing it', async (ctx) => {
|
||||
const sealed = await open(browser(), {
|
||||
assets: assetServer.origin,
|
||||
@@ -384,109 +370,6 @@ for (const engine of ['chromium', 'webkit']) {
|
||||
expect(read.popups).toBe(0)
|
||||
}, 120_000)
|
||||
|
||||
it("cannot reach the shell through a meta refresh at the embedder's own URL", async (ctx) => {
|
||||
// Same-origin meta-refresh targets shell document; foreign-origin arm cannot prove shell-origin counter works.
|
||||
const own = await open(browser(), {
|
||||
signal: ctx.signal,
|
||||
extra: { head: '<meta http-equiv="refresh" content="0;url=/">' }
|
||||
})
|
||||
// Require painted artifact before interpreting navigation refusal.
|
||||
expect(own.pixelBefore).toBe(ARTIFACT_RGB)
|
||||
// Link-to-/ control reads one on same counter, proving refresh zero is observable.
|
||||
expect(own.ownOriginTopNavigations).toBe(0)
|
||||
expect(own.topNavigations).toBe(0)
|
||||
// Also reject self-frame shell-document fetch, which would embed session page inside preview.
|
||||
expect(own.ownOriginFrameNavigations).toBe(0)
|
||||
|
||||
// No-policy/allow-same-origin control must navigate frame to shell / to prove observer is not blind.
|
||||
const loose = await open(browser(), {
|
||||
signal: ctx.signal,
|
||||
csp: null,
|
||||
sandbox: 'allow-scripts allow-same-origin allow-top-navigation',
|
||||
extra: { head: '<meta http-equiv="refresh" content="0;url=/">' },
|
||||
// Navigating arm no longer contains marker; await navigation instead of artifact readiness.
|
||||
frameReady: 'load',
|
||||
expectNavigation: 'frame'
|
||||
})
|
||||
expect(loose.ownOriginFrameNavigations).toBe(1)
|
||||
|
||||
// Test sandbox token alone with no CSP; navigation must never begin or report.
|
||||
const tokenOnly = await open(browser(), {
|
||||
signal: ctx.signal,
|
||||
csp: null,
|
||||
extra: { head: '<meta http-equiv="refresh" content="0;url=/">' }
|
||||
})
|
||||
expect(tokenOnly.pixelBefore).toBe(ARTIFACT_RGB)
|
||||
expect(tokenOnly.ownOriginFrameNavigations).toBe(0)
|
||||
expect(tokenOnly.ownOriginTopNavigations).toBe(0)
|
||||
expect(tokenOnly.violations).toEqual([])
|
||||
|
||||
// Test CSP alone with allow-same-origin: frame-src none blocks request at embedder; engines leave different content, so assert no server request.
|
||||
const policyOnly = await open(browser(), {
|
||||
signal: ctx.signal,
|
||||
sandbox: 'allow-scripts allow-same-origin allow-top-navigation',
|
||||
extra: { head: '<meta http-equiv="refresh" content="0;url=/">' },
|
||||
frameReady: 'load'
|
||||
})
|
||||
expect(policyOnly.ownOriginFrameNavigations).toBe(0)
|
||||
expect(policyOnly.ownOriginTopNavigations).toBe(0)
|
||||
expect(policyOnly.violations.join(' ')).toContain('frame-src')
|
||||
}, 180_000)
|
||||
|
||||
it('hands up nothing without a tap, and nothing for a form or a new window', async (ctx) => {
|
||||
const meta = await open(browser(), {
|
||||
signal: ctx.signal,
|
||||
extra: { head: `<meta http-equiv="refresh" content="0;url=${foreignOrigin}/meta.html">` }
|
||||
})
|
||||
expect(meta.topNavigations).toBe(0)
|
||||
expect(meta.ownOriginTopNavigations).toBe(0)
|
||||
const form = await open(browser(), {
|
||||
signal: ctx.signal,
|
||||
act: async ({ frame }) => {
|
||||
await frame.click('#submit', { timeout: 2000 })
|
||||
}
|
||||
})
|
||||
expect(form.actError).toBeNull()
|
||||
expect(form.pixelBefore).toBe(ARTIFACT_RGB)
|
||||
expect(form.topNavigations).toBe(0)
|
||||
const blank = await open(browser(), {
|
||||
signal: ctx.signal,
|
||||
act: async ({ frame }) => {
|
||||
await frame.click('#blanklink', { timeout: 2000 })
|
||||
}
|
||||
})
|
||||
expect(blank.actError).toBeNull()
|
||||
expect(blank.pixelBefore).toBe(ARTIFACT_RGB)
|
||||
expect(blank.topNavigations).toBe(0)
|
||||
expect(blank.popups).toBe(0)
|
||||
const allowedForm = await open(browser(), {
|
||||
signal: ctx.signal,
|
||||
csp: null,
|
||||
sandbox: 'allow-forms allow-top-navigation-by-user-activation',
|
||||
expectNavigation: 'main-frame',
|
||||
act: async ({ frame }) => {
|
||||
await frame.click('#submit', { timeout: 2000 })
|
||||
}
|
||||
})
|
||||
expect(allowedForm.pixelBefore).toBe(ARTIFACT_RGB)
|
||||
expect(allowedForm.actError).toBeNull()
|
||||
expect(allowedForm.topNavigations).toBe(1)
|
||||
const allowedBlank = await open(browser(), {
|
||||
signal: ctx.signal,
|
||||
csp: null,
|
||||
sandbox: 'allow-popups allow-popups-to-escape-sandbox',
|
||||
act: async ({ page, frame }) => {
|
||||
await Promise.all([
|
||||
page.waitForEvent('popup', { timeout: 10_000 }),
|
||||
frame.click('#blanklink', { timeout: 2000 })
|
||||
])
|
||||
}
|
||||
})
|
||||
expect(allowedBlank.pixelBefore).toBe(ARTIFACT_RGB)
|
||||
expect(allowedBlank.actError).toBeNull()
|
||||
expect(allowedBlank.popups).toBe(1)
|
||||
}, 180_000)
|
||||
|
||||
// Force slow-arm diagnostic sampling branch; formerly unexecuted branch had out-of-scope name and no test/lint coverage.
|
||||
|
||||
// Force bounded navigation timeout after missed click; require useful diagnostic instead of exhausting whole case budget.
|
||||
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises'
|
||||
import { join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
|
||||
import * as esbuild from 'esbuild'
|
||||
import { chromium } from 'playwright-core'
|
||||
import {
|
||||
MOBILE_WEB_APP_ROOT_RESET,
|
||||
mobileWebAppBuildOptions
|
||||
} from '../../build/mobile-web-app/build-mobile-web-app-bundle.mjs'
|
||||
import { mobileWebAppDependenciesPresent } from '../mobile-web-app-bundle-dependencies.mjs'
|
||||
import { createBundleServer, readShellCsp } from '../preview/mobile-web-app-render-harness.mjs'
|
||||
|
||||
// The phone's web pages must pan the transcript by touch and give a pinch to its text-size detector, not page zoom.
|
||||
const mobileDir = fileURLToPath(new URL('../../../../mobile', import.meta.url))
|
||||
|
||||
const entry = `
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import { Text, View } from 'react-native'
|
||||
import { GestureHandlerRootView } from 'react-native-gesture-handler'
|
||||
import { MobileNativeChatPageScroll } from './src/session/native-chat/transcript/MobileNativeChatPageScroll'
|
||||
import {
|
||||
MobileNativeChatPinchZoom,
|
||||
useMobileNativeChatPinchGesture
|
||||
} from './src/session/native-chat/transcript/mobile-native-chat-pinch-zoom'
|
||||
|
||||
function Transcript() {
|
||||
const { fontScale, pinchGesture } = useMobileNativeChatPinchGesture('chat')
|
||||
return <View style={{ height: 600, width: '100%' }}>
|
||||
<Text testID="font-scale">{fontScale}</Text>
|
||||
<GestureHandlerRootView style={{ flex: 1 }}>
|
||||
<MobileNativeChatPinchZoom gesture={pinchGesture}>
|
||||
<MobileNativeChatPageScroll testID="transcript">
|
||||
{Array.from({ length: 60 }, (_, i) => <Text key={i}>message {i}</Text>)}
|
||||
</MobileNativeChatPageScroll>
|
||||
</MobileNativeChatPinchZoom>
|
||||
</GestureHandlerRootView>
|
||||
</View>
|
||||
}
|
||||
createRoot(document.getElementById('root')).render(<Transcript />)
|
||||
`
|
||||
|
||||
const bundles = mobileWebAppDependenciesPresent()
|
||||
const describeRender = bundles ? describe : describe.skip
|
||||
let scratch
|
||||
let server
|
||||
let origin
|
||||
let browser
|
||||
|
||||
beforeAll(async () => {
|
||||
if (!bundles) {
|
||||
return
|
||||
}
|
||||
await mkdir(join(mobileDir, '.tmp'), { recursive: true })
|
||||
scratch = await mkdtemp(join(mobileDir, '.tmp', 'chat-touch-scroll-'))
|
||||
const outDir = join(scratch, 'bundle')
|
||||
await esbuild.build({
|
||||
...mobileWebAppBuildOptions([]),
|
||||
entryPoints: undefined,
|
||||
stdin: { contents: entry, resolveDir: mobileDir, loader: 'tsx', sourcefile: 'transcript.tsx' },
|
||||
splitting: false,
|
||||
write: true,
|
||||
outdir: outDir,
|
||||
entryNames: 'transcript',
|
||||
metafile: false
|
||||
})
|
||||
await writeFile(
|
||||
join(outDir, 'index.html'),
|
||||
'<!doctype html><html><head><meta charset="utf-8">' +
|
||||
'<meta name="viewport" content="width=device-width, initial-scale=1">' +
|
||||
`${MOBILE_WEB_APP_ROOT_RESET}</head>` +
|
||||
'<body><div id="root"></div><script type="module" src="/transcript.js"></script></body></html>'
|
||||
)
|
||||
const served = await createBundleServer({ outDir, cspHeader: await readShellCsp() })
|
||||
server = served.server
|
||||
origin = served.origin
|
||||
const executablePath = process.env.ORCA_MOBILE_WEB_RENDER_BROWSER
|
||||
browser = await chromium.launch({ headless: true, ...(executablePath ? { executablePath } : {}) })
|
||||
}, 180_000)
|
||||
|
||||
afterAll(async () => {
|
||||
await browser?.close()
|
||||
server?.close()
|
||||
if (scratch) {
|
||||
await rm(scratch, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
|
||||
async function touch(page, steps) {
|
||||
const cdp = await page.context().newCDPSession(page)
|
||||
const [first, ...rest] = steps
|
||||
await cdp.send('Input.dispatchTouchEvent', { type: 'touchStart', touchPoints: first })
|
||||
for (const touchPoints of rest) {
|
||||
await cdp.send('Input.dispatchTouchEvent', { type: 'touchMove', touchPoints })
|
||||
await page.evaluate(() => new Promise(requestAnimationFrame))
|
||||
}
|
||||
await cdp.send('Input.dispatchTouchEvent', { type: 'touchEnd', touchPoints: [] })
|
||||
await cdp.detach()
|
||||
}
|
||||
|
||||
const frames = (count, at) => Array.from({ length: count + 1 }, (_, step) => at(step / count))
|
||||
|
||||
async function openTranscript() {
|
||||
const context = await browser.newContext({
|
||||
viewport: { width: 390, height: 844 },
|
||||
hasTouch: true,
|
||||
isMobile: true
|
||||
})
|
||||
const page = await context.newPage()
|
||||
await page.goto(`${origin}/`)
|
||||
await page.getByTestId('transcript').waitFor()
|
||||
return page
|
||||
}
|
||||
|
||||
describeRender('native chat transcript in the phone web pages', () => {
|
||||
it('pans the transcript under one finger', async () => {
|
||||
const page = await openTranscript()
|
||||
await touch(
|
||||
page,
|
||||
frames(10, (t) => [{ x: 195, y: 200 + 300 * t }])
|
||||
)
|
||||
await expect
|
||||
.poll(() => page.getByTestId('transcript').evaluate((element) => element.scrollTop))
|
||||
.toBeLessThan(-100)
|
||||
await page.context().close()
|
||||
})
|
||||
|
||||
it('gives a pinch to the text size, not to page zoom', async () => {
|
||||
const page = await openTranscript()
|
||||
await touch(
|
||||
page,
|
||||
frames(10, (t) => [
|
||||
{ x: 195, y: 330 - 120 * t, id: 0 },
|
||||
{ x: 195, y: 370 + 120 * t, id: 1 }
|
||||
])
|
||||
)
|
||||
await expect.poll(() => page.getByTestId('font-scale').textContent()).not.toBe('1')
|
||||
expect(await page.evaluate(() => window.visualViewport.scale)).toBe(1)
|
||||
await page.context().close()
|
||||
})
|
||||
})
|
||||
@@ -16,31 +16,12 @@ import { mobileWebAppDependenciesPresent } from '../mobile-web-app-bundle-depend
|
||||
import {
|
||||
createBundleServer,
|
||||
installCspViolationRecorder,
|
||||
installListenerRecorder,
|
||||
readShellCsp
|
||||
} from '../preview/mobile-web-app-render-harness.mjs'
|
||||
|
||||
const mobileDir = fileURLToPath(new URL('../../../../mobile', import.meta.url))
|
||||
const componentDir = join(mobileDir, 'src/components')
|
||||
|
||||
const COMMANDS = [
|
||||
{ label: 'H1', command: 'heading1', select: 'all', expect: 'h1' },
|
||||
{ label: 'H2', command: 'heading2', select: 'all', expect: 'h2' },
|
||||
{ label: 'H3', command: 'heading3', select: 'all', expect: 'h3' },
|
||||
{ label: 'Bold', command: 'bold', select: 'word', expect: 'b,strong' },
|
||||
{ label: 'Italic', command: 'italic', select: 'word', expect: 'i,em' },
|
||||
{ label: 'Strike', command: 'strike', select: 'word', expect: 'strike,s,del' },
|
||||
{ label: 'Bullet list', command: 'bulletList', select: 'all', expect: 'ul' },
|
||||
{ label: 'Numbered list', command: 'orderedList', select: 'all', expect: 'ol' },
|
||||
{ label: 'Checklist', command: 'taskList', select: 'all', expect: 'ul[data-type="taskList"]' },
|
||||
{ label: 'Quote', command: 'quote', select: 'all', expect: 'blockquote' },
|
||||
{ label: 'Inline code', command: 'inlineCode', select: 'word', expect: 'code' },
|
||||
{ label: 'Code block', command: 'codeBlock', select: 'all', expect: 'pre' }
|
||||
]
|
||||
|
||||
// Paragraph undoes another command; starting from p would prove nothing.
|
||||
const PARAGRAPH = { label: 'Body', command: 'paragraph' }
|
||||
|
||||
// Serve inserted image locally: nonexistent URL logs WebKit load failure; successful paint proves shipped CSP admits it.
|
||||
const IMAGE_PATH = '/inserted.png'
|
||||
const URL_COMMANDS = [
|
||||
@@ -151,21 +132,6 @@ function Harness() {
|
||||
createRoot(document.getElementById('root')).render(createElement(Harness))
|
||||
`
|
||||
|
||||
// Install ReactNativeWebView recorder before bundle: absence alone cannot prove editor JSON avoids shell bridge if bridge object never existed.
|
||||
function installBridgeObjectRecorder() {
|
||||
globalThis.__orcaBridgeReads = []
|
||||
const bridge = {
|
||||
postMessage: (message) => globalThis.__orcaBridgeReads.push(`post ${String(message)}`)
|
||||
}
|
||||
Object.defineProperty(globalThis, 'ReactNativeWebView', {
|
||||
configurable: true,
|
||||
get: () => {
|
||||
globalThis.__orcaBridgeReads.push('read')
|
||||
return bridge
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const bundles = mobileWebAppDependenciesPresent()
|
||||
const describeEditor = bundles ? describe : describe.skip
|
||||
|
||||
@@ -256,9 +222,7 @@ async function openPage(browser) {
|
||||
}
|
||||
})
|
||||
page.on('pageerror', (error) => consoleErrors.push(`pageerror: ${error.message}`))
|
||||
await page.addInitScript(installBridgeObjectRecorder)
|
||||
await page.addInitScript(installCspViolationRecorder)
|
||||
await page.addInitScript(installListenerRecorder, { selector: '#editor' })
|
||||
await page.goto(`${origin}/`, { waitUntil: 'domcontentloaded' })
|
||||
await page.waitForFunction(() => document.body.dataset.ready === 'yes')
|
||||
await page.waitForSelector('#first-surface #editor')
|
||||
@@ -326,89 +290,7 @@ describeEditor(
|
||||
|
||||
afterAll(() => browser?.close())
|
||||
|
||||
it('mounts the document, reports ready through the seam and never touches the bridge', async () => {
|
||||
const { page, consoleErrors } = await openPage(browser)
|
||||
try {
|
||||
await setContent(page, '# Title', '<h1>Title</h1>')
|
||||
expect(await readSurface(page)).toBe('<h1>Title</h1>')
|
||||
// Initial markup proves document ready reached controller and pushed content through seam.
|
||||
expect(await page.evaluate(() => globalThis.__orcaBridgeReads)).toEqual([])
|
||||
expect(await page.evaluate(() => globalThis.__orcaCspViolations)).toEqual([])
|
||||
expect(consoleErrors).toEqual([])
|
||||
// No editor occlusion report: screen’s web module already measures viewport, so reporting twice would lift bar twice.
|
||||
expect(await page.evaluate(() => globalThis.__orcaEditor.insets)).toEqual([])
|
||||
} finally {
|
||||
await page.close()
|
||||
}
|
||||
}, 600_000)
|
||||
|
||||
it('runs every one of the fifteen commands against the document', async () => {
|
||||
const { page, consoleErrors } = await openPage(browser)
|
||||
try {
|
||||
for (const [index, entry] of COMMANDS.entries()) {
|
||||
const body = bodyFor(index)
|
||||
await setContent(page, body, `<p>${body}</p>`)
|
||||
// Require command effect absent beforehand or undelivered command could pass on previous document.
|
||||
expect(
|
||||
await page.evaluate(
|
||||
(selector) =>
|
||||
document.querySelector('#first-surface #editor')?.querySelector(selector),
|
||||
entry.expect
|
||||
),
|
||||
`${entry.label} was already applied before it ran`
|
||||
).toBeNull()
|
||||
await select(page, entry.select)
|
||||
await press(page, entry.label)
|
||||
await page.waitForFunction(
|
||||
(selector) =>
|
||||
document.querySelector('#first-surface #editor')?.querySelector(selector) !==
|
||||
null,
|
||||
entry.expect,
|
||||
{ timeout: 15_000 }
|
||||
)
|
||||
}
|
||||
|
||||
// Paragraph must undo another block type; it is a no-op on p.
|
||||
await setContent(page, '# Title', '<h1>Title</h1>')
|
||||
await select(page, 'all')
|
||||
await press(page, PARAGRAPH.label)
|
||||
await page.waitForFunction(
|
||||
() =>
|
||||
document.querySelector('#first-surface #editor')?.querySelector('h1') === null &&
|
||||
document.querySelector('#first-surface #editor')?.querySelector('p') !== null,
|
||||
null,
|
||||
{ timeout: 15_000 }
|
||||
)
|
||||
|
||||
expect(await page.evaluate(() => globalThis.__orcaCspViolations)).toEqual([])
|
||||
expect(consoleErrors).toEqual([])
|
||||
} finally {
|
||||
await page.close()
|
||||
}
|
||||
}, 600_000)
|
||||
|
||||
// Both engines nest unordered list inside existing p; inline paragraph serialization once dropped bullet when saved.
|
||||
it('edits and selects under the shipped document style, which makes other text unselectable', async () => {
|
||||
const { page, consoleErrors } = await openPage(browser)
|
||||
try {
|
||||
await setContent(page, 'alpha', '<p>alpha</p>')
|
||||
const word = page.locator('#first-surface #editor p')
|
||||
await word.click()
|
||||
await page.keyboard.press('End')
|
||||
await page.keyboard.type(' bravo')
|
||||
await page.waitForFunction(
|
||||
() =>
|
||||
document.querySelector('#first-surface #editor p')?.textContent === 'alpha bravo'
|
||||
)
|
||||
// Use browser gesture: a scripted Range bypasses body user-select:none.
|
||||
await page.evaluate(() => window.getSelection()?.removeAllRanges())
|
||||
await word.dblclick()
|
||||
expect(await page.evaluate(() => window.getSelection()?.toString().trim())).not.toBe('')
|
||||
expect(consoleErrors).toEqual([])
|
||||
} finally {
|
||||
await page.close()
|
||||
}
|
||||
}, 600_000)
|
||||
|
||||
it('reports a typed bullet list as a list, and renders that markdown back as one', async () => {
|
||||
const { page, consoleErrors } = await openPage(browser)
|
||||
|
||||
@@ -74,23 +74,6 @@ it('tracks workspace source and manifest closures without trusting dist or widen
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it('checks ordinary source unit files against actual imports before skipping the matrix', async () => {
|
||||
const reachable = 'src/main/persistence/example/used.test.ts'
|
||||
const unrelated = 'src/main/persistence/example/unrelated.test.tsx'
|
||||
const removed = 'src/main/persistence/example/removed.test.ts'
|
||||
const root = moduleTree({
|
||||
'entry.ts': `import './${reachable}'; throw Error('never execute')`,
|
||||
[reachable]: 'export const value = 1',
|
||||
[unrelated]: 'throw Error("never execute unrelated test")'
|
||||
})
|
||||
const inputs = await collectNodeServerInputs({ root, entryPoints: ['entry.ts'] })
|
||||
expect(inputs.has(reachable)).toBe(true)
|
||||
expect(inputs.has(unrelated)).toBe(false)
|
||||
expect((await classifyNodeServerChanges([reachable], async () => inputs)).shouldRun).toBe(true)
|
||||
expect((await classifyNodeServerChanges([unrelated], async () => inputs)).shouldRun).toBe(false)
|
||||
expect((await classifyNodeServerChanges([removed], async () => inputs)).shouldRun).toBe(false)
|
||||
})
|
||||
|
||||
it('retains qualification when a removed ordinary unit file breaks an actual import', async () => {
|
||||
const removed = 'src/main/persistence/example/removed.test.ts'
|
||||
const root = moduleTree({ 'entry.ts': `import './${removed}'` })
|
||||
|
||||
@@ -5,7 +5,7 @@ import { buildCounterbalancedSchedule } from '../measurement/counterbalanced-ben
|
||||
|
||||
const bundled = await build({
|
||||
stdin: {
|
||||
contents: "export * from './src/main/ai-vault/session-root-dedup.ts'",
|
||||
contents: "export * from './src/main/ai-vault/parsing/session-root-dedup.ts'",
|
||||
resolveDir: process.cwd(),
|
||||
loader: 'ts'
|
||||
},
|
||||
|
||||
@@ -32,10 +32,10 @@ async function load(contents) {
|
||||
return import(`data:text/javascript;base64,${encoded}`)
|
||||
}
|
||||
const [baselineModule, currentModule] = await Promise.all([
|
||||
load(`import { sessionSortTime } from './session-scanner-accumulator';
|
||||
load(`import { sessionSortTime } from './parsing/session-scanner-accumulator';
|
||||
export ${baselineFunction.getText(baselineSource)}`),
|
||||
load(`export { canStopParsingSessions } from './session-scan-cutoff';
|
||||
export { ScannedSessionCollection } from './session-root-dedup';`)
|
||||
load(`export { canStopParsingSessions } from './parsing/session-scan-cutoff';
|
||||
export { ScannedSessionCollection } from './parsing/session-root-dedup';`)
|
||||
])
|
||||
const baseline = baselineModule.canStopParsingSessions
|
||||
const current = currentModule.canStopParsingSessions
|
||||
|
||||
@@ -1,28 +1,81 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { dirname, resolve } from 'node:path'
|
||||
import { mkdtemp, rm, writeFile } from 'node:fs/promises'
|
||||
import { createRequire } from 'node:module'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { dirname, join, resolve } from 'node:path'
|
||||
import { performance } from 'node:perf_hooks'
|
||||
import { build } from 'esbuild'
|
||||
import { buildCounterbalancedSchedule } from '../measurement/counterbalanced-benchmark-schedule.mjs'
|
||||
import { summarizeBenchmarkSamples } from '../measurement/benchmark-sample-summary.mjs'
|
||||
import ts from 'typescript-api'
|
||||
|
||||
const baselineSourcePathArgument = process.argv.find((arg) =>
|
||||
arg.startsWith('--baseline-source-path=')
|
||||
)
|
||||
const baselineSourcePath = resolve(
|
||||
baselineSourcePathArgument?.slice('--baseline-source-path='.length) ??
|
||||
'src/main/ai-vault/session-scanner-accumulator.ts'
|
||||
)
|
||||
|
||||
function retargetLegacyAccumulatorValueImports(source) {
|
||||
const program = ts.createSourceFile(baselineSourcePath, source, ts.ScriptTarget.Latest, true)
|
||||
assert.equal(program.parseDiagnostics.length, 0, 'Baseline source must parse')
|
||||
const replacements = []
|
||||
for (const statement of program.statements) {
|
||||
if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) {
|
||||
continue
|
||||
}
|
||||
if (
|
||||
resolve(dirname(baselineSourcePath), statement.moduleSpecifier.text) !==
|
||||
resolve('src/main/ai-vault/session-scanner-values')
|
||||
) {
|
||||
continue
|
||||
}
|
||||
const clause = statement.importClause
|
||||
assert(
|
||||
clause && !clause.name && clause.namedBindings && ts.isNamedImports(clause.namedBindings)
|
||||
)
|
||||
const imports = clause.namedBindings.elements.map((binding) => {
|
||||
const name = (binding.propertyName ?? binding.name).text
|
||||
const owner =
|
||||
name === 'extractString'
|
||||
? 'src/shared/trimmed-string.ts'
|
||||
: name === 'timestampMs'
|
||||
? 'src/main/ai-vault/parsing/session-record-time.ts'
|
||||
: null
|
||||
assert(owner, `Unsupported historical accumulator value import: ${name}`)
|
||||
return `import ${clause.isTypeOnly ? 'type ' : ''}{ ${binding.getText(program)} } from ${JSON.stringify(resolve(owner))}`
|
||||
})
|
||||
replacements.push({
|
||||
start: statement.getStart(program),
|
||||
end: statement.end,
|
||||
text: imports.join('\n')
|
||||
})
|
||||
}
|
||||
for (const replacement of replacements.toReversed()) {
|
||||
source = source.slice(0, replacement.start) + replacement.text + source.slice(replacement.end)
|
||||
}
|
||||
return source
|
||||
}
|
||||
|
||||
// git show <ref>:src/main/ai-vault/session-scanner-accumulator.ts | node config/scripts/session-timeline-benchmark.mjs
|
||||
const target = resolve('src/main/ai-vault/session-scanner-accumulator.ts')
|
||||
async function load(source) {
|
||||
const target = resolve('src/main/ai-vault/parsing/session-scanner-accumulator.ts')
|
||||
async function load(source, sourcePath = target) {
|
||||
const result = await build({
|
||||
stdin: {
|
||||
contents: `
|
||||
export {createAccumulator, cloneSessionAccumulator, updateTimeline, finalizeSession}
|
||||
from './session-scanner-accumulator';
|
||||
export {createClaudeSessionParseState, consumeClaudeSessionLine}
|
||||
from './session-scanner-primary-parsers';`,
|
||||
from '../scanners/claude/session-scanner-primary-parsers';`,
|
||||
loader: 'ts',
|
||||
resolveDir: dirname(target)
|
||||
},
|
||||
bundle: true,
|
||||
write: false,
|
||||
platform: 'node',
|
||||
format: 'esm',
|
||||
format: 'cjs',
|
||||
plugins: [
|
||||
{
|
||||
name: 'timeline-baseline',
|
||||
@@ -30,18 +83,26 @@ async function load(source) {
|
||||
plugin.onLoad({ filter: /session-scanner-accumulator\.ts$/ }, () => ({
|
||||
contents: source,
|
||||
loader: 'ts',
|
||||
resolveDir: dirname(target)
|
||||
resolveDir: dirname(sourcePath)
|
||||
}))
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
return import(
|
||||
`data:text/javascript;base64,${Buffer.from(result.outputFiles[0].text).toString('base64')}`
|
||||
)
|
||||
const directory = await mkdtemp(join(tmpdir(), 'orca-session-timeline-'))
|
||||
try {
|
||||
const file = join(directory, 'timeline.cjs')
|
||||
await writeFile(file, result.outputFiles[0].text)
|
||||
return createRequire(import.meta.url)(file)
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true })
|
||||
}
|
||||
}
|
||||
const implementations = {
|
||||
before: await load(readFileSync(0, 'utf8')),
|
||||
before: await load(
|
||||
retargetLegacyAccumulatorValueImports(readFileSync(0, 'utf8')),
|
||||
baselineSourcePath
|
||||
),
|
||||
after: await load(readFileSync(target, 'utf8'))
|
||||
}
|
||||
const file = { path: 'timeline.jsonl', mtimeMs: 0, modifiedAt: '2026-01-01T00:00:00.000Z' }
|
||||
|
||||
+8
-2
@@ -50,7 +50,10 @@ if (ROUNDS % 2 !== 0) {
|
||||
}
|
||||
|
||||
const CHUNK_SOURCE = readFileSync(
|
||||
new URL('../../../../src/main/runtime/rpc/terminal-output-frame-chunks.ts', import.meta.url),
|
||||
new URL(
|
||||
'../../../../src/main/runtime/rpc/terminal/terminal-output-frame-chunks.ts',
|
||||
import.meta.url
|
||||
),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
@@ -101,7 +104,10 @@ const { TerminalStreamOpcode, encodeTerminalStreamJson, encodeTerminalStreamText
|
||||
.href
|
||||
)
|
||||
const { exceedsTerminalStreamChunkBytes, iterateTerminalOutputFrameChunks } = await import(
|
||||
new URL('../../../../src/main/runtime/rpc/terminal-output-frame-chunks.ts', import.meta.url).href
|
||||
new URL(
|
||||
'../../../../src/main/runtime/rpc/terminal/terminal-output-frame-chunks.ts',
|
||||
import.meta.url
|
||||
).href
|
||||
)
|
||||
|
||||
function previousGate(data) {
|
||||
|
||||
+4
-1
@@ -68,7 +68,10 @@ const {
|
||||
measureTerminalStreamByteLength,
|
||||
terminalStreamByteLengthExceeds
|
||||
} = await import(
|
||||
new URL('../../../../src/main/runtime/rpc/terminal-stream-byte-length.ts', import.meta.url).href
|
||||
new URL(
|
||||
'../../../../src/main/runtime/rpc/terminal/terminal-stream-byte-length.ts',
|
||||
import.meta.url
|
||||
).href
|
||||
)
|
||||
|
||||
const REQUESTED_SNAPSHOT_BYTE_BUDGET = (() => {
|
||||
|
||||
@@ -1,258 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
// Compare real CLI emits before/after deferring RuntimeClient’s Zod/ws/tweetnacl/store graph until after flag validation.
|
||||
// Restore seven baseline files; use fresh processes to measure cold graphs, alternate arm order, and verify output/exit equality before timing.
|
||||
import { execFileSync, spawnSync } from 'node:child_process'
|
||||
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
import { performance } from 'node:perf_hooks'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const REPO = fileURLToPath(new URL('../../../..', import.meta.url))
|
||||
|
||||
const ROUNDS = Number(process.env.ORCA_CLI_DEFER_BENCH_ROUNDS ?? '30')
|
||||
const WARMUP = Number(process.env.ORCA_CLI_DEFER_BENCH_WARMUP ?? '3')
|
||||
|
||||
for (const [name, value] of [
|
||||
['ORCA_CLI_DEFER_BENCH_ROUNDS', ROUNDS],
|
||||
['ORCA_CLI_DEFER_BENCH_WARMUP', WARMUP]
|
||||
]) {
|
||||
if (!Number.isSafeInteger(value) || value <= 0) {
|
||||
throw new Error(`${name} must be a positive integer, received ${value}`)
|
||||
}
|
||||
}
|
||||
if (ROUNDS % 2 !== 0) {
|
||||
// Why: arms alternate which one leads; an odd count biases one arm.
|
||||
throw new Error(`ORCA_CLI_DEFER_BENCH_ROUNDS must be even, received ${ROUNDS}`)
|
||||
}
|
||||
|
||||
const TOUCHED = [
|
||||
'src/cli/args.ts',
|
||||
'src/cli/dispatch.ts',
|
||||
'src/cli/flags.ts',
|
||||
'src/cli/format.ts',
|
||||
'src/cli/index.ts',
|
||||
'src/cli/runtime/client.ts',
|
||||
'src/cli/selectors.ts'
|
||||
]
|
||||
|
||||
// Re-read production call forms so reverting deferral cannot make both arms identical; prose mentions must not satisfy the guard.
|
||||
function assertMarkersFresh() {
|
||||
const checks = [
|
||||
['src/cli/index.ts', "await import('./runtime-client.js')"],
|
||||
['src/cli/index.ts', 'await loadRuntimeClientClass()'],
|
||||
['src/cli/index.ts', "import type { RuntimeClient } from './runtime-client'"],
|
||||
['src/cli/runtime/client.ts', "await import('./websocket-transport.js')"],
|
||||
['src/cli/runtime/client.ts', 'await loadSendWebSocketRequest()'],
|
||||
['src/cli/args.ts', "import { RuntimeClientError } from './runtime/types'"],
|
||||
['src/cli/flags.ts', "import { RuntimeClientError } from './runtime/types'"],
|
||||
['src/cli/dispatch.ts', "import { RuntimeClientError } from './runtime/types'"],
|
||||
['src/cli/selectors.ts', "import { RuntimeClientError } from './runtime/types'"],
|
||||
['src/cli/format.ts', "} from './runtime/types'"]
|
||||
]
|
||||
for (const [file, marker] of checks) {
|
||||
if (!readFileSync(join(REPO, file), 'utf8').includes(marker)) {
|
||||
throw new Error(
|
||||
`${file} no longer contains \`${marker}\` — cli-runtime-client-deferral-benchmark.mjs is stale`
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function buildArm(label, baselineRev) {
|
||||
// Build inside repo so emitted modules resolve its node_modules.
|
||||
const outDir = join(REPO, `.bench-out-${label}`)
|
||||
rmSync(outDir, { recursive: true, force: true })
|
||||
const restore = []
|
||||
try {
|
||||
if (baselineRev) {
|
||||
for (const file of TOUCHED) {
|
||||
const path = join(REPO, file)
|
||||
restore.push([path, readFileSync(path)])
|
||||
writeFileSync(
|
||||
path,
|
||||
execFileSync('git', ['show', `${baselineRev}:${file}`], {
|
||||
cwd: REPO,
|
||||
maxBuffer: 64 * 1024 * 1024
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
execFileSync(
|
||||
'npx',
|
||||
[
|
||||
'tsc',
|
||||
'-p',
|
||||
'config/tsconfig.cli.json',
|
||||
'--outDir',
|
||||
outDir,
|
||||
'--composite',
|
||||
'false',
|
||||
'--incremental',
|
||||
'false'
|
||||
],
|
||||
{ cwd: REPO, stdio: 'inherit' }
|
||||
)
|
||||
} finally {
|
||||
for (const [path, contents] of restore) {
|
||||
writeFileSync(path, contents)
|
||||
}
|
||||
}
|
||||
return join(outDir, 'cli/index.js')
|
||||
}
|
||||
|
||||
function run(entry, argv, env) {
|
||||
const result = spawnSync(process.execPath, [entry, ...argv], {
|
||||
cwd: REPO,
|
||||
env: { ...process.env, ...env },
|
||||
encoding: 'buffer'
|
||||
})
|
||||
if (result.error) {
|
||||
throw result.error
|
||||
}
|
||||
return {
|
||||
status: result.status,
|
||||
stdout: result.stdout.toString('utf8'),
|
||||
stderr: result.stderr.toString('utf8')
|
||||
}
|
||||
}
|
||||
|
||||
// Count eager CJS graph in a child via Module._load, measuring the graph deferral actually moves.
|
||||
function countEagerModules(entry) {
|
||||
const probe = `
|
||||
const Module = require('module')
|
||||
const original = Module._load
|
||||
const seen = new Set()
|
||||
Module._load = function (request, parent, isMain) {
|
||||
try { seen.add(Module._resolveFilename(request, parent, isMain)) } catch { seen.add(request) }
|
||||
return original.apply(this, arguments)
|
||||
}
|
||||
require(${JSON.stringify(entry)})
|
||||
const all = [...seen]
|
||||
process.stdout.write(JSON.stringify({
|
||||
total: all.length,
|
||||
nodeModules: all.filter((p) => p.includes('node_modules')).length
|
||||
}))
|
||||
`
|
||||
const result = spawnSync(process.execPath, ['-e', probe], { cwd: REPO, encoding: 'utf8' })
|
||||
if (result.status !== 0) {
|
||||
throw new Error(`module probe failed: ${result.stderr}`)
|
||||
}
|
||||
return JSON.parse(result.stdout)
|
||||
}
|
||||
|
||||
const median = (values) => {
|
||||
const sorted = [...values].sort((a, b) => a - b)
|
||||
return sorted[Math.floor(sorted.length / 2)]
|
||||
}
|
||||
|
||||
const baselineIndex = process.argv.indexOf('--baseline')
|
||||
const baselineRev = baselineIndex === -1 ? 'HEAD' : process.argv[baselineIndex + 1]
|
||||
|
||||
assertMarkersFresh()
|
||||
|
||||
const userDataPath = mkdtempSync(join(REPO, '.bench-userdata-'))
|
||||
|
||||
try {
|
||||
console.log(`Building eager baseline (${baselineRev}) …`)
|
||||
const eagerEntry = buildArm('eager', baselineRev)
|
||||
console.log('Building deferred (working tree) …')
|
||||
const deferredEntry = buildArm('deferred', null)
|
||||
|
||||
const eagerGraph = countEagerModules(eagerEntry)
|
||||
const deferredGraph = countEagerModules(deferredEntry)
|
||||
console.log(
|
||||
`\nEager modules at process load: ${eagerGraph.total} -> ${deferredGraph.total} ` +
|
||||
`(node_modules ${eagerGraph.nodeModules} -> ${deferredGraph.nodeModules})`
|
||||
)
|
||||
if (deferredGraph.total >= eagerGraph.total) {
|
||||
throw new Error(
|
||||
'deferred arm loads no fewer modules — the fixture does not exercise the change'
|
||||
)
|
||||
}
|
||||
|
||||
// Use empty user-data dirs for deterministic runtime-dependent cases.
|
||||
const isolated = { ORCA_USER_DATA_PATH: userDataPath }
|
||||
/** @type {Array<[string, string[], Record<string, string>]>} */
|
||||
const cases = [
|
||||
['orca --help', ['--help'], {}],
|
||||
['orca help worktree', ['help', 'worktree'], {}],
|
||||
['orca (no args)', [], {}],
|
||||
['unknown command', ['no-such-command'], {}],
|
||||
['unknown flag', ['worktree', 'list', '--nope'], {}],
|
||||
['orca agent-context --json', ['agent-context', '--json'], {}],
|
||||
['orca status --json', ['status', '--json'], isolated],
|
||||
['orca worktree list --json', ['worktree', 'list', '--json'], isolated]
|
||||
]
|
||||
|
||||
// Compare output/exit before timing or a broken arm printing nothing appears fastest.
|
||||
for (const [label, argv, env] of cases) {
|
||||
const before = run(eagerEntry, argv, env)
|
||||
const after = run(deferredEntry, argv, env)
|
||||
if (
|
||||
before.status !== after.status ||
|
||||
before.stdout !== after.stdout ||
|
||||
before.stderr !== after.stderr
|
||||
) {
|
||||
throw new Error(`arms disagree for "${label}" — refusing to report a timing`)
|
||||
}
|
||||
if (before.stdout.length + before.stderr.length === 0) {
|
||||
throw new Error(`"${label}" produced no output on either arm; it proves nothing`)
|
||||
}
|
||||
}
|
||||
|
||||
const pad = (value, width) => String(value).padStart(width)
|
||||
console.log('\nFresh process per sample, wall clock. Lower is better.')
|
||||
console.log(`rounds=${ROUNDS} warmup=${WARMUP} (per-arm median, arms alternate lead)`)
|
||||
console.log(`${pad('case', 26)} ${pad('eager', 10)} ${pad('deferred', 10)} ${pad('speedup', 9)}`)
|
||||
|
||||
// Accumulated so V8 cannot treat the spawn loop as dead code.
|
||||
let consumed = 0
|
||||
|
||||
for (const [label, argv, env] of cases) {
|
||||
for (let index = 0; index < WARMUP; index += 1) {
|
||||
consumed += run(eagerEntry, argv, env).stdout.length
|
||||
consumed += run(deferredEntry, argv, env).stdout.length
|
||||
}
|
||||
const samples = { eager: [], deferred: [] }
|
||||
for (let round = 0; round < ROUNDS; round += 1) {
|
||||
// Alternate which arm leads so a drifting machine load cannot be
|
||||
// attributed to one arm.
|
||||
const order =
|
||||
round % 2 === 0
|
||||
? [
|
||||
['eager', eagerEntry],
|
||||
['deferred', deferredEntry]
|
||||
]
|
||||
: [
|
||||
['deferred', deferredEntry],
|
||||
['eager', eagerEntry]
|
||||
]
|
||||
for (const [arm, entry] of order) {
|
||||
const started = performance.now()
|
||||
const result = run(entry, argv, env)
|
||||
samples[arm].push(performance.now() - started)
|
||||
consumed += result.stdout.length
|
||||
}
|
||||
}
|
||||
const eagerMs = median(samples.eager)
|
||||
const deferredMs = median(samples.deferred)
|
||||
console.log(
|
||||
`${pad(label, 26)} ${pad(`${eagerMs.toFixed(1)} ms`, 10)} ${pad(`${deferredMs.toFixed(1)} ms`, 10)} ${pad(`${(eagerMs / deferredMs).toFixed(2)}x`, 9)}`
|
||||
)
|
||||
}
|
||||
|
||||
if (consumed === 0) {
|
||||
throw new Error('no output consumed — the timing loop was optimised away')
|
||||
}
|
||||
console.log(
|
||||
'\nThe help and error rows are the ones the change targets: they return\n' +
|
||||
'before any client construction, so they drop the whole graph. `status` and\n' +
|
||||
'`worktree list` still construct a client, so they only save the eager parse\n' +
|
||||
'of the parts the local path never uses (ws/tweetnacl via websocket-transport).'
|
||||
)
|
||||
} finally {
|
||||
rmSync(userDataPath, { recursive: true, force: true })
|
||||
for (const label of ['eager', 'deferred']) {
|
||||
rmSync(join(REPO, `.bench-out-${label}`), { recursive: true, force: true })
|
||||
}
|
||||
}
|
||||
@@ -1,446 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
// Compare stdout/stderr/exit byte-for-byte across two real CLI emits: current tree and selected files restored from baseline (default HEAD~).
|
||||
// Usage: node config/scripts/cli-runtime-client-deferral-equivalence.mjs [--baseline <rev>]
|
||||
import { execFileSync, spawnSync } from 'node:child_process'
|
||||
import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync, readFileSync } from 'node:fs'
|
||||
import { join, resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const REPO = fileURLToPath(new URL('../../../..', import.meta.url))
|
||||
|
||||
// Restore only these baseline files; remove baseline-absent files (e.g. cli-error.ts), then restore the working tree.
|
||||
const TOUCHED = [
|
||||
'src/cli/args.ts',
|
||||
'src/cli/cli-error.ts',
|
||||
'src/cli/dispatch.ts',
|
||||
'src/cli/flags.ts',
|
||||
'src/cli/format.ts',
|
||||
'src/cli/index.ts',
|
||||
'src/cli/runtime/client.ts',
|
||||
'src/cli/selectors.ts'
|
||||
]
|
||||
|
||||
// Fail if real deferral call shapes change or baseline/current could become identical and pass vacuously.
|
||||
function assertMarkersFresh() {
|
||||
const index = readFileSync(join(REPO, 'src/cli/index.ts'), 'utf8')
|
||||
const client = readFileSync(join(REPO, 'src/cli/runtime/client.ts'), 'utf8')
|
||||
const checks = [
|
||||
['src/cli/index.ts', index, 'await loadRuntimeClientClass()'],
|
||||
['src/cli/index.ts', index, "await import('./runtime-client.js')"],
|
||||
['src/cli/index.ts', index, "import type { RuntimeClient } from './runtime-client'"],
|
||||
['src/cli/runtime/client.ts', client, 'await loadSendWebSocketRequest()'],
|
||||
['src/cli/runtime/client.ts', client, "await import('./websocket-transport.js')"]
|
||||
]
|
||||
for (const [file, source, marker] of checks) {
|
||||
// Match calls so prose mentions cannot satisfy the guard.
|
||||
if (!source.includes(marker)) {
|
||||
throw new Error(
|
||||
`${file} no longer contains \`${marker}\` — cli-runtime-client-deferral-equivalence.mjs is stale`
|
||||
)
|
||||
}
|
||||
}
|
||||
const repointed = ['src/cli/args.ts', 'src/cli/flags.ts', 'src/cli/dispatch.ts']
|
||||
for (const file of repointed) {
|
||||
const source = readFileSync(join(REPO, file), 'utf8')
|
||||
if (!source.includes("import { RuntimeClientError } from './runtime/types'")) {
|
||||
throw new Error(`${file} no longer repoints RuntimeClientError at ./runtime/types — stale`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function buildTree(label, baselineRev) {
|
||||
// Build inside repo so emitted modules resolve its node_modules.
|
||||
const outDir = join(REPO, `.equiv-out-${label}`)
|
||||
rmSync(outDir, { recursive: true, force: true })
|
||||
const restored = []
|
||||
try {
|
||||
if (baselineRev) {
|
||||
for (const file of TOUCHED) {
|
||||
const path = join(REPO, file)
|
||||
restored.push([path, existsSync(path) ? readFileSync(path) : null])
|
||||
const old = spawnSync('git', ['show', `${baselineRev}:${file}`], {
|
||||
cwd: REPO,
|
||||
maxBuffer: 64 * 1024 * 1024
|
||||
})
|
||||
if (old.status === 0) {
|
||||
writeFileSync(path, old.stdout)
|
||||
} else {
|
||||
rmSync(path, { force: true })
|
||||
}
|
||||
}
|
||||
}
|
||||
execFileSync(
|
||||
'npx',
|
||||
[
|
||||
'tsc',
|
||||
'-p',
|
||||
'config/tsconfig.cli.json',
|
||||
'--outDir',
|
||||
outDir,
|
||||
'--composite',
|
||||
'false',
|
||||
'--incremental',
|
||||
'false'
|
||||
],
|
||||
{ cwd: REPO, stdio: 'inherit' }
|
||||
)
|
||||
} finally {
|
||||
for (const [path, contents] of restored) {
|
||||
if (contents === null) {
|
||||
rmSync(path, { force: true })
|
||||
} else {
|
||||
writeFileSync(path, contents)
|
||||
}
|
||||
}
|
||||
}
|
||||
return join(outDir, 'cli/index.js')
|
||||
}
|
||||
|
||||
// Every case must exit itself; bound spawnSync so reaching a blocking command fails instead of stalling forever.
|
||||
const RUN_TIMEOUT_MS = 30_000
|
||||
|
||||
function run(entry, argv, env) {
|
||||
const result = spawnSync(process.execPath, [entry, ...argv], {
|
||||
cwd: REPO,
|
||||
env: { ...process.env, ...env },
|
||||
encoding: 'buffer',
|
||||
timeout: RUN_TIMEOUT_MS,
|
||||
killSignal: 'SIGKILL'
|
||||
})
|
||||
if (result.error) {
|
||||
if (result.error.code === 'ETIMEDOUT') {
|
||||
throw new Error(
|
||||
`orca ${argv.join(' ')} did not exit within ${RUN_TIMEOUT_MS} ms — it reached a blocking command`
|
||||
)
|
||||
}
|
||||
throw result.error
|
||||
}
|
||||
return {
|
||||
status: result.status,
|
||||
stdout: result.stdout.toString('utf8'),
|
||||
stderr: result.stderr.toString('utf8')
|
||||
}
|
||||
}
|
||||
|
||||
// Require identical bytes; empty user-data dirs make runtime-dependent cases deterministically report not running.
|
||||
function buildCases(isolatedUserData) {
|
||||
const isolated = { ORCA_USER_DATA_PATH: isolatedUserData }
|
||||
const cases = [
|
||||
// Paths that must never load the runtime client at all.
|
||||
[[], {}],
|
||||
[['--help'], {}],
|
||||
[['help'], {}],
|
||||
[['help', 'worktree'], {}],
|
||||
[['help', 'browser'], {}],
|
||||
[['worktree', '--help'], {}],
|
||||
[['help', 'no-such-command'], {}],
|
||||
[['no-such-command'], {}],
|
||||
[['no-such-command'], { ORCA_PAIRING_CODE: 'garbage' }],
|
||||
[['wrktree', 'list'], {}],
|
||||
[['agent-context'], {}],
|
||||
[['agent-context', '--json'], {}],
|
||||
// Flag validation must still fire before any runtime lookup.
|
||||
[['worktree', 'list', '--nonexistent-flag'], {}],
|
||||
[['worktree', 'list', '--nonexistent-flag', '--json'], {}],
|
||||
[['browser', 'snapshot', '--nonexistent-flag'], {}],
|
||||
// resolveRemotePairing throws from the RuntimeClient CONSTRUCTOR.
|
||||
[['status', '--pairing-code', 'x', '--environment', 'y'], isolated],
|
||||
[['status', '--pairing-code', 'x', '--environment', 'y', '--json'], isolated],
|
||||
[['status', '--pairing-code', 'not-a-pairing-code'], isolated],
|
||||
[['status', '--pairing-code', 'not-a-pairing-code', '--json'], isolated],
|
||||
[['status', '--pairing-code', 'orca://pair?code=zzzz'], isolated],
|
||||
[['status', '--environment', 'no-such-environment'], isolated],
|
||||
[['status', '--environment', 'no-such-environment', '--json'], isolated],
|
||||
[['worktree', 'list', '--environment', 'no-such-environment', '--json'], isolated],
|
||||
// The env-var fallback must stay live for non-suppressed commands...
|
||||
[['status', '--json'], { ...isolated, ORCA_PAIRING_CODE: 'not-a-pairing-code' }],
|
||||
[['status', '--json'], { ...isolated, ORCA_REMOTE_PAIRING: 'not-a-pairing-code' }],
|
||||
[['status', '--json'], { ...isolated, ORCA_ENVIRONMENT: 'no-such-environment' }],
|
||||
// Keep suppression for local-only groups. Do not invoke agent hooks on/off: they modify real ~/.claude configuration outside ORCA_USER_DATA_PATH.
|
||||
[['environment', 'list', '--json'], { ...isolated, ORCA_ENVIRONMENT: 'no-such-environment' }],
|
||||
[['environment', 'list', '--json'], { ...isolated, ORCA_PAIRING_CODE: 'not-a-pairing-code' }],
|
||||
[['agent-context', '--json'], { ...isolated, ORCA_PAIRING_CODE: 'not-a-pairing-code' }],
|
||||
// Runtime-unavailable reporting (RuntimeClientError formatting).
|
||||
[['status'], isolated],
|
||||
[['status', '--json'], isolated],
|
||||
[['worktree', 'list', '--json'], isolated],
|
||||
[['terminal', 'list', '--json'], isolated]
|
||||
]
|
||||
// Seed fuzzing for reproducibility; all pool tokens must be safe to execute, checked against UNSAFE_TOKENS before running any case.
|
||||
const tokens = [
|
||||
'worktree',
|
||||
'list',
|
||||
'status',
|
||||
'browser',
|
||||
'snapshot',
|
||||
'terminal',
|
||||
'environment',
|
||||
'agent',
|
||||
'agent-context',
|
||||
'vm',
|
||||
'--json',
|
||||
'--help',
|
||||
'--pairing-code',
|
||||
'--environment',
|
||||
'--worktree',
|
||||
'orca://pair?code=!!!',
|
||||
'',
|
||||
'-',
|
||||
'--',
|
||||
'--=',
|
||||
'a'.repeat(300),
|
||||
'näme-ünicode',
|
||||
'💥',
|
||||
'../..',
|
||||
'x\ty'
|
||||
]
|
||||
let seed = 0x9e3779b9
|
||||
const next = () => {
|
||||
seed ^= seed << 13
|
||||
seed ^= seed >>> 17
|
||||
seed ^= seed << 5
|
||||
return (seed >>> 0) / 0x100000000
|
||||
}
|
||||
// Check entire pool, not just sampled cases: serve once survived review here and escaped the per-case scan by chance.
|
||||
assertTokensSafe(tokens, 'fuzz token pool')
|
||||
assertFuzzPoolDeclaredReadOnly(tokens)
|
||||
for (let index = 0; index < 400; index += 1) {
|
||||
const length = 1 + Math.floor(next() * 4)
|
||||
const argv = []
|
||||
for (let part = 0; part < length; part += 1) {
|
||||
argv.push(tokens[Math.floor(next() * tokens.length)])
|
||||
}
|
||||
cases.push([argv, isolated])
|
||||
}
|
||||
for (const [argv] of cases) {
|
||||
assertTokensSafe(argv, `argv ${JSON.stringify(argv)}`)
|
||||
}
|
||||
return cases
|
||||
}
|
||||
|
||||
// Cases run real CLI with developer HOME/PATH: deny foreground commands, surviving children, config/registry writes and real UI input.
|
||||
// Deny mixed read/write groups (capture/intercept/label/relation) wholesale; fuzzing cannot distinguish their subcommands.
|
||||
const FOREGROUND_TOKENS = ['serve', 'open', 'claude-teams', 'exec', 'eval', 'launch', 'attach']
|
||||
const MUTATING_TOKENS = [
|
||||
// persistent config and registry state
|
||||
'on',
|
||||
'off',
|
||||
'hooks',
|
||||
'create',
|
||||
'remove',
|
||||
'rm',
|
||||
'delete',
|
||||
'add',
|
||||
'edit',
|
||||
'set',
|
||||
'set-value',
|
||||
'set-base-ref',
|
||||
'setup-clone',
|
||||
'setup-create',
|
||||
'setup-update',
|
||||
'setup-delete',
|
||||
'setup-existing-folder',
|
||||
'install',
|
||||
'uninstall',
|
||||
'reinstall',
|
||||
'update',
|
||||
'clone',
|
||||
'apply',
|
||||
'write',
|
||||
'reset',
|
||||
'clear',
|
||||
'enable',
|
||||
'disable',
|
||||
'use-default',
|
||||
'permissions',
|
||||
// process and pane lifecycle
|
||||
'run',
|
||||
'run-stop',
|
||||
'start',
|
||||
'stop',
|
||||
'kill',
|
||||
'shutdown',
|
||||
'close',
|
||||
'split',
|
||||
'switch',
|
||||
'rename',
|
||||
'focus',
|
||||
// orchestration writes
|
||||
'send',
|
||||
'reply',
|
||||
'dispatch',
|
||||
'task-create',
|
||||
'task-update',
|
||||
'gate-create',
|
||||
'gate-resolve',
|
||||
// issue-tracker writes
|
||||
'save-issue',
|
||||
'comment',
|
||||
'label',
|
||||
'relation',
|
||||
'assignee',
|
||||
'priority',
|
||||
'estimate',
|
||||
'due-date',
|
||||
// browser / computer / emulator input and navigation
|
||||
'goto',
|
||||
'back',
|
||||
'forward',
|
||||
'reload',
|
||||
'click',
|
||||
'dblclick',
|
||||
'hover',
|
||||
'fill',
|
||||
'type',
|
||||
'type-text',
|
||||
'select',
|
||||
'select-all',
|
||||
'uncheck',
|
||||
'keypress',
|
||||
'press-key',
|
||||
'inserttext',
|
||||
'hotkey',
|
||||
'paste-text',
|
||||
'perform-secondary-action',
|
||||
'drag',
|
||||
'scroll',
|
||||
'scrollintoview',
|
||||
'wheel',
|
||||
'move',
|
||||
'up',
|
||||
'down',
|
||||
'tap',
|
||||
'gesture',
|
||||
'button',
|
||||
'rotate',
|
||||
'upload',
|
||||
'download',
|
||||
'dismiss',
|
||||
'accept',
|
||||
'highlight',
|
||||
'viewport',
|
||||
'geolocation',
|
||||
'headers',
|
||||
'credentials',
|
||||
'offline',
|
||||
'media',
|
||||
'device',
|
||||
'capture',
|
||||
'intercept'
|
||||
]
|
||||
|
||||
const UNSAFE_TOKENS = new Map([
|
||||
...FOREGROUND_TOKENS.map((token) => [token, 'runs in the foreground or spawns a process']),
|
||||
...MUTATING_TOKENS.map((token) => [token, 'can write outside ORCA_USER_DATA_PATH'])
|
||||
])
|
||||
|
||||
// Deny lists miss new verbs (serve once escaped); require explicit read-only allowlisting for every pool token too.
|
||||
const READ_ONLY_FUZZ_TOKENS = new Set([
|
||||
// command tokens: every path they can form is a list/show or a parse error
|
||||
'agent',
|
||||
'agent-context',
|
||||
'browser',
|
||||
'environment',
|
||||
'list',
|
||||
'snapshot',
|
||||
'status',
|
||||
'terminal',
|
||||
'vm',
|
||||
'worktree',
|
||||
// global flags and hostile strings, which reach no handler at all
|
||||
'--json',
|
||||
'--help',
|
||||
'--pairing-code',
|
||||
'--environment',
|
||||
'--worktree',
|
||||
'orca://pair?code=!!!',
|
||||
'',
|
||||
'-',
|
||||
'--',
|
||||
'--=',
|
||||
'a'.repeat(300),
|
||||
'näme-ünicode',
|
||||
'💥',
|
||||
'../..',
|
||||
'x\ty'
|
||||
])
|
||||
|
||||
function assertTokensSafe(tokens, context) {
|
||||
for (const token of tokens) {
|
||||
const reason = UNSAFE_TOKENS.get(token)
|
||||
if (reason) {
|
||||
throw new Error(`Refusing to run ${context}: "${token}" ${reason}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reject neither/both-list membership before any case runs; sampling cannot prove pool safety.
|
||||
function assertFuzzPoolDeclaredReadOnly(tokens) {
|
||||
for (const token of tokens) {
|
||||
if (!READ_ONLY_FUZZ_TOKENS.has(token)) {
|
||||
throw new Error(
|
||||
`Fuzz token ${JSON.stringify(token)} is not declared in READ_ONLY_FUZZ_TOKENS — declare it read-only or drop it`
|
||||
)
|
||||
}
|
||||
}
|
||||
for (const token of READ_ONLY_FUZZ_TOKENS) {
|
||||
if (UNSAFE_TOKENS.has(token)) {
|
||||
throw new Error(
|
||||
`Token ${JSON.stringify(token)} is declared both read-only and unsafe — the two lists disagree`
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const baselineIndex = process.argv.indexOf('--baseline')
|
||||
const baselineRev = baselineIndex === -1 ? 'HEAD' : process.argv[baselineIndex + 1]
|
||||
|
||||
assertMarkersFresh()
|
||||
|
||||
const isolatedUserData = mkdtempSync(join(REPO, '.equiv-userdata-'))
|
||||
mkdirSync(join(isolatedUserData, 'empty'), { recursive: true })
|
||||
|
||||
let oldEntry
|
||||
let newEntry
|
||||
try {
|
||||
// Build cases and check safety before expensive tsc compiles so unsafe tokens fail immediately.
|
||||
const cases = buildCases(isolatedUserData)
|
||||
|
||||
console.log(`Building baseline (${baselineRev}) …`)
|
||||
oldEntry = buildTree('old', baselineRev)
|
||||
console.log('Building working tree …')
|
||||
newEntry = buildTree('new', null)
|
||||
|
||||
console.log(`Comparing ${cases.length} invocations byte for byte …`)
|
||||
let mismatches = 0
|
||||
for (const [argv, env] of cases) {
|
||||
const before = run(oldEntry, argv, env)
|
||||
const after = run(newEntry, argv, env)
|
||||
if (
|
||||
before.status !== after.status ||
|
||||
before.stdout !== after.stdout ||
|
||||
before.stderr !== after.stderr
|
||||
) {
|
||||
mismatches += 1
|
||||
console.error(`\nMISMATCH argv=${JSON.stringify(argv)} env=${JSON.stringify(env)}`)
|
||||
console.error(` exit before=${before.status} after=${after.status}`)
|
||||
if (before.stdout !== after.stdout) {
|
||||
console.error(` stdout before=${JSON.stringify(before.stdout.slice(0, 400))}`)
|
||||
console.error(` after =${JSON.stringify(after.stdout.slice(0, 400))}`)
|
||||
}
|
||||
if (before.stderr !== after.stderr) {
|
||||
console.error(` stderr before=${JSON.stringify(before.stderr.slice(0, 400))}`)
|
||||
console.error(` after =${JSON.stringify(after.stderr.slice(0, 400))}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mismatches > 0) {
|
||||
throw new Error(`${mismatches} of ${cases.length} invocations differ`)
|
||||
}
|
||||
console.log(`\nAll ${cases.length} invocations byte-identical (stdout, stderr, exit code).`)
|
||||
} finally {
|
||||
rmSync(isolatedUserData, { recursive: true, force: true })
|
||||
for (const label of ['old', 'new']) {
|
||||
rmSync(resolve(REPO, `.equiv-out-${label}`), { recursive: true, force: true })
|
||||
}
|
||||
}
|
||||
@@ -17,11 +17,12 @@ const { validatePluginFile, pluginManifestWarnings } = loadPluginSchemaModule(
|
||||
const { parsePluginManifest } = loadPluginSchemaModule('manifest/plugin-manifest.ts')
|
||||
// Why the CLI's main entry: `orca plugin validate` and `release-entry` run these same checks, and
|
||||
// the printed contentHash must be what Orca computes at install.
|
||||
const {
|
||||
pluginCatalogReleaseForHead,
|
||||
validateDeclaredPluginArtifacts,
|
||||
validatePluginInstallContent
|
||||
} = loadPluginSchemaModule('../../main/plugins/plugin-authoring-checks.ts')
|
||||
const { pluginCatalogReleaseForHead } = loadPluginSchemaModule(
|
||||
'../../main/plugins/plugin-catalog-release-entry.ts'
|
||||
)
|
||||
const { validateDeclaredPluginArtifacts, validatePluginInstallContent } = loadPluginSchemaModule(
|
||||
'../../main/plugins/plugin-artifact-validation.ts'
|
||||
)
|
||||
// Why shared: `orca plugin validate` runs these same strict artifact checks.
|
||||
const { strictPluginArtifactErrors, strictPluginArtifactWarnings } = loadPluginSchemaModule(
|
||||
'authoring/plugin-strict-artifact-checks.ts'
|
||||
|
||||
@@ -4,7 +4,7 @@ import path from 'node:path'
|
||||
import process from 'node:process'
|
||||
import { runProcess } from '@orca/process-host'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { createPluginFromTemplate } from '../../../../src/cli/plugin-authoring/plugin-create'
|
||||
import { createPluginFromTemplate } from '../../../../src/cli/plugins/authoring/plugin-create'
|
||||
|
||||
const SCRIPT = path.join(import.meta.dirname, './validate-plugin-files.mjs')
|
||||
const roots = []
|
||||
|
||||
+1
-128
@@ -4,10 +4,8 @@ import { existsSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
|
||||
const STARTUP_TIMEOUT_MS = 20_000
|
||||
const APPIMAGE_EXTRACTION_TIMEOUT_MS = 60_000
|
||||
const commandArgs = process.argv.slice(2)
|
||||
const appImageArg = valueAfter('--appimage')
|
||||
const pairingOnly = commandArgs.includes('--pairing-only')
|
||||
if (!appImageArg) {
|
||||
fail('Usage: run-headless-linux-pairing-docker.mjs --appimage /path/to/orca.AppImage')
|
||||
}
|
||||
@@ -32,28 +30,17 @@ const images = [
|
||||
tag: 'orca-headless-pairing:debian-13',
|
||||
base: 'debian@sha256:020c0d20b9880058cbe785a9db107156c3c75c2ac944a6aa7ab59f2add76a7bd',
|
||||
libasound: 'libasound2t64'
|
||||
},
|
||||
{
|
||||
name: 'ubuntu-22.04-baseline',
|
||||
tag: 'orca-headless-pairing:ubuntu-22.04',
|
||||
base: 'ubuntu@sha256:0e0a0fc6d18feda9db1590da249ac93e8d5abfea8f4c3c0c849ce512b5ef8982',
|
||||
libasound: 'libasound2'
|
||||
}
|
||||
]
|
||||
|
||||
try {
|
||||
docker(['volume', 'create', artifactVolume])
|
||||
docker(['network', 'create', network])
|
||||
for (const image of pairingOnly ? images.slice(0, 2) : images) {
|
||||
for (const image of images) {
|
||||
buildImage(image)
|
||||
}
|
||||
extractAppImage(images[0].tag)
|
||||
if (!pairingOnly) {
|
||||
await validateStartupMatrix()
|
||||
await validateUnavailableContracts()
|
||||
}
|
||||
await validateAuthenticatedPairing()
|
||||
await validateUnreachableOffer()
|
||||
console.log('Headless Linux pairing Docker validation passed.')
|
||||
} finally {
|
||||
for (const container of containers) {
|
||||
@@ -111,71 +98,6 @@ function extractAppImage(image) {
|
||||
])
|
||||
}
|
||||
|
||||
async function validateStartupMatrix() {
|
||||
const required = images.slice(0, 2)
|
||||
for (const image of required) {
|
||||
for (const launch of ['direct', 'xvfb', 'dbus-xvfb', 'journal']) {
|
||||
for (const mode of ['human', 'json']) {
|
||||
const result = await startAndWait({ image, launch, mode, address: 'pair-host.test' })
|
||||
validateReady(result.stdout, mode, 'pair-host.test', {
|
||||
allowStdoutNoise: launch !== 'direct'
|
||||
})
|
||||
stopContainer(result.name)
|
||||
console.log(`PASS ${image.name} ${launch} ${mode}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
const baseline = await startAndWait({
|
||||
image: images[2],
|
||||
launch: 'xvfb',
|
||||
mode: 'json',
|
||||
address: '127.0.0.1'
|
||||
})
|
||||
validateReady(baseline.stdout, 'json', '127.0.0.1', { allowStdoutNoise: true })
|
||||
stopContainer(baseline.name)
|
||||
console.log(`PASS ${images[2].name} xvfb json`)
|
||||
|
||||
const publicEntry = await startAndWait({
|
||||
image: images[0],
|
||||
launch: 'direct',
|
||||
mode: 'json',
|
||||
address: '127.0.0.1',
|
||||
appPath: '/artifacts/orca.AppImage',
|
||||
startupTimeoutMs: APPIMAGE_EXTRACTION_TIMEOUT_MS
|
||||
})
|
||||
validateReady(publicEntry.stdout, 'json', '127.0.0.1', { allowStdoutNoise: true })
|
||||
stopContainer(publicEntry.name)
|
||||
console.log('PASS AppImage --appimage-extract-and-run --no-sandbox serve')
|
||||
}
|
||||
|
||||
async function validateUnavailableContracts() {
|
||||
const invalid = await startAndWait({
|
||||
image: images[0],
|
||||
launch: 'direct',
|
||||
mode: 'json',
|
||||
address: '0.0.0.0'
|
||||
})
|
||||
const invalidPayload = readyJson(invalid.stdout)
|
||||
assert(invalidPayload.pairing?.available === false, 'wildcard pairing must be unavailable')
|
||||
assert(
|
||||
invalidPayload.pairing.reason === 'invalid_advertised_endpoint',
|
||||
'wildcard pairing must expose invalid_advertised_endpoint'
|
||||
)
|
||||
stopContainer(invalid.name)
|
||||
|
||||
const disabled = await startAndWait({
|
||||
image: images[1],
|
||||
launch: 'journal',
|
||||
mode: 'json',
|
||||
address: '127.0.0.1',
|
||||
noPairing: true
|
||||
})
|
||||
const disabledPayload = readyJson(disabled.stdout)
|
||||
assert(disabledPayload.pairing?.reason === 'disabled_by_operator', 'disabled reason is missing')
|
||||
stopContainer(disabled.name)
|
||||
console.log('PASS explicit unavailable pairing contracts')
|
||||
}
|
||||
|
||||
async function validateAuthenticatedPairing() {
|
||||
const server = await startAndWait({
|
||||
image: images[0],
|
||||
@@ -220,22 +142,6 @@ async function validateAuthenticatedPairing() {
|
||||
console.log('PASS paired E2EE updater inventory and manual-service fallback')
|
||||
}
|
||||
|
||||
async function validateUnreachableOffer() {
|
||||
const server = await startAndWait({
|
||||
image: images[0],
|
||||
launch: 'direct',
|
||||
mode: 'json',
|
||||
address: 'orca-pairing-server:6769',
|
||||
port: '6768',
|
||||
networkAlias: 'orca-pairing-server'
|
||||
})
|
||||
const payload = readyJson(server.stdout)
|
||||
const client = runPairingClient(payload.pairing.url)
|
||||
assert(client.status !== 0, 'a deliberately mismatched advertised port unexpectedly connected')
|
||||
stopContainer(server.name)
|
||||
console.log('PASS unreachable advertised endpoint fails the real client probe')
|
||||
}
|
||||
|
||||
async function startAndWait({
|
||||
image,
|
||||
launch,
|
||||
@@ -318,39 +224,6 @@ function hasCompleteReadyContract(stdout) {
|
||||
return readyJsonObjects(stdout).length > 0
|
||||
}
|
||||
|
||||
function validateReady(logs, mode, expectedHost, options = {}) {
|
||||
if (mode === 'human') {
|
||||
assert(
|
||||
(logs.match(/^Orca server ready$/gm) ?? []).length === 1,
|
||||
'human ready marker is not exact-once'
|
||||
)
|
||||
assert(logs.includes('Bound endpoint: ws://0.0.0.0:'), 'human bound endpoint is missing')
|
||||
assert(
|
||||
logs.includes(`Advertised endpoint: ws://${expectedHost}:`),
|
||||
'human advertised endpoint is missing'
|
||||
)
|
||||
assert(logs.includes('Pairing URL: orca://pair?code='), 'human pairing URL is missing')
|
||||
return
|
||||
}
|
||||
if (!options.allowStdoutNoise) {
|
||||
const stdoutLines = logs.split(/\r?\n/).filter(Boolean)
|
||||
assert(
|
||||
stdoutLines.length === 1,
|
||||
`JSON stdout must contain exactly one line, found ${stdoutLines.length}:\n${logs}`
|
||||
)
|
||||
}
|
||||
const payload = readyJson(logs)
|
||||
assert(payload.schemaVersion === 1, 'ready JSON schemaVersion is missing')
|
||||
assert(payload.endpoint === payload.boundEndpoint, 'legacy JSON endpoint alias is inconsistent')
|
||||
assert(payload.boundEndpoint?.startsWith('ws://0.0.0.0:'), 'JSON bound endpoint is invalid')
|
||||
assert(payload.advertisedEndpoint?.includes(expectedHost), 'JSON advertised endpoint is invalid')
|
||||
assert(payload.pairing?.available === true, 'JSON pairing offer is unavailable')
|
||||
assert(
|
||||
new URL(payload.boundEndpoint).port === new URL(payload.advertisedEndpoint).port,
|
||||
'an advertised host without a port must use the actual bound port'
|
||||
)
|
||||
}
|
||||
|
||||
function readyJson(logs) {
|
||||
const matches = readyJsonObjects(logs)
|
||||
assert(matches.length === 1, `expected one ready JSON object, found ${matches.length}`)
|
||||
|
||||
-32
@@ -24,18 +24,6 @@ const CLEANUP_TIMEOUT_MS = 30_000
|
||||
|
||||
// Exact statuses reject silent no-op launches as well as crashes.
|
||||
const CASES = [
|
||||
{
|
||||
name: 'nofuse-userns-bundled-help',
|
||||
expectStatus: 0,
|
||||
expectOutput: 'Usage: orca <command>',
|
||||
why: 'The bundled launcher must run with no FUSE, no display, and userns restricted (#11609, #12530).'
|
||||
},
|
||||
{
|
||||
name: 'nofuse-userns-bundled-version',
|
||||
expectStatus: 0,
|
||||
expectOutput: /^\d+\.\d+\.\d+/m,
|
||||
why: 'A deployment must be able to read the installed version without a display (#13719).'
|
||||
},
|
||||
{
|
||||
name: 'nofuse-userns-bundled-status',
|
||||
// No runtime is running; the CLI must report that itself.
|
||||
@@ -43,32 +31,12 @@ const CASES = [
|
||||
expectOutput: 'appRunning',
|
||||
why: 'A command that needs the runtime must report its absence, not abort.'
|
||||
},
|
||||
{
|
||||
name: 'nofuse-userns-bundled-skills',
|
||||
expectStatus: 0,
|
||||
// Why: the rendered help header, not a bare 'skills' — the case name contains that word.
|
||||
expectOutput: 'Usage: orca skills',
|
||||
why: 'skills is a pure-text command that must never need Chromium (#14229).'
|
||||
},
|
||||
{
|
||||
name: 'nofuse-userns-bundled-worktree',
|
||||
expectStatus: 1,
|
||||
expectOutput: "Orca is not running. Run 'orca open' first.",
|
||||
why: 'A runtime-dependent command must report the missing runtime, not abort.'
|
||||
},
|
||||
{
|
||||
name: 'nofuse-nosandbox-direct-binary-skills',
|
||||
expectStatus: 0,
|
||||
expectOutput: 'Usage: orca skills',
|
||||
why: 'A direct binary launch that reaches JavaScript must run the command, not boot a GUI (#14229).'
|
||||
},
|
||||
{
|
||||
name: 'nofuse-nosandbox-direct-binary-gui',
|
||||
// A missing display is an expected diagnosis, not a crash.
|
||||
expectStatus: 1,
|
||||
expectOutput: 'needs a usable display server',
|
||||
why: 'A desktop launch with no display must diagnose it instead of dying in uv_close (#13719).'
|
||||
},
|
||||
{
|
||||
name: 'stale-display-nosandbox-direct-binary-gui',
|
||||
expectStatus: 1,
|
||||
|
||||
@@ -179,7 +179,7 @@ function serializeEmbeddedModule(guides) {
|
||||
})
|
||||
.join(',\n')
|
||||
|
||||
return `// Generated by config/scripts/generate-bundled-skill-guides.mjs. Do not edit.\n\nexport type BundledSkillGuideReference = {\n readonly name: string\n readonly markdown: string\n}\n\nexport type BundledSkillGuide = {\n readonly name: string\n readonly description: string\n readonly markdown: string\n readonly aliases: readonly string[]\n readonly references: readonly BundledSkillGuideReference[]\n}\n\n${markdownConstants}\n\n// oxfmt-ignore\nexport const BUNDLED_SKILL_GUIDES = [\n${guideEntries}\n] as const satisfies readonly BundledSkillGuide[]\n`
|
||||
return `// Generated by config/scripts/skills/bundle-generation/generate-bundled-skill-guides.mjs. Do not edit.\n\nexport type BundledSkillGuideReference = {\n readonly name: string\n readonly markdown: string\n}\n\nexport type BundledSkillGuide = {\n readonly name: string\n readonly description: string\n readonly markdown: string\n readonly aliases: readonly string[]\n readonly references: readonly BundledSkillGuideReference[]\n}\n\n${markdownConstants}\n\n// oxfmt-ignore\nexport const BUNDLED_SKILL_GUIDES = [\n${guideEntries}\n] as const satisfies readonly BundledSkillGuide[]\n`
|
||||
}
|
||||
|
||||
async function readGuideReferences(repoRoot, guideName) {
|
||||
@@ -317,7 +317,7 @@ async function buildArtifacts(repoRoot = REPO_ROOT) {
|
||||
|
||||
return [
|
||||
{
|
||||
path: path.join(repoRoot, 'src', 'cli', 'bundled-skill-guides.ts'),
|
||||
path: path.join(repoRoot, 'src', 'cli', 'skills', 'bundled-skill-guides.ts'),
|
||||
content: serializeEmbeddedModule(guides)
|
||||
},
|
||||
...projections
|
||||
|
||||
+4
-1
@@ -208,12 +208,15 @@ function hookLines({ hooks, hookContribution, typeText }) {
|
||||
|
||||
function renderHostApi(sources, { frame, worker }) {
|
||||
const { hostApi, hostDoc, capabilities } = sources
|
||||
const names = hostApi.PLUGIN_HOST_METHOD_NAMES
|
||||
const names = hostApi.PLUGIN_STABLE_HOST_METHOD_NAMES
|
||||
const methodsFor = (surface) => hostApi.pluginHostMethodsFor(surface).map(code).join(', ')
|
||||
const methods = names.map((name) => {
|
||||
const spec = hostApi.PLUGIN_HOST_API[name]
|
||||
const facts = [
|
||||
spec.capability ? `capability ${code(spec.capability)}` : 'no capability',
|
||||
...Object.entries(spec.paramCapabilities ?? {}).map(
|
||||
([param, kind]) => `${code(param)} also needs ${code(kind)}`
|
||||
),
|
||||
spec.surfaces.join(', '),
|
||||
`since ${hostVersion(sources, spec.since)}`,
|
||||
...(spec.deprecatedSince === undefined
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { createHash } from 'node:crypto'
|
||||
import { execFileSync } from 'node:child_process'
|
||||
import {
|
||||
chmod,
|
||||
copyFile,
|
||||
mkdir,
|
||||
mkdtemp,
|
||||
@@ -114,29 +113,6 @@ describe('skill bundle manifest generator', () => {
|
||||
expect(digests).toHaveLength(2)
|
||||
})
|
||||
|
||||
it.runIf(process.platform !== 'win32')(
|
||||
'rejects executable files in shipped skill packages',
|
||||
async () => {
|
||||
const packageRoot = await createPackage()
|
||||
await writeFile(path.join(packageRoot, 'SKILL.md'), 'skill\n')
|
||||
await writeFile(path.join(packageRoot, 'run.sh'), '#!/bin/sh\necho ok\n')
|
||||
await chmod(path.join(packageRoot, 'run.sh'), 0o755)
|
||||
|
||||
await expect(collectPackageFiles(packageRoot)).rejects.toThrow(
|
||||
'Executable file is not allowed in a shipped skill: run.sh'
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
it.runIf(process.platform === 'linux')('rejects case-colliding paths', async () => {
|
||||
const packageRoot = await createPackage()
|
||||
await writeFile(path.join(packageRoot, 'SKILL.md'), 'skill')
|
||||
await writeFile(path.join(packageRoot, 'Readme.md'), 'one')
|
||||
await writeFile(path.join(packageRoot, 'README.md'), 'two')
|
||||
|
||||
await expect(collectPackageFiles(packageRoot)).rejects.toThrow('Case-colliding skill paths')
|
||||
})
|
||||
|
||||
it('keeps guarding a directory or link that only wears an OS metadata name', async () => {
|
||||
const packageRoot = await createPackage()
|
||||
await writeFile(path.join(packageRoot, 'SKILL.md'), 'demo skill\n')
|
||||
|
||||
-7
@@ -126,13 +126,6 @@ describe('main sync-spawn ratchet', () => {
|
||||
expect(uses(source)).toEqual({ count: 0, symbols: [] })
|
||||
})
|
||||
|
||||
it.each(['import {', 'const broken = ;'])(
|
||||
'fails closed on source it cannot parse: %s',
|
||||
(source) => {
|
||||
expect(() => uses(source)).toThrow('Cannot parse src/main/consumer.ts')
|
||||
}
|
||||
)
|
||||
|
||||
it('fails a new file and a rising count, and passes at the baseline count', () => {
|
||||
const one = "import { spawnSync } from 'node:child_process'\nspawnSync('a')"
|
||||
const root = tree({
|
||||
|
||||
+1
-54
@@ -4,7 +4,7 @@ import { tmpdir } from 'node:os'
|
||||
import path from 'node:path'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { main as fsMain } from './check-main-sync-fs-ratchet.mjs'
|
||||
import { collectSyncLaunchUses } from '../../process-boundaries/check-main-sync-spawn-ratchet.mjs'
|
||||
import '../../process-boundaries/check-main-sync-spawn-ratchet.mjs'
|
||||
import { countBlockingApis, main } from './check-main-blocking-api-ratchet.mjs'
|
||||
|
||||
const file = 'src/main/consumer.ts'
|
||||
@@ -24,34 +24,6 @@ afterEach(() => {
|
||||
})
|
||||
|
||||
describe('main blocking API ratchets', () => {
|
||||
it('counts import aliases, namespace APIs, CommonJS and Atomics aliases by category', () => {
|
||||
expect(
|
||||
counts(`import { scryptSync as hash } from 'node:crypto'
|
||||
import * as z from 'node:zlib'
|
||||
const { pbkdf2Sync } = require('crypto')
|
||||
hash('pw'); pbkdf2Sync('pw'); z.gzipSync('bytes'); z.futureSync('bytes')
|
||||
const { wait: sleep } = Atomics; sleep(buffer, 0, 0)`)
|
||||
).toEqual({ compression: 2, crypto: 2, atomics: 1, sqlite: 0, ipc: 0 })
|
||||
})
|
||||
|
||||
it.each([
|
||||
["import { DatabaseSync as DB } from 'node:sqlite'", 'DB'],
|
||||
["import DB from 'better-sqlite3'", 'DB'],
|
||||
["import DB from '../sqlite/sync-database'", 'DB'],
|
||||
["const { DatabaseSync: DB } = require('node:sqlite')", 'DB'],
|
||||
["const { DatabaseSync: DB } = process.getBuiltinModule('node:sqlite')", 'DB'],
|
||||
["import * as sqlite from 'node:sqlite'", 'sqlite.DatabaseSync']
|
||||
])('guards SQLite constructors and statement work: %s', (load, ctor) => {
|
||||
expect(
|
||||
counts(`${load}
|
||||
const db = new ${ctor}('db')
|
||||
db.exec('schema')
|
||||
const statement = db.prepare('select')
|
||||
statement.run(); statement.get(); statement.all(); for (const row of statement.iterate()) {}
|
||||
db.prepare('select').get()`)
|
||||
).toEqual({ compression: 0, crypto: 0, atomics: 0, sqlite: 9, ipc: 0 })
|
||||
})
|
||||
|
||||
it('guards typed SQL receivers without charging Map.get or async backup', () => {
|
||||
expect(
|
||||
counts(`import type Database from '../sqlite/sync-database'
|
||||
@@ -77,31 +49,6 @@ describe('main blocking API ratchets', () => {
|
||||
).toBe(5)
|
||||
})
|
||||
|
||||
it('guards callable better-sqlite3 construction and modern builtin subprocess loads', () => {
|
||||
expect(
|
||||
counts(
|
||||
`import Database from 'better-sqlite3'; const db = Database('test'); db.exec('sql'); db.prepare('sql').get()`
|
||||
).sqlite
|
||||
).toBe(4)
|
||||
expect(
|
||||
collectSyncLaunchUses(file, `process.getBuiltinModule('node:child_process').execSync('test')`)
|
||||
.count
|
||||
).toBe(1)
|
||||
})
|
||||
|
||||
it('guards synchronous preload requests and main replies', () => {
|
||||
expect(
|
||||
counts(
|
||||
"import { ipcRenderer as ipc } from 'electron'; ipc.sendSync('get')",
|
||||
'src/preload/index.ts'
|
||||
).ipc
|
||||
).toBe(1)
|
||||
expect(counts("ipcMain.on('get', (event) => { event.returnValue = value })").ipc).toBe(1)
|
||||
expect(counts("ipc.sendSync('get'); event.returnValue = value", 'src/shared/ipc.ts').ipc).toBe(
|
||||
2
|
||||
)
|
||||
})
|
||||
|
||||
it('ignores strings, comments, unrelated SQL-shaped methods and nonblocking APIs', () => {
|
||||
expect(
|
||||
counts(`import * as c from 'node:crypto'; import * as z from 'node:zlib'
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
import {
|
||||
cpSync,
|
||||
mkdtempSync,
|
||||
mkdirSync,
|
||||
readFileSync,
|
||||
rmSync,
|
||||
symlinkSync,
|
||||
writeFileSync
|
||||
} from 'node:fs'
|
||||
import { createRequire } from 'node:module'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join, resolve } from 'node:path'
|
||||
import { expect, it } from 'vitest'
|
||||
|
||||
const require = createRequire(import.meta.resolve('@tailwindcss/vite'))
|
||||
const { compile } = require('@tailwindcss/node')
|
||||
const { Scanner } = require('@tailwindcss/oxide')
|
||||
|
||||
it('generates renderer CSS from production files while excluding test and spec files', async () => {
|
||||
const root = mkdtempSync(join(tmpdir(), 'orca-tailwind-sources-'))
|
||||
try {
|
||||
const renderer = join(root, 'src', 'renderer', 'src')
|
||||
const assets = join(renderer, 'assets')
|
||||
cpSync(resolve('src/renderer/src/assets'), assets, { recursive: true })
|
||||
cpSync(resolve('src/shared/styles'), join(root, 'src', 'shared', 'styles'), { recursive: true })
|
||||
symlinkSync(resolve('node_modules'), join(root, 'node_modules'), 'junction')
|
||||
const components = join(renderer, 'components')
|
||||
mkdirSync(components)
|
||||
writeFileSync(join(components, 'example.tsx'), 'export const style = "z-[31415]"')
|
||||
writeFileSync(join(components, 'example.test.tsx'), 'export const style = "z-[27182]"')
|
||||
writeFileSync(join(components, 'example.spec.ts'), 'export const style = "z-[16180]"')
|
||||
|
||||
const compiler = await compile(readFileSync(join(assets, 'main.css'), 'utf8'), {
|
||||
base: assets,
|
||||
onDependency() {}
|
||||
})
|
||||
const automaticSources =
|
||||
compiler.root === 'none' ? [] : [compiler.root ?? { base: root, pattern: '**/*' }]
|
||||
const scanner = new Scanner({
|
||||
sources: [
|
||||
...automaticSources.map((source) => ({ ...source, negated: false })),
|
||||
...compiler.sources
|
||||
]
|
||||
})
|
||||
const css = compiler.build(scanner.scan())
|
||||
expect(css).toContain('z-index: 31415')
|
||||
expect(css).not.toContain('z-index: 27182')
|
||||
expect(css).not.toContain('z-index: 16180')
|
||||
|
||||
writeFileSync(join(components, 'added.tsx'), 'export const style = "z-[14142]"')
|
||||
expect(compiler.build(scanner.scan())).toContain('z-index: 14142')
|
||||
} finally {
|
||||
rmSync(root, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
@@ -1,6 +1,6 @@
|
||||
// A startOrcad test that fails partway must not leave latches closed: later tests in the worker would wait 10 s.
|
||||
import { afterEach } from 'vitest'
|
||||
import { _resetOrcadFeatureReadinessForTests } from '../../../../src/main/runtime/rpc/orcad-feature-readiness'
|
||||
import { _resetOrcadFeatureReadinessForTests } from '../../../../src/main/runtime/rpc/startup/orcad-readiness'
|
||||
|
||||
afterEach(() => {
|
||||
_resetOrcadFeatureReadinessForTests()
|
||||
|
||||
@@ -12,14 +12,13 @@ const NODE_RUNTIME_INCLUDE = [
|
||||
'tests/e2e/cursor-quota-transport.unit.test.ts',
|
||||
'tests/e2e/helpers/electron-process-shutdown.unit.test.ts',
|
||||
'src/main/ai-vault-search/storage/session-search-index-writer.test.ts',
|
||||
'src/main/ai-vault/session-scanner-unlimited-dedup.test.ts',
|
||||
'src/main/ai-vault/parsing/session-scanner-unlimited-dedup.test.ts',
|
||||
// The parse cache persists through node:sqlite.
|
||||
'src/main/ai-vault/parse-cache/session-parse-cache-antigravity-upgrade.test.ts',
|
||||
'src/main/ai-vault/parse-cache/session-parse-cache-persistence.test.ts',
|
||||
'src/main/ai-vault/session-scanner-scope-cwd-facts.test.ts',
|
||||
'src/main/ai-vault/session-scanner-scope-walk.test.ts',
|
||||
'src/main/ai-vault/scope/session-scanner-scope-walk.test.ts',
|
||||
// The forced-probe handoff race opens only under V8's promise scheduling, which Electron main uses.
|
||||
'src/main/github/rate-limit.test.ts',
|
||||
'src/main/github/api/rate-limit.test.ts',
|
||||
// Electron main bridges streams with Node's implementation.
|
||||
'src/main/host/electron-http-client.test.ts',
|
||||
'src/main/browser/extensions/native-messaging/browser-extension-native-host-process-backpressure.test.ts',
|
||||
@@ -108,28 +107,26 @@ const NODE_RUNTIME_INCLUDE = [
|
||||
// Playwright's CDP transport needs Node's WebSocket implementation.
|
||||
'src/main/browser/guest-lifecycle/popups/presentation/popup-origin-chrome.electron.test.ts',
|
||||
'src/main/browser/guest-lifecycle/navigation/browser-link-materialization.electron.test.ts',
|
||||
'src/main/browser/guest-lifecycle/popups/compatibility/browser-popup-compatibility.electron.test.ts',
|
||||
'src/main/browser/guest-lifecycle/popups/compatibility/browser-popup-native-compatibility.electron.test.ts',
|
||||
'src/main/browser/guest-lifecycle/popups/compatibility/browser-popup-background-compatibility.electron.test.ts',
|
||||
'src/main/ai-vault/scanners/devin/session-scanner-devin-db.test.ts',
|
||||
'src/shared/workspace-session/workspace-session-salvage.test.ts',
|
||||
'src/main/git/repositories/discovery/repo-detection.test.ts',
|
||||
'src/renderer/src/components/browser-pane/annotate/browser-grab-toast-owner-cleanup.test.tsx',
|
||||
'src/main/window/native-chat-paste-files.test.ts',
|
||||
'src/main/native-chat/paste-files/native-chat-paste-files.test.ts',
|
||||
'src/main/computer/desktop-script/runtime-host/desktop-script-serve-channel.test.ts',
|
||||
'src/main/providers/local-pty/local-pty-child-process-verdict.test.ts',
|
||||
'src/main/providers/working-directory-validation.test.ts',
|
||||
'src/main/pty/process-retirement/posix-pty-process-groups.integration.test.ts',
|
||||
'src/shared/ephemeral-vm-recipe-output-capture.test.ts',
|
||||
'src/main/window/main-window-updater-deferred-setup.test.ts',
|
||||
'src/main/updater/lifecycle/main-window-updater-deferred-setup.test.ts',
|
||||
'src/renderer/src/components/terminal-pane/host-state/terminal-pane-host-state-memo.test.ts',
|
||||
'src/main/native-chat/agent-session-journal/**/*.test.ts',
|
||||
'src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-terminal-writer-acquire.test.ts',
|
||||
'src/main/runtime/agent-session/records/agent-session-conversation-name-store.test.ts',
|
||||
'src/main/runtime/rpc/ws-transport.test.ts',
|
||||
'src/main/runtime/rpc/methods/structured-sessions/attachments/structured-agent-session-visual.test.ts',
|
||||
// Bun resolves 'ws' to its built-in client, which bypasses the patched package.
|
||||
'src/main/runtime/rpc/ws-empty-payload-frame-write.test.ts',
|
||||
'src/main/runtime/rpc/transports/websocket/ws-empty-payload-frame-write.test.ts',
|
||||
'src/shared/remote-runtime/remote-runtime-client.test.ts',
|
||||
'src/shared/remote-runtime/remote-runtime-connect-bound.test.ts',
|
||||
// Bun's built-in ws client ignores maxPayload; the product opener only runs on Node.
|
||||
|
||||
@@ -211,7 +211,7 @@ const CROSS_VERSION_WIRE_PREFIXES = [
|
||||
'src/shared/browser/client-hosting/browser-client-host-protocol',
|
||||
'src/shared/browser/network/tunnels/browser-network-tunnel-protocol',
|
||||
// Both released/current WebSocket transports must accept web upgrade marker (cross-version-web-upgrade-marker).
|
||||
'src/main/runtime/rpc/ws-transport.ts',
|
||||
'src/main/runtime/rpc/transports/websocket/ws-transport.ts',
|
||||
'src/shared/web-origin-security.ts',
|
||||
'src/shared/browser/client-hosting/browser-client-host-placement',
|
||||
'src/shared/agent-launch/contracts/agent-launch-intent',
|
||||
@@ -241,7 +241,7 @@ const CROSS_VERSION_WIRE_PREFIXES = [
|
||||
'src/shared/agent-session-record',
|
||||
'src/shared/agent-session-provider-handle',
|
||||
'src/shared/agent-session/journal/',
|
||||
'src/main/ai-vault/structured-session-ownership.ts',
|
||||
'src/main/ai-vault/structured-sessions/structured-session-ownership.ts',
|
||||
'src/main/native-chat/agent-session-journal/',
|
||||
'src/main/native-chat/agent-session-wire/',
|
||||
// The released phone contract runs the current discovery owner and Claude producer.
|
||||
@@ -258,11 +258,11 @@ const CROSS_VERSION_WIRE_PREFIXES = [
|
||||
'src/main/runtime/rpc/dispatcher',
|
||||
// Run on every request the suites dispatch, whatever its method.
|
||||
'src/main/runtime/rpc/core.ts',
|
||||
'src/main/runtime/rpc/errors.ts',
|
||||
'src/main/runtime/rpc/orchestration-contract-fence.ts',
|
||||
'src/main/runtime/rpc/orchestration-session-caller.ts',
|
||||
'src/main/runtime/rpc/orchestration-legacy-compatibility.ts',
|
||||
'src/main/runtime/rpc/orchestration-mutation-executor.ts',
|
||||
'src/main/runtime/rpc/responses/rpc-response.ts',
|
||||
'src/main/runtime/rpc/orchestration/compatibility/orchestration-contract-fence.ts',
|
||||
'src/main/runtime/rpc/orchestration/callers/orchestration-session-caller.ts',
|
||||
'src/main/runtime/rpc/orchestration/compatibility/orchestration-legacy-compatibility.ts',
|
||||
'src/main/runtime/rpc/orchestration/mutations/orchestration-mutation-executor.ts',
|
||||
'src/shared/orchestration/orchestration-rpc-contract.ts',
|
||||
'src/main/runtime/rpc/methods/agent-launch/agent-launch',
|
||||
'src/main/runtime/rpc/methods/history/ai-vault.ts',
|
||||
|
||||
@@ -132,7 +132,7 @@ export const PR_E2E_SOURCE_ROUTES = [
|
||||
file
|
||||
) ||
|
||||
(isProductSource(file) &&
|
||||
/^src\/(?:cli\/runtime\/(?:launch|serve-)|main\/orcad\/(?:main|orcad-entry|orcad-command-startup|orcad-instance-lock|orcad-command-arguments|orcad-lifecycle)\.ts$|main\/startup\/desktop-profile-instance-lock\.ts$|main\/daemon\/(?:[^/]+\/)*daemon-(?:spawner|endpoint-adoption|init)|main\/server\/serve-)/.test(
|
||||
/^src\/(?:cli\/runtime\/(?:launch|serve-)|main\/orcad\/(?:main|orcad-entry|orcad-command-startup|orcad-instance-lock|orcad-command-arguments|orcad-lifecycle)\.ts$|main\/startup\/profile-startup\/desktop-profile-instance-lock\.ts$|main\/daemon\/(?:[^/]+\/)*daemon-(?:spawner|endpoint-adoption|init)|main\/server\/serve-)/.test(
|
||||
file
|
||||
))
|
||||
},
|
||||
@@ -142,14 +142,16 @@ export const PR_E2E_SOURCE_ROUTES = [
|
||||
matches: (file) =>
|
||||
file === 'tests/e2e/helpers/orca-serve-cli-host.ts' ||
|
||||
(isProductSource(file) &&
|
||||
/^src\/main\/startup\/(?:windows-app-data-path|main-process-preflight)\.ts$/.test(file))
|
||||
/^src\/main\/startup\/(?:windows-startup\/windows-app-data-path|main-process-preflight)\.ts$/.test(
|
||||
file
|
||||
))
|
||||
},
|
||||
{
|
||||
id: 'clipboard.windows-copy-file',
|
||||
specs: ['tests/e2e/file-explorer-copy-file-windows.spec.ts'],
|
||||
matches: (file) =>
|
||||
isProductSource(file) &&
|
||||
/^src\/(?:main\/window\/clipboard-(?:file-copy|ipc-handlers)|renderer\/src\/components\/right-sidebar\/file-explorer\/panel\/file-explorer-row-file-transfer)\.ts$/.test(
|
||||
/^src\/(?:main\/window\/clipboard\/clipboard-(?:file-copy|ipc-handlers)|renderer\/src\/components\/right-sidebar\/file-explorer\/panel\/file-explorer-row-file-transfer)\.ts$/.test(
|
||||
file
|
||||
)
|
||||
},
|
||||
@@ -492,7 +494,7 @@ export const PR_E2E_SOURCE_ROUTES = [
|
||||
matches: (file) =>
|
||||
file === 'tests/e2e/helpers/connector-fake-claude.ts' ||
|
||||
(isProductSource(file) &&
|
||||
/^src\/(?:main\/external-conversations\/|main\/runtime\/rpc\/methods\/connector\.ts$|cli\/(?:handlers|specs)\/connector\.ts$|shared\/rpc-contract\/connector-params\.ts$)/.test(
|
||||
/^src\/(?:main\/external-conversations\/|main\/runtime\/rpc\/methods\/connector\.ts$|cli\/(?:connectors|specs)\/connector\.ts$|shared\/rpc-contract\/connector-params\.ts$)/.test(
|
||||
file
|
||||
))
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ export const PR_EDITOR_PREVIEW_E2E_SOURCE_ROUTES = [
|
||||
) ||
|
||||
[
|
||||
'src/main/ipc/filesystem/filesystem-read-handlers.ts',
|
||||
'src/main/startup/privileged-custom-schemes.ts',
|
||||
'src/main/startup/chromium-policy/privileged-custom-schemes.ts',
|
||||
'src/preload/api/fs-bridge.ts',
|
||||
'src/renderer/src/runtime/files/reads/runtime-file-range-preview.ts',
|
||||
'src/renderer/src/runtime/files/reads/runtime-file-read-client.ts',
|
||||
|
||||
@@ -15,16 +15,7 @@ function featureRoute(id, specs, prefixes) {
|
||||
|
||||
// Feature areas whose specs the nightly suite alone used to select (gap audit, Oct 2026).
|
||||
export const PR_FEATURE_AREA_E2E_SOURCE_ROUTES = [
|
||||
featureRoute(
|
||||
'feature.automations-ui',
|
||||
['automation-prompt-disclosure'],
|
||||
[`${COMPONENTS}automations/`]
|
||||
),
|
||||
featureRoute(
|
||||
'feature.sparse-checkout',
|
||||
['sparse-explorer-proof', 'sparse-preset-proof'],
|
||||
[`${COMPONENTS}sparse/`]
|
||||
),
|
||||
featureRoute('feature.sparse-checkout', ['sparse-explorer-proof'], [`${COMPONENTS}sparse/`]),
|
||||
featureRoute(
|
||||
'feature.onboarding',
|
||||
['onboarding', 'onboarding-language-catalog-retry'],
|
||||
|
||||
@@ -129,7 +129,6 @@ export const LINUX_PACKAGE_TESTS = [
|
||||
'src/main/browser/guest-lifecycle/popups/presentation/popup-origin-chrome.electron.test.ts',
|
||||
'src/main/browser/guest-lifecycle/navigation/browser-link-materialization.electron.test.ts',
|
||||
'src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts',
|
||||
'src/main/browser/guest-lifecycle/popups/compatibility/browser-popup-compatibility.electron.test.ts',
|
||||
'src/main/browser/guest-lifecycle/popups/compatibility/browser-popup-native-compatibility.electron.test.ts',
|
||||
'src/main/browser/guest-lifecycle/popups/compatibility/browser-popup-background-compatibility.electron.test.ts',
|
||||
'src/main/browser/extensions/api-runtime/browser-extension-api.electron.test.ts',
|
||||
@@ -195,10 +194,10 @@ export const WINDOWS_BOUNDARY_TESTS = [
|
||||
'src/main/cli/wsl/wsl-cli-powershell-boundary.test.ts',
|
||||
'src/main/cursor/hook-service.test.ts',
|
||||
'src/main/orca-profiles/profile-index-store.test.ts',
|
||||
'src/main/startup/windows-install-dir-acl-repair.win32.test.ts',
|
||||
'src/main/startup/windows-app-data-path.test.ts',
|
||||
'src/main/startup/windows-std-handle-inheritance.win32.test.ts',
|
||||
'src/main/startup/windows-isolated-spawner.win32.test.ts',
|
||||
'src/main/startup/windows-install-permissions/windows-install-dir-acl-repair.win32.test.ts',
|
||||
'src/main/startup/windows-startup/windows-app-data-path.test.ts',
|
||||
'src/main/startup/windows-startup/windows-std-handle-inheritance.win32.test.ts',
|
||||
'src/main/startup/windows-startup/windows-isolated-spawner.win32.test.ts',
|
||||
'src/main/runtime/workspaces/catalog/worktree-scan-admin-fingerprint-gate.test.ts',
|
||||
'src/shared/secure-storage/secure-path-windows-acl.win32.test.ts',
|
||||
'src/main/runtime/rpc/server/pairing/unreadable-secret-store-preservation.win32.test.ts',
|
||||
|
||||
@@ -123,9 +123,9 @@ const SPECIFIC_PLUGIN_ROUTES = [
|
||||
'src\\/main\\/plugins\\/panels\\/(?:frame-serving\\/|guest-isolation\\/|desktop-actions\\/)?plugin-frame-',
|
||||
'src\\/shared\\/plugins\\/frames\\/plugin-(?:frame-guest|panel-shell)',
|
||||
'src\\/preload\\/plugin-frame-guest',
|
||||
'src\\/main\\/window\\/(?:main-window-webview-security|attach-main-window-services|host-frame-permission-policy)',
|
||||
'src\\/main\\/window\\/(?:security/(?:main-window-webview-security|host-frame-permission-policy)|attach-main-window-services)',
|
||||
'src\\/main\\/ipc\\/(?:plugins|plugin-frame-entry-ipc)\\.ts$',
|
||||
'src\\/main\\/startup\\/main-process-plugins',
|
||||
'src\\/main\\/startup\\/plugin-startup\\/main-process-plugins',
|
||||
'config\\/build-plugins\\/main-build-entry-points',
|
||||
'src\\/main\\/browser\\/guest-lifecycle\\/input\\/browser-guest-shortcut-(?:forwarding|dispatch)',
|
||||
'src\\/renderer\\/src\\/components\\/(?:plugins\\/frames\\/|right-sidebar\\/plugin-panels\\/PluginPanel\\.tsx$)',
|
||||
@@ -165,7 +165,7 @@ const SPECIFIC_PLUGIN_ROUTES = [
|
||||
'src\\/main\\/plugins\\/panels\\/(?:frame-serving\\/)?plugin-frame-(?:module-|source-serving|protocol\\.ts$)',
|
||||
'src\\/main\\/plugins\\/plugin-content-hash',
|
||||
'src\\/shared\\/plugins\\/frames\\/plugin-frame-source-modules',
|
||||
'src\\/cli\\/plugin-authoring\\/plugin-(?:type-files|components-template)',
|
||||
'src\\/cli\\/plugins\\/authoring\\/plugin-(?:type-files|components-template)',
|
||||
'examples\\/plugins\\/hello-tsx\\/'
|
||||
].join('|'),
|
||||
'plugin-frame-guest|plugin-smoke'
|
||||
@@ -218,7 +218,7 @@ const SPECIFIC_PLUGIN_ROUTES = [
|
||||
'src\\/(?:main\\/plugins\\/view\\/(?!plugin-view-replay)|shared\\/plugins\\/view\\/)',
|
||||
'src\\/main\\/runtime\\/rpc\\/methods\\/plugin-view',
|
||||
// Every `plugin shot` checks for a chrome region and resolves the default shots folder.
|
||||
'src\\/cli\\/(?:handlers\\/plugin-(?:view|shot-chrome|shot-default-dir)|specs\\/plugin-view)',
|
||||
'src\\/cli\\/(?:plugins\\/view\\/plugin-(?:view|shot-chrome|shot-default-dir)|specs\\/plugin-view)',
|
||||
'src\\/renderer\\/src\\/hooks\\/(?:ipc-events\\/plugin-view-ipc-bridge|use-document-dark-theme)',
|
||||
'src\\/renderer\\/src\\/components\\/right-sidebar\\/(?:plugin-panels\\/health\\/(?:plugin-panel-draw-status|use-plugin-panel-draw-report)|right-sidebar-panel-content)'
|
||||
].join('|'),
|
||||
@@ -233,14 +233,14 @@ const SPECIFIC_PLUGIN_ROUTES = [
|
||||
`${STORE}shot-replay`,
|
||||
'src\\/main\\/plugins\\/view\\/plugin-view-replay',
|
||||
'src\\/main\\/plugins\\/testing\\/plugin-test-(?:hooks|register)',
|
||||
'src\\/cli\\/(?:handlers|specs)\\/plugin-shot-scenario',
|
||||
'src\\/cli\\/plugin-authoring\\/plugin-(?:panel-check|test-runner|test-node)'
|
||||
'src\\/cli\\/(?:plugins\\/view|specs)\\/plugin-shot-scenario',
|
||||
'src\\/cli\\/plugins\\/authoring\\/plugin-(?:panel-check|test-runner|test-node)'
|
||||
].join('|')
|
||||
),
|
||||
pluginRoute(
|
||||
'plugins.view-shot-editor',
|
||||
['plugin-shot-editor'],
|
||||
'src\\/cli\\/handlers\\/plugin-shot-editor'
|
||||
'src\\/cli\\/plugins\\/view\\/plugin-shot-editor'
|
||||
),
|
||||
pluginRoute(
|
||||
'plugins.startup-and-manifest',
|
||||
|
||||
@@ -18,11 +18,11 @@ export const SHELL_PREFIXES = [
|
||||
'src/main/runtime/terminal/wait/tui-idle-evidence-source.ts',
|
||||
'src/main/runtime/terminal/wait/tui-idle-evidence.ts',
|
||||
'src/main/runtime/terminal/wait/tui-idle-zsh-preexec-hook-order.live-shell.test.ts',
|
||||
'src/main/startup/shell-probe-terminal-detach',
|
||||
'src/main/startup/shell-probe-lifetime',
|
||||
'src/main/startup/hydrate-shell-path',
|
||||
'src/main/startup/login-shell-environment',
|
||||
'src/main/startup/shell-path-probe',
|
||||
'src/main/startup/shell-environment/shell-probe-terminal-detach',
|
||||
'src/main/startup/shell-environment/shell-probe-lifetime',
|
||||
'src/main/startup/shell-environment/hydrate-shell-path',
|
||||
'src/main/startup/shell-environment/login-shell-environment',
|
||||
'src/main/startup/shell-environment/shell-path-probe',
|
||||
'src/renderer/src/components/terminal-pane/pty-connection/emulation/fish-color-scheme',
|
||||
'src/shared/fish-',
|
||||
'src/shared/terminal/pty/ingress/pty-reply-echo-shapes',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[
|
||||
{
|
||||
"filePath": "src/main/startup/main-process-quit.ts",
|
||||
"filePath": "src/main/startup/quit/main-process-quit.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "before-quit allowed for update install",
|
||||
"dynamic": false,
|
||||
@@ -8,7 +8,7 @@
|
||||
"reason": "Updater lifecycle diagnostics are not displayed as UI copy."
|
||||
},
|
||||
{
|
||||
"filePath": "src/main/startup/main-process-quit.ts",
|
||||
"filePath": "src/main/startup/quit/main-process-quit.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "will-quit cleanup for update install; daemonTeardown=disconnect",
|
||||
"dynamic": false,
|
||||
@@ -16,7 +16,7 @@
|
||||
"reason": "Updater lifecycle diagnostics are not displayed as UI copy."
|
||||
},
|
||||
{
|
||||
"filePath": "src/main/startup/profile-state-recovery-preflight.ts",
|
||||
"filePath": "src/main/startup/profile-startup/profile-state-recovery-preflight.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "Invalid profile-state recovery launch.",
|
||||
"dynamic": false,
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
"../src/main/ipc/worktree-linked-work-item-metadata.ts",
|
||||
"../src/main/ipc/worktree-metadata-merge.ts",
|
||||
"../src/main/wsl/discovery/wsl-availability.ts",
|
||||
"../src/main/wsl/discovery/wsl-discovery-change.ts",
|
||||
"../src/main/wsl/filesystem/wsl-directory-probe-command.ts",
|
||||
"../src/main/wsl/discovery/wsl-distro-list-output.ts",
|
||||
"../src/main/wsl/discovery/wsl-distro-retry.ts",
|
||||
@@ -87,13 +88,13 @@
|
||||
"../src/main/persistence/applying-settings/ui-selection-normalization.ts",
|
||||
"../src/main/persistence/applying-settings/ui-interaction-merge.ts",
|
||||
"../src/main/credentials/protected-secret-persistence.ts",
|
||||
"../src/main/startup/serve-desktop-activation.ts",
|
||||
"../src/main/startup/serve-mode-argv.ts",
|
||||
"../src/main/startup/single-instance-lock.ts",
|
||||
"../src/main/startup/startup-diagnostics.ts",
|
||||
"../src/main/window/focus-existing-window.ts",
|
||||
"../src/main/window/foreground-activation-policy.ts",
|
||||
"../src/main/window/macos-app-activation.ts"
|
||||
"../src/main/startup/serve-launch/serve-desktop-activation.ts",
|
||||
"../src/main/startup/serve-launch/serve-mode-argv.ts",
|
||||
"../src/main/startup/profile-startup/single-instance-lock.ts",
|
||||
"../src/main/startup/diagnostics/startup-diagnostics.ts",
|
||||
"../src/main/window/activation/focus-existing-window.ts",
|
||||
"../src/main/window/activation/foreground-activation-policy.ts",
|
||||
"../src/main/window/activation/macos-app-activation.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
"../src/main/runtime/rpc/methods/source-control/github/github-repo-work-item-methods.ts",
|
||||
"../src/main/runtime/orca-runtime.ts",
|
||||
"../src/main/runtime/rpc/core.ts",
|
||||
"../src/main/runtime/rpc/dispatcher-request-parsing.ts",
|
||||
"../src/main/github/issue-field-options.ts",
|
||||
"../src/main/runtime/rpc/dispatch/dispatcher-request-parsing.ts",
|
||||
"../src/main/github/issues/issue-field-options.ts",
|
||||
"../src/main/runtime/workspaces/process-listing/runtime-worktree-ps-summaries.ts",
|
||||
"../src/types/build-constants.d.ts",
|
||||
"../src/main/native-chat/transcript-line-decoders-claude.ts",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="113" height="20" role="img" aria-label="downloads: 173m">
|
||||
<title>downloads: 173m</title>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="113" height="20" role="img" aria-label="downloads: 174m">
|
||||
<title>downloads: 174m</title>
|
||||
<linearGradient id="s" x2="0" y2="100%">
|
||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||
<stop offset="1" stop-opacity=".1"/>
|
||||
@@ -15,7 +15,7 @@
|
||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="11">
|
||||
<text x="37" y="15" fill="#010101" fill-opacity=".3">downloads</text>
|
||||
<text x="37" y="14">downloads</text>
|
||||
<text x="93.5" y="15" fill="#010101" fill-opacity=".3">173m</text>
|
||||
<text x="93.5" y="14">173m</text>
|
||||
<text x="93.5" y="15" fill="#010101" fill-opacity=".3">174m</text>
|
||||
<text x="93.5" y="14">174m</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 943 B After Width: | Height: | Size: 943 B |
@@ -63,7 +63,7 @@ The exact release the catalog vouches for. Orca refuses bytes that differ.
|
||||
| `images` | [CatalogImages](#catalogimages) | no | 1.4.245 | Images extracted from the release by catalog CI, which re-encodes them and strips metadata. Same rules as the manifest: icon PNG, WEBP, static, at least 128×128, square, at most 256 KB. Cover PNG, JPEG, WEBP, static, at least 800×500, at most 1024 KB. Screenshots PNG, JPEG, WEBP, static, at least 1280×800, at most 1536 KB. Images must not imitate Orca's trust badges. |
|
||||
| `themePreview` | [CatalogThemePreview](#catalogthemepreview)[] | no | 1.4.245 | Up to 4 theme palettes for listing art. Display only; the installed theme files decide the real colors. |
|
||||
| `contributes` | [CatalogContribution](#catalogcontribution)[] | no | 1.4.245 | What the release adds, as the listing shows it. Generate it with the catalog tooling; Orca refuses an install whose manifest says otherwise. |
|
||||
| `capabilities` | (`"workspace:read"` \| `"workspace:write"` \| `"agent:read"` \| `"agent:launch"` \| `"terminal:send"` \| `"terminal:read"` \| `"notifications:show"` \| `"storage:own"` \| `"secrets:own"` \| `"settings:own"` \| `"appearance:write"`)[] | no | 1.4.245 | Every capability the release asks for. Orca refuses an install whose manifest asks for different ones. Example: `["notifications:show"]` |
|
||||
| `capabilities` | (`"workspace:read"` \| `"workspace:write"` \| `"agent:read"` \| `"agent:launch"` \| `"terminal:send"` \| `"terminal:read"` \| `"notifications:show"` \| `"storage:own"` \| `"secrets:own"` \| `"settings:own"` \| `"appearance:write"` \| `"workspace:create"` \| `"automation:read"` \| `"automation:write"` \| `"history:read"`)[] | no | 1.4.245 | Every capability the release asks for. Orca refuses an install whose manifest asks for different ones. Example: `["notifications:show"]` |
|
||||
| `fileTypes` | string[] | no | 1.4.245 | Extensions, without the dot, that this release opens. Orca suggests the plugin when such a file has no viewer. |
|
||||
| `editorFileTypes` | string[] | no | 1.4.245 | The `fileTypes` this release opens in a custom editor. Orca suggests the plugin for such a file even when it already opens it as text. |
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<!-- Generated by `pnpm generate:plugin-schemas` from src/shared/plugins. Do not edit. -->
|
||||
|
||||
Host API 1.6 (`"pluginApi": 1`). Workers call a method with `await orca.host.call(name, params)`; panels and custom editors call the same methods through `window.orca.host.call(name, params)`. Each method lists the surfaces allowed to call it; any other surface gets `not_permitted`. `orca.host.has(name)` answers synchronously whether this Orca offers a method on the current surface, and `orca.api` is `{ major, minor }`. See [Plugin authoring](./plugin-authoring.md) for the frame API.
|
||||
Host API 1.9 (`"pluginApi": 1`). Workers call a method with `await orca.host.call(name, params)`; panels and custom editors call the same methods through `window.orca.host.call(name, params)`. Each method lists the surfaces allowed to call it; any other surface gets `not_permitted`. `orca.host.has(name)` answers synchronously whether this Orca offers a method on the current surface, and `orca.api` is `{ major, minor }`. See [Plugin authoring](./plugin-authoring.md) for the frame API.
|
||||
|
||||
Every call is checked against the capabilities the user approved, and params are validated before Orca runs anything: params are strict, so a field this Orca does not know is refused with `invalid_params` instead of being dropped. Mutations are recorded in the audit log as `plugin:<publisher>.<id>`.
|
||||
|
||||
@@ -12,7 +12,7 @@ Methods whose capability is `none` need no capability but still need the plugin
|
||||
|
||||
| Method | Capability | Surfaces | Mutation | Since | Summary |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| [`workspace.readContext`](#workspacereadcontext) | `workspace:read` | worker, panel, editor | no | 1.0 | Branch, name and terminal ids of the focused workspace, or null when none is focused. |
|
||||
| [`workspace.readContext`](#workspacereadcontext) | `workspace:read` | worker, panel, editor | no | 1.0 | Id, branch, name and terminal ids of the focused workspace, or null when none is focused. |
|
||||
| [`terminal.sendText`](#terminalsendtext) | `terminal:send` | worker | yes | 1.0 | Types text into one terminal named by id, optionally pressing Enter. |
|
||||
| [`notifications.show`](#notificationsshow) | `notifications:show` | worker, panel, editor | yes | 1.0 | Shows a desktop notification. |
|
||||
| [`storage.get`](#storageget) | `storage:own` | worker, panel, editor | no | 1.0 | Reads a JSON value from the plugin's private store; null when absent. |
|
||||
@@ -28,12 +28,13 @@ Methods whose capability is `none` need no capability but still need the plugin
|
||||
| [`shell.openExternal`](#shellopenexternal) | none | panel, editor | no | 1.1 | Opens an http:, https: or mailto: URL in the default browser. Needs a click or key press in the frame; desktop app only. Orca asks the person before an http(s) host the plugin was not allowed; `opened` is false if they cancel. |
|
||||
| [`files.saveAs`](#filessaveas) | none | panel, editor | yes | 1.1 | Offers data (a string or ArrayBuffer, up to 64 MiB) in Orca's save dialog; the plugin never learns the path. Needs a click or key press in the frame; desktop app only. |
|
||||
| [`plugin.request`](#pluginrequest) | none | panel, editor | no | 1.2 | Asks the plugin's own worker to run the handler it registered with `orca.panels.handle(name)`, starting the worker if needed; resolves with what the handler returned. `unknown_method` when no handler has that name. |
|
||||
| [`agents.list`](#agentslist) | `agent:read` | worker, panel, editor | no | 1.2 | The agents in the focused workspace: their terminal, title, agent kind and status. `agent.status.changed` reports each change after. |
|
||||
| [`agents.list`](#agentslist) | `agent:read` | worker, panel, editor | no | 1.2 | The agents in the focused workspace: their terminal, title, agent kind, status, session and dispatched task. `agent.status.changed` reports each change after. |
|
||||
| [`events.subscribe`](#eventssubscribe) | none | panel, editor | no | 1.2 | Delivers a workspace, agent or editor event to this panel as `orca.on(event)`; needs the event's read capability, when it has one. The frame APIs call it for you. |
|
||||
| [`statusBar.update`](#statusbarupdate) | none | worker | no | 1.2 | Changes one of the plugin's `contributes.statusBarItems` (named by `id`): fields given replace their current value, `visible: false` hides it. Desktop app only; lasts until Orca restarts, and is hidden while the plugin is disabled. A plugin with `main` and status bar items has its worker started when it is enabled and kept running while it stays enabled, so a worker can poll and update its items without an event or a hook. |
|
||||
| [`appearance.read`](#appearanceread) | `appearance:write` | worker | no | 1.4 | Reads the current desktop appearance revision for a conditional update. |
|
||||
| [`appearance.apply`](#appearanceapply) | `appearance:write` | worker | yes | 1.4 | Publishes owned app/editor and terminal colors and selects them in the desktop. Returns publication, not renderer acknowledgement. |
|
||||
| [`workspace.list`](#workspacelist) | `workspace:read` | worker | no | 1.3 | Lists every workspace, Git worktrees and folders, on every host Orca reaches. |
|
||||
| [`workspace.list`](#workspacelist) | `workspace:read` | worker | no | 1.3 | Lists every workspace, Git worktrees and folders, on every host Orca reaches; `includeStatus` (host API 1.7) adds each one's agent status. `hostId` is the host a row records (`local`, `ssh:…`, `runtime:…`), or null when it records none, as for a project-group folder on this machine. |
|
||||
| [`project.list`](#projectlist) | `workspace:read` | worker | no | 1.7 | Lists your projects (repositories and folders) on every host; `id` is what `workspace.list` rows name as `projectId`. `hostId` is always named: `local`, `ssh:…` or `runtime:…`. |
|
||||
| [`workspace.open`](#workspaceopen) | `workspace:write` | worker | yes | 1.3 | Shows a workspace in Orca, as clicking it in the sidebar does; a folder workspace needs the desktop app. |
|
||||
| [`workspace.rename`](#workspacerename) | `workspace:write` | worker | yes | 1.5 | Renames a workspace in Orca's sidebar, as renaming it by hand does; the name stays until it is renamed again. |
|
||||
| [`terminal.create`](#terminalcreate) | `terminal:send` | worker | yes | 1.3 | Opens a terminal in a workspace, optionally running a command, in the background. |
|
||||
@@ -41,14 +42,25 @@ Methods whose capability is `none` need no capability but still need the plugin
|
||||
| [`agent.launch`](#agentlaunch) | `agent:launch` | worker | yes | 1.3 | Starts an agent's CLI in a new terminal of a workspace, in the background, and returns as soon as it starts; a `prompt` is sent once the agent is ready. |
|
||||
| [`editor.open`](#editoropen) | `workspace:write` | worker | yes | 1.3 | Opens a file of a workspace in an editor tab of Orca's window; desktop app only. `workspace.open` shows the workspace. |
|
||||
| [`commands.run`](#commandsrun) | `workspace:write` | worker | yes | 1.3 | Runs one of Orca's built-in actions in its window, never a plugin's replacement of it; desktop app only. |
|
||||
| [`project.setHidden`](#projectsethidden) | `workspace:write` | worker | yes | 1.9 | Hides a project from Orca's sidebar, or shows it again, as Hide Project in its menu does. View-only: its workspaces, terminals, agents and automations keep running, `workspace.list` still lists its workspaces, `project.list` marks it `hidden`, and Orca's Hidden projects list can show it again. It changes one host's copy of the project; on a paired Orca server it hides the project for everyone connected. |
|
||||
| [`terminal.list`](#terminallist) | `workspace:read` | worker | no | 1.7 | Lists a workspace's terminals, at most 50; `workspace.readContext` lists the focused one's. |
|
||||
| [`terminal.focus`](#terminalfocus) | `workspace:write` | worker | yes | 1.7 | Shows any terminal's workspace and focuses its pane, as clicking it does; desktop app only. `focused` is false when a newer focus request won or the window did not move to it. |
|
||||
| [`terminal.close`](#terminalclose) | `terminal:send` | worker | yes | 1.7 | Closes a terminal of the focused workspace, or one this plugin opened (`terminal.create`, `agent.launch`), stopping what runs in it (local or SSH); closing its last pane closes the tab. Any other terminal is refused with `action_failed`. A plugin keeps its terminals until it is disabled or removed. |
|
||||
| [`workspace.create`](#workspacecreate) | `workspace:create` (+`agent:launch` for `agent`) | worker | yes | 1.8 | Creates a workspace (a new branch and worktree) in a Git project, local or SSH, and returns its id; with `agent`, starts that agent there once setup has run, in the background unless `open`; if the agent fails after the workspace exists, the error names its id. Orca's workspace-create and agent hooks run as for any create. |
|
||||
| [`agent.resume`](#agentresume) | `agent:launch` | worker | yes | 1.8 | Resumes an agent's earlier session by its `sessionId` in a new terminal of a workspace, in the background; `started` is false when an Orca terminal already runs it. From host API 1.9, a session no Orca pane runs that Agent Session History lists on this computer (among the workspace's own sessions and the 200 newest) is prepared and started as Orca's own Resume does, in the agent account Orca would pick; only `agent:launch` is needed, since the plugin must already know the id. Other sessions, and workspaces on another host, resume by id. In WSL it uses the distro's default agent account, as `agent.launch` does. |
|
||||
| [`automation.list`](#automationlist) | `automation:read` | worker | no | 1.8 | Lists the automations this Orca schedules, at most 200, with each one's prompt cut to 4096 characters. |
|
||||
| [`automation.create`](#automationcreate) | `automation:write` | worker | yes | 1.8 | Creates an automation that starts `agent` with `prompt` on `schedule`, even when the plugin is not running, with the person's settings for that agent; Orca's Automations page shows it as created by the plugin. |
|
||||
| [`automation.update`](#automationupdate) | `automation:write` | worker | yes | 1.8 | Changes an automation's name, prompt, schedule, time zone or whether it is enabled. Orca first asks the person about an automation this plugin did not create (or created before it was removed or disabled); if they decline or cannot be asked, or it changes while they are asked, nothing changes and `reason` says why. Orca also asks before a new prompt or schedule, or resuming, for any automation whose runs use extra agent settings the person chose. |
|
||||
| [`automation.delete`](#automationdelete) | `automation:write` | worker | yes | 1.8 | Deletes an automation. Orca first asks the person about an automation this plugin did not create (or created before it was removed or disabled); if they decline or cannot be asked, or it changes while they are asked, nothing changes and `reason` says why. |
|
||||
| [`agent.listSessions`](#agentlistsessions) | `history:read` | worker | no | 1.9 | Past agent sessions in Orca's Agent Session History on this computer (WSL distributions included on Windows), newest first: title, agent, workspace, branch, times, message and token counts, and whether an Orca terminal here runs it. Leaves out Antigravity IDE conversations and subagent transcripts, and never gives the conversation or file paths, though a title can be the start of its first message. `agent.resume` resumes one by its `sessionId`, for agents that resume by id. |
|
||||
| [`editor.readTypography`](#editorreadtypography) | none | worker, panel, editor | no | 1.6 | The font family, size, weight, line height, ligatures, word wrap and minimap Orca's file editor uses now, editor zoom included. `editor.typography.changed` reports each change after. |
|
||||
|
||||
### `workspace.readContext`
|
||||
|
||||
Branch, name and terminal ids of the focused workspace, or null when none is focused.
|
||||
Id, branch, name and terminal ids of the focused workspace, or null when none is focused.
|
||||
|
||||
```ts
|
||||
(params?: {}) => { branch: string; displayName: string; terminals: { id: string; title?: string }[] } | null
|
||||
(params?: {}) => { workspaceId?: string; branch: string; displayName: string; terminals: { id: string; title?: string }[] } | null
|
||||
```
|
||||
|
||||
### `terminal.sendText`
|
||||
@@ -173,10 +185,10 @@ Asks the plugin's own worker to run the handler it registered with `orca.panels.
|
||||
|
||||
### `agents.list`
|
||||
|
||||
The agents in the focused workspace: their terminal, title, agent kind and status. `agent.status.changed` reports each change after.
|
||||
The agents in the focused workspace: their terminal, title, agent kind, status, session and dispatched task. `agent.status.changed` reports each change after.
|
||||
|
||||
```ts
|
||||
(params?: {}) => { agents: { terminalId: string | null; title: string | null; agent: string | null; state: "working" | "blocked" | "waiting" | "done"; stateStartedAt: number }[] }
|
||||
(params?: {}) => { agents: { terminalId: string | null; title: string | null; agent: string | null; state: "working" | "blocked" | "waiting" | "done"; stateStartedAt: number; sessionId?: string | null; task?: { title: string } | null }[] }
|
||||
```
|
||||
|
||||
### `events.subscribe`
|
||||
@@ -213,10 +225,18 @@ Publishes owned app/editor and terminal colors and selects them in the desktop.
|
||||
|
||||
### `workspace.list`
|
||||
|
||||
Lists every workspace, Git worktrees and folders, on every host Orca reaches.
|
||||
Lists every workspace, Git worktrees and folders, on every host Orca reaches; `includeStatus` (host API 1.7) adds each one's agent status. `hostId` is the host a row records (`local`, `ssh:…`, `runtime:…`), or null when it records none, as for a project-group folder on this machine.
|
||||
|
||||
```ts
|
||||
(params?: {}) => { workspaces: { id: string; kind: "worktree" | "folder"; name: string; project?: string | null; path: string; branch: string | null; hostId: string | null }[]; truncated: boolean }
|
||||
(params?: { includeStatus?: boolean }) => { workspaces: { id: string; kind: "worktree" | "folder"; name: string; project?: string | null; projectId?: string | null; path: string; branch: string | null; hostId: string | null; status?: { state: "working" | "permission" | "done" | "active" | "inactive"; unread: boolean; terminalCount: number; lastActivityAt: number | null } }[]; truncated: boolean; statusTruncated?: boolean }
|
||||
```
|
||||
|
||||
### `project.list`
|
||||
|
||||
Lists your projects (repositories and folders) on every host; `id` is what `workspace.list` rows name as `projectId`. `hostId` is always named: `local`, `ssh:…` or `runtime:…`.
|
||||
|
||||
```ts
|
||||
(params?: {}) => { projects: { id: string; name: string; kind: "git" | "folder"; hostId: string | null; path: string; hidden?: boolean }[]; truncated: boolean }
|
||||
```
|
||||
|
||||
### `workspace.open`
|
||||
@@ -275,6 +295,94 @@ Runs one of Orca's built-in actions in its window, never a plugin's replacement
|
||||
(params: { action: "worktree.history.back" | "worktree.history.forward" | "sidebar.left.toggle" | "sidebar.sleepingWorkspaces.toggle" | "floatingWorkspace.maximize" | "tab.rename" | "workspace.rename" | "workspace.openBoard" | "view.tasks" | "sidebar.right.toggle" | "sidebar.explorer.toggle" | "sidebar.search.toggle" | "sidebar.sourceControl.toggle" | "sidebar.checks.toggle" | "sidebar.ports.toggle" }) => { ran: true }
|
||||
```
|
||||
|
||||
### `project.setHidden`
|
||||
|
||||
Hides a project from Orca's sidebar, or shows it again, as Hide Project in its menu does. View-only: its workspaces, terminals, agents and automations keep running, `workspace.list` still lists its workspaces, `project.list` marks it `hidden`, and Orca's Hidden projects list can show it again. It changes one host's copy of the project; on a paired Orca server it hides the project for everyone connected.
|
||||
|
||||
```ts
|
||||
(params: { projectId: string; hostId?: string; hidden: boolean }) => { hostId: string; hidden: boolean }
|
||||
```
|
||||
|
||||
### `terminal.list`
|
||||
|
||||
Lists a workspace's terminals, at most 50; `workspace.readContext` lists the focused one's.
|
||||
|
||||
```ts
|
||||
(params: { workspaceId: string }) => { terminals: { id: string; title?: string }[]; truncated: boolean }
|
||||
```
|
||||
|
||||
### `terminal.focus`
|
||||
|
||||
Shows any terminal's workspace and focuses its pane, as clicking it does; desktop app only. `focused` is false when a newer focus request won or the window did not move to it.
|
||||
|
||||
```ts
|
||||
(params: { terminalId: string }) => { focused: boolean }
|
||||
```
|
||||
|
||||
### `terminal.close`
|
||||
|
||||
Closes a terminal of the focused workspace, or one this plugin opened (`terminal.create`, `agent.launch`), stopping what runs in it (local or SSH); closing its last pane closes the tab. Any other terminal is refused with `action_failed`. A plugin keeps its terminals until it is disabled or removed.
|
||||
|
||||
```ts
|
||||
(params: { terminalId: string }) => { closed: true }
|
||||
```
|
||||
|
||||
### `workspace.create`
|
||||
|
||||
Creates a workspace (a new branch and worktree) in a Git project, local or SSH, and returns its id; with `agent`, starts that agent there once setup has run, in the background unless `open`; if the agent fails after the workspace exists, the error names its id. Orca's workspace-create and agent hooks run as for any create.
|
||||
|
||||
```ts
|
||||
(params: { projectId: string; hostId?: string; name?: string; baseBranch?: string; agent?: string; prompt?: string; setup?: "skip"; open?: boolean }) => { workspaceId: string; terminalId?: string }
|
||||
```
|
||||
|
||||
### `agent.resume`
|
||||
|
||||
Resumes an agent's earlier session by its `sessionId` in a new terminal of a workspace, in the background; `started` is false when an Orca terminal already runs it. From host API 1.9, a session no Orca pane runs that Agent Session History lists on this computer (among the workspace's own sessions and the 200 newest) is prepared and started as Orca's own Resume does, in the agent account Orca would pick; only `agent:launch` is needed, since the plugin must already know the id. Other sessions, and workspaces on another host, resume by id. In WSL it uses the distro's default agent account, as `agent.launch` does.
|
||||
|
||||
```ts
|
||||
(params: { workspaceId: string; agent: "claude" | "codebuddy" | "codex" | "qoder" | "qoder-cn" | "qwen-code" | "gemini" | "antigravity" | "opencode" | "opencode2" | "pi" | "mimo-code" | "droid" | "grok" | "devin" | "omp" | "prime-agent" | "copilot" | "cursor" | "kimi" | "muse" | "zcode" | "dsh" | "jcode" | "kiro" | "hermes"; sessionId: string }) => { terminalId: string; started: boolean }
|
||||
```
|
||||
|
||||
### `automation.list`
|
||||
|
||||
Lists the automations this Orca schedules, at most 200, with each one's prompt cut to 4096 characters.
|
||||
|
||||
```ts
|
||||
(params?: {}) => { automations: { id: string; name: string; agent: string; prompt: string; promptTruncated: boolean; projectId: string | null; hostId: string | null; workspaceId: string | null; workspaceMode: "existing" | "new-per-run"; schedule: string | null; timezone: string; enabled: boolean; nextRunAt: number | null; lastRunAt: number | null; createdByThisPlugin: boolean }[]; truncated: boolean }
|
||||
```
|
||||
|
||||
### `automation.create`
|
||||
|
||||
Creates an automation that starts `agent` with `prompt` on `schedule`, even when the plugin is not running, with the person's settings for that agent; Orca's Automations page shows it as created by the plugin.
|
||||
|
||||
```ts
|
||||
(params: { name: string; prompt: string; agent: string; projectId?: string; hostId?: string; workspaceId?: string; schedule: string; timezone?: string; enabled?: boolean; creationKey?: string }) => { automationId: string }
|
||||
```
|
||||
|
||||
### `automation.update`
|
||||
|
||||
Changes an automation's name, prompt, schedule, time zone or whether it is enabled. Orca first asks the person about an automation this plugin did not create (or created before it was removed or disabled); if they decline or cannot be asked, or it changes while they are asked, nothing changes and `reason` says why. Orca also asks before a new prompt or schedule, or resuming, for any automation whose runs use extra agent settings the person chose.
|
||||
|
||||
```ts
|
||||
(params: { automationId: string; name?: string; prompt?: string; schedule?: string; timezone?: string; enabled?: boolean }) => { updated: boolean; reason?: "cancelled" | "consent-unavailable" | "changed" }
|
||||
```
|
||||
|
||||
### `automation.delete`
|
||||
|
||||
Deletes an automation. Orca first asks the person about an automation this plugin did not create (or created before it was removed or disabled); if they decline or cannot be asked, or it changes while they are asked, nothing changes and `reason` says why.
|
||||
|
||||
```ts
|
||||
(params: { automationId: string }) => { deleted: boolean; reason?: "cancelled" | "consent-unavailable" | "changed" }
|
||||
```
|
||||
|
||||
### `agent.listSessions`
|
||||
|
||||
Past agent sessions in Orca's Agent Session History on this computer (WSL distributions included on Windows), newest first: title, agent, workspace, branch, times, message and token counts, and whether an Orca terminal here runs it. Leaves out Antigravity IDE conversations and subagent transcripts, and never gives the conversation or file paths, though a title can be the start of its first message. `agent.resume` resumes one by its `sessionId`, for agents that resume by id.
|
||||
|
||||
```ts
|
||||
(params?: { workspaceId?: string; limit?: number }) => { sessions: { sessionId: string; agent: string; title: string; workspaceId: string | null; hostId: string; branch: string | null; createdAt: number | null; updatedAt: number; messageCount: number; totalTokens: number; running: boolean }[]; truncated: boolean }
|
||||
```
|
||||
|
||||
### `editor.readTypography`
|
||||
|
||||
The font family, size, weight, line height, ligatures, word wrap and minimap Orca's file editor uses now, editor zoom included. `editor.typography.changed` reports each change after.
|
||||
@@ -289,10 +397,10 @@ A worker receives the events its manifest lists in `contributes.events` through
|
||||
|
||||
| Event | Payload | Summary |
|
||||
| --- | --- | --- |
|
||||
| `workspace.created` | `{ workspaceId: string; kind: "worktree" \| "folder"; path: string; branch: string }` | A worktree workspace was created. |
|
||||
| `workspace.removed` | `{ workspaceId: string; kind: "worktree" \| "folder"; path: string }` | A worktree workspace was removed. |
|
||||
| `agent.status.changed` | `{ workspaceId: string \| null; paneKey: string; terminalId?: string; title?: string; state: "working" \| "blocked" \| "waiting" \| "done"; receivedAt: number; mainAgent?: { state: "working" \| "blocked" \| "waiting" \| "done"; outcome?: "success" \| "failure" \| "cancellation" \| "superseded" \| "interruption" \| "unconfirmed"; stateStartedAt: number } }` | An agent in a terminal pane changed status; `workspaceId` is null when Orca cannot tie the pane to a workspace, and `terminalId` names its terminal when Orca lists it. |
|
||||
| `workspace.changed` | `{ context: { branch: string; displayName: string; terminals: { id: string; title?: string }[] } \| null }` | The focused workspace changed, or its terminals were opened, closed or renamed; `context` is what `workspace.readContext` now answers. Each new subscriber first gets the current context. |
|
||||
| `workspace.created` | `{ workspaceId: string; workspaceListId?: string; kind: "worktree" \| "folder"; path: string; branch: string }` | A worktree workspace was created; `workspaceListId` (host API 1.7) is the id `workspace.list` gives it. |
|
||||
| `workspace.removed` | `{ workspaceId: string; workspaceListId?: string; kind: "worktree" \| "folder"; path: string }` | A worktree workspace was removed; `workspaceListId` (host API 1.7) is the id `workspace.list` gave it. |
|
||||
| `agent.status.changed` | `{ workspaceId: string \| null; workspaceListId?: string; paneKey: string; terminalId?: string; title?: string; state: "working" \| "blocked" \| "waiting" \| "done"; receivedAt: number; mainAgent?: { state: "working" \| "blocked" \| "waiting" \| "done"; outcome?: "success" \| "failure" \| "cancellation" \| "superseded" \| "interruption" \| "unconfirmed"; stateStartedAt: number }; sessionId?: string }` | An agent in a terminal pane changed status; `workspaceId` is null when Orca cannot tie the pane to a workspace, `workspaceListId` (host API 1.7) is the id `workspace.list` gives that workspace, `terminalId` names its terminal when Orca lists it, and `sessionId` (host API 1.8) is what `agent.resume` takes. |
|
||||
| `workspace.changed` | `{ context: { workspaceId?: string; branch: string; displayName: string; terminals: { id: string; title?: string }[] } \| null }` | The focused workspace changed, or its terminals were opened, closed or renamed; `context` is what `workspace.readContext` now answers, its `workspaceId` included. Each new subscriber first gets the current context. |
|
||||
| `editor.typography.changed` | `{ fontFamily: string; cssFontFamily: string; fontSize: number; fontWeight: string; lineHeight: number; fontLigatures: boolean; wordWrap: "on" \| "off"; minimap: boolean }` | What Orca's file editor uses changed (a setting or the editor zoom); the payload is what `editor.readTypography` now answers. Needs no capability. |
|
||||
|
||||
## Hooks
|
||||
|
||||
@@ -237,7 +237,7 @@ A host API the plugin may call once the user consents.
|
||||
|
||||
| Field | Type | Required | Since | Description |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `kind` | `"workspace:read"` \| `"workspace:write"` \| `"agent:read"` \| `"agent:launch"` \| `"terminal:send"` \| `"terminal:read"` \| `"notifications:show"` \| `"storage:own"` \| `"secrets:own"` \| `"settings:own"` \| `"appearance:write"` | yes | 1.4.160 | Capability granted on user consent. |
|
||||
| `kind` | `"workspace:read"` \| `"workspace:write"` \| `"agent:read"` \| `"agent:launch"` \| `"terminal:send"` \| `"terminal:read"` \| `"notifications:show"` \| `"storage:own"` \| `"secrets:own"` \| `"settings:own"` \| `"appearance:write"` \| `"workspace:create"` \| `"automation:read"` \| `"automation:write"` \| `"history:read"` | yes | 1.4.160 | Capability granted on user consent. |
|
||||
|
||||
## Screenshot
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@
|
||||
"notifications:show"
|
||||
]
|
||||
],
|
||||
"maxItems": 11,
|
||||
"maxItems": 15,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
@@ -364,7 +364,11 @@
|
||||
"storage:own",
|
||||
"secrets:own",
|
||||
"settings:own",
|
||||
"appearance:write"
|
||||
"appearance:write",
|
||||
"workspace:create",
|
||||
"automation:read",
|
||||
"automation:write",
|
||||
"history:read"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1581,7 +1581,11 @@
|
||||
"storage:own",
|
||||
"secrets:own",
|
||||
"settings:own",
|
||||
"appearance:write"
|
||||
"appearance:write",
|
||||
"workspace:create",
|
||||
"automation:read",
|
||||
"automation:write",
|
||||
"history:read"
|
||||
],
|
||||
"description": "Capability granted on user consent.",
|
||||
"x-orca-since": "1.4.160",
|
||||
@@ -1596,7 +1600,11 @@
|
||||
"storage:own": "1.4.245",
|
||||
"secrets:own": "1.4.245",
|
||||
"settings:own": "1.4.160",
|
||||
"appearance:write": "1.4.249"
|
||||
"appearance:write": "1.4.249",
|
||||
"workspace:create": "1.4.258",
|
||||
"automation:read": "1.4.258",
|
||||
"automation:write": "1.4.258",
|
||||
"history:read": "1.4.258"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -95,10 +95,14 @@ orca repo add --path /abs/path/to/folder --kind folder --json
|
||||
orca repo show --repo id:<repoId> --json
|
||||
orca repo set-base-ref --repo id:<repoId> --ref origin/main --json
|
||||
orca repo search-refs --repo id:<repoId> --query main --limit 10 --json
|
||||
orca repo hide --repo id:<repoId> --json
|
||||
orca repo unhide --repo id:<repoId> --json
|
||||
```
|
||||
|
||||
Set the repo base ref before creating lots of worktrees so new tasks branch from the right place by default.
|
||||
|
||||
`repo hide` takes a project out of the sidebar, project pickers and the workspace switcher without stopping anything: its terminals, agents and automations keep running, `repo list` still lists it with `hiddenAt` set, and commands that name it keep working. Hiding applies to one host's copy of a project; add `--host <host>` to pick which copy when it is set up on several. On a paired Orca server the setting lives on that server, so hiding a project there hides it for everyone connected to it. `repo unhide`, or the Hidden projects list at the bottom of the sidebar, shows it again.
|
||||
|
||||
`repo add` defaults to `--kind git`. Use `--kind folder` to open an ordinary directory, including a repo-tool root containing separate Git repositories, as a folder workspace without Git worktrees or source control. With `--environment`, use an absolute path on that Orca server.
|
||||
|
||||
## Worktrees
|
||||
|
||||
@@ -29,3 +29,24 @@ Pick a custom desktop notification sound per category under [Settings → Notifi
|
||||
Supported formats: MP3, WAV, OGG, M4A, AAC, FLAC. One file applies to all delivered desktop notifications.
|
||||
|
||||
When you use a custom sound, set its playback volume from the same settings pane.
|
||||
|
||||
## Disable mobile push from a host
|
||||
|
||||
Set `ORCA_MOBILE_PUSH_MODE` in the environment of each desktop or remote runtime
|
||||
that sends mobile push, then restart that host:
|
||||
|
||||
- `full` (default): existing notification titles, bodies and navigation identifiers.
|
||||
- `disabled`: no alert or test sends and no new push registration from that host.
|
||||
Existing registration deletion and queued cleanup still run. This does not
|
||||
itself erase historical gateway/provider records or disable live in-app events.
|
||||
|
||||
An unrecognized nonempty value disables push delivery. This is a host configuration,
|
||||
not a centrally enforced organization policy. Users who control the host environment
|
||||
can change it. It applies to that host's push gateway traffic, not local desktop
|
||||
notifications or direct/Relay application content. Every sending host needs the
|
||||
setting; older Orca versions do not implement it. OS notification permissions and
|
||||
lock-screen preview settings are separate controls.
|
||||
|
||||
There is no generic-content mode: enabled push may include project/agent text and
|
||||
identifiers. Disabling phone lock-screen previews does not stop that content from
|
||||
reaching the push gateway and APNs/FCM.
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFile, readdir } from 'node:fs/promises'
|
||||
import { existsSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import test from 'node:test'
|
||||
|
||||
const siteRoot = path.resolve(import.meta.dirname, '..')
|
||||
const contentRoot = path.join(siteRoot, 'content', 'docs')
|
||||
const publicRoot = path.join(siteRoot, 'public')
|
||||
|
||||
async function walkFiles(directory, extension) {
|
||||
const entries = await readDirectory(directory)
|
||||
const files = []
|
||||
for (const entry of entries) {
|
||||
const absolutePath = path.join(directory, entry.name)
|
||||
if (entry.isDirectory()) {
|
||||
files.push(...(await walkFiles(absolutePath, extension)))
|
||||
} else if (!extension || entry.name.endsWith(extension)) {
|
||||
files.push(absolutePath)
|
||||
}
|
||||
}
|
||||
return files
|
||||
}
|
||||
|
||||
async function readDirectory(directory) {
|
||||
return readdir(directory, { withFileTypes: true })
|
||||
}
|
||||
|
||||
function publicPathExists(urlPath) {
|
||||
const pathname = urlPath.split('#', 1)[0].split('?', 1)[0]
|
||||
return existsSync(path.join(publicRoot, pathname.replace(/^\//, '')))
|
||||
}
|
||||
|
||||
function isMediaPath(urlPath) {
|
||||
return /\.(?:gif|jpe?g|png|webp|mp4|svg|ico)$/i.test(urlPath.split(/[?#]/, 1)[0])
|
||||
}
|
||||
|
||||
test('every local media URL referenced by docs resolves in public assets', async () => {
|
||||
const files = await walkFiles(contentRoot, '.mdx')
|
||||
const localUrls = new Set()
|
||||
for (const file of files) {
|
||||
const content = await readFile(file, 'utf8')
|
||||
for (const match of content.matchAll(
|
||||
/(?:src|href)=['"](\/docs\/[^'"\s)]+)|\]\((\/docs\/[^)\s]+)\)/g
|
||||
)) {
|
||||
const url = match[1] ?? match[2]
|
||||
if (isMediaPath(url)) {
|
||||
localUrls.add(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.ok(localUrls.size > 0, 'expected docs to reference at least one local media asset')
|
||||
for (const url of localUrls) {
|
||||
assert.ok(publicPathExists(url), `${url} is referenced but missing from public/`)
|
||||
}
|
||||
})
|
||||
|
||||
test('docs content does not link to routes that only exist on the marketing site', async () => {
|
||||
const files = await walkFiles(contentRoot, '.mdx')
|
||||
assert.ok(files.length > 0, 'expected docs content pages')
|
||||
for (const file of files) {
|
||||
const content = await readFile(file, 'utf8')
|
||||
for (const match of content.matchAll(/\]\((\/(?!docs(?:\/|[)#]))[^)\s]+)\)/g)) {
|
||||
assert.fail(`${path.relative(siteRoot, file)} links to an unhosted local route: ${match[1]}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -12,15 +12,6 @@ test('link destinations retain escaped closing parentheses and literal escapes',
|
||||
}
|
||||
})
|
||||
|
||||
test('search excerpts omit inline Markdown syntax', () => {
|
||||
assert.equal(
|
||||
stripSearchExcerptMarkdown(
|
||||
'Use **bold**, *emphasis*, `inline code`, and [linked text](https://example.com).'
|
||||
),
|
||||
'Use bold, emphasis, inline code, and linked text.'
|
||||
)
|
||||
})
|
||||
|
||||
test('search excerpts preserve highlighted matches inside Markdown', () => {
|
||||
assert.equal(
|
||||
stripSearchExcerptMarkdown('**<mark>Privacy</mark> controls**'),
|
||||
|
||||
@@ -89,6 +89,7 @@
|
||||
"usesCleartextTraffic": true,
|
||||
"allowBackup": false,
|
||||
"permissions": ["RECORD_AUDIO", "MODIFY_AUDIO_SETTINGS"],
|
||||
"blockedPermissions": ["android.permission.SYSTEM_ALERT_WINDOW"],
|
||||
"package": "com.stably.orca.mobile",
|
||||
"versionCode": 28,
|
||||
"googleServicesFile": "./google-services.json"
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
import { useCallback } from 'react'
|
||||
import { useLocalSearchParams, useRouter } from 'expo-router'
|
||||
import { firstParam } from '../../../../src/navigation/route-param-reader'
|
||||
import { STANDALONE_SESSION_PARAM } from '../../../../src/navigation/host-stack-navigation'
|
||||
import {
|
||||
shellScreenRoute,
|
||||
shellScreenRouteKey
|
||||
@@ -25,6 +26,7 @@ export default withWorkspaceRoute(function MobileSessionScreen() {
|
||||
created?: string | string[]
|
||||
warning?: string | string[]
|
||||
paneKey?: string | string[]
|
||||
standalone?: string | string[]
|
||||
}>()
|
||||
const hostId = firstParam(params.hostId)
|
||||
const worktreeId = firstParam(params.worktreeId)
|
||||
@@ -45,7 +47,7 @@ export default withWorkspaceRoute(function MobileSessionScreen() {
|
||||
// Omit empty params: created=1 is one-shot, warning is host text, absent name derives a label, and empty paneKey marks a spent tap.
|
||||
const routeParams: Record<string, string> = {
|
||||
...Object.fromEntries(
|
||||
(['name', 'created', 'warning', 'paneKey'] as const)
|
||||
(['name', 'created', 'warning', 'paneKey', STANDALONE_SESSION_PARAM] as const)
|
||||
.map((key) => [key, firstParam(params[key])] as const)
|
||||
.filter(([, value]) => value !== '')
|
||||
),
|
||||
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package expo.modules.orcagziputf8codec
|
||||
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Test
|
||||
|
||||
class StrictUtf8Test {
|
||||
@Test
|
||||
fun `hands back to JS what TextDecoder would repair or strip`() {
|
||||
val refused = listOf(
|
||||
byteArrayOf(0xef.toByte(), 0xbb.toByte(), 0xbf.toByte(), 0x41),
|
||||
byteArrayOf(0xc0.toByte(), 0x80.toByte()),
|
||||
byteArrayOf(0xed.toByte(), 0xa0.toByte(), 0x80.toByte()),
|
||||
byteArrayOf(0x41, 0xe2.toByte(), 0x82.toByte()),
|
||||
byteArrayOf(0x80.toByte()),
|
||||
byteArrayOf(0xf5.toByte(), 0x80.toByte(), 0x80.toByte(), 0x80.toByte())
|
||||
)
|
||||
for (bytes in refused) {
|
||||
assertNull(decodeStrictUtf8(bytes))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import Foundation
|
||||
// The codec's decisions, compiled and run without a device, from the module directory:
|
||||
//
|
||||
// swiftc -O -o /tmp/gzip-utf8-codec-checks ios/BoundedGunzip.swift \
|
||||
// ios/StrictUtf8.swift tests/GzipUtf8CodecChecks.swift && /tmp/gzip-utf8-codec-checks
|
||||
// tests/GzipUtf8CodecChecks.swift && /tmp/gzip-utf8-codec-checks
|
||||
@main struct GzipUtf8CodecChecks {
|
||||
static var failures = 0
|
||||
|
||||
@@ -37,14 +37,6 @@ import Foundation
|
||||
check(actual == expected, "gunzip: \(name)")
|
||||
}
|
||||
|
||||
let refused: [[UInt8]] = [
|
||||
[0xef, 0xbb, 0xbf, 0x41], [0xc0, 0x80], [0xed, 0xa0, 0x80], [0x41, 0xe2, 0x82], [0x80],
|
||||
[0xf5, 0x80, 0x80, 0x80],
|
||||
]
|
||||
for input in refused {
|
||||
check(decodeStrictUtf8(Data(input)) == nil, "utf8: refuses \(input)")
|
||||
}
|
||||
|
||||
print(failures == 0 ? "all checks passed" : "\(failures) check(s) failed")
|
||||
exit(failures == 0 ? 0 : 1)
|
||||
}
|
||||
|
||||
@@ -11,38 +11,6 @@ import Foundation
|
||||
// ios/MobileWebShellNavigationPolicy.swift \
|
||||
// tests/MobileWebShellChecks.swift && /tmp/mobile-web-shell-checks
|
||||
@main struct MobileWebShellChecks {
|
||||
static let session = "sess-01JN_aZ9"
|
||||
|
||||
static func parts(
|
||||
path: String,
|
||||
method: String = "GET",
|
||||
hasRangeHeader: Bool = false,
|
||||
scheme: String? = MobileWebShellOrigin.scheme,
|
||||
host: String? = session,
|
||||
port: Int? = nil,
|
||||
user: String? = nil,
|
||||
query: String? = nil,
|
||||
fragment: String? = nil,
|
||||
urlByteCount: Int = 64
|
||||
) -> MobileWebShellRequestParts {
|
||||
MobileWebShellRequestParts(
|
||||
method: method,
|
||||
hasRangeHeader: hasRangeHeader,
|
||||
scheme: scheme,
|
||||
host: host,
|
||||
port: port,
|
||||
user: user,
|
||||
query: query,
|
||||
fragment: fragment,
|
||||
percentEncodedPath: path,
|
||||
urlByteCount: urlByteCount
|
||||
)
|
||||
}
|
||||
|
||||
static func resolve(_ request: MobileWebShellRequestParts) -> String? {
|
||||
MobileWebShellOrigin.resolveRequestPath(request, sessionId: session)
|
||||
}
|
||||
|
||||
static func manifest(
|
||||
schemaVersion: Int = 1,
|
||||
entrypoint: String = "index.html",
|
||||
@@ -68,54 +36,10 @@ import Foundation
|
||||
}
|
||||
|
||||
|
||||
static func checkRequestResolution() {
|
||||
precondition(resolve(parts(path: "/")) == "/")
|
||||
precondition(resolve(parts(path: "")) == "/")
|
||||
precondition(resolve(parts(path: "/assets/aa.js")) == "/assets/aa.js")
|
||||
// A host a parser canonicalised must still bind to this session.
|
||||
precondition(resolve(parts(path: "/", host: session.uppercased())) == "/")
|
||||
|
||||
precondition(resolve(parts(path: "/", method: "POST")) == nil)
|
||||
precondition(resolve(parts(path: "/", method: "HEAD")) == nil)
|
||||
precondition(resolve(parts(path: "/", hasRangeHeader: true)) == nil)
|
||||
precondition(resolve(parts(path: "/", scheme: "https")) == nil)
|
||||
precondition(resolve(parts(path: "/", scheme: nil)) == nil)
|
||||
// Unicode folding would serve assets to unminted Kelvin-sign hosts.
|
||||
precondition(MobileWebShellOrigin.resolveRequestPath(
|
||||
parts(path: "/", host: "\u{212A}ey"),
|
||||
sessionId: "key"
|
||||
) == nil)
|
||||
precondition(MobileWebShellOrigin.resolveRequestPath(
|
||||
parts(path: "/", host: "KEY"),
|
||||
sessionId: "key"
|
||||
) == "/")
|
||||
precondition(resolve(parts(path: "/", host: "other-session")) == nil)
|
||||
precondition(resolve(parts(path: "/", host: nil)) == nil)
|
||||
precondition(resolve(parts(path: "/", port: 443)) == nil)
|
||||
precondition(resolve(parts(path: "/", user: "someone")) == nil)
|
||||
precondition(resolve(parts(path: "/", query: "v=1")) == nil)
|
||||
precondition(resolve(parts(path: "/", fragment: "frag")) == nil)
|
||||
precondition(resolve(parts(path: "/assets/%2e%2e/etc")) == nil)
|
||||
precondition(resolve(parts(path: "assets/aa.js")) == nil)
|
||||
precondition(resolve(parts(path: "/", urlByteCount: 8 * 1024)) == "/")
|
||||
precondition(resolve(parts(path: "/", urlByteCount: 8 * 1024 + 1)) == nil)
|
||||
precondition(MobileWebShellOrigin.resolveRequestPath(parts(path: "/"), sessionId: "") == nil)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static func checkGenerationMap() {
|
||||
guard let built = generation(manifest()) else { preconditionFailure("manifest rejected") }
|
||||
precondition(built.entries.count == 4)
|
||||
precondition(built.entries["/"]?.file.path == "/tmp/generation/index.html")
|
||||
precondition(built.entries["/"]?.contentType == "text/html; charset=utf-8")
|
||||
// Only / may serve document bytes with CSP; no entrypoint alias.
|
||||
precondition(built.entries["/index.html"] == nil)
|
||||
precondition(built.entries["/assets/aa.js"]?.contentType == "text/javascript; charset=utf-8")
|
||||
precondition(built.entries["/assets/bb.png"]?.file.path == "/tmp/generation/assets/bb.png")
|
||||
precondition(built.entries["/manifest.json"]?.contentType == "application/json")
|
||||
precondition(built.entries["/assets/cc.js"] == nil)
|
||||
precondition(built.entries["/../secret"] == nil)
|
||||
|
||||
precondition(generation(manifest(schemaVersion: 2)) == nil)
|
||||
precondition(generation(manifest(entrypoint: "start.html")) == nil)
|
||||
@@ -143,7 +67,6 @@ import Foundation
|
||||
// NSNumber bridges JSON true and 1.0 to Int; neither satisfies the integer-1 contract.
|
||||
precondition(generation(Data(#"{"schemaVersion":true,"entrypoint":"index.html","assets":[{"path":"index.html","contentType":"text/html"}]}"#.utf8)) == nil)
|
||||
precondition(generation(Data(#"{"schemaVersion":1.0,"entrypoint":"index.html","assets":[{"path":"index.html","contentType":"text/html"}]}"#.utf8)) == nil)
|
||||
precondition(generation(Data(#"{"schemaVersion":1,"entrypoint":"index.html","assets":[{"path":"index.html","contentType":"text/html"}]}"#.utf8)) != nil)
|
||||
precondition(generation(Data(#"{"schemaVersion":"1","entrypoint":"index.html","assets":[{"path":"index.html","contentType":"text/html"}]}"#.utf8)) == nil)
|
||||
precondition(generation(Data("not json".utf8)) == nil)
|
||||
precondition(generation(Data("[]".utf8)) == nil)
|
||||
@@ -223,162 +146,9 @@ import Foundation
|
||||
|
||||
|
||||
|
||||
static func bridgeSource(
|
||||
isOurWebView: Bool = true,
|
||||
isMainFrame: Bool = true,
|
||||
hasCommittedDocument: Bool = true,
|
||||
originProtocol: String = MobileWebShellOrigin.scheme,
|
||||
originHost: String = session
|
||||
) -> MobileWebShellBridgeSource {
|
||||
MobileWebShellBridgeSource(
|
||||
isOurWebView: isOurWebView,
|
||||
isMainFrame: isMainFrame,
|
||||
hasCommittedDocument: hasCommittedDocument,
|
||||
originProtocol: originProtocol,
|
||||
originHost: originHost
|
||||
)
|
||||
}
|
||||
|
||||
static func acceptsBridge(_ source: MobileWebShellBridgeSource) -> Bool {
|
||||
MobileWebShellBridge.accepts(source, sessionId: session)
|
||||
}
|
||||
|
||||
|
||||
static func checkBridgeAcceptance() {
|
||||
precondition(acceptsBridge(bridgeSource()))
|
||||
// Simulator: WebKit ASCII-lowercases custom-scheme hosts; exact session comparison refuses every message.
|
||||
precondition(acceptsBridge(bridgeSource(originHost: "sess-01jn_az9")))
|
||||
precondition(acceptsBridge(bridgeSource(originHost: "SESS-01JN_AZ9")))
|
||||
|
||||
// A frame we did not serve.
|
||||
precondition(!acceptsBridge(bridgeSource(originHost: "sess-01JN_aZ8")))
|
||||
precondition(!acceptsBridge(bridgeSource(originHost: "")))
|
||||
precondition(!acceptsBridge(bridgeSource(originHost: "sess-01JN_aZ9.evil")))
|
||||
// Unicode folding would accept unminted Kelvin-sign hosts.
|
||||
precondition(!MobileWebShellBridge.accepts(
|
||||
bridgeSource(originHost: "\u{212A}ey"),
|
||||
sessionId: "key"
|
||||
))
|
||||
precondition(MobileWebShellOrigin.asciiLowercased("\u{212A}EY") == "\u{212A}ey")
|
||||
|
||||
// Another scheme reaching the same handler.
|
||||
precondition(!acceptsBridge(bridgeSource(originProtocol: "https")))
|
||||
precondition(!acceptsBridge(bridgeSource(originProtocol: "")))
|
||||
precondition(!acceptsBridge(bridgeSource(originProtocol: "orca-mobile-web ")))
|
||||
|
||||
// A subframe, and a message routed to a WebView that is not ours.
|
||||
precondition(!acceptsBridge(bridgeSource(isMainFrame: false)))
|
||||
precondition(!acceptsBridge(bridgeSource(isOurWebView: false)))
|
||||
|
||||
// The replaced same-origin document remains alive until the new load commits.
|
||||
precondition(!acceptsBridge(bridgeSource(hasCommittedDocument: false)))
|
||||
|
||||
// No applied session is not an empty one: nothing may be accepted before a load.
|
||||
precondition(!MobileWebShellBridge.accepts(bridgeSource(originHost: ""), sessionId: ""))
|
||||
precondition(!MobileWebShellBridge.accepts(bridgeSource(originHost: "a b"), sessionId: "a b"))
|
||||
}
|
||||
|
||||
static func checkBridgePostTarget() {
|
||||
func canPost(
|
||||
_ host: String?,
|
||||
_ sessionId: String = session,
|
||||
committed: Bool = true
|
||||
) -> Bool {
|
||||
MobileWebShellBridge.canPost(
|
||||
toFrameOriginHost: host,
|
||||
sessionId: sessionId,
|
||||
hasCommittedDocument: committed
|
||||
)
|
||||
}
|
||||
|
||||
precondition(canPost(session))
|
||||
// The same ASCII fold as acceptance: WebKit reports the host lowercased.
|
||||
precondition(canPost("sess-01jn_az9"))
|
||||
|
||||
// Never post without an accepted frame: before first message, after failure/death, or with bridge disabled.
|
||||
precondition(!canPost(nil))
|
||||
|
||||
// A frame from another document, and a frame under no session at all.
|
||||
precondition(!canPost("sess-01JN_aZ8"))
|
||||
precondition(!canPost("\u{212A}ey", "key"))
|
||||
precondition(!canPost(session, ""))
|
||||
precondition(!canPost("", ""))
|
||||
|
||||
// Provisional navigation invalidates the held frame until commit.
|
||||
precondition(!canPost(session, committed: false))
|
||||
}
|
||||
|
||||
|
||||
// One allow/opener decision; TypeScript’s readBridgeExternalLinkUrl owns scheme filtering.
|
||||
static func checkNavigationVerdict() {
|
||||
let foreign = "https://example.com/artifact-link"
|
||||
let document = "orca-mobile-web://\(session)/"
|
||||
func verdict(
|
||||
_ url: String? = "https://example.com/artifact-link",
|
||||
isMainFrame: Bool = true,
|
||||
isDocumentUrl: Bool = false,
|
||||
isShellLoad: Bool = false,
|
||||
hasGesture: Bool = true,
|
||||
isDownload: Bool = false
|
||||
) -> MobileWebShellNavigationVerdict {
|
||||
MobileWebShellNavigationPolicy.verdict(
|
||||
url: url,
|
||||
isMainFrame: isMainFrame,
|
||||
isDocumentUrl: isDocumentUrl,
|
||||
isShellLoad: isShellLoad,
|
||||
hasGesture: hasGesture,
|
||||
isDownload: isDownload
|
||||
)
|
||||
}
|
||||
precondition(verdict() == .cancelAndOffer(foreign))
|
||||
// WebKit reports our own load with main-frame source and target.
|
||||
precondition(verdict(document, isDocumentUrl: true, isShellLoad: true, hasGesture: false) == .allow)
|
||||
// Never offer/reload other document-URL navigations; sandboxed top navigation can report no gesture.
|
||||
precondition(verdict(document, isDocumentUrl: true, hasGesture: false) == .cancel)
|
||||
precondition(verdict(document, isDocumentUrl: true, hasGesture: true) == .cancel)
|
||||
// Refuse non-shell document loads from page or preview frames.
|
||||
precondition(verdict(document, isDocumentUrl: true, isShellLoad: false, hasGesture: false) == .cancel)
|
||||
// A top-page meta refresh or a redirect to somewhere else: refused, and never opened.
|
||||
precondition(verdict(hasGesture: false) == .cancel)
|
||||
// Gestured downloads reach the opener, never the document-load allowance.
|
||||
precondition(
|
||||
verdict(document, isDocumentUrl: true, isShellLoad: true, hasGesture: false, isDownload: true)
|
||||
== .cancel
|
||||
)
|
||||
precondition(verdict(isDownload: true) == .cancelAndOffer(foreign))
|
||||
// Document-URL downloads are never offered, regardless of gesture.
|
||||
precondition(verdict(document, isDocumentUrl: true, isDownload: true) == .cancel)
|
||||
// A foreign-URL subframe is never offered: the user is not leaving the app.
|
||||
precondition(verdict(isMainFrame: false) == .cancel)
|
||||
precondition(verdict(isMainFrame: false, hasGesture: false) == .cancel)
|
||||
// Sealed srcdoc frames (HTML previews, chat visuals) load; no other subframe or top-level srcdoc does.
|
||||
let srcdoc = MobileWebShellNavigationPolicy.inlineDocumentUrl
|
||||
precondition(verdict(srcdoc, isMainFrame: false, hasGesture: false) == .allow)
|
||||
precondition(verdict(srcdoc, isMainFrame: false, isDownload: true) == .cancel)
|
||||
precondition(verdict(srcdoc, hasGesture: false) == .cancel)
|
||||
precondition(verdict("about:blank", isMainFrame: false, hasGesture: false) == .cancel)
|
||||
precondition(verdict(document, isMainFrame: false, isDocumentUrl: true, isShellLoad: true) == .cancel)
|
||||
precondition(verdict(nil) == .cancel)
|
||||
precondition(verdict("") == .cancel)
|
||||
// The crossing cap, at it and one past it.
|
||||
let cap = MobileWebShellNavigationPolicy.maxCancelledNavigationUrlCharacters
|
||||
let prefix = "https://example.com/"
|
||||
let atCap = prefix + String(repeating: "a", count: cap - prefix.count)
|
||||
precondition(atCap.count == cap)
|
||||
precondition(MobileWebShellNavigationPolicy.offerableUrl(atCap) == atCap)
|
||||
precondition(MobileWebShellNavigationPolicy.offerableUrl(atCap + "a") == nil)
|
||||
precondition(verdict(atCap + "a") == .cancel)
|
||||
// A scheme the opener will refuse still crosses: one filter, in the half that updates.
|
||||
precondition(verdict("javascript:alert(1)") == .cancelAndOffer("javascript:alert(1)"))
|
||||
}
|
||||
|
||||
static func main() {
|
||||
checkRequestResolution()
|
||||
checkGenerationMap()
|
||||
checkLoadStateMachine()
|
||||
checkNavigationVerdict()
|
||||
checkBridgeAcceptance()
|
||||
checkBridgePostTarget()
|
||||
print("mobile web shell checks OK")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,6 @@ import Foundation
|
||||
precondition(!restored.contains(identity(1, "qa-host", "qa-epoch", "other"), now: 102))
|
||||
precondition(!restored.contains(identity(1), now: 86501))
|
||||
precondition(PushDismissalIdentity(["hostFingerprint":"h", "notificationId":"n", "notificationEpoch":"e", "notificationSeq":true]) == nil)
|
||||
precondition(restored.containsNotification(payload(1), now: 102))
|
||||
precondition(!restored.containsNotification(payload(3), now: 102))
|
||||
precondition(!restored.containsNotification(payload(1, "other"), now: 102))
|
||||
precondition(!restored.containsNotification(payload(1, "qa-host", "other"), now: 102))
|
||||
precondition(!restored.containsNotification(payload(1, "qa-host", "qa-epoch", "other"), now: 102))
|
||||
precondition(!restored.containsNotification(["hostFingerprint": "qa-host"], now: 102))
|
||||
for hosts in [1, 3] {
|
||||
for index in 0..<520 {
|
||||
ledger.remember(identity(2, "host-\(index % hosts)", "epoch-\(hosts)", "note-\(index)"), now: 200)
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
@main
|
||||
struct RecordingInterruptionIntentTests {
|
||||
static func main() {
|
||||
var intent = RecordingInterruptionIntent()
|
||||
// An idle audio interruption never starts a recording.
|
||||
intent.began(wasRecording: false)
|
||||
precondition(intent.ended(shouldResume: true, isRecording: false) == .blocked)
|
||||
// A still-owned recording resumes once, not again on a duplicate end event.
|
||||
intent.began(wasRecording: true)
|
||||
precondition(intent.ended(shouldResume: true, isRecording: false) == .resume)
|
||||
precondition(intent.ended(shouldResume: true, isRecording: false) == .blocked)
|
||||
// A blocked or missing shouldResume bit consumes the old resume request.
|
||||
intent.began(wasRecording: true)
|
||||
precondition(intent.ended(shouldResume: false, isRecording: false) == .blocked)
|
||||
precondition(intent.ended(shouldResume: true, isRecording: false) == .blocked)
|
||||
// JavaScript cancels capture after began; ended must not turn its microphone back on.
|
||||
intent.began(wasRecording: true)
|
||||
intent.cancel()
|
||||
precondition(intent.ended(shouldResume: true, isRecording: false) == .blocked)
|
||||
// A newer explicit recording must not be cancelled by the old end notification.
|
||||
intent.began(wasRecording: true)
|
||||
intent.cancel()
|
||||
precondition(intent.ended(shouldResume: true, isRecording: true) == .none)
|
||||
// The most recent interruption, even one while idle, replaces old resume intent.
|
||||
intent.began(wasRecording: true)
|
||||
intent.began(wasRecording: false)
|
||||
precondition(intent.ended(shouldResume: true, isRecording: false) == .blocked)
|
||||
print("RecordingInterruptionIntent: 8 assertions passed")
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,8 @@ export function useAgentListRowActions(
|
||||
hostId: row.hostId,
|
||||
worktreeId: row.entry.worktreeId,
|
||||
name: row.entry.workspaceName,
|
||||
// Home's lists span desktops, so Back returns to them rather than to this desktop's list.
|
||||
standalone: true,
|
||||
...(withPane ? { paneKey: row.entry.agent.paneKey } : {})
|
||||
}),
|
||||
[openMobileSession]
|
||||
|
||||
@@ -46,6 +46,8 @@ export type DragReorderListProps<ItemT> = {
|
||||
rowHeight?: number
|
||||
scopeKey?: string
|
||||
rowPresentation?: 'settings' | 'plain'
|
||||
/** A long press anywhere on the row lifts it, not only on its grip. */
|
||||
liftFromRow?: boolean
|
||||
renderRow: (item: ItemT, handle: ReactNode) => ReactNode
|
||||
/** Called with every item key in the new order after a drop changes it. */
|
||||
onReorder?: (orderedKeys: string[]) => void
|
||||
@@ -66,6 +68,7 @@ export function DragReorderList<ItemT>({
|
||||
rowHeight,
|
||||
scopeKey = '',
|
||||
rowPresentation = 'settings',
|
||||
liftFromRow = false,
|
||||
renderRow,
|
||||
onReorder,
|
||||
onMove,
|
||||
@@ -349,6 +352,7 @@ export function DragReorderList<ItemT>({
|
||||
movable={!canMove || canMove(item)}
|
||||
disabled={isMoveDisabled?.(item) ?? false}
|
||||
presentation={rowPresentation}
|
||||
liftFromRow={liftFromRow}
|
||||
onMeasure={onMeasure}
|
||||
shared={shared}
|
||||
scrollOffsetY={scrollOffsetY}
|
||||
|
||||
@@ -55,6 +55,7 @@ export function DragReorderRow({
|
||||
movable,
|
||||
disabled,
|
||||
presentation,
|
||||
liftFromRow = false,
|
||||
onMeasure,
|
||||
shared,
|
||||
scrollOffsetY,
|
||||
@@ -71,6 +72,7 @@ export function DragReorderRow({
|
||||
movable: boolean
|
||||
disabled: boolean
|
||||
presentation: 'settings' | 'plain'
|
||||
liftFromRow?: boolean
|
||||
onMeasure: (key: string, height: number) => void
|
||||
shared: DragSharedState
|
||||
scrollOffsetY: SharedValue<number>
|
||||
@@ -191,43 +193,56 @@ export function DragReorderRow({
|
||||
restingBackground
|
||||
])
|
||||
|
||||
const handle = movable ? (
|
||||
const grip = (
|
||||
<Animated.View
|
||||
style={[styles.handle, presentation === 'plain' && styles.queueHandle]}
|
||||
accessible
|
||||
accessibilityRole="button"
|
||||
accessibilityState={{ disabled }}
|
||||
accessibilityLabel={t('components.dragReorderRow.dragToReorder', 'Drag to reorder')}
|
||||
accessibilityHint={t(
|
||||
'components.dragReorderRow.reorderHint',
|
||||
'Use the move up and move down actions to reorder without dragging'
|
||||
)}
|
||||
accessibilityActions={[
|
||||
{ name: 'moveUp', label: t('components.dragReorderRow.moveUp', 'Move up') },
|
||||
{ name: 'moveDown', label: t('components.dragReorderRow.moveDown', 'Move down') }
|
||||
]}
|
||||
onAccessibilityAction={(event) => {
|
||||
if (disabled) {
|
||||
return
|
||||
}
|
||||
if (event.nativeEvent.actionName === 'moveUp') {
|
||||
onAccessibilityMove(rowKey, -1)
|
||||
} else if (event.nativeEvent.actionName === 'moveDown') {
|
||||
onAccessibilityMove(rowKey, 1)
|
||||
}
|
||||
}}
|
||||
hitSlop={{
|
||||
top: 8,
|
||||
bottom: 8,
|
||||
left: 8,
|
||||
right: presentation === 'plain' ? 24 : 8
|
||||
}}
|
||||
>
|
||||
<GripVertical size={18} color={colors.textMuted} />
|
||||
</Animated.View>
|
||||
)
|
||||
// Lifting from the whole row puts the one gesture there; the grip then only shows and moves by actions.
|
||||
// Only the plain row carries the row gesture; a settings row keeps it on the grip.
|
||||
const rowLifts = liftFromRow && movable && presentation === 'plain'
|
||||
const handle = !movable ? null : rowLifts ? (
|
||||
grip
|
||||
) : (
|
||||
<GestureDetector gesture={pan}>{grip}</GestureDetector>
|
||||
)
|
||||
const plainContent = rowLifts ? (
|
||||
<GestureDetector gesture={pan}>
|
||||
<Animated.View
|
||||
style={[styles.handle, presentation === 'plain' && styles.queueHandle]}
|
||||
accessible
|
||||
accessibilityRole="button"
|
||||
accessibilityState={{ disabled }}
|
||||
accessibilityLabel={t('components.dragReorderRow.dragToReorder', 'Drag to reorder')}
|
||||
accessibilityHint={t(
|
||||
'components.dragReorderRow.reorderHint',
|
||||
'Use the move up and move down actions to reorder without dragging'
|
||||
)}
|
||||
accessibilityActions={[
|
||||
{ name: 'moveUp', label: t('components.dragReorderRow.moveUp', 'Move up') },
|
||||
{ name: 'moveDown', label: t('components.dragReorderRow.moveDown', 'Move down') }
|
||||
]}
|
||||
onAccessibilityAction={(event) => {
|
||||
if (disabled) {
|
||||
return
|
||||
}
|
||||
if (event.nativeEvent.actionName === 'moveUp') {
|
||||
onAccessibilityMove(rowKey, -1)
|
||||
} else if (event.nativeEvent.actionName === 'moveDown') {
|
||||
onAccessibilityMove(rowKey, 1)
|
||||
}
|
||||
}}
|
||||
hitSlop={{
|
||||
top: 8,
|
||||
bottom: 8,
|
||||
left: 8,
|
||||
right: presentation === 'plain' ? 24 : 8
|
||||
}}
|
||||
>
|
||||
<GripVertical size={18} color={colors.textMuted} />
|
||||
</Animated.View>
|
||||
<View collapsable={false}>{renderContent(handle)}</View>
|
||||
</GestureDetector>
|
||||
) : null
|
||||
) : (
|
||||
renderContent(handle)
|
||||
)
|
||||
return (
|
||||
<Animated.View
|
||||
onLayout={(event) => onMeasure(rowKey, event.nativeEvent.layout.height)}
|
||||
@@ -239,7 +254,7 @@ export function DragReorderRow({
|
||||
]}
|
||||
>
|
||||
{presentation === 'plain' ? (
|
||||
renderContent(handle)
|
||||
plainContent
|
||||
) : (
|
||||
<>
|
||||
<View style={styles.rowContent}>{renderContent(handle)}</View>
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
OctagonAlert,
|
||||
TriangleAlert
|
||||
} from 'lucide-react-native'
|
||||
import type { GitHubCalloutKind } from '../../../src/shared/github/github-callouts'
|
||||
import type { GitHubCalloutKind } from '../../../src/shared/github/markdown/github-callouts'
|
||||
import { translate } from '../i18n/mobile-i18n'
|
||||
import { styles } from './mobile-markdown-styles'
|
||||
import { colors } from '../theme/mobile-theme'
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { parseMobileMarkdownTree } from './mobile-markdown-tree'
|
||||
|
||||
const blocks = (source: string) => parseMobileMarkdownTree(source, false).children
|
||||
|
||||
describe('GitHub syntax in mobile Markdown', () => {
|
||||
it('draws an https <img> at its authored width and leaves icons out', () => {
|
||||
expect(
|
||||
blocks(
|
||||
'<p align="center"><img width="300" alt="shot" src="https://example.com/a.png"></p>\n\n' +
|
||||
'Minor <img src="https://example.com/icon.svg" width="16" alt="">'
|
||||
)
|
||||
).toEqual([
|
||||
{
|
||||
type: 'paragraph',
|
||||
children: [
|
||||
{ type: 'image', url: 'https://example.com/a.png', alt: 'shot', data: { width: 300 } }
|
||||
]
|
||||
},
|
||||
{ type: 'paragraph', children: [{ type: 'text', value: 'Minor ' }] }
|
||||
])
|
||||
})
|
||||
})
|
||||
@@ -53,10 +53,6 @@ describe('text growing a character at a time', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('joins a line that stops being a heading to the paragraph above', () => {
|
||||
expect(grown('para\n#x')).toEqual([paragraph('para\n#x')])
|
||||
})
|
||||
|
||||
it('makes one math block once a display formula closes past a blank line', () => {
|
||||
expect(grown('$$\nx\n\ny\n$$')).toEqual([
|
||||
{ type: 'math', value: 'x\n\ny', source: '$$\nx\n\ny\n$$' }
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user