mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
Merge current main for CI guard reset
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo 'Usage: install-ubuntu-apt-packages.sh <package>...' >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
bash "$(dirname "${BASH_SOURCE[0]}")/prepare-ubuntu-apt.sh"
|
||||
|
||||
# Bound both routes while allowing large fallback downloads.
|
||||
# Run deadlines as root so sudo cannot leave apt in a separate session.
|
||||
if sudo timeout --kill-after=10s 45 apt-get update -o Acquire::Languages=none && sudo timeout --kill-after=10s 120 apt-get install -y "$@"; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo 'Ubuntu package setup failed; trying the same packages through the MIT mirror.' >&2
|
||||
for host in archive.ubuntu.com ports.ubuntu.com mirrors.mit.edu; do
|
||||
timeout 5 getent ahosts "$host" || true
|
||||
done
|
||||
|
||||
bash "$(dirname "${BASH_SOURCE[0]}")/use-ubuntu-apt-mirror.sh"
|
||||
bash "$(dirname "${BASH_SOURCE[0]}")/recover-ubuntu-dpkg.sh" || true
|
||||
# Unrelated repositories may fail refresh; apt still verifies the requested packages.
|
||||
if ! sudo timeout --kill-after=10s 120 apt-get update -o Acquire::Languages=none; then
|
||||
echo 'Index refresh incomplete; attempting the requested packages with available authenticated indexes.' >&2
|
||||
fi
|
||||
sudo timeout --kill-after=10s 600 apt-get install -y "$@"
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# A timed-out apt frontend can leave dpkg running in a separate session.
|
||||
sudo timeout --kill-after=10s 30 bash -euo pipefail -c '
|
||||
while lslocks --noheadings --raw --notruncate --output PATH | grep -E "^/var/lib/dpkg/lock(-frontend)?$" >/dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
dpkg --configure -a
|
||||
'
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Change repository locations while retaining suites, architectures and signing keys.
|
||||
for source in /etc/apt/apt-mirrors.txt /etc/apt/sources.list /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources; do
|
||||
if [ -f "$source" ]; then
|
||||
sudo sed -i -E \
|
||||
-e 's#https?://(azure\.archive|archive|security)\.ubuntu\.com/ubuntu#https://mirrors.mit.edu/ubuntu#g' \
|
||||
-e 's#https?://ports\.ubuntu\.com/ubuntu-ports#https://mirrors.mit.edu/ubuntu-ports#g' \
|
||||
"$source"
|
||||
fi
|
||||
done
|
||||
@@ -93,16 +93,10 @@ jobs:
|
||||
pnpm vitest run --config config/vitest.config.ts
|
||||
config/scripts/performance/macos-computer-owner/macos-computer-helper-owner-loss-group-recovery.test.mjs
|
||||
config/scripts/performance/macos-computer-owner/macos-computer-helper-owner-loss-processes.test.mjs
|
||||
src/main/computer/sidecar-client.test.ts
|
||||
src/main/computer/macos-native-provider-client.test.ts
|
||||
src/main/computer/macos-native-provider-socket.test.ts
|
||||
src/main/computer/macos-computer-use-permissions.test.ts
|
||||
src/main/computer/macos-computer-use-permission-status.test.ts
|
||||
src/main/computer/sidecar-transport/sidecar-client.test.ts
|
||||
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-provider-actions.test.ts
|
||||
src/main/computer/desktop-script-provider-cache-lifecycle.test.ts
|
||||
src/main/computer/desktop-script-provider-errors.test.ts
|
||||
src/main/computer/desktop-script-provider-action-errors.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
|
||||
|
||||
@@ -27,23 +27,6 @@ env:
|
||||
BASELINE_SHA: 030c88deecf3adc212d22f57b085e4bd5c6e48e6
|
||||
|
||||
jobs:
|
||||
contract:
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.draft != true
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 180
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- run: python -m unittest discover -s config/benchmarks/computer-use -p 'test_*.py'
|
||||
|
||||
linux:
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.draft != true
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -123,6 +123,10 @@ jobs:
|
||||
exit 0
|
||||
fi
|
||||
read -r -a packages <<< "$ORCA_E2E_APT_PACKAGES"
|
||||
if [ -f .github/scripts/install-ubuntu-apt-packages.sh ]; then
|
||||
bash .github/scripts/install-ubuntu-apt-packages.sh "${packages[@]}"
|
||||
exit 0
|
||||
fi
|
||||
if [ -f .github/scripts/prepare-ubuntu-apt.sh ]; then
|
||||
bash .github/scripts/prepare-ubuntu-apt.sh
|
||||
else
|
||||
@@ -483,6 +487,15 @@ jobs:
|
||||
retention-days: 14
|
||||
if-no-files-found: warn
|
||||
|
||||
- name: Upload parked split visual proof
|
||||
if: always() && contains(inputs.test_files, 'tests/e2e/terminal-parked-cli-split.spec.ts')
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: parked-split-proof-${{ strategy.job-index }}${{ inputs.artifact_suffix }}-attempt-${{ github.run_attempt }}
|
||||
path: test-results/**/parked-cli-split-*.png
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Upload Playwright traces
|
||||
if: failure() || cancelled()
|
||||
uses: actions/upload-artifact@v7
|
||||
@@ -529,7 +542,12 @@ jobs:
|
||||
ref: ${{ inputs.ref || github.ref }}
|
||||
persist-credentials: false
|
||||
- name: Install headless tools
|
||||
run: sudo apt-get update && sudo apt-get install -y build-essential ripgrep xvfb openbox x11-utils
|
||||
run: &install_headless_tools |
|
||||
if [ -f .github/scripts/install-ubuntu-apt-packages.sh ]; then
|
||||
bash .github/scripts/install-ubuntu-apt-packages.sh build-essential ripgrep xvfb openbox x11-utils
|
||||
else
|
||||
sudo apt-get update && sudo apt-get install -y build-essential ripgrep xvfb openbox x11-utils
|
||||
fi
|
||||
- uses: ./.github/actions/install-node-dependencies
|
||||
with:
|
||||
native-runtime: electron
|
||||
@@ -636,7 +654,7 @@ jobs:
|
||||
- name: Fetch the 1.4.224 relay sources
|
||||
run: git fetch --no-tags --depth=1 origin +refs/tags/v1.4.224:refs/tags/v1.4.224
|
||||
- name: Install headless tools
|
||||
run: sudo apt-get update && sudo apt-get install -y build-essential ripgrep xvfb openbox x11-utils
|
||||
run: *install_headless_tools
|
||||
- uses: ./.github/actions/install-node-dependencies
|
||||
with:
|
||||
native-runtime: electron
|
||||
|
||||
@@ -70,7 +70,6 @@ jobs:
|
||||
- name: Run golden E2E tests on Linux
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
xvfb-run --auto-servernum env SKIP_BUILD=1 ORCA_E2E_FORWARD_APP_LOGS=1 pnpm run test:e2e tests/e2e/golden-core-flows.spec.ts
|
||||
xvfb-run --auto-servernum env SKIP_BUILD=1 ORCA_E2E_FORWARD_APP_LOGS=1 pnpm run --if-present test:e2e:workspace-session-golden
|
||||
if [ -f tests/e2e/golden-fresh-profile-terminal.spec.ts ]; then
|
||||
xvfb-run --auto-servernum env SKIP_BUILD=1 ORCA_E2E_FORWARD_APP_LOGS=1 pnpm run test:e2e tests/e2e/golden-fresh-profile-terminal.spec.ts tests/e2e/golden-shell-command.spec.ts
|
||||
@@ -84,7 +83,6 @@ jobs:
|
||||
- name: Run golden E2E tests on macOS
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
env SKIP_BUILD=1 ORCA_E2E_FORWARD_APP_LOGS=1 pnpm run test:e2e tests/e2e/golden-core-flows.spec.ts
|
||||
env SKIP_BUILD=1 ORCA_E2E_FORWARD_APP_LOGS=1 pnpm run --if-present test:e2e:workspace-session-golden
|
||||
if [ -f tests/e2e/golden-fresh-profile-terminal.spec.ts ]; then
|
||||
env SKIP_BUILD=1 ORCA_E2E_FORWARD_APP_LOGS=1 pnpm run test:e2e tests/e2e/golden-fresh-profile-terminal.spec.ts tests/e2e/golden-shell-command.spec.ts
|
||||
|
||||
@@ -27,7 +27,6 @@ on:
|
||||
- 'src/main/runtime/agent-session/agent-session-account-*.ts'
|
||||
- 'src/main/runtime/agent-session/agent-session-acquisition-*.ts'
|
||||
- 'src/main/runtime/agent-session/agent-session-conversation-*.ts'
|
||||
- 'src/main/runtime/agent-session/agent-session-death-*.ts'
|
||||
- 'src/main/runtime/agent-session/agent-session-launch-*.ts'
|
||||
- 'src/main/runtime/agent-session/agent-session-operation-*.ts'
|
||||
- 'src/main/runtime/agent-session/agent-session-rewind-*.ts'
|
||||
@@ -116,7 +115,6 @@ on:
|
||||
- 'src/main/runtime/agent-session/agent-session-account-*.ts'
|
||||
- 'src/main/runtime/agent-session/agent-session-acquisition-*.ts'
|
||||
- 'src/main/runtime/agent-session/agent-session-conversation-*.ts'
|
||||
- 'src/main/runtime/agent-session/agent-session-death-*.ts'
|
||||
- 'src/main/runtime/agent-session/agent-session-launch-*.ts'
|
||||
- 'src/main/runtime/agent-session/agent-session-operation-*.ts'
|
||||
- 'src/main/runtime/agent-session/agent-session-rewind-*.ts'
|
||||
|
||||
@@ -20,18 +20,12 @@ on:
|
||||
# without these a rename lands green and only breaks the next nightly.
|
||||
- 'src/main/runtime/session-tabs/session-tabs-phone-layout-moves.test.ts'
|
||||
- 'src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-terminal-writer-acquire.test.ts'
|
||||
- 'src/shared/agent-launch/permissions/tui-agent-permission-choice.test.ts'
|
||||
- 'src/main/runtime/rpc/methods/projects/repo.test.ts'
|
||||
- 'src/renderer/src/components/tab-bar/use-new-tab-agent-menu-host-preferences.test.tsx'
|
||||
- 'src/main/sqlite/sync-database.test.ts'
|
||||
- 'src/main/runtime/orchestration/db/row-column-lists.test.ts'
|
||||
- 'src/main/codex-usage/codex-rollout-file-lifetime.test.ts'
|
||||
- 'src/main/codex-usage/scanner-incremental-append.test.ts'
|
||||
- 'src/main/usage/jsonl-file-reader.test.ts'
|
||||
- 'src/main/usage/jsonl-file-snapshot.test.ts'
|
||||
- 'src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler-queue-retention.test.ts'
|
||||
- 'src/main/usage/source-input/jsonl/jsonl-file-reader.test.ts'
|
||||
- 'src/main/claude-usage/scanner-incremental-append.test.ts'
|
||||
- 'src/main/claude-usage/store-checkpoint-persistence.test.ts'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -5,7 +5,7 @@ on:
|
||||
paths:
|
||||
- 'src/shared/source-control/ai/generation/commit-message-agent-specs-primary.ts'
|
||||
- 'tests/tools/pi-provider-runtime-smoke.mjs'
|
||||
- 'src/main/pi/rpc-history-*.ts'
|
||||
- 'src/main/pi/rpc/history/rpc-history-*.ts'
|
||||
- '.github/workflows/pi-provider-runtime.yml'
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
+17
-11
@@ -512,6 +512,10 @@ jobs:
|
||||
if: needs.code_paths.outputs.static_analysis == 'true'
|
||||
run: bun config/scripts/localization/source-extraction/audit-localization-coverage.mjs --check
|
||||
|
||||
- name: Verify startup and worktree localization coverage
|
||||
if: needs.code_paths.outputs.static_analysis == 'true'
|
||||
run: bun run verify:startup-worktree-localization-coverage
|
||||
|
||||
- name: Verify mobile localization
|
||||
if: needs.code_paths.outputs.static_analysis == 'true'
|
||||
run: bun config/scripts/localization/catalog-validation/verify-mobile-localization.mjs
|
||||
@@ -786,15 +790,7 @@ jobs:
|
||||
id: shells
|
||||
background: true
|
||||
run: |
|
||||
# Per-connection limits complement the whole-command apt deadlines below.
|
||||
sudo tee /etc/apt/apt.conf.d/99-orca-shell-contracts >/dev/null <<'APTCONF'
|
||||
Acquire::http::Timeout "15";
|
||||
Acquire::https::Timeout "15";
|
||||
Acquire::Retries "1";
|
||||
APTCONF
|
||||
# Unrelated runner repositories may fail refresh; installing zsh must still succeed.
|
||||
timeout 120 sudo apt-get update || true
|
||||
timeout 300 sudo apt-get install -y zsh
|
||||
bash .github/scripts/install-ubuntu-apt-packages.sh zsh
|
||||
# A fixed 4.x release meets the contract without tracking package-repository updates.
|
||||
case "$(uname -m)" in
|
||||
aarch64) arch=aarch64 sha=57349f0111728c64b703a84e611aa97ff4d1fa8466385d64e67bd5bc3ffa49fc ;;
|
||||
@@ -932,7 +928,18 @@ jobs:
|
||||
background: true
|
||||
run: |
|
||||
bash .github/scripts/prepare-ubuntu-apt.sh
|
||||
pnpm exec playwright-core install --with-deps webkit
|
||||
if [ ! -f .github/scripts/use-ubuntu-apt-mirror.sh ]; then
|
||||
pnpm exec playwright-core install --with-deps webkit
|
||||
exit 0
|
||||
fi
|
||||
echo 'Installing WebKit dependencies through the primary route.'
|
||||
if ! sudo env "PATH=$PATH" timeout --kill-after=10s 240 ./node_modules/.bin/playwright-core install-deps webkit; then
|
||||
echo 'Dependency installation did not complete; retrying with the Ubuntu mirror fallback.'
|
||||
bash .github/scripts/use-ubuntu-apt-mirror.sh
|
||||
bash .github/scripts/recover-ubuntu-dpkg.sh || true
|
||||
sudo env "PATH=$PATH" timeout --kill-after=10s 600 ./node_modules/.bin/playwright-core install-deps webkit
|
||||
fi
|
||||
timeout --kill-after=10s 180 pnpm exec playwright-core install webkit
|
||||
|
||||
# The entry lives in mobile/ so one React resolves; without this every RN import is nothing.
|
||||
- uses: ./.github/actions/install-mobile-dependencies
|
||||
@@ -1106,7 +1113,6 @@ jobs:
|
||||
xvfb-run --auto-servernum pnpm exec vitest run --config config/vitest.config.ts
|
||||
--no-file-parallelism
|
||||
src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts
|
||||
src/main/persistence/profile-state/profile-state-writer-stall.electron.test.ts
|
||||
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
|
||||
|
||||
@@ -62,7 +62,6 @@ on:
|
||||
- 'src/shared/shell/launch/shell-argument-quoting.ts'
|
||||
- '!src/**/*.test.ts'
|
||||
- 'src/main/managed-server/host-state/orcad-windows-host-lane.test.ts'
|
||||
- 'tests/e2e/ssh-orcad-auto-convert.spec.ts'
|
||||
- 'tests/e2e/helpers/orcad-convert-host.ts'
|
||||
- 'tests/e2e/helpers/orcad-convert-flow.ts'
|
||||
- 'tests/e2e/helpers/orcad-upgrade-profile.ts'
|
||||
@@ -78,7 +77,7 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
cells:
|
||||
description: Comma-separated cell ids from src/main/ssh/hostile-host-test-support/ssh-windows-host-cells.ts; empty runs the default set (orcad-cli-* cells run only when named).
|
||||
description: Comma-separated cells orcad-cmd, orcad-powershell, or orcad-cli-managed; empty runs the two shell cells.
|
||||
required: false
|
||||
default: ''
|
||||
preparation_mode:
|
||||
@@ -144,7 +143,7 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
# Keep complete server/test trees; missing future imports fail the unchanged builds.
|
||||
# All of src: the orcad-convert cell builds the full e2e app and the bundled CLI.
|
||||
# All of src: the managed CLI cell builds the full e2e app and bundled CLI.
|
||||
# mobile: the template ships the mobile web page, which builds from mobile/.
|
||||
# cloud: config/tsconfig.vitest-transform.json references the cloud projects, so vitest needs them.
|
||||
sparse-checkout: |
|
||||
@@ -242,10 +241,8 @@ jobs:
|
||||
New-Item -ItemType Directory -Force -Path $receipts | Out-Null
|
||||
$cells=@($env:CELLS -split ',' | ForEach-Object {$_.Trim()} | Where-Object {$_})
|
||||
if(-not $cells.Count){$cells=@('orcad-cmd','orcad-powershell')}
|
||||
# One Windows host runs the app-level conversion; it is last because it switches native modules.
|
||||
if(-not $env:CELLS -and '${{ matrix.arch }}' -eq 'x64' -and '${{ matrix.server }}' -eq 'inbox'){$cells+='orcad-convert'}
|
||||
# App cells reach the managed server through an SSH local forward, which provisioning grants to the last accounts only.
|
||||
$appCellIds=@('orcad-convert','orcad-cli-managed','orcad-cli-convert')
|
||||
$appCellIds=@('orcad-cli-managed')
|
||||
$cells=@($cells | Where-Object {$appCellIds -notcontains $_})+@($cells | Where-Object {$appCellIds -contains $_})
|
||||
$forwarding=@($cells | Where-Object {$appCellIds -contains $_}).Count
|
||||
$archive=''
|
||||
|
||||
@@ -35,7 +35,6 @@ on:
|
||||
- '!**/*.test.ts'
|
||||
- '!**/*.test.tsx'
|
||||
- 'src/main/wsl/orcad/wsl-orcad-real-distro-lane.test.ts'
|
||||
- 'src/main/persistence/moving-wsl-projects/wsl-move-real-pause.test.ts'
|
||||
- 'src/main/wsl/orcad/wsl-orcad-real-distro-idle-release-lane.test.ts'
|
||||
- '.github/workflows/wsl-orcad-e2e.yml'
|
||||
- 'config/ci/wsl-lifecycle/**'
|
||||
@@ -343,20 +342,8 @@ jobs:
|
||||
run: |
|
||||
node node_modules/vitest/vitest.mjs run --config config/vitest.config.ts src/main/wsl/orcad/wsl-orcad-real-distro-lane.test.ts --reporter=verbose 2>&1 | Tee-Object (Join-Path $env:ORCA_WSL_ORCAD_LANE_RECEIPTS 'survive.log')
|
||||
if ($global:LASTEXITCODE -ne 0) { throw "survive phase failed: $global:LASTEXITCODE" }
|
||||
# The WSL move's pause on real distro shells: Sleep ends them, the daemon proves the exit,
|
||||
# the journal keeps each pane's folder, and a new shell opens there.
|
||||
- name: 'WSL move: pause real distro terminals'
|
||||
if: ${{ !cancelled() && steps.import.outcome == 'success' }}
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
ORCA_WSL_MOVE_REAL_PAUSE_DISTRO: ${{ env.PLAIN_DISTRO }}
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force $env:ORCA_WSL_ORCAD_LANE_RECEIPTS | Out-Null
|
||||
node node_modules/vitest/vitest.mjs run --config config/vitest.config.ts src/main/persistence/moving-wsl-projects/wsl-move-real-pause.test.ts --reporter=verbose 2>&1 | Tee-Object (Join-Path $env:ORCA_WSL_ORCAD_LANE_RECEIPTS 'wsl-move-real-pause.log')
|
||||
if ($global:LASTEXITCODE -ne 0) { throw "WSL move real pause failed: $global:LASTEXITCODE" }
|
||||
wsl.exe --terminate $env:PLAIN_DISTRO
|
||||
# R40: with no terminal left, orcad idle-exits and the holder lets the distro stop on its own.
|
||||
- name: 'Phase 3: idle orcad releases the distro; distro restart to first output baseline'
|
||||
- name: 'Phase 3: idle orcad releases the distro'
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
ORCA_RUN_WSL_ORCAD_LANE: '1'
|
||||
|
||||
@@ -121,6 +121,9 @@ validation-screenshots/
|
||||
test-results/
|
||||
playwright-report/
|
||||
|
||||
# Claude Code settings are machine-local.
|
||||
**/.claude/settings.local.json
|
||||
|
||||
# Agent skills are installed per machine.
|
||||
/.claude/skills/
|
||||
/.agents/skills/
|
||||
|
||||
+3
-3
@@ -79,7 +79,7 @@
|
||||
{
|
||||
"name": "@linear/sdk",
|
||||
"allowTypeImports": true,
|
||||
"message": "Value-importing @linear/sdk hoists its ~2.6MB CJS bundle into the eager top-level require block and defeats the lazy loader. Use `import type` plus loadLinearSdk() from src/main/linear/linear-sdk.ts."
|
||||
"message": "Value-importing @linear/sdk hoists its ~2.6MB CJS bundle into the eager top-level require block and defeats the lazy loader. Use `import type` plus loadLinearSdk() from src/main/linear/requests/linear-sdk.ts."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -129,7 +129,7 @@
|
||||
{
|
||||
"name": "@linear/sdk",
|
||||
"allowTypeImports": true,
|
||||
"message": "Value-importing @linear/sdk hoists its ~2.6MB CJS bundle into the eager top-level require block and defeats the lazy loader. Use `import type` plus loadLinearSdk() from src/main/linear/linear-sdk.ts."
|
||||
"message": "Value-importing @linear/sdk hoists its ~2.6MB CJS bundle into the eager top-level require block and defeats the lazy loader. Use `import type` plus loadLinearSdk() from src/main/linear/requests/linear-sdk.ts."
|
||||
},
|
||||
{
|
||||
"name": "ssh2",
|
||||
@@ -228,7 +228,7 @@
|
||||
{
|
||||
"name": "@linear/sdk",
|
||||
"allowTypeImports": true,
|
||||
"message": "Value-importing @linear/sdk hoists its ~2.6MB CJS bundle into the eager top-level require block and defeats the lazy loader. Use `import type` plus loadLinearSdk() from src/main/linear/linear-sdk.ts."
|
||||
"message": "Value-importing @linear/sdk hoists its ~2.6MB CJS bundle into the eager top-level require block and defeats the lazy loader. Use `import type` plus loadLinearSdk() from src/main/linear/requests/linear-sdk.ts."
|
||||
},
|
||||
{
|
||||
"name": "ssh2",
|
||||
|
||||
@@ -292,11 +292,9 @@ Pair with your desktop app to monitor and steer your agents from your phone.
|
||||
|
||||
- **Discord:** Join the community on **[Discord](https://discord.gg/fzjDKHxv8Q)**.
|
||||
- **Twitter / X:** Follow **[@orca_build](https://x.com/orca_build)** for updates and announcements.
|
||||
- **WeChat:** Scan to join an Orca community WeChat group. If one group is full, join another.
|
||||
- **WeChat:** Scan to join an Orca community WeChat group.
|
||||
|
||||
<img src="docs/assets/wechat-qr-group14.jpg" alt="WeChat QR code for the Orca community" width="160" />
|
||||
<img src="docs/assets/wechat-qr-group15.jpg" alt="WeChat QR code for the Orca community" width="160" />
|
||||
<img src="docs/assets/wechat-qr-group16.jpg" alt="WeChat QR code for the Orca community" width="160" />
|
||||
<img src="docs/assets/wechat-qr.jpg" alt="WeChat QR code for the Orca community" width="160" />
|
||||
|
||||
- **Feedback & Ideas:** We ship fast. Missing something? [Request a new feature](https://github.com/stablyai/orca/issues).
|
||||
- **Privacy:** See the [privacy & telemetry docs](https://www.onorca.dev/docs/telemetry) for what anonymous usage data Orca collects and how to opt out.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Later run-all.ts checks against the same host: rebind, orphan grace, silence,
|
||||
// forced resets and pre-upgrade refusals.
|
||||
// forced resets.
|
||||
import WebSocket from 'ws'
|
||||
import { GRACE_MS, ORIGIN, PING_MS, PORT, SILENCE_MS, makeControl, openPhone, record, sleep, waitFor, type Ctx, type Control } from './run-all-harness'
|
||||
|
||||
@@ -89,12 +89,4 @@ export async function runLifecycleChecks(ctx: Ctx, main: Control, mainAck: Ack):
|
||||
back.client.closeNow()
|
||||
}
|
||||
|
||||
// Bad JWT -> 401 before upgrade; malformed host id -> 429.
|
||||
{
|
||||
const bad = new WebSocket(`ws://127.0.0.1:${PORT}/v1/host/control`, { headers: { authorization: 'Bearer nope' } })
|
||||
const status = await new Promise<number>((res) => bad.on('unexpected-response', (_q, r) => res(r.statusCode ?? 0)))
|
||||
const badHost = new WebSocket(`ws://127.0.0.1:${PORT}/v1/connect/short`)
|
||||
const s2 = await new Promise<number>((res) => badHost.on('unexpected-response', (_q, r) => res(r.statusCode ?? 0)))
|
||||
record('R11/R5 ES256 JWKS rejects bad token (401); malformed host id 429', status === 401 && s2 === 429, `${status},${s2}`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,11 +100,6 @@ async function runTests(ctx: Ctx): Promise<void> {
|
||||
const mainAck = await main.client.connect()
|
||||
const transport = main.bindTransport(mainAck.generation)
|
||||
|
||||
// Alarm-driven app ping, answered by the shipped client's pong handler.
|
||||
await sleep(PING_MS * 3 + 300)
|
||||
record('R2/R5 alarm-driven JSON ping parsed by shipped client, pong keeps control alive',
|
||||
main.events.pings >= 2 && main.client.isLive(), `pings=${main.events.pings} live=${main.client.isLive()}`)
|
||||
|
||||
// Phone connect -> conn-open (strict, shipped parser) -> host data -> relay-hello (shipped parser).
|
||||
const phone = openPhone(ctx)
|
||||
const helloOk = await waitFor(() => phone.hello !== null, 5000)
|
||||
|
||||
@@ -45,6 +45,9 @@ export type ControlAttachment = {
|
||||
clientKeepalive?: boolean
|
||||
// A keepalive control found silent: one relay ping sent at this time (see probeSilentControls).
|
||||
probeAt?: number
|
||||
// Upgrade and activation times, for metrics (absent on attachments from before these fields).
|
||||
openedAt?: number
|
||||
activeAt?: number
|
||||
}
|
||||
export type Attachment = ControlAttachment
|
||||
export type Conn = {
|
||||
@@ -74,6 +77,9 @@ export const NO_DEADLINE = Number.MAX_SAFE_INTEGER
|
||||
// How long a silent keepalive control has to answer the relay ping before it is closed.
|
||||
export const KEEPALIVE_PROBE_MS = 10_000
|
||||
export const SWEEP_AT_KEY = 'sweepAt'
|
||||
// Diagnostics only: the host's last control close, read once by the next activation.
|
||||
export const LAST_CONTROL_CLOSE_KEY = 'lastControlClose'
|
||||
export type LastControlClose = { goneAt: number; closedAt: number; code: number }
|
||||
// 6 h ± 30 min, as the cells: desktops re-ask the director at least this often.
|
||||
export const LEASE_BASE_MS = 6 * 60 * 60 * 1000
|
||||
export const LEASE_JITTER_MS = 30 * 60 * 1000
|
||||
@@ -178,6 +184,7 @@ export abstract class HostRelayBase extends DurableObject<Env> {
|
||||
this.attach(ws, null)
|
||||
if (a.k === 'control' && a.phase === 'active') { metric(this.env, 'control_close', 1, String(code), [], '', a.place) }
|
||||
if (a.k === 'control' && a.phase === 'active' && !this.activeControl()) {
|
||||
await this.ctx.storage.put<LastControlClose>(LAST_CONTROL_CLOSE_KEY, { goneAt, closedAt: Date.now(), code })
|
||||
const session = await this.ctx.storage.get<Session>('session')
|
||||
if (session && session.generation === a.generation) {
|
||||
const hostReason = relayHostCloseReasonFrom(reason)
|
||||
|
||||
@@ -28,8 +28,16 @@ export abstract class HostRelayControl extends HostRelayHandshake {
|
||||
// Where the host is going away anyway (export, erase, drain, a new control of the same host): a
|
||||
// silent control is closed now. Its orphan time is the latest the ping alarm would have found it,
|
||||
// so rebind and the orphan grace are never shorter than before.
|
||||
// A control closed for silence: value = seconds silent, label = where it was found, reason =
|
||||
// keepalive | legacy; double2 = seconds since it became active (-1 if unknown).
|
||||
protected deadControlMetric(a: ControlAttachment, now: number, seen: number, found: 'alarm' | 'on_demand' | 'expired'): void {
|
||||
const ageS = a.activeAt === undefined ? -1 : Math.round((now - a.activeAt) / 1000)
|
||||
metric(this.env, 'silence_close', Math.round((now - seen) / 1000), found, [ageS], this.keepalive(a) ? 'keepalive' : 'legacy', a.place)
|
||||
}
|
||||
|
||||
protected async closeSilentControls(now = Date.now()): Promise<void> {
|
||||
for (const { ws, seen } of this.silentControls(now)) {
|
||||
for (const { ws, a, seen } of this.silentControls(now)) {
|
||||
this.deadControlMetric(a, now, seen, 'on_demand')
|
||||
this.close(ws, RELAY_CLOSE_CODE.PEER_DROPPED, 'control silence timeout')
|
||||
await this.onSocketGone(ws, RELAY_CLOSE_CODE.PEER_DROPPED, '', Math.min(now, seen + this.config.silenceTimeoutMs + this.config.pingIntervalMs))
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { RELAY_CLOSE_CODE } from '../../../packages/relay-contract/src/close-cod
|
||||
import { metric } from './metrics'
|
||||
import type { EdgeClaims } from './env'
|
||||
import { b64, b64url, fromB64, hmacSha256, sha256B64url, timingSafeEqualStr } from './bytes'
|
||||
import { HostRelayBase, ASSIGNMENT_CHECK_DEADLINE_MS, NO_DEADLINE, LEASE_BASE_MS, LEASE_JITTER_MS, type ControlAttachment, type Session } from './host-relay-base'
|
||||
import { HostRelayBase, ASSIGNMENT_CHECK_DEADLINE_MS, NO_DEADLINE, LEASE_BASE_MS, LEASE_JITTER_MS, type ControlAttachment, type Session, LAST_CONTROL_CLOSE_KEY, type LastControlClose } from './host-relay-base'
|
||||
|
||||
export abstract class HostRelayHandshake extends HostRelayBase {
|
||||
protected async onHostHello(ws: WebSocket, a: ControlAttachment, type: unknown, body: Record<string, unknown>): Promise<void> {
|
||||
@@ -157,6 +157,7 @@ export abstract class HostRelayHandshake extends HostRelayBase {
|
||||
})
|
||||
const leaseExpiresAt = now + LEASE_BASE_MS + Math.round((Math.random() * 2 - 1) * LEASE_JITTER_MS)
|
||||
a.phase = 'active'
|
||||
a.activeAt = now
|
||||
a.generation = generation
|
||||
a.lastPongAt = now
|
||||
a.lastPingAt = now
|
||||
@@ -191,7 +192,12 @@ export abstract class HostRelayHandshake extends HostRelayBase {
|
||||
})
|
||||
// After the ack, which strict shipped parsers must see unchanged; only hosts that asked get it.
|
||||
if (a.clientKeepalive) { this.send(ws, { type: 'keepalive-offer', v: 1, intervalMs: this.config.pingIntervalMs }) }
|
||||
metric(this.env, 'control_active', 1, rebind ? 'rebind' : 'new', [], '', a.place)
|
||||
metric(this.env, 'control_active', 1, rebind ? 'rebind' : 'new', [a.openedAt === undefined ? -1 : now - a.openedAt], a.clientKeepalive ? 'keepalive' : 'legacy', a.place)
|
||||
const last = await this.ctx.storage.get<LastControlClose>(LAST_CONTROL_CLOSE_KEY)
|
||||
if (last) {
|
||||
await this.ctx.storage.delete(LAST_CONTROL_CLOSE_KEY)
|
||||
metric(this.env, 'reconnect_gap', Math.round((now - last.goneAt) / 1000), String(last.code), [Math.round((last.closedAt - last.goneAt) / 1000)], a.clientKeepalive ? 'keepalive' : 'legacy', a.place)
|
||||
}
|
||||
await this.reschedule()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,8 @@ export class HostRelay extends HostRelayPhones {
|
||||
claims,
|
||||
origin,
|
||||
caps: [...parseRelayHostCapabilities(request.headers.get('x-orca-host-capabilities') ?? '')],
|
||||
deadline: Date.now() + RELAY_PROTOCOL_LIMITS.firstFrameDeadlineMs
|
||||
deadline: Date.now() + RELAY_PROTOCOL_LIMITS.firstFrameDeadlineMs,
|
||||
openedAt: Date.now()
|
||||
})
|
||||
await this.reschedule()
|
||||
return new Response(null, { status: 101, webSocket: client })
|
||||
@@ -180,14 +181,25 @@ export class HostRelay extends HostRelayPhones {
|
||||
continue
|
||||
}
|
||||
if (now - seen > this.config.silenceTimeoutMs && (!this.keepalive(a) || now - a.probeAt! >= KEEPALIVE_PROBE_MS - 50)) {
|
||||
this.deadControlMetric(a, now, seen, 'alarm')
|
||||
this.close(ws, RELAY_CLOSE_CODE.PEER_DROPPED, 'control silence timeout')
|
||||
await this.onSocketGone(ws, RELAY_CLOSE_CODE.PEER_DROPPED, '')
|
||||
continue
|
||||
}
|
||||
// Same order as the cells' heartbeat: expired auth past its grace, then the 6 h lease.
|
||||
if (now > a.claims.exp + CONTROL_CONTINUITY_LIMITS.expiredAuthExistingSpliceGraceMs) {
|
||||
// A host already silent past the limit is gone (asleep, offline): it closes as one, so
|
||||
// drop counts stay comparable with the cells, whose pings would have closed it earlier.
|
||||
// Its probe is cut short: the expired authorization ends the socket either way.
|
||||
if (now - seen > this.config.silenceTimeoutMs) {
|
||||
this.deadControlMetric(a, now, seen, 'expired')
|
||||
this.close(ws, RELAY_CLOSE_CODE.PEER_DROPPED, 'control silence timeout')
|
||||
await this.onSocketGone(ws, RELAY_CLOSE_CODE.PEER_DROPPED, '', Math.min(now, seen + this.config.silenceTimeoutMs + this.config.pingIntervalMs))
|
||||
continue
|
||||
}
|
||||
const sinceRefreshS = a.lastRefreshAt === undefined ? -1 : Math.round((now - a.lastRefreshAt) / 1000)
|
||||
metric(this.env, 'auth_expired_close', sinceRefreshS, a.lastRefreshAt === undefined ? 'never' : 'refreshed', [], '', a.place)
|
||||
const seenAgoS = Math.round((now - seen) / 1000)
|
||||
metric(this.env, 'auth_expired_close', sinceRefreshS, a.lastRefreshAt === undefined ? 'never' : 'refreshed', [seenAgoS, a.activeAt === undefined ? -1 : Math.round((now - a.activeAt) / 1000)], this.keepalive(a) ? 'keepalive' : 'legacy', a.place)
|
||||
this.close(ws, RELAY_CLOSE_CODE.BAD_OUTER_CREDENTIAL, 'relay authorization expired')
|
||||
await this.onSocketGone(ws, RELAY_CLOSE_CODE.BAD_OUTER_CREDENTIAL, '')
|
||||
continue
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
import type { Env } from './env'
|
||||
|
||||
export type MetricEvent =
|
||||
// label 'new' | 'rebind'; reason 'keepalive' | 'legacy' (took the keepalive offer or not);
|
||||
// double2 = ms from the upgrade to activation (the desktop gives up a connect after 15 s).
|
||||
| 'control_active'
|
||||
| 'control_close'
|
||||
| 'phone_open'
|
||||
@@ -26,7 +28,16 @@ export type MetricEvent =
|
||||
| 'control_upgrade'
|
||||
// Control closed 4401 for expired authorization: value = seconds since its last extending
|
||||
// refresh, label 'refreshed'; -1 and label 'never' when this socket never extended its token.
|
||||
// double2 = seconds since the host's last inbound frame or keepalive, double3 = seconds since the
|
||||
// control became active (-1 if unknown); reason 'keepalive' | 'legacy'.
|
||||
| 'auth_expired_close'
|
||||
// Control closed for silence (deadControlMetric, host-relay-control.ts).
|
||||
| 'silence_close'
|
||||
// A host's control came back after its last control closed: value = seconds from when that
|
||||
// control was last known alive (silence closes) or closed (others) to this activation; label =
|
||||
// that close code; double2 = seconds between last-known-alive and the actual close.
|
||||
// reason 'keepalive' | 'legacy' of the new control.
|
||||
| 'reconnect_gap'
|
||||
// Pre-auth socket refused by the per-source limiter: label 'phone' | 'data' | 'health'. Unpushed-host phones: 'not_on_edge'.
|
||||
| 'preauth_limited'
|
||||
| 'not_on_edge'
|
||||
|
||||
@@ -47,14 +47,14 @@ export function newHost(): Host {
|
||||
}
|
||||
}
|
||||
|
||||
export async function mint(key: KeyLike, relayHostId: string, issuer = ISSUER): Promise<string> {
|
||||
export async function mint(key: KeyLike, relayHostId: string, issuer = ISSUER, expiresIn = '5m'): Promise<string> {
|
||||
return new SignJWT({ purpose: 'host-control', prof: `prof-${USER}`, relayHostId })
|
||||
.setProtectedHeader({ alg: 'ES256', kid: REMOTE ? 'spike' : 'mvp' })
|
||||
.setSubject(USER)
|
||||
.setIssuer(issuer)
|
||||
.setAudience('orca-relay')
|
||||
.setIssuedAt()
|
||||
.setExpirationTime('5m')
|
||||
.setExpirationTime(expiresIn)
|
||||
.sign(key)
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,32 @@ export async function keepaliveProbeCheck(key: KeyLike): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
// K4: a keepalive host gone silent when its authorization expires closes as a dropped host (4408),
|
||||
// not 4401, so edge drop counts stay comparable with the cells (their pings would have closed it).
|
||||
export async function keepaliveExpiredSilentCheck(key: KeyLike): Promise<void> {
|
||||
const host = newHost()
|
||||
await assign(host.relayHostId, 'edge', EPOCH, [])
|
||||
const started = Date.now()
|
||||
// Alive for 50 s, then silent: the silence probe (sent ~9 s later) is still pending when the
|
||||
// 3 s token passes its 60 s grace at ~63 s, so the expiry check is what closes it.
|
||||
const c = control(host, await mint(key, host.relayHostId, undefined, '3s'), EPOCH, {
|
||||
caps: `${SHIPPED_CAPS},client-keepalive-v1`,
|
||||
drop: () => Date.now() - started > 50_000
|
||||
})
|
||||
await c.client.connect()
|
||||
try {
|
||||
const closed = await waitFor(() => c.events.closes.length > 0, 3_000 + 60_000 + 15_000)
|
||||
const after = Date.now() - started
|
||||
record(
|
||||
'K4 silent keepalive host at token expiry: closed 4408 (not 4401)',
|
||||
closed && c.events.closes.includes(4408) && !c.events.closes.includes(4401) && after >= 59_000,
|
||||
`closedAfter=${after}ms pings=${c.events.pings} closes=${c.events.closes}`
|
||||
)
|
||||
} finally {
|
||||
c.client.closeNow()
|
||||
}
|
||||
}
|
||||
|
||||
// F5: POST /__admin/drain sends the host's controls back to the director (drain frame, 4503).
|
||||
export async function drainCheck(key: KeyLike): Promise<void> {
|
||||
const host = newHost()
|
||||
|
||||
@@ -41,7 +41,7 @@ import {
|
||||
waitFor,
|
||||
type Host
|
||||
} from './harness-mvp-object'
|
||||
import { drainCheck, heartbeatCheck, keepaliveCheck, keepaliveProbeCheck, objectHealthCheck } from './mvp-object-hardening'
|
||||
import { drainCheck, heartbeatCheck, keepaliveCheck, keepaliveExpiredSilentCheck, keepaliveProbeCheck, objectHealthCheck } from './mvp-object-hardening'
|
||||
import { replayCheck, rotationCheck } from './mvp-object-replay'
|
||||
|
||||
async function mainRemote(): Promise<void> {
|
||||
@@ -107,7 +107,7 @@ async function main(): Promise<void> {
|
||||
await sleep(500)
|
||||
}
|
||||
await run(host, privateKey, () => jwksHits)
|
||||
await Promise.all([heartbeatCheck(privateKey), keepaliveCheck(privateKey), keepaliveProbeCheck(privateKey), drainCheck(privateKey), replayCheck(), rotationCheck()])
|
||||
await Promise.all([heartbeatCheck(privateKey), keepaliveCheck(privateKey), keepaliveProbeCheck(privateKey), keepaliveExpiredSilentCheck(privateKey), drainCheck(privateKey), replayCheck(), rotationCheck()])
|
||||
await sweepCheck()
|
||||
await preAuthCheck(stateDir)
|
||||
await objectHealthCheck(stateDir)
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import { expect, it } from 'vitest'
|
||||
import { OBJECT_STORE_SCHEMA } from '../src/object-store-schema.generated'
|
||||
import { relayObjectStoreSchema } from './object-store-schema'
|
||||
|
||||
it('object store schema matches the relay schema', async () => {
|
||||
expect([...OBJECT_STORE_SCHEMA]).toEqual(await relayObjectStoreSchema())
|
||||
})
|
||||
|
||||
it('stamps fresh objects, keeps pre-version ones, refuses objects newer than the code', async () => {
|
||||
const { DatabaseSync } = await import('node:sqlite')
|
||||
|
||||
@@ -46,6 +46,7 @@ import {
|
||||
EdgeMoveDeferredError,
|
||||
EdgeMoveBusyError,
|
||||
inEdgeCohort,
|
||||
mayBeOnEdge,
|
||||
mapEpochFloor,
|
||||
type EdgeAssignments
|
||||
} from './edge-relay.js'
|
||||
@@ -485,8 +486,9 @@ export function createRelayApp(
|
||||
edge?.ready === true &&
|
||||
body.data.regionCorrection?.action !== 'report' &&
|
||||
inEdgeCohort(edge.config, claims.relayHostId, requestedRegion, claims.sub)
|
||||
if (edge?.pushes && !toEdge) {
|
||||
if (edge?.pushes && !toEdge && mayBeOnEdge(edge.config, claims.relayHostId, claims.sub)) {
|
||||
// Any lane below may re-place a host whose row is on the edge; its devices come back first.
|
||||
// Hosts that were never in a cohort skip this row read (most asks; the pool is small).
|
||||
try {
|
||||
leftEdge = await edge.leaveEdge(identity)
|
||||
} catch (error) {
|
||||
@@ -820,7 +822,11 @@ export function createRelayApp(
|
||||
relayHostId: body.data.relayHostId
|
||||
}
|
||||
// A host on the relay edge: the liveness rule below would read its row as no answer.
|
||||
const onEdge = await operations.edgeAssignments?.edgeAssignment(identity)
|
||||
const edgeAssignments = operations.edgeAssignments
|
||||
const onEdge =
|
||||
edgeAssignments && mayBeOnEdge(edgeAssignments.config, identity.relayHostId, identity.userId)
|
||||
? await edgeAssignments.edgeAssignment(identity)
|
||||
: null
|
||||
if (onEdge) {
|
||||
return context.json({
|
||||
v: 1,
|
||||
|
||||
@@ -46,462 +46,7 @@ async function setup(
|
||||
return { database, store }
|
||||
}
|
||||
|
||||
async function setupHeadroomReassignment(): Promise<{
|
||||
database: RelayDatabase
|
||||
store: RelayAssignmentStore
|
||||
source: RelayCellConfig
|
||||
target: RelayCellConfig
|
||||
}> {
|
||||
const database = await openInMemoryRelayDatabase()
|
||||
databases.push(database)
|
||||
const store = new RelayAssignmentStore(database, () => 100, {
|
||||
requireLiveCells: true,
|
||||
heartbeatTtlMs: 45_000
|
||||
})
|
||||
const source = {
|
||||
...LIMITED_CELL,
|
||||
id: 'saturated-source',
|
||||
url: 'https://saturated-source.example.com'
|
||||
}
|
||||
const target = {
|
||||
...LIMITED_CELL,
|
||||
id: 'available-target',
|
||||
url: 'https://available-target.example.com'
|
||||
}
|
||||
await store.reconcileCells([source, target], true)
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: source.id,
|
||||
cellUrl: source.url,
|
||||
cellIncarnation: '11111111-1111-4111-8111-111111111111',
|
||||
startedAt: 50,
|
||||
ready: true,
|
||||
observedRequests: 0,
|
||||
totalConnections: 450,
|
||||
inFlightConnections: 0,
|
||||
reservedConnectionUnits: 0,
|
||||
enforcedConnectionUnits: 450,
|
||||
connectionHardCap: 600,
|
||||
connectionUnobservedBound: 50
|
||||
})
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: target.id,
|
||||
cellUrl: target.url,
|
||||
cellIncarnation: '22222222-2222-4222-8222-222222222222',
|
||||
startedAt: 50,
|
||||
ready: true,
|
||||
observedRequests: 0,
|
||||
totalConnections: 0,
|
||||
inFlightConnections: 0,
|
||||
reservedConnectionUnits: 0,
|
||||
enforcedConnectionUnits: 0,
|
||||
connectionHardCap: 600,
|
||||
connectionUnobservedBound: 50
|
||||
})
|
||||
return { database, store, source, target }
|
||||
}
|
||||
|
||||
describe('relay assignment connection headroom', () => {
|
||||
it('requires exact, internally consistent telemetry from limited cells', async () => {
|
||||
const database = await openInMemoryRelayDatabase()
|
||||
databases.push(database)
|
||||
const store = new RelayAssignmentStore(database, () => 100)
|
||||
await store.reconcileCells([LIMITED_CELL], true)
|
||||
const heartbeat = {
|
||||
cellId: LIMITED_CELL.id,
|
||||
cellUrl: LIMITED_CELL.url,
|
||||
cellIncarnation: '11111111-1111-4111-8111-111111111111',
|
||||
startedAt: 50,
|
||||
ready: true,
|
||||
observedRequests: 0
|
||||
}
|
||||
|
||||
await expect(store.recordCellHeartbeat(heartbeat)).rejects.toThrow(
|
||||
'cell_connection_telemetry_mismatch'
|
||||
)
|
||||
await expect(
|
||||
store.recordCellHeartbeat({
|
||||
...heartbeat,
|
||||
totalConnections: 550,
|
||||
inFlightConnections: 2,
|
||||
reservedConnectionUnits: 3,
|
||||
enforcedConnectionUnits: 554,
|
||||
connectionHardCap: 600,
|
||||
connectionUnobservedBound: 50
|
||||
})
|
||||
).rejects.toThrow('cell_connection_telemetry_mismatch')
|
||||
await expect(
|
||||
store.recordCellHeartbeat({
|
||||
...heartbeat,
|
||||
totalConnections: 601,
|
||||
inFlightConnections: 0,
|
||||
reservedConnectionUnits: 0,
|
||||
enforcedConnectionUnits: 601,
|
||||
connectionHardCap: 600,
|
||||
connectionUnobservedBound: 50
|
||||
})
|
||||
).resolves.toBeUndefined()
|
||||
})
|
||||
|
||||
it('keeps placing against the old cap until the cell reports a raised one', async () => {
|
||||
const { store } = await setup(449)
|
||||
const expanded = {
|
||||
...LIMITED_CELL,
|
||||
connectionHardCap: 1_000 as const
|
||||
}
|
||||
|
||||
await store.reconcileCells([expanded], true)
|
||||
await expect(store.cellDeploymentStatus(expanded.id)).resolves.toMatchObject({
|
||||
connectionCapacity: { hardCap: 1_000, effectiveHardCap: 600, heartbeatFresh: true }
|
||||
})
|
||||
await expect(
|
||||
store.assign({ userId: 'transition-user', relayHostId: 'host000000000099' })
|
||||
).resolves.toMatchObject({ cellId: expanded.id })
|
||||
await expect(
|
||||
store.assign({ userId: 'transition-user-2', relayHostId: 'host000000000096' })
|
||||
).rejects.toThrow('relay_capacity_exhausted')
|
||||
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: expanded.id,
|
||||
cellUrl: expanded.url,
|
||||
cellIncarnation: '22222222-2222-4222-8222-222222222222',
|
||||
startedAt: 200,
|
||||
ready: true,
|
||||
observedRequests: 0,
|
||||
totalConnections: 449,
|
||||
inFlightConnections: 0,
|
||||
reservedConnectionUnits: 0,
|
||||
enforcedConnectionUnits: 449,
|
||||
connectionHardCap: 1_000,
|
||||
connectionUnobservedBound: 50
|
||||
})
|
||||
await expect(store.cellDeploymentStatus(expanded.id)).resolves.toMatchObject({
|
||||
connectionCapacity: {
|
||||
hardCap: 1_000,
|
||||
ordinaryConnectionLimit: 900,
|
||||
normalAdmissionPause: 850,
|
||||
heartbeatFresh: true
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('fails placement closed while the admin path changes the unobserved bound', async () => {
|
||||
const { store } = await setup(0)
|
||||
const lowered = {
|
||||
...LIMITED_CELL,
|
||||
connectionUnobservedBound: 49
|
||||
}
|
||||
|
||||
await store.configureCell(lowered, 'general')
|
||||
await expect(
|
||||
store.assign({ userId: 'admin-transition', relayHostId: 'host000000000098' })
|
||||
).rejects.toThrow('relay_capacity_exhausted')
|
||||
await expect(store.cellDeploymentStatus(lowered.id)).resolves.toMatchObject({
|
||||
connectionCapacity: { hardCap: 600, heartbeatFresh: false }
|
||||
})
|
||||
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: lowered.id,
|
||||
cellUrl: lowered.url,
|
||||
cellIncarnation: '22222222-2222-4222-8222-222222222222',
|
||||
startedAt: 200,
|
||||
ready: true,
|
||||
observedRequests: 0,
|
||||
totalConnections: 0,
|
||||
inFlightConnections: 0,
|
||||
reservedConnectionUnits: 0,
|
||||
enforcedConnectionUnits: 0,
|
||||
connectionHardCap: 600,
|
||||
connectionUnobservedBound: 49
|
||||
})
|
||||
await expect(
|
||||
store.assign({ userId: 'admin-restored', relayHostId: 'host000000000097' })
|
||||
).resolves.toMatchObject({ cellId: lowered.id })
|
||||
})
|
||||
|
||||
it('admits exactly one reservation at the admission boundary', async () => {
|
||||
const { database, store } = await setup(449)
|
||||
const results = await Promise.allSettled([
|
||||
store.assign({ userId: 'user-1', relayHostId: 'host000000000001' }),
|
||||
store.assign({ userId: 'user-2', relayHostId: 'host000000000002' })
|
||||
])
|
||||
|
||||
expect(results.filter(({ status }) => status === 'fulfilled')).toHaveLength(1)
|
||||
expect(
|
||||
results
|
||||
.filter(({ status }) => status === 'rejected')
|
||||
.map((result) => (result.status === 'rejected' ? result.reason : null))
|
||||
).toEqual([expect.objectContaining({ message: 'relay_capacity_exhausted' })])
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT activity_id FROM relay_assignment_activity_leases
|
||||
WHERE activity_kind = 'control' AND activity_id LIKE 'control-pending:%'`
|
||||
)
|
||||
).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('rejects at the boundary before mutating durable assignment state', async () => {
|
||||
const { database, store } = await setup(450)
|
||||
|
||||
await expect(
|
||||
store.assign({ userId: 'user-1', relayHostId: 'host000000000001' })
|
||||
).rejects.toThrow('relay_capacity_exhausted')
|
||||
expect(await database.query(`SELECT * FROM relay_assignments`)).toEqual([])
|
||||
expect(await database.query(`SELECT * FROM relay_assignment_activity_leases`)).toEqual([])
|
||||
})
|
||||
|
||||
it('charges every active reservation state at the admission boundary', async () => {
|
||||
const { database, store } = await setup(447)
|
||||
await database.query(
|
||||
`INSERT INTO relay_control_connection_reservations
|
||||
(reservation_id, idempotency_key, user_id, relay_host_id,
|
||||
assignment_epoch, cell_id, state, created_at, timeout_at, updated_at)
|
||||
VALUES
|
||||
('active-reserved', 'active-reserved', 'state-user', 'state-host-1',
|
||||
1, ?, 'reserved', 1, 2, 1),
|
||||
('active-debt', 'active-debt', 'state-user', 'state-host-2',
|
||||
1, ?, 'late-arrival-debt', 1, 2, 1),
|
||||
('active-claimed', 'active-claimed', 'state-user', 'state-host-3',
|
||||
1, ?, 'claimed', 1, 2, 1)`,
|
||||
[LIMITED_CELL.id, LIMITED_CELL.id, LIMITED_CELL.id]
|
||||
)
|
||||
|
||||
await expect(
|
||||
store.assign({ userId: 'blocked-user', relayHostId: 'blockedhost00001' })
|
||||
).rejects.toThrow('relay_capacity_exhausted')
|
||||
expect(await database.query(`SELECT * FROM relay_assignment_activity_leases`)).toEqual([])
|
||||
})
|
||||
|
||||
it('does not charge released reservation history', async () => {
|
||||
const { database, store } = await setup(449)
|
||||
await database.query(
|
||||
`INSERT INTO relay_control_connection_reservations
|
||||
(reservation_id, idempotency_key, user_id, relay_host_id,
|
||||
assignment_epoch, cell_id, state, created_at, timeout_at, updated_at)
|
||||
VALUES ('released-history', 'released-history', 'state-user', 'state-host',
|
||||
1, ?, 'released', 1, 2, 1)`,
|
||||
[LIMITED_CELL.id]
|
||||
)
|
||||
|
||||
await expect(
|
||||
store.assign({ userId: 'admitted-user', relayHostId: 'admittedhost0001' })
|
||||
).resolves.toMatchObject({ cellId: LIMITED_CELL.id })
|
||||
})
|
||||
|
||||
it('rejects sticky control restoration before mutating assignment state', async () => {
|
||||
const { database, store } = await setup(450)
|
||||
const identity = { userId: 'sticky-user', relayHostId: 'stickyhost000001' }
|
||||
await database.query(
|
||||
`INSERT INTO relay_assignments
|
||||
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at,
|
||||
last_activity_at, reserved_controls, reserved_splices, reserved_invites,
|
||||
pending_installs, pending_confirmations, migration_leases)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
[identity.userId, identity.relayHostId, LIMITED_CELL.id, 1, 10_000, 100, 0, 0, 1, 0, 0, 0]
|
||||
)
|
||||
|
||||
await expect(store.assign(identity)).rejects.toThrow('relay_connection_headroom_exhausted')
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT cell_id, assignment_epoch, reserved_controls, reserved_invites
|
||||
FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
).toEqual([
|
||||
{
|
||||
cell_id: LIMITED_CELL.id,
|
||||
assignment_epoch: 1,
|
||||
reserved_controls: 0,
|
||||
reserved_invites: 1
|
||||
}
|
||||
])
|
||||
expect(await database.query(`SELECT * FROM relay_assignment_activity_leases`)).toEqual([])
|
||||
})
|
||||
|
||||
it('moves a zero-activity assignment off a general cell without connection headroom', async () => {
|
||||
const { database, store, source, target } = await setupHeadroomReassignment()
|
||||
const identity = { userId: 'movable-user', relayHostId: 'movablehost000001' }
|
||||
await database.query(
|
||||
`INSERT INTO relay_assignments
|
||||
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at,
|
||||
last_activity_at, reserved_controls, reserved_splices, reserved_invites,
|
||||
pending_installs, pending_confirmations, migration_leases)
|
||||
VALUES (?, ?, ?, ?, ?, ?, 0, 0, 0, 0, 0, 0)`,
|
||||
[identity.userId, identity.relayHostId, source.id, 7, 10_000, 100]
|
||||
)
|
||||
await database.query(
|
||||
`INSERT INTO relay_control_connection_reservations
|
||||
(reservation_id, idempotency_key, user_id, relay_host_id,
|
||||
assignment_epoch, cell_id, state, inclusion_watermark,
|
||||
claim_activity_id, created_at, timeout_at, claimed_at, released_at,
|
||||
updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, 'late-arrival-debt', NULL, NULL, ?, ?, NULL, NULL, ?)`,
|
||||
[
|
||||
'superseded-reservation',
|
||||
'superseded-reservation',
|
||||
identity.userId,
|
||||
identity.relayHostId,
|
||||
7,
|
||||
source.id,
|
||||
50,
|
||||
99,
|
||||
100
|
||||
]
|
||||
)
|
||||
|
||||
await expect(store.assign(identity)).resolves.toMatchObject({
|
||||
cellId: target.id,
|
||||
assignmentEpoch: 8
|
||||
})
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT cell_id, assignment_epoch, reserved_controls
|
||||
FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
).toEqual([{ cell_id: target.id, assignment_epoch: 8, reserved_controls: 1 }])
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT cell_id, activity_kind FROM relay_assignment_activity_leases
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
).toEqual([{ cell_id: target.id, activity_kind: 'control' }])
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT cell_id, assignment_epoch, state
|
||||
FROM relay_control_connection_reservations
|
||||
WHERE user_id = ? AND relay_host_id = ?
|
||||
ORDER BY assignment_epoch`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
).toEqual([
|
||||
{ cell_id: source.id, assignment_epoch: 7, state: 'released' },
|
||||
{ cell_id: target.id, assignment_epoch: 8, state: 'reserved' }
|
||||
])
|
||||
})
|
||||
|
||||
it('keeps non-control activity pinned when its cell has no connection headroom', async () => {
|
||||
const { database, store, source } = await setupHeadroomReassignment()
|
||||
const identity = { userId: 'pinned-user', relayHostId: 'pinnedhost0000001' }
|
||||
await database.query(
|
||||
`INSERT INTO relay_assignments
|
||||
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at,
|
||||
last_activity_at, reserved_controls, reserved_splices, reserved_invites,
|
||||
pending_installs, pending_confirmations, migration_leases)
|
||||
VALUES (?, ?, ?, ?, ?, ?, 0, 0, 1, 0, 0, 0)`,
|
||||
[identity.userId, identity.relayHostId, source.id, 7, 10_000, 100]
|
||||
)
|
||||
|
||||
await expect(store.assign(identity)).rejects.toThrow('relay_connection_headroom_exhausted')
|
||||
expect(await store.resolve(identity)).toMatchObject({
|
||||
cellId: source.id,
|
||||
assignmentEpoch: 7
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps a zero-activity assignment pinned on an existing-only cell', async () => {
|
||||
const { database, store, source } = await setupHeadroomReassignment()
|
||||
const identity = { userId: 'pinned-existing-only-user', relayHostId: 'pinnedexistingonl' }
|
||||
await store.setCellAdmissionState(source.id, 'existing-only')
|
||||
await database.query(
|
||||
`INSERT INTO relay_assignments
|
||||
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at,
|
||||
last_activity_at, reserved_controls, reserved_splices, reserved_invites,
|
||||
pending_installs, pending_confirmations, migration_leases)
|
||||
VALUES (?, ?, ?, ?, ?, ?, 0, 0, 0, 0, 0, 0)`,
|
||||
[identity.userId, identity.relayHostId, source.id, 7, 10_000, 100]
|
||||
)
|
||||
|
||||
await expect(store.assign(identity)).rejects.toThrow('relay_connection_headroom_exhausted')
|
||||
expect(await store.resolve(identity)).toMatchObject({
|
||||
cellId: source.id,
|
||||
assignmentEpoch: 7
|
||||
})
|
||||
expect(await database.query(`SELECT * FROM relay_assignment_activity_leases`)).toEqual([])
|
||||
})
|
||||
|
||||
it('keeps a zero-activity assignment pinned on an unstamped migration-only cell', async () => {
|
||||
// Why: an evacuation target is deliberately migration-only and deliberately
|
||||
// full. Without the roll's isolate stamp it must keep the hosts it holds.
|
||||
const { database, store, source } = await setupHeadroomReassignment()
|
||||
const identity = { userId: 'pinned-migration-only-user', relayHostId: 'pinnedmigrationonly' }
|
||||
await store.setCellAdmissionState(source.id, 'migration-only')
|
||||
await database.query(
|
||||
`INSERT INTO relay_assignments
|
||||
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at,
|
||||
last_activity_at, reserved_controls, reserved_splices, reserved_invites,
|
||||
pending_installs, pending_confirmations, migration_leases)
|
||||
VALUES (?, ?, ?, ?, ?, ?, 0, 0, 0, 0, 0, 0)`,
|
||||
[identity.userId, identity.relayHostId, source.id, 7, 10_000, 100]
|
||||
)
|
||||
|
||||
await expect(store.assign(identity)).rejects.toThrow('relay_connection_headroom_exhausted')
|
||||
expect(await store.resolve(identity)).toMatchObject({
|
||||
cellId: source.id,
|
||||
assignmentEpoch: 7
|
||||
})
|
||||
})
|
||||
|
||||
it('renames a pending reservation exactly once on control activation', async () => {
|
||||
const { database, store } = await setup(449)
|
||||
const identity = { userId: 'user-1', relayHostId: 'host000000000001' }
|
||||
const assignment = await store.assign(identity)
|
||||
|
||||
await store.activateControl(identity, {
|
||||
cellId: LIMITED_CELL.id,
|
||||
assignmentEpoch: assignment.assignmentEpoch,
|
||||
generation: 1
|
||||
})
|
||||
await store.activateControl(identity, {
|
||||
cellId: LIMITED_CELL.id,
|
||||
assignmentEpoch: assignment.assignmentEpoch,
|
||||
generation: 1
|
||||
})
|
||||
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT activity_id, request_units FROM relay_assignment_activity_leases
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
).toEqual([{ activity_id: 'control:limited:1', request_units: 1 }])
|
||||
})
|
||||
|
||||
it('keeps expired pending reservations charged as late-arrival debt', async () => {
|
||||
let now = 100
|
||||
const { database, store } = await setup(449, () => now)
|
||||
await store.assign({ userId: 'user-1', relayHostId: 'host000000000001' })
|
||||
now += ASSIGNMENT_LIMITS.activityLeaseMs + 1
|
||||
await store.releaseExpiredActivityLeases()
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: LIMITED_CELL.id,
|
||||
cellUrl: LIMITED_CELL.url,
|
||||
cellIncarnation: '11111111-1111-4111-8111-111111111111',
|
||||
startedAt: 50,
|
||||
ready: true,
|
||||
observedRequests: 0,
|
||||
totalConnections: 449,
|
||||
inFlightConnections: 0,
|
||||
reservedConnectionUnits: 0,
|
||||
enforcedConnectionUnits: 449,
|
||||
connectionHardCap: 600,
|
||||
connectionUnobservedBound: 50
|
||||
})
|
||||
|
||||
await expect(
|
||||
store.assign({ userId: 'user-2', relayHostId: 'host000000000002' })
|
||||
).rejects.toThrow('relay_capacity_exhausted')
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT activity_id FROM relay_assignment_activity_leases
|
||||
WHERE activity_kind = 'control' AND activity_id LIKE 'control-pending:%'`
|
||||
)
|
||||
).toHaveLength(0)
|
||||
expect(await database.query(`SELECT state FROM relay_control_connection_reservations`)).toEqual(
|
||||
[{ state: 'late-arrival-debt' }]
|
||||
)
|
||||
})
|
||||
|
||||
it('reconciles late-arrival debt only after a covering absolute snapshot', async () => {
|
||||
let now = 100
|
||||
const { database, store } = await setup(449, () => now)
|
||||
@@ -559,386 +104,4 @@ describe('relay assignment connection headroom', () => {
|
||||
store.assign({ userId: 'blocked-user', relayHostId: 'blockedhost00001' })
|
||||
).rejects.toThrow('relay_capacity_exhausted')
|
||||
})
|
||||
|
||||
it('rejects duplicate and out-of-order absolute snapshots', async () => {
|
||||
const { database, store } = await setup(0)
|
||||
const heartbeat = {
|
||||
cellId: LIMITED_CELL.id,
|
||||
cellUrl: LIMITED_CELL.url,
|
||||
cellIncarnation: '11111111-1111-4111-8111-111111111111',
|
||||
startedAt: 50,
|
||||
ready: true,
|
||||
observedRequests: 0,
|
||||
totalConnections: 10,
|
||||
inFlightConnections: 0,
|
||||
reservedConnectionUnits: 0,
|
||||
enforcedConnectionUnits: 10,
|
||||
connectionInclusionWatermark: 10,
|
||||
connectionHardCap: 600 as const,
|
||||
connectionUnobservedBound: 50
|
||||
}
|
||||
await store.recordCellHeartbeat(heartbeat)
|
||||
await expect(store.recordCellHeartbeat(heartbeat)).rejects.toThrow('stale_connection_snapshot')
|
||||
await expect(
|
||||
store.recordCellHeartbeat({
|
||||
...heartbeat,
|
||||
totalConnections: 9,
|
||||
enforcedConnectionUnits: 9,
|
||||
connectionInclusionWatermark: 9
|
||||
})
|
||||
).rejects.toThrow('stale_connection_snapshot')
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT inclusion_watermark, enforced_connection_units
|
||||
FROM relay_cell_connection_snapshots`
|
||||
)
|
||||
).toEqual([{ inclusion_watermark: 10, enforced_connection_units: 10 }])
|
||||
})
|
||||
|
||||
it('keeps crash retries bound to one reservation claim', async () => {
|
||||
let now = 100
|
||||
const { database, store } = await setup(448, () => now)
|
||||
const identity = { userId: 'retry-user', relayHostId: 'retryhost0000001' }
|
||||
const assignment = await store.assign(identity)
|
||||
await new RelayAssignmentStore(database, () => now, {
|
||||
requireLiveCells: true,
|
||||
heartbeatTtlMs: 45_000
|
||||
}).assign(identity)
|
||||
expect(await database.query(`SELECT state FROM relay_control_connection_reservations`)).toEqual(
|
||||
[{ state: 'reserved' }]
|
||||
)
|
||||
now += ASSIGNMENT_LIMITS.activityLeaseMs + 1
|
||||
await store.releaseExpiredActivityLeases()
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: LIMITED_CELL.id,
|
||||
cellUrl: LIMITED_CELL.url,
|
||||
cellIncarnation: '11111111-1111-4111-8111-111111111111',
|
||||
startedAt: 50,
|
||||
ready: true,
|
||||
observedRequests: 0,
|
||||
totalConnections: 448,
|
||||
inFlightConnections: 0,
|
||||
reservedConnectionUnits: 0,
|
||||
enforcedConnectionUnits: 448,
|
||||
connectionHardCap: 600,
|
||||
connectionUnobservedBound: 50
|
||||
})
|
||||
await store.assign(identity)
|
||||
const restarted = new RelayAssignmentStore(database, () => now, {
|
||||
requireLiveCells: true,
|
||||
heartbeatTtlMs: 45_000
|
||||
})
|
||||
|
||||
const activation = {
|
||||
cellId: LIMITED_CELL.id,
|
||||
assignmentEpoch: assignment.assignmentEpoch,
|
||||
generation: 1,
|
||||
connectionInclusionWatermark: 5
|
||||
}
|
||||
await restarted.activateControl(identity, activation)
|
||||
await restarted.activateControl(identity, activation)
|
||||
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT state, claim_activity_id
|
||||
FROM relay_control_connection_reservations
|
||||
ORDER BY created_at ASC, reservation_id ASC`
|
||||
)
|
||||
).toEqual([{ state: 'claimed', claim_activity_id: 'control:limited:1' }])
|
||||
})
|
||||
|
||||
it('releases only redundant expired debt after a fresh absolute snapshot', async () => {
|
||||
let now = 100
|
||||
const { database, store } = await setup(449, () => now)
|
||||
const identity = { userId: 'debt-user', relayHostId: 'debthost000000001' }
|
||||
const assignment = await store.assign(identity)
|
||||
now += ASSIGNMENT_LIMITS.activityLeaseMs + 1
|
||||
await store.releaseExpiredActivityLeases()
|
||||
await database.query(
|
||||
`INSERT INTO relay_control_connection_reservations
|
||||
(reservation_id, idempotency_key, user_id, relay_host_id,
|
||||
assignment_epoch, cell_id, state, inclusion_watermark,
|
||||
claim_activity_id, created_at, timeout_at, claimed_at, released_at,
|
||||
updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, 'late-arrival-debt', NULL, NULL, ?, ?, NULL, NULL, ?)`,
|
||||
[
|
||||
'duplicate-reservation',
|
||||
'duplicate-reservation',
|
||||
identity.userId,
|
||||
identity.relayHostId,
|
||||
assignment.assignmentEpoch,
|
||||
LIMITED_CELL.id,
|
||||
101,
|
||||
now - 1,
|
||||
now
|
||||
]
|
||||
)
|
||||
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: LIMITED_CELL.id,
|
||||
cellUrl: LIMITED_CELL.url,
|
||||
cellIncarnation: '11111111-1111-4111-8111-111111111111',
|
||||
startedAt: 50,
|
||||
ready: true,
|
||||
observedRequests: 0,
|
||||
totalConnections: 449,
|
||||
inFlightConnections: 0,
|
||||
reservedConnectionUnits: 0,
|
||||
enforcedConnectionUnits: 449,
|
||||
connectionInclusionWatermark: 5,
|
||||
connectionHardCap: 600,
|
||||
connectionUnobservedBound: 50
|
||||
})
|
||||
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT state, COUNT(*) AS count
|
||||
FROM relay_control_connection_reservations
|
||||
GROUP BY state ORDER BY state`
|
||||
)
|
||||
).toEqual([
|
||||
{ state: 'late-arrival-debt', count: 1 },
|
||||
{ state: 'released', count: 1 }
|
||||
])
|
||||
})
|
||||
|
||||
it('releases expired debt for a snapshot-proven aborted older epoch', async () => {
|
||||
const now = 1_000
|
||||
const { database, store } = await setup(0, () => now)
|
||||
const identity = { userId: 'aborted-user', relayHostId: 'abortedhost00001' }
|
||||
await database.query(
|
||||
`INSERT INTO relay_assignments
|
||||
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at,
|
||||
last_activity_at, reserved_controls, reserved_splices, reserved_invites,
|
||||
pending_installs, pending_confirmations, migration_leases)
|
||||
VALUES (?, ?, ?, ?, ?, ?, 0, 0, 0, 0, 0, 0)`,
|
||||
[identity.userId, identity.relayHostId, LIMITED_CELL.id, 3, now, now]
|
||||
)
|
||||
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 (?, ?, ?, ?, 1, 2, 0, 1, ?, ?, NULL, ?, ?, ?)`,
|
||||
[
|
||||
identity.userId,
|
||||
identity.relayHostId,
|
||||
'source',
|
||||
LIMITED_CELL.id,
|
||||
now - 2,
|
||||
now - 3,
|
||||
now - 1,
|
||||
now - 4,
|
||||
now - 1
|
||||
]
|
||||
)
|
||||
await database.query(
|
||||
`INSERT INTO relay_control_connection_reservations
|
||||
(reservation_id, idempotency_key, user_id, relay_host_id,
|
||||
assignment_epoch, cell_id, state, inclusion_watermark,
|
||||
claim_activity_id, created_at, timeout_at, claimed_at, released_at,
|
||||
updated_at)
|
||||
VALUES (?, ?, ?, ?, 2, ?, 'late-arrival-debt', NULL, NULL, ?, ?, NULL, NULL, ?)`,
|
||||
[
|
||||
'aborted-reservation',
|
||||
'aborted-reservation',
|
||||
identity.userId,
|
||||
identity.relayHostId,
|
||||
LIMITED_CELL.id,
|
||||
now - 4,
|
||||
now - 2,
|
||||
now - 1
|
||||
]
|
||||
)
|
||||
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: LIMITED_CELL.id,
|
||||
cellUrl: LIMITED_CELL.url,
|
||||
cellIncarnation: '11111111-1111-4111-8111-111111111111',
|
||||
startedAt: 50,
|
||||
ready: true,
|
||||
observedRequests: 0,
|
||||
totalConnections: 0,
|
||||
inFlightConnections: 0,
|
||||
reservedConnectionUnits: 0,
|
||||
enforcedConnectionUnits: 0,
|
||||
connectionInclusionWatermark: 5,
|
||||
connectionHardCap: 600,
|
||||
connectionUnobservedBound: 50
|
||||
})
|
||||
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT state FROM relay_control_connection_reservations
|
||||
WHERE reservation_id = ?`,
|
||||
['aborted-reservation']
|
||||
)
|
||||
).toEqual([{ state: 'released' }])
|
||||
})
|
||||
|
||||
it('fails a limited cell closed on stale telemetry while leaving legacy cells unchanged', async () => {
|
||||
let now = 100
|
||||
const { store } = await setup(0, () => now)
|
||||
now += 45_001
|
||||
await expect(
|
||||
store.assign({ userId: 'user-1', relayHostId: 'host000000000001' })
|
||||
).rejects.toThrow('relay_capacity_exhausted')
|
||||
|
||||
const legacyDatabase = await openInMemoryRelayDatabase()
|
||||
databases.push(legacyDatabase)
|
||||
const legacyStore = new RelayAssignmentStore(legacyDatabase, () => now, {
|
||||
requireLiveCells: true,
|
||||
heartbeatTtlMs: 45_000
|
||||
})
|
||||
const legacy = {
|
||||
id: 'legacy',
|
||||
url: 'https://legacy.example.com',
|
||||
capacityRequests: 10
|
||||
}
|
||||
await legacyStore.reconcileCells([legacy], true)
|
||||
await legacyStore.recordCellHeartbeat({
|
||||
cellId: legacy.id,
|
||||
cellUrl: legacy.url,
|
||||
cellIncarnation: '22222222-2222-4222-8222-222222222222',
|
||||
startedAt: now,
|
||||
ready: true,
|
||||
observedRequests: 0
|
||||
})
|
||||
await expect(
|
||||
legacyStore.assign({ userId: 'user-2', relayHostId: 'host000000000002' })
|
||||
).resolves.toMatchObject({ cellId: 'legacy' })
|
||||
})
|
||||
|
||||
it('does not create connection debt for mixed-version uncapped cells', async () => {
|
||||
let now = 100
|
||||
const legacy = {
|
||||
id: 'legacy',
|
||||
url: 'https://legacy.example.com',
|
||||
capacityRequests: 10
|
||||
}
|
||||
const { database, store } = await setup(0, () => now)
|
||||
await store.reconcileCells([legacy], true)
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: legacy.id,
|
||||
cellUrl: legacy.url,
|
||||
cellIncarnation: '22222222-2222-4222-8222-222222222222',
|
||||
startedAt: 50,
|
||||
ready: true,
|
||||
observedRequests: 0
|
||||
})
|
||||
|
||||
await store.assign({ userId: 'legacy-user', relayHostId: 'legacyhost000001' })
|
||||
expect(await database.query(`SELECT * FROM relay_control_connection_reservations`)).toEqual([])
|
||||
expect(await store.releaseExpiredActivityLeases()).toBe(0)
|
||||
now += ASSIGNMENT_LIMITS.activityLeaseMs + 1
|
||||
expect(await store.releaseExpiredActivityLeases()).toBe(1)
|
||||
expect(await database.query(`SELECT * FROM relay_control_connection_reservations`)).toEqual([])
|
||||
})
|
||||
|
||||
it('rejects dormant rebalance before changing the assignment epoch', async () => {
|
||||
const now = ASSIGNMENT_LIMITS.dormantTtlMs + 100
|
||||
const database = await openInMemoryRelayDatabase()
|
||||
databases.push(database)
|
||||
const store = new RelayAssignmentStore(database, () => now, {
|
||||
requireLiveCells: true,
|
||||
heartbeatTtlMs: 45_000
|
||||
})
|
||||
const source = {
|
||||
id: 'source',
|
||||
url: 'https://source.example.com',
|
||||
capacityRequests: 10
|
||||
}
|
||||
await store.reconcileCells([source, LIMITED_CELL], true)
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: source.id,
|
||||
cellUrl: source.url,
|
||||
cellIncarnation: '22222222-2222-4222-8222-222222222222',
|
||||
startedAt: now - 50,
|
||||
ready: true,
|
||||
observedRequests: 0
|
||||
})
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: LIMITED_CELL.id,
|
||||
cellUrl: LIMITED_CELL.url,
|
||||
cellIncarnation: '11111111-1111-4111-8111-111111111111',
|
||||
startedAt: now - 50,
|
||||
ready: true,
|
||||
observedRequests: 0,
|
||||
totalConnections: 450,
|
||||
inFlightConnections: 0,
|
||||
reservedConnectionUnits: 0,
|
||||
enforcedConnectionUnits: 450,
|
||||
connectionHardCap: 600,
|
||||
connectionUnobservedBound: 50
|
||||
})
|
||||
const identity = { userId: 'dormant-user', relayHostId: 'dormanthost00001' }
|
||||
await database.query(
|
||||
`INSERT INTO relay_assignments
|
||||
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at,
|
||||
last_activity_at, reserved_controls, reserved_splices, reserved_invites,
|
||||
pending_installs, pending_confirmations, migration_leases)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
[identity.userId, identity.relayHostId, source.id, 7, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
)
|
||||
|
||||
await expect(store.rebalanceDormant(identity, LIMITED_CELL.id)).rejects.toThrow(
|
||||
'relay_connection_headroom_exhausted'
|
||||
)
|
||||
expect(await store.resolve(identity)).toMatchObject({
|
||||
cellId: source.id,
|
||||
assignmentEpoch: 7
|
||||
})
|
||||
expect(await database.query(`SELECT * FROM relay_assignment_activity_leases`)).toEqual([])
|
||||
})
|
||||
|
||||
it('rejects an evacuation target at its pause before migration mutation', async () => {
|
||||
const database = await openInMemoryRelayDatabase()
|
||||
databases.push(database)
|
||||
const store = new RelayAssignmentStore(database, () => 100, {
|
||||
requireLiveCells: true,
|
||||
heartbeatTtlMs: 45_000
|
||||
})
|
||||
const source = {
|
||||
id: 'source',
|
||||
url: 'https://source.example.com',
|
||||
capacityRequests: 10
|
||||
}
|
||||
await store.reconcileCells([source, { ...LIMITED_CELL, initiallyEnabled: false }], true)
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: source.id,
|
||||
cellUrl: source.url,
|
||||
cellIncarnation: '22222222-2222-4222-8222-222222222222',
|
||||
startedAt: 50,
|
||||
ready: true,
|
||||
observedRequests: 0
|
||||
})
|
||||
await store.recordCellHeartbeat({
|
||||
cellId: LIMITED_CELL.id,
|
||||
cellUrl: LIMITED_CELL.url,
|
||||
cellIncarnation: '11111111-1111-4111-8111-111111111111',
|
||||
startedAt: 50,
|
||||
ready: true,
|
||||
observedRequests: 0,
|
||||
totalConnections: 450,
|
||||
inFlightConnections: 0,
|
||||
reservedConnectionUnits: 0,
|
||||
enforcedConnectionUnits: 450,
|
||||
connectionHardCap: 600,
|
||||
connectionUnobservedBound: 50
|
||||
})
|
||||
const identity = { userId: 'user-1', relayHostId: 'host000000000001' }
|
||||
const assignment = await store.assign(identity)
|
||||
expect(assignment.cellId).toBe(source.id)
|
||||
await store.setCellEnabled(LIMITED_CELL.id, true)
|
||||
|
||||
await expect(store.startEvacuation(identity, LIMITED_CELL.id)).rejects.toThrow(
|
||||
'relay_connection_headroom_exhausted'
|
||||
)
|
||||
expect(await database.query(`SELECT * FROM relay_assignment_migrations`)).toEqual([])
|
||||
expect(await store.resolve(identity)).toMatchObject({
|
||||
cellId: source.id,
|
||||
assignmentEpoch: assignment.assignmentEpoch
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
+19
-612
@@ -1,4 +1,3 @@
|
||||
import { ASSIGNMENT_LIMITS } from '@orca-cloud/relay-contract/assignment-invariants'
|
||||
import { createHash } from 'node:crypto'
|
||||
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'
|
||||
import { RelayAssignmentRowBusyError, RelayAssignmentStore } from './assignment-store.js'
|
||||
@@ -52,7 +51,6 @@ const OTHER_REGION: RelayCellConfig = {
|
||||
...CAPPED
|
||||
}
|
||||
const CELLS = [ISOLATED, ...TARGETS, OTHER_REGION]
|
||||
const HOST_COUNT = 50
|
||||
|
||||
function hostIdentity(index: number): { userId: string; relayHostId: string } {
|
||||
return {
|
||||
@@ -74,48 +72,6 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
|
||||
return Number(rows[0]!['reserved_requests'])
|
||||
}
|
||||
|
||||
// The accounting invariant the migration paths assert: a cell's counter is
|
||||
// exactly the units of the leases held on it.
|
||||
async function expectReservationAccounting(): Promise<void> {
|
||||
for (const cell of CELLS) {
|
||||
const leased = await databases[0]!.query(
|
||||
`SELECT COALESCE(SUM(request_units), 0) AS units
|
||||
FROM relay_assignment_activity_leases WHERE cell_id = ?`,
|
||||
[cell.id]
|
||||
)
|
||||
expect({ cell: cell.id, reserved: await reservedRequests(cell.id) }).toEqual({
|
||||
cell: cell.id,
|
||||
reserved: Number(leased[0]!['units'])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function expectReservationAccountingExcept(cellId: string): Promise<void> {
|
||||
for (const cell of CELLS.filter(({ id }) => id !== cellId)) {
|
||||
const leased = await databases[0]!.query(
|
||||
`SELECT COALESCE(SUM(request_units), 0) AS units
|
||||
FROM relay_assignment_activity_leases WHERE cell_id = ?`,
|
||||
[cell.id]
|
||||
)
|
||||
expect(await reservedRequests(cell.id)).toBe(Number(leased[0]!['units']))
|
||||
}
|
||||
}
|
||||
|
||||
async function counters(identity: {
|
||||
userId: string
|
||||
relayHostId: string
|
||||
}): Promise<{ controls: number; splices: number }> {
|
||||
const rows = await databases[0]!.query(
|
||||
`SELECT reserved_controls, reserved_splices FROM relay_assignments
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
return {
|
||||
controls: Number(rows[0]!['reserved_controls']),
|
||||
splices: Number(rows[0]!['reserved_splices'])
|
||||
}
|
||||
}
|
||||
|
||||
// Holds the named relay_cells rows in another session until released, the
|
||||
// way a release from a far cell holds its row across a round trip.
|
||||
async function holdCellRows(cellIds: string[]): Promise<() => Promise<void>> {
|
||||
@@ -144,40 +100,18 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
|
||||
}
|
||||
|
||||
async function waitForLock(table: 'relay_cells' | 'relay_assignments'): Promise<void> {
|
||||
await vi.waitFor(async () => {
|
||||
const rows = await databases[0]!.query(
|
||||
`SELECT COUNT(*) AS waiting FROM pg_stat_activity
|
||||
await vi.waitFor(
|
||||
async () => {
|
||||
const rows = await databases[0]!.query(
|
||||
`SELECT COUNT(*) AS waiting FROM pg_stat_activity
|
||||
WHERE datname = current_database() AND wait_event_type = 'Lock'
|
||||
AND application_name = ? AND query LIKE ? AND query LIKE '%FOR UPDATE%'`,
|
||||
[databaseApplicationName(1), `%${table}%`]
|
||||
)
|
||||
expect(Number(rows[0]?.['waiting'])).toBeGreaterThan(0)
|
||||
}, { timeout: 4_000, interval: 10 })
|
||||
}
|
||||
|
||||
// Puts a host on the source with a live control and a splice, then isolates
|
||||
// the source for a roll with both targets open.
|
||||
async function seedActiveHostOnIsolatedSource(index: number): Promise<{
|
||||
identity: { userId: string; relayHostId: string }
|
||||
first: { cellId: string; assignmentEpoch: number }
|
||||
}> {
|
||||
const identity = hostIdentity(index)
|
||||
await applySelector({ [TARGETS[0]!.id]: 'migration-only', [TARGETS[1]!.id]: 'migration-only' })
|
||||
const first = await stores[0]!.assign(identity, 'us-central1')
|
||||
expect(first.cellId).toBe(ISOLATED.id)
|
||||
await stores[0]!.activateControl(identity, {
|
||||
cellId: ISOLATED.id,
|
||||
assignmentEpoch: first.assignmentEpoch,
|
||||
generation: 1
|
||||
})
|
||||
await stores[0]!.acquireActivity(identity, {
|
||||
activityId: 'splice:keep-1',
|
||||
kind: 'splice',
|
||||
cellId: ISOLATED.id
|
||||
})
|
||||
await applySelector({ [TARGETS[0]!.id]: 'general', [TARGETS[1]!.id]: 'general' })
|
||||
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
|
||||
return { identity, first }
|
||||
[databaseApplicationName(1), `%${table}%`]
|
||||
)
|
||||
expect(Number(rows[0]?.['waiting'])).toBeGreaterThan(0)
|
||||
},
|
||||
{ timeout: 4_000, interval: 10 }
|
||||
)
|
||||
}
|
||||
|
||||
// `enforced` puts a cell at its connection cap, which leaves it no headroom.
|
||||
@@ -211,9 +145,7 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
|
||||
const current = await stores[0]!.inspectCellAdmissionSelector()
|
||||
// Built from relay_cells, not from the selector's own membership: the apply
|
||||
// requires exact coverage of the fleet, and this database is shared.
|
||||
const fleet = await databases[0]!.query(
|
||||
`SELECT cell_id FROM relay_cells ORDER BY cell_id ASC`
|
||||
)
|
||||
const fleet = await databases[0]!.query(`SELECT cell_id FROM relay_cells ORDER BY cell_id ASC`)
|
||||
const membership: CellAdmissionMembership = {
|
||||
existingOnly: [],
|
||||
migrationOnly: [],
|
||||
@@ -251,15 +183,6 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
|
||||
})
|
||||
}
|
||||
|
||||
async function rollIsolatedAt(cellId: string): Promise<number | null> {
|
||||
const rows = await databases[0]!.query(
|
||||
`SELECT roll_isolated_at FROM relay_cell_admission WHERE cell_id = ?`,
|
||||
[cellId]
|
||||
)
|
||||
const value = rows[0]?.['roll_isolated_at']
|
||||
return value === undefined || value === null ? null : Number(value)
|
||||
}
|
||||
|
||||
// Every case starts from the whole fleet general; a case that leaves a cell
|
||||
// isolated would otherwise starve the next one of placement candidates.
|
||||
async function resetFleet(): Promise<void> {
|
||||
@@ -301,11 +224,13 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
|
||||
// Four connections so the concurrent dials below really contend on the
|
||||
// fleet-wide relay_cells lock rather than queueing in one client.
|
||||
for (let index = 0; index < 4; index += 1) {
|
||||
databases.push(await openRelayDatabase({
|
||||
databaseUrl,
|
||||
dataDir: '',
|
||||
applicationName: databaseApplicationName(index)
|
||||
}))
|
||||
databases.push(
|
||||
await openRelayDatabase({
|
||||
databaseUrl,
|
||||
dataDir: '',
|
||||
applicationName: databaseApplicationName(index)
|
||||
})
|
||||
)
|
||||
}
|
||||
stores = databases.map(
|
||||
(database) =>
|
||||
@@ -344,129 +269,6 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
|
||||
for (const connection of databases) await connection.close()
|
||||
})
|
||||
|
||||
it('stamps only the named cell on isolate and clears it on restore', async () => {
|
||||
await resetFleet()
|
||||
expect(await rollIsolatedAt(ISOLATED.id)).toBeNull()
|
||||
|
||||
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
|
||||
const stamped = await rollIsolatedAt(ISOLATED.id)
|
||||
expect(stamped).toBe(NOW)
|
||||
// Cells the isolate did not name stay unmarked even when parked in the same
|
||||
// apply: that is every non-roll flow, and its hosts must keep their pin.
|
||||
await applySelector({ [TARGETS[0]!.id]: 'migration-only' })
|
||||
expect(await rollIsolatedAt(TARGETS[0]!.id)).toBeNull()
|
||||
|
||||
// A failed wave re-isolates rather than restoring; the stamp survives, and
|
||||
// does not move, so the hosts left behind stay eligible.
|
||||
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
|
||||
expect(await rollIsolatedAt(ISOLATED.id)).toBe(stamped)
|
||||
|
||||
// Restore writes 'general', and the same statement clears the stamp.
|
||||
await applySelector({ [ISOLATED.id]: 'general' })
|
||||
expect(await rollIsolatedAt(ISOLATED.id)).toBeNull()
|
||||
}, 30_000)
|
||||
|
||||
it('classifies a reconnect by its home cell’s stamp in the verification read', async () => {
|
||||
await resetFleet()
|
||||
const identity = hostIdentity(903)
|
||||
const classify = { classifyHomeRollIsolation: true }
|
||||
await applySelector({ [TARGETS[0]!.id]: 'migration-only', [TARGETS[1]!.id]: 'migration-only' })
|
||||
const first = await stores[0]!.assign(identity, 'us-central1')
|
||||
await applySelector({ [TARGETS[0]!.id]: 'general', [TARGETS[1]!.id]: 'general' })
|
||||
expect(first.cellId).toBe(ISOLATED.id)
|
||||
expect(await stores[0]!.resolve(identity, classify)).not.toHaveProperty('homeCellRollIsolated')
|
||||
|
||||
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
|
||||
expect(await stores[0]!.resolve(identity, classify)).toMatchObject({
|
||||
cellId: ISOLATED.id,
|
||||
homeCellRollIsolated: true
|
||||
})
|
||||
|
||||
await applySelector({ [ISOLATED.id]: 'general' })
|
||||
expect(await stores[0]!.resolve(identity, classify)).not.toHaveProperty('homeCellRollIsolated')
|
||||
}, 30_000)
|
||||
|
||||
it('ignores a stamp older than the roll it is supposed to describe', async () => {
|
||||
// A failed wave keeps its stamp on purpose and can sit for hours; past the
|
||||
// bound the cell stops shedding hosts one dial at a time.
|
||||
await resetFleet()
|
||||
const identity = hostIdentity(902)
|
||||
const first = await stores[0]!.assign(identity, 'us-central1')
|
||||
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
|
||||
await databases[0]!.query(
|
||||
`UPDATE relay_cell_admission SET roll_isolated_at = ? WHERE cell_id = ?`,
|
||||
[NOW - (2 * 60 * 60_000 + 1), ISOLATED.id]
|
||||
)
|
||||
|
||||
expect(await stores[0]!.assign(identity, 'us-central1')).toMatchObject({
|
||||
cellId: first.cellId,
|
||||
assignmentEpoch: first.assignmentEpoch
|
||||
})
|
||||
}, 30_000)
|
||||
|
||||
it('re-places every host off an isolated cell without leaking a reservation', async () => {
|
||||
await resetFleet()
|
||||
const identities = Array.from({ length: HOST_COUNT }, (_, index) => hostIdentity(index))
|
||||
const sourceBaseline = await reservedRequests(ISOLATED.id)
|
||||
const targetBaseline =
|
||||
(await reservedRequests(TARGETS[0]!.id)) + (await reservedRequests(TARGETS[1]!.id))
|
||||
|
||||
// Everyone lands on the cell about to be isolated.
|
||||
await applySelector({ [TARGETS[0]!.id]: 'migration-only', [TARGETS[1]!.id]: 'migration-only' })
|
||||
const first = new Map<string, { cellId: string; assignmentEpoch: number }>()
|
||||
for (const identity of identities) {
|
||||
const grant = await stores[0]!.assign(identity, 'us-central1')
|
||||
expect(grant.cellId).toBe(ISOLATED.id)
|
||||
first.set(identity.relayHostId, grant)
|
||||
}
|
||||
await applySelector({ [TARGETS[0]!.id]: 'general', [TARGETS[1]!.id]: 'general' })
|
||||
|
||||
// The isolate step. The state and the stamp are written by one UPDATE under
|
||||
// the fleet-wide relay_cells lock, so there is no torn state to race against.
|
||||
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
|
||||
expect(await rollIsolatedAt(ISOLATED.id)).not.toBeNull()
|
||||
|
||||
const grants = await Promise.all(
|
||||
identities.map(
|
||||
async (identity, index) =>
|
||||
await stores[1 + (index % (stores.length - 1))]!.assign(identity, 'us-central1')
|
||||
)
|
||||
)
|
||||
|
||||
for (const [index, grant] of grants.entries()) {
|
||||
const identity = identities[index]!
|
||||
expect(grant.cellId).not.toBe(ISOLATED.id)
|
||||
expect(TARGETS.map(({ id }) => id)).toContain(grant.cellId)
|
||||
// Exactly once: a double bump would mean two transactions both moved it.
|
||||
expect(grant.assignmentEpoch).toBe(first.get(identity.relayHostId)!.assignmentEpoch + 1)
|
||||
}
|
||||
|
||||
// The placement leaves the source row alone: each host's pending control
|
||||
// there still counts until the source releases it.
|
||||
expect(await reservedRequests(ISOLATED.id)).toBe(sourceBaseline + HOST_COUNT)
|
||||
expect(
|
||||
(await reservedRequests(TARGETS[0]!.id)) + (await reservedRequests(TARGETS[1]!.id))
|
||||
).toBe(targetBaseline + HOST_COUNT)
|
||||
await expectReservationAccounting()
|
||||
for (const identity of identities) {
|
||||
expect(
|
||||
await stores[0]!.releaseActivity(
|
||||
identity,
|
||||
`control-pending:${first.get(identity.relayHostId)!.assignmentEpoch}`
|
||||
)
|
||||
).toBe(true)
|
||||
}
|
||||
expect(await reservedRequests(ISOLATED.id)).toBe(sourceBaseline)
|
||||
await expectReservationAccounting()
|
||||
|
||||
const rows = await databases[0]!.query(
|
||||
`SELECT COUNT(*) AS count FROM relay_assignments
|
||||
WHERE user_id LIKE '${USER_PREFIX}-%' AND cell_id = ?`,
|
||||
[ISOLATED.id]
|
||||
)
|
||||
expect(Number(rows[0]!['count'])).toBe(0)
|
||||
}, 60_000)
|
||||
|
||||
it('lets exactly one of a host’s racing dials win the re-placement', async () => {
|
||||
await resetFleet()
|
||||
const identity = hostIdentity(900)
|
||||
@@ -486,9 +288,7 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
|
||||
stores[1]!.assign(identity, 'us-central1'),
|
||||
stores[2]!.assign(identity, 'us-central1')
|
||||
])
|
||||
const granted = raced.flatMap((result) =>
|
||||
result.status === 'fulfilled' ? [result.value] : []
|
||||
)
|
||||
const granted = raced.flatMap((result) => (result.status === 'fulfilled' ? [result.value] : []))
|
||||
expect(granted.length).toBeGreaterThan(0)
|
||||
|
||||
// Concurrent dials may grant repeatedly but commit one move: one epoch/unit on target, preserving source leases until release.
|
||||
@@ -502,399 +302,6 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
|
||||
).toBe(targetBaseline + 1)
|
||||
}, 30_000)
|
||||
|
||||
it('grants no host the isolated cell after the admission flip commits', async () => {
|
||||
await resetFleet()
|
||||
const identity = hostIdentity(901)
|
||||
const first = await stores[0]!.assign(identity, 'us-central1')
|
||||
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
|
||||
|
||||
for (let dial = 0; dial < 5; dial += 1) {
|
||||
const grant = await stores[1 + (dial % (stores.length - 1))]!.assign(
|
||||
identity,
|
||||
'us-central1'
|
||||
)
|
||||
expect(grant.cellId).not.toBe(ISOLATED.id)
|
||||
}
|
||||
// Only the first dial re-places; the rest are ordinary sticky re-grants.
|
||||
expect((await stores[0]!.resolve(identity))?.assignmentEpoch).toBe(
|
||||
first.assignmentEpoch + 1
|
||||
)
|
||||
}, 30_000)
|
||||
it('leaves the source row to the source’s own releases and keeps the host’s counters', async () => {
|
||||
await resetFleet()
|
||||
const { identity, first } = await seedActiveHostOnIsolatedSource(910)
|
||||
const sourceBefore = await reservedRequests(ISOLATED.id)
|
||||
const targetsBefore =
|
||||
(await reservedRequests(TARGETS[0]!.id)) + (await reservedRequests(TARGETS[1]!.id))
|
||||
expect(sourceBefore).toBe(3)
|
||||
expect(await counters(identity)).toEqual({ controls: 1, splices: 1 })
|
||||
|
||||
const moved = await stores[1]!.assign(identity, 'us-central1')
|
||||
expect(TARGETS.map(({ id }) => id)).toContain(moved.cellId)
|
||||
expect(moved.assignmentEpoch).toBe(first.assignmentEpoch + 1)
|
||||
expect(await reservedRequests(ISOLATED.id)).toBe(sourceBefore)
|
||||
expect(
|
||||
(await reservedRequests(TARGETS[0]!.id)) + (await reservedRequests(TARGETS[1]!.id))
|
||||
).toBe(targetsBefore + 1)
|
||||
// One control added on the target; the source's control and splice kept.
|
||||
expect(await counters(identity)).toEqual({ controls: 2, splices: 1 })
|
||||
await expectReservationAccounting()
|
||||
|
||||
// The source closes the host's sockets: each release takes its own units.
|
||||
expect(await stores[0]!.releaseActivity(identity, `control:${ISOLATED.id}:1`)).toBe(true)
|
||||
expect(await reservedRequests(ISOLATED.id)).toBe(sourceBefore - 1)
|
||||
expect(await counters(identity)).toEqual({ controls: 1, splices: 1 })
|
||||
expect(await stores[0]!.releaseActivity(identity, 'splice:keep-1')).toBe(true)
|
||||
expect(await reservedRequests(ISOLATED.id)).toBe(0)
|
||||
// The target's control survives the source's releases.
|
||||
expect(await counters(identity)).toEqual({ controls: 1, splices: 0 })
|
||||
await expectReservationAccounting()
|
||||
}, 30_000)
|
||||
|
||||
it('re-places an isolated incumbent while the source row is held', async () => {
|
||||
await resetFleet()
|
||||
const { identity, first } = await seedActiveHostOnIsolatedSource(911)
|
||||
const sourceBefore = await reservedRequests(ISOLATED.id)
|
||||
const release = await holdCellRows([ISOLATED.id])
|
||||
try {
|
||||
// Held far past the 500ms bounded wait: a placement that asked for the
|
||||
// source row could not finish inside this window.
|
||||
const moved = await Promise.race([
|
||||
stores[1]!.assign(identity, 'us-central1'),
|
||||
new Promise<'blocked'>((resolve) => setTimeout(() => resolve('blocked'), 3_000))
|
||||
])
|
||||
expect(moved).not.toBe('blocked')
|
||||
expect(moved).toMatchObject({ assignmentEpoch: first.assignmentEpoch + 1 })
|
||||
} finally {
|
||||
await release()
|
||||
}
|
||||
expect(await reservedRequests(ISOLATED.id)).toBe(sourceBefore)
|
||||
await expectReservationAccounting()
|
||||
}, 30_000)
|
||||
|
||||
it('waits for the target rows it increments', async () => {
|
||||
await resetFleet()
|
||||
const { identity, first } = await seedActiveHostOnIsolatedSource(912)
|
||||
const targetsBefore =
|
||||
(await reservedRequests(TARGETS[0]!.id)) + (await reservedRequests(TARGETS[1]!.id))
|
||||
const release = await holdCellRows(TARGETS.map(({ id }) => id))
|
||||
const placement = stores[1]!.assign(identity, 'us-central1')
|
||||
try {
|
||||
await waitForLock('relay_cells')
|
||||
} finally {
|
||||
await release()
|
||||
await placement.catch(() => undefined)
|
||||
}
|
||||
expect(await placement).toMatchObject({ assignmentEpoch: first.assignmentEpoch + 1 })
|
||||
expect(
|
||||
(await reservedRequests(TARGETS[0]!.id)) + (await reservedRequests(TARGETS[1]!.id))
|
||||
).toBe(targetsBefore + 1)
|
||||
await expectReservationAccounting()
|
||||
}, 30_000)
|
||||
|
||||
it('keeps the pin when no general cell in any region has headroom', async () => {
|
||||
await resetFleet()
|
||||
const { identity, first } = await seedActiveHostOnIsolatedSource(913)
|
||||
const sourceBefore = await reservedRequests(ISOLATED.id)
|
||||
await databases[0]!.query(
|
||||
`UPDATE relay_cells SET reserved_requests = capacity_requests WHERE cell_id IN (?, ?, ?)`,
|
||||
[...TARGETS, OTHER_REGION].map(({ id }) => id)
|
||||
)
|
||||
try {
|
||||
expect(await stores[1]!.assign(identity, 'us-central1')).toMatchObject({
|
||||
cellId: ISOLATED.id,
|
||||
assignmentEpoch: first.assignmentEpoch
|
||||
})
|
||||
expect(await reservedRequests(ISOLATED.id)).toBe(sourceBefore)
|
||||
expect(await counters(identity)).toEqual({ controls: 1, splices: 1 })
|
||||
} finally {
|
||||
await databases[0]!.query(
|
||||
`UPDATE relay_cells SET reserved_requests = 0 WHERE cell_id IN (?, ?, ?)`,
|
||||
[...TARGETS, OTHER_REGION].map(({ id }) => id)
|
||||
)
|
||||
}
|
||||
}, 30_000)
|
||||
|
||||
it('moves to another region when its own is at the connection cap, without the source row', async () => {
|
||||
await resetFleet()
|
||||
const { identity, first } = await seedActiveHostOnIsolatedSource(917)
|
||||
const sourceBefore = await reservedRequests(ISOLATED.id)
|
||||
await heartbeatAll(Object.fromEntries(TARGETS.map(({ id }) => [id, 600])))
|
||||
const release = await holdCellRows([ISOLATED.id])
|
||||
try {
|
||||
const moved = await Promise.race([
|
||||
stores[1]!.assign(identity, 'us-central1'),
|
||||
new Promise<'blocked'>((resolve) => setTimeout(() => resolve('blocked'), 3_000))
|
||||
])
|
||||
expect(moved).toMatchObject({
|
||||
cellId: OTHER_REGION.id,
|
||||
region: 'asia-east2',
|
||||
assignmentEpoch: first.assignmentEpoch + 1
|
||||
})
|
||||
} finally {
|
||||
await release()
|
||||
await heartbeatAll()
|
||||
}
|
||||
expect(await reservedRequests(ISOLATED.id)).toBe(sourceBefore)
|
||||
expect(await reservedRequests(OTHER_REGION.id)).toBe(1)
|
||||
await expectReservationAccounting()
|
||||
}, 30_000)
|
||||
it('places a dormant host without asking for its old cell row', async () => {
|
||||
await resetFleet()
|
||||
const identity = hostIdentity(914)
|
||||
await applySelector({ [TARGETS[0]!.id]: 'migration-only', [TARGETS[1]!.id]: 'migration-only' })
|
||||
const first = await stores[0]!.assign(identity, 'us-central1')
|
||||
expect(first.cellId).toBe(ISOLATED.id)
|
||||
// Dormant: no units held and no activity inside the dormancy window.
|
||||
await databases[0]!.query(
|
||||
`DELETE FROM relay_assignment_activity_leases WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
await databases[0]!.query(
|
||||
`UPDATE relay_assignments SET reserved_controls = 0, last_activity_at = ?
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[NOW - ASSIGNMENT_LIMITS.dormantTtlMs, identity.userId, identity.relayHostId]
|
||||
)
|
||||
await databases[0]!.query(`UPDATE relay_cells SET reserved_requests = 0 WHERE cell_id = ?`, [
|
||||
ISOLATED.id
|
||||
])
|
||||
await applySelector({ [TARGETS[0]!.id]: 'general', [TARGETS[1]!.id]: 'general' })
|
||||
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
|
||||
|
||||
const release = await holdCellRows([ISOLATED.id])
|
||||
try {
|
||||
const moved = await Promise.race([
|
||||
stores[1]!.assign(identity, 'us-central1'),
|
||||
new Promise<'blocked'>((resolve) => setTimeout(() => resolve('blocked'), 3_000))
|
||||
])
|
||||
expect(moved).toMatchObject({ assignmentEpoch: first.assignmentEpoch + 1 })
|
||||
expect(TARGETS.map(({ id }) => id)).toContain(moved === 'blocked' ? moved : moved.cellId)
|
||||
} finally {
|
||||
await release()
|
||||
}
|
||||
await expectReservationAccounting()
|
||||
}, 30_000)
|
||||
// Moves a seeded host onto TARGETS[0] next to another host whose splice there
|
||||
// outlives the test, so an over-charge shows instead of clamping at zero.
|
||||
async function seedMovedHostBesideNeighbour(index: number): Promise<{
|
||||
identity: { userId: string; relayHostId: string }
|
||||
neighbour: { userId: string; relayHostId: string }
|
||||
}> {
|
||||
const { identity } = await seedActiveHostOnIsolatedSource(index)
|
||||
await applySelector({ [TARGETS[1]!.id]: 'migration-only' })
|
||||
const neighbour = hostIdentity(index + 50)
|
||||
expect((await stores[0]!.assign(neighbour, 'us-central1')).cellId).toBe(TARGETS[0]!.id)
|
||||
await stores[0]!.acquireActivity(neighbour, {
|
||||
activityId: 'splice:neighbour',
|
||||
kind: 'splice',
|
||||
cellId: TARGETS[0]!.id,
|
||||
expiresAt: NOW + 10 * 60 * 60_000
|
||||
})
|
||||
expect((await stores[1]!.assign(identity, 'us-central1')).cellId).toBe(TARGETS[0]!.id)
|
||||
expect(await counters(identity)).toEqual({ controls: 2, splices: 1 })
|
||||
await expectReservationAccounting()
|
||||
return { identity, neighbour }
|
||||
}
|
||||
|
||||
it('leaves a host with leases on two cells to the lease sweep', async () => {
|
||||
await resetFleet()
|
||||
const { identity } = await seedMovedHostBesideNeighbour(915)
|
||||
// Past every lease but the neighbour's splice.
|
||||
const later = new RelayAssignmentStore(databases[0]!, () => NOW + 60 * 60_000, {
|
||||
requireLiveCells: true,
|
||||
heartbeatTtlMs: 45_000
|
||||
})
|
||||
try {
|
||||
// Aggregate expiry first, with the source's leases still present: the
|
||||
// order a lease sweep skipped on a busy row leaves behind.
|
||||
await later.releaseExpiredActivity()
|
||||
expect(await counters(identity)).toEqual({ controls: 2, splices: 1 })
|
||||
await expectReservationAccounting()
|
||||
await later.releaseExpiredActivityLeases()
|
||||
await later.releaseExpiredActivity()
|
||||
expect(await counters(identity)).toEqual({ controls: 0, splices: 0 })
|
||||
expect(await reservedRequests(ISOLATED.id)).toBe(0)
|
||||
// Only the neighbour's splice is left on the target.
|
||||
expect(await reservedRequests(TARGETS[0]!.id)).toBe(2)
|
||||
await expectReservationAccounting()
|
||||
} finally {
|
||||
await applySelector({ [TARGETS[1]!.id]: 'general' })
|
||||
}
|
||||
}, 30_000)
|
||||
|
||||
it('frees the source leases on their own cell when the target dies', async () => {
|
||||
await resetFleet()
|
||||
const { identity } = await seedMovedHostBesideNeighbour(916)
|
||||
// The roll finishes, then the target stops heartbeating before the source
|
||||
// has released the host. Uncapped, so no fence is needed to move off it.
|
||||
await applySelector({ [ISOLATED.id]: 'general' })
|
||||
await databases[0]!.query(`UPDATE relay_cell_runtime SET ready = 0 WHERE cell_id = ?`, [
|
||||
TARGETS[0]!.id
|
||||
])
|
||||
await databases[0]!.query(`DELETE FROM relay_cell_connection_limits WHERE cell_id = ?`, [
|
||||
TARGETS[0]!.id
|
||||
])
|
||||
try {
|
||||
const moved = await stores[1]!.assign(identity, 'us-central1')
|
||||
expect(moved.cellId).toBe(ISOLATED.id)
|
||||
expect(await counters(identity)).toEqual({ controls: 1, splices: 0 })
|
||||
// The deleted source leases took their units with them; a late release
|
||||
// from the source finds nothing and charges nothing.
|
||||
expect(await stores[0]!.releaseActivity(identity, `control:${ISOLATED.id}:1`)).toBe(false)
|
||||
expect(await reservedRequests(ISOLATED.id)).toBe(1)
|
||||
expect(await reservedRequests(TARGETS[0]!.id)).toBe(3)
|
||||
await expectReservationAccounting()
|
||||
} finally {
|
||||
// Re-registers the connection limit, then the heartbeat restores ready.
|
||||
await stores[0]!.reconcileCells(CELLS, false)
|
||||
await heartbeatAll()
|
||||
await applySelector({ [TARGETS[1]!.id]: 'general' })
|
||||
}
|
||||
}, 30_000)
|
||||
// A host main's old placement left behind: its counters were reset while its
|
||||
// source lease stayed, and the lease's release floored them at zero.
|
||||
async function seedDriftedHost(
|
||||
index: number,
|
||||
counted: { controls: number; unbackedSourceUnits: number }
|
||||
): Promise<{ identity: { userId: string; relayHostId: string }; epoch: number }> {
|
||||
const identity = hostIdentity(index)
|
||||
await applySelector({ [TARGETS[0]!.id]: 'migration-only', [TARGETS[1]!.id]: 'migration-only' })
|
||||
const first = await stores[0]!.assign(identity, 'us-central1')
|
||||
expect(first.cellId).toBe(ISOLATED.id)
|
||||
await stores[0]!.activateControl(identity, {
|
||||
cellId: ISOLATED.id,
|
||||
assignmentEpoch: first.assignmentEpoch,
|
||||
generation: 1
|
||||
})
|
||||
await databases[0]!.query(
|
||||
`UPDATE relay_assignments SET reserved_controls = ? WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[counted.controls, identity.userId, identity.relayHostId]
|
||||
)
|
||||
// Units the source still counts with no lease behind them.
|
||||
await databases[0]!.query(
|
||||
`UPDATE relay_cells SET reserved_requests = reserved_requests + ? WHERE cell_id = ?`,
|
||||
[counted.unbackedSourceUnits, ISOLATED.id]
|
||||
)
|
||||
await applySelector({ [TARGETS[0]!.id]: 'general', [TARGETS[1]!.id]: 'general' })
|
||||
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
|
||||
return { identity, epoch: first.assignmentEpoch }
|
||||
}
|
||||
|
||||
it('heals counters below the leases on the narrowed path', async () => {
|
||||
await resetFleet()
|
||||
const { identity, epoch } = await seedDriftedHost(918, { controls: 0, unbackedSourceUnits: 0 })
|
||||
expect(await counters(identity)).toEqual({ controls: 0, splices: 0 })
|
||||
await expectReservationAccounting()
|
||||
const release = await holdCellRows([ISOLATED.id])
|
||||
try {
|
||||
const moved = await Promise.race([
|
||||
stores[1]!.assign(identity, 'us-central1'),
|
||||
new Promise<'blocked'>((resolve) => setTimeout(() => resolve('blocked'), 3_000))
|
||||
])
|
||||
expect(moved).toMatchObject({ assignmentEpoch: epoch + 1 })
|
||||
expect(TARGETS.map(({ id }) => id)).toContain(moved === 'blocked' ? moved : moved.cellId)
|
||||
} finally {
|
||||
await release()
|
||||
}
|
||||
// The kept source control plus the new one.
|
||||
expect(await counters(identity)).toEqual({ controls: 2, splices: 0 })
|
||||
await expectReservationAccounting()
|
||||
expect(await stores[0]!.releaseActivity(identity, `control:${ISOLATED.id}:1`)).toBe(true)
|
||||
expect(await counters(identity)).toEqual({ controls: 1, splices: 0 })
|
||||
expect(await reservedRequests(ISOLATED.id)).toBe(0)
|
||||
await expectReservationAccounting()
|
||||
}, 30_000)
|
||||
|
||||
it('takes the all-rows path for units no lease backs', async () => {
|
||||
await resetFleet()
|
||||
const { identity, epoch } = await seedDriftedHost(919, { controls: 3, unbackedSourceUnits: 2 })
|
||||
await expectReservationAccountingExcept(ISOLATED.id)
|
||||
const release = await holdCellRows([ISOLATED.id])
|
||||
const held = stores[1]!.assign(identity, 'us-central1').then(
|
||||
() => 'placed' as const,
|
||||
() => 'failed' as const
|
||||
)
|
||||
try {
|
||||
// It needs the source row to take the unbacked units off it, so while the
|
||||
// row is held it either waits or times out; it never places.
|
||||
expect(
|
||||
await Promise.race([
|
||||
held,
|
||||
new Promise<'waiting'>((resolve) => setTimeout(() => resolve('waiting'), 1_000))
|
||||
])
|
||||
).not.toBe('placed')
|
||||
} finally {
|
||||
await release()
|
||||
}
|
||||
await held
|
||||
// Whether the held dial finished after the release or failed, the next one
|
||||
// lands the single move.
|
||||
expect(await stores[1]!.assign(identity, 'us-central1')).toMatchObject({
|
||||
assignmentEpoch: epoch + 1
|
||||
})
|
||||
expect(await counters(identity)).toEqual({ controls: 2, splices: 0 })
|
||||
await expectReservationAccounting()
|
||||
}, 30_000)
|
||||
it('refuses at once while the host’s own release holds its assignment row', async () => {
|
||||
await resetFleet()
|
||||
const { identity, epoch } = await seedDriftedHost(921, { controls: 1, unbackedSourceUnits: 0 })
|
||||
const release = await holdRows(
|
||||
`SELECT user_id FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
try {
|
||||
const startedAt = performance.now()
|
||||
await expect(stores[1]!.assign(identity, 'us-central1')).rejects.toBeInstanceOf(
|
||||
RelayAssignmentRowBusyError
|
||||
)
|
||||
// An isolated pin gets no wait: far under the 1s a release can hold it.
|
||||
expect(performance.now() - startedAt).toBeLessThan(500)
|
||||
} finally {
|
||||
await release()
|
||||
}
|
||||
expect((await stores[0]!.resolve(identity))?.assignmentEpoch).toBe(epoch)
|
||||
expect((await stores[1]!.assign(identity, 'us-central1')).assignmentEpoch).toBe(epoch + 1)
|
||||
await expectReservationAccounting()
|
||||
}, 30_000)
|
||||
|
||||
it('waits up to a second for the row of a host pinned to a live general cell', async () => {
|
||||
await resetFleet()
|
||||
const identity = hostIdentity(922)
|
||||
const first = await stores[0]!.assign(identity, 'us-central1')
|
||||
const holdAssignment = async (): Promise<() => Promise<void>> =>
|
||||
await holdRows(
|
||||
`SELECT user_id FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[identity.userId, identity.relayHostId]
|
||||
)
|
||||
|
||||
// A short hold, like a calm host's own release: the sticky re-grant waits.
|
||||
const shortHold = await holdAssignment()
|
||||
const regrant = stores[1]!.assign(identity, 'us-central1')
|
||||
try {
|
||||
await waitForLock('relay_assignments')
|
||||
} finally {
|
||||
await shortHold()
|
||||
await regrant.catch(() => undefined)
|
||||
}
|
||||
expect(await regrant).toMatchObject({
|
||||
cellId: first.cellId,
|
||||
assignmentEpoch: first.assignmentEpoch
|
||||
})
|
||||
|
||||
// Held past the bound: refused, after about the bound and not the pool's.
|
||||
const longHold = await holdAssignment()
|
||||
try {
|
||||
const startedAt = performance.now()
|
||||
await expect(stores[1]!.assign(identity, 'us-central1')).rejects.toBeInstanceOf(
|
||||
RelayAssignmentRowBusyError
|
||||
)
|
||||
const waitedMs = performance.now() - startedAt
|
||||
expect(waitedMs).toBeGreaterThanOrEqual(900)
|
||||
expect(waitedMs).toBeLessThan(2_000)
|
||||
} finally {
|
||||
await longHold()
|
||||
}
|
||||
}, 30_000)
|
||||
it('never waits on the assignment row while its retry holds the pinned cell row', async () => {
|
||||
await resetFleet()
|
||||
const identity = hostIdentity(923)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createHash } from 'node:crypto'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { RelayAssignmentStore, RelayHomeCellUnavailableError } from './assignment-store.js'
|
||||
import { ReservePaceError } from './reserve-placement/reserve-assignment.js'
|
||||
import { RelayAssignmentStore } from './assignment-store.js'
|
||||
|
||||
import {
|
||||
encodeMembership,
|
||||
type CellAdmissionMembership,
|
||||
@@ -41,16 +41,10 @@ afterEach(async () => {
|
||||
for (const database of databases.splice(0)) await database.close()
|
||||
})
|
||||
|
||||
// Counts the reads this change adds, so the general hot path can be held to a
|
||||
// single admission lookup and no migration lookup at all.
|
||||
class QueryCountingDatabase implements RelayDatabase {
|
||||
readonly sql: string[] = []
|
||||
class WriteFailureDatabase implements RelayDatabase {
|
||||
// Fails the first statement containing this fragment, so a test can roll a
|
||||
// transaction back at a chosen point.
|
||||
failOnce: string | undefined
|
||||
// Locked statements that report the row busy, in order: each fragment fires
|
||||
// once, on the first locked statement containing it after the one before.
|
||||
lockUnavailableSequence: string[] = []
|
||||
|
||||
constructor(private readonly delegate: RelayDatabase) {}
|
||||
|
||||
@@ -58,12 +52,7 @@ class QueryCountingDatabase implements RelayDatabase {
|
||||
return this.delegate.dialect
|
||||
}
|
||||
|
||||
count(fragment: string): number {
|
||||
return this.sql.filter((statement) => statement.includes(fragment)).length
|
||||
}
|
||||
|
||||
record(sql: string): void {
|
||||
this.sql.push(sql)
|
||||
if (this.failOnce !== undefined && sql.includes(this.failOnce)) {
|
||||
this.failOnce = undefined
|
||||
throw new Error('injected_placement_write_failure')
|
||||
@@ -80,17 +69,8 @@ class QueryCountingDatabase implements RelayDatabase {
|
||||
params?: unknown[],
|
||||
options?: RelayLockOptions
|
||||
): Promise<SqlRow[]> {
|
||||
this.recordLocked(sql)
|
||||
return await this.delegate.queryLocked(sql, params, options)
|
||||
}
|
||||
|
||||
recordLocked(sql: string): void {
|
||||
this.record(sql)
|
||||
const next = this.lockUnavailableSequence[0]
|
||||
if (next !== undefined && sql.includes(next)) {
|
||||
this.lockUnavailableSequence.shift()
|
||||
throw new Error('database_lock_unavailable')
|
||||
}
|
||||
return await this.delegate.queryLocked(sql, params, options)
|
||||
}
|
||||
|
||||
async transaction<T>(
|
||||
@@ -107,8 +87,7 @@ class QueryCountingDatabase implements RelayDatabase {
|
||||
await this.delegate.close()
|
||||
}
|
||||
|
||||
// A nested transaction shares this one's tape, so a whole assign() is
|
||||
// measured as a unit.
|
||||
// Inject the failure inside the transaction so the real database rolls it back.
|
||||
private recording(inner: RelayDatabase): RelayDatabase {
|
||||
return {
|
||||
dialect: inner.dialect,
|
||||
@@ -117,7 +96,7 @@ class QueryCountingDatabase implements RelayDatabase {
|
||||
return await inner.query(sql, params)
|
||||
},
|
||||
queryLocked: async (sql, params, options) => {
|
||||
this.recordLocked(sql)
|
||||
this.record(sql)
|
||||
return await inner.queryLocked(sql, params, options)
|
||||
},
|
||||
transaction: async (operation, options) => await inner.transaction(operation, options),
|
||||
@@ -129,7 +108,7 @@ class QueryCountingDatabase implements RelayDatabase {
|
||||
interface Harness {
|
||||
store: RelayAssignmentStore
|
||||
database: RelayDatabase
|
||||
counter: QueryCountingDatabase
|
||||
counter: WriteFailureDatabase
|
||||
heartbeat: (cell: RelayCellConfig, at?: number) => Promise<void>
|
||||
setNow: (value: number) => void
|
||||
/** The real isolate path: one selector apply that names the cell it stamps. */
|
||||
@@ -144,7 +123,7 @@ interface Harness {
|
||||
async function setup(cells: RelayCellConfig[] = CELLS): Promise<Harness> {
|
||||
const inner = await openInMemoryRelayDatabase()
|
||||
databases.push(inner)
|
||||
const counter = new QueryCountingDatabase(inner)
|
||||
const counter = new WriteFailureDatabase(inner)
|
||||
let now = START_MS
|
||||
const store = new RelayAssignmentStore(counter, () => now, {
|
||||
requireLiveCells: true,
|
||||
@@ -233,43 +212,6 @@ async function setup(cells: RelayCellConfig[] = CELLS): Promise<Harness> {
|
||||
}
|
||||
}
|
||||
|
||||
async function insertMigration(
|
||||
database: RelayDatabase,
|
||||
input: {
|
||||
sourceCellId: string
|
||||
targetCellId: string
|
||||
assignmentEpoch: number
|
||||
leases: number
|
||||
settled?: 'completed' | 'aborted'
|
||||
}
|
||||
): Promise<void> {
|
||||
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 (?, ?, ?, ?, ?, ?, 1, 1, ?, NULL, ?, ?, ?, ?)`,
|
||||
[
|
||||
IDENTITY.userId,
|
||||
IDENTITY.relayHostId,
|
||||
input.sourceCellId,
|
||||
input.targetCellId,
|
||||
input.assignmentEpoch - 1,
|
||||
input.assignmentEpoch,
|
||||
START_MS + 900_000,
|
||||
input.settled === 'completed' ? START_MS : null,
|
||||
input.settled === 'aborted' ? START_MS : null,
|
||||
START_MS,
|
||||
START_MS
|
||||
]
|
||||
)
|
||||
await database.query(
|
||||
`UPDATE relay_assignments SET migration_leases = ?
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[input.leases, IDENTITY.userId, IDENTITY.relayHostId]
|
||||
)
|
||||
}
|
||||
|
||||
type ConsoleWarnSpy = { mock: { calls: unknown[][] } }
|
||||
|
||||
function jsonEvents(warn: ConsoleWarnSpy, event: string): unknown[] {
|
||||
@@ -280,381 +222,6 @@ function jsonEvents(warn: ConsoleWarnSpy, event: string): unknown[] {
|
||||
}
|
||||
|
||||
describe('re-placing a host off a cell isolated for a roll', () => {
|
||||
it('leaves a host on a live general cell untouched, at one added admission read', async () => {
|
||||
const { store, counter } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
|
||||
counter.sql.length = 0
|
||||
const second = await store.assign(IDENTITY, 'us-central1')
|
||||
|
||||
// Identical, not merely same-celled: the clock has not moved, so every
|
||||
// field including the lease deadline must match; only the first was placed.
|
||||
expect(second).toEqual({ ...first, placed: undefined })
|
||||
// One row read answers both the stranded rule and the roll-stamp check.
|
||||
expect(counter.count('relay_cell_admission')).toBe(1)
|
||||
expect(counter.count('relay_assignment_migrations')).toBe(0)
|
||||
// No placement: the sticky lane never reaches the fleet-wide inventory.
|
||||
expect(counter.count('ORDER BY cell_id ASC')).toBe(0)
|
||||
})
|
||||
|
||||
it('keeps a host pinned to a migration-only cell with no roll stamp', async () => {
|
||||
// Unstamped non-roll parking must retain hosts or undo evacuation/Asia rollback/operator intent.
|
||||
const { store, park, rollIsolatedAt } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
await park(first.cellId, 'migration-only')
|
||||
|
||||
expect(await rollIsolatedAt(first.cellId)).toBeNull()
|
||||
const pinned = await store.assign(IDENTITY, 'us-central1')
|
||||
expect(pinned).toMatchObject({ cellId: first.cellId, assignmentEpoch: first.assignmentEpoch })
|
||||
expect(pinned.placed).toBeUndefined()
|
||||
})
|
||||
|
||||
it('re-places a host once the roll stamp is set', async () => {
|
||||
const { store, counter, isolateForRoll, rollIsolatedAt } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
await isolateForRoll(first.cellId)
|
||||
|
||||
expect(await rollIsolatedAt(first.cellId)).toBe(START_MS)
|
||||
counter.sql.length = 0
|
||||
const moved = await store.assign(IDENTITY, 'us-central1')
|
||||
|
||||
expect(moved.cellId).not.toBe(first.cellId)
|
||||
expect(moved.assignmentEpoch).toBe(first.assignmentEpoch + 1)
|
||||
expect(moved.placed).toBe(true)
|
||||
expect(counter.count('relay_assignment_migrations')).toBeGreaterThan(0)
|
||||
|
||||
// Durable: the next dial does not bounce back to the isolated cell.
|
||||
const kept = await store.assign(IDENTITY, 'us-central1')
|
||||
expect(kept).toMatchObject({ cellId: moved.cellId, assignmentEpoch: moved.assignmentEpoch })
|
||||
expect(kept.placed).toBeUndefined()
|
||||
})
|
||||
|
||||
it.each([
|
||||
{ label: 'just inside the bound', age: 2 * 60 * 60_000 - 1, moves: true },
|
||||
{ label: 'just outside the bound', age: 2 * 60 * 60_000 + 1, moves: false }
|
||||
])('treats a stamp $label as $moves', async ({ age, moves }) => {
|
||||
// Past a normal ~15-minute roll, stamps may be failed-wave or old-restore orphans; keep possibly healthy hosts pinned for operator recovery.
|
||||
const { store, heartbeat, isolateForRoll, setNow } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
await isolateForRoll(first.cellId)
|
||||
|
||||
const later = START_MS + age
|
||||
setNow(later)
|
||||
for (const cell of CELLS) await heartbeat(cell, later)
|
||||
const grant = await store.assign(IDENTITY, 'us-central1')
|
||||
|
||||
if (moves) {
|
||||
expect(grant.cellId).not.toBe(first.cellId)
|
||||
expect(grant.assignmentEpoch).toBe(first.assignmentEpoch + 1)
|
||||
} else {
|
||||
expect(grant.cellId).toBe(first.cellId)
|
||||
expect(grant.assignmentEpoch).toBe(first.assignmentEpoch)
|
||||
}
|
||||
})
|
||||
|
||||
it('stops re-placing once restore clears the stamp', async () => {
|
||||
const { store, isolateForRoll, restore, rollIsolatedAt } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
await isolateForRoll(first.cellId)
|
||||
await restore(first.cellId)
|
||||
|
||||
expect(await rollIsolatedAt(first.cellId)).toBeNull()
|
||||
expect(await store.assign(IDENTITY, 'us-central1')).toMatchObject({
|
||||
cellId: first.cellId,
|
||||
assignmentEpoch: first.assignmentEpoch
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps a host pinned to an existing-only cell that still serves it', async () => {
|
||||
// Why: existing-only cells serve the hosts they already hold (PR #194). Only
|
||||
// assignmentStrandedOnUnservedCell may release that pin, and only on proof
|
||||
// the cell stopped serving this host.
|
||||
const { store, database, heartbeat, park, setNow } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
await park(first.cellId, 'existing-only')
|
||||
await database.query(
|
||||
`INSERT INTO relay_assignment_activity_leases
|
||||
(user_id, relay_host_id, activity_id, activity_kind, cell_id,
|
||||
request_units, expires_at, updated_at)
|
||||
VALUES (?, ?, 'control:live-1', 'control', ?, 1, ?, ?)`,
|
||||
[IDENTITY.userId, IDENTITY.relayHostId, first.cellId, START_MS + 600_000, START_MS]
|
||||
)
|
||||
|
||||
// Past the stranded rule's minimum grant age, which outlives the heartbeat TTL.
|
||||
setNow(START_MS + 61_000)
|
||||
for (const cell of CELLS) await heartbeat(cell, START_MS + 61_000)
|
||||
expect(await store.assign(IDENTITY, 'us-central1')).toMatchObject({
|
||||
cellId: first.cellId,
|
||||
assignmentEpoch: first.assignmentEpoch
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps a host pinned on an unstamped cell whose migration has completed', async () => {
|
||||
// Completed evacuations await separate promotion in migration-only; re-placement would undo them.
|
||||
const { store, database, park } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
await insertMigration(database, {
|
||||
sourceCellId: 'us-c2',
|
||||
targetCellId: first.cellId,
|
||||
assignmentEpoch: first.assignmentEpoch,
|
||||
leases: 0,
|
||||
settled: 'completed'
|
||||
})
|
||||
await park(first.cellId, 'migration-only')
|
||||
|
||||
expect(await store.assign(IDENTITY, 'us-central1')).toMatchObject({
|
||||
cellId: first.cellId,
|
||||
assignmentEpoch: first.assignmentEpoch
|
||||
})
|
||||
})
|
||||
|
||||
it('re-places a stamped cell whose migration has completed', async () => {
|
||||
const { store, database, isolateForRoll } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
await insertMigration(database, {
|
||||
sourceCellId: 'us-c2',
|
||||
targetCellId: first.cellId,
|
||||
assignmentEpoch: first.assignmentEpoch,
|
||||
leases: 0,
|
||||
settled: 'completed'
|
||||
})
|
||||
await isolateForRoll(first.cellId)
|
||||
|
||||
expect((await store.assign(IDENTITY, 'us-central1')).cellId).not.toBe(first.cellId)
|
||||
})
|
||||
|
||||
it('keeps the pin while a migration lease is outstanding', async () => {
|
||||
const { store, database, isolateForRoll } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
await insertMigration(database, {
|
||||
sourceCellId: first.cellId,
|
||||
targetCellId: 'us-c2',
|
||||
assignmentEpoch: first.assignmentEpoch,
|
||||
leases: 1
|
||||
})
|
||||
await isolateForRoll(first.cellId)
|
||||
|
||||
expect(await store.assign(IDENTITY, 'us-central1')).toMatchObject({
|
||||
cellId: first.cellId,
|
||||
assignmentEpoch: first.assignmentEpoch
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps the pin while a migration row is open but its lease has lapsed', async () => {
|
||||
// Migration rows outlive their 15-minute counters and cannot roll back from non-general sources; re-placement would strand them.
|
||||
const { store, database, isolateForRoll } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
await insertMigration(database, {
|
||||
sourceCellId: first.cellId,
|
||||
targetCellId: 'us-c2',
|
||||
assignmentEpoch: first.assignmentEpoch,
|
||||
leases: 0
|
||||
})
|
||||
await isolateForRoll(first.cellId)
|
||||
|
||||
expect(await store.assign(IDENTITY, 'us-central1')).toMatchObject({
|
||||
cellId: first.cellId,
|
||||
assignmentEpoch: first.assignmentEpoch
|
||||
})
|
||||
})
|
||||
|
||||
it('crosses a region boundary only when its own region has no room', async () => {
|
||||
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
const { store, isolateForRoll, park } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
const other = CELLS.find((cell) => cell.region === 'us-central1' && cell.id !== first.cellId)!
|
||||
await park(other.id, 'migration-only')
|
||||
await isolateForRoll(first.cellId)
|
||||
|
||||
warn.mockClear()
|
||||
expect(await store.assign(IDENTITY, 'us-central1')).toMatchObject({
|
||||
cellId: 'asia-c1',
|
||||
assignmentEpoch: first.assignmentEpoch + 1
|
||||
})
|
||||
expect(jsonEvents(warn, 'orca_relay_sticky_replaced_off_isolated_cell')).toEqual([
|
||||
{
|
||||
event: 'orca_relay_sticky_replaced_off_isolated_cell',
|
||||
fromCellId: first.cellId,
|
||||
fromRegion: 'us-central1',
|
||||
admissionState: 'migration-only',
|
||||
toCellId: 'asia-c1',
|
||||
region: 'asia-east2'
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('keeps the pin, and says so, when no region has a general cell with room', async () => {
|
||||
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
const { store, isolateForRoll, park } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
for (const cell of CELLS) {
|
||||
if (cell.id !== first.cellId) await park(cell.id, 'migration-only')
|
||||
}
|
||||
await isolateForRoll(first.cellId)
|
||||
|
||||
warn.mockClear()
|
||||
expect(await store.assign(IDENTITY, 'us-central1')).toMatchObject({
|
||||
cellId: first.cellId,
|
||||
assignmentEpoch: first.assignmentEpoch
|
||||
})
|
||||
expect(jsonEvents(warn, 'orca_relay_sticky_replacement_deferred')).toEqual([
|
||||
{
|
||||
event: 'orca_relay_sticky_replacement_deferred',
|
||||
reason: 'no_same_region_headroom',
|
||||
cellId: first.cellId,
|
||||
region: 'us-central1'
|
||||
}
|
||||
])
|
||||
expect(jsonEvents(warn, 'orca_relay_sticky_replaced_off_isolated_cell')).toEqual([])
|
||||
})
|
||||
|
||||
it('prefers its own region over a less loaded cell elsewhere', async () => {
|
||||
const { store, isolateForRoll } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
await isolateForRoll(first.cellId)
|
||||
const moved = await store.assign(IDENTITY, 'us-central1')
|
||||
expect(moved.region).toBe('us-central1')
|
||||
expect(moved.cellId).not.toBe(first.cellId)
|
||||
})
|
||||
|
||||
it('moves the only cell of a region to another region', async () => {
|
||||
const { store, isolateForRoll } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'asia-east2')
|
||||
expect(first.region).toBe('asia-east2')
|
||||
await isolateForRoll(first.cellId)
|
||||
|
||||
// asia-c1 is the only Asia cell, so the only in-region candidate is gone.
|
||||
const moved = await store.assign(IDENTITY, 'asia-east2')
|
||||
expect(moved.region).toBe('us-central1')
|
||||
expect(moved.assignmentEpoch).toBe(first.assignmentEpoch + 1)
|
||||
})
|
||||
|
||||
describe('with a reserve cell in its own region', () => {
|
||||
const onReserve = {
|
||||
...IDENTITY,
|
||||
cellId: 'asia-reserve',
|
||||
cellUrl: 'https://asia-reserve.example.com',
|
||||
assignmentEpoch: 9,
|
||||
leaseExpiresAt: START_MS + 1_000_000,
|
||||
region: 'asia-east2' as const
|
||||
}
|
||||
|
||||
it('leaves the region as before when the reserve cell has no room either', async () => {
|
||||
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
const { store, isolateForRoll } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'asia-east2')
|
||||
await isolateForRoll(first.cellId)
|
||||
warn.mockClear()
|
||||
const regionReserve = vi.fn(async () => null)
|
||||
const moved = await store.assign(IDENTITY, 'asia-east2', 'asia-east2', undefined, {
|
||||
regionReserve
|
||||
})
|
||||
expect(moved).toMatchObject({
|
||||
region: 'us-central1',
|
||||
assignmentEpoch: first.assignmentEpoch + 1
|
||||
})
|
||||
expect(regionReserve).toHaveBeenCalledOnce()
|
||||
expect(jsonEvents(warn, 'orca_relay_sticky_replaced_off_isolated_cell')).toMatchObject([
|
||||
{ fromCellId: first.cellId, region: 'us-central1' }
|
||||
])
|
||||
})
|
||||
|
||||
it('treats a throttled reserve cell as no room, so the drain does not wait on its intake', async () => {
|
||||
const { store, isolateForRoll } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'asia-east2')
|
||||
await isolateForRoll(first.cellId)
|
||||
const regionReserve = vi.fn(async () => {
|
||||
throw new ReservePaceError(4)
|
||||
})
|
||||
await expect(
|
||||
store.assign(IDENTITY, 'asia-east2', 'asia-east2', undefined, { regionReserve })
|
||||
).resolves.toMatchObject({
|
||||
region: 'us-central1',
|
||||
assignmentEpoch: first.assignmentEpoch + 1
|
||||
})
|
||||
expect(regionReserve).toHaveBeenCalledOnce()
|
||||
})
|
||||
|
||||
describe('when no database cell has room anywhere', () => {
|
||||
const onUsReserve = { ...onReserve, cellId: 'us-reserve', region: 'us-central1' as const }
|
||||
const isolateWithNoDatabaseRoom = async () => {
|
||||
const harness = await setup()
|
||||
const first = await harness.store.assign(IDENTITY, 'asia-east2')
|
||||
await harness.isolateForRoll(first.cellId)
|
||||
for (const cell of CELLS.filter((entry) => entry.region === 'us-central1')) {
|
||||
await harness.park(cell.id, 'migration-only')
|
||||
}
|
||||
return { ...harness, first }
|
||||
}
|
||||
|
||||
// Today's rule: a live isolated cell keeps a host no other cell can take.
|
||||
it('keeps the pin and never asks the spill', async () => {
|
||||
const { store, first } = await isolateWithNoDatabaseRoom()
|
||||
const reserveSpill = vi.fn(async () => onUsReserve)
|
||||
const kept = await store.assign(IDENTITY, 'asia-east2', 'asia-east2', undefined, {
|
||||
reserveSpill
|
||||
})
|
||||
expect(kept).toMatchObject({ cellId: first.cellId, assignmentEpoch: first.assignmentEpoch })
|
||||
expect(reserveSpill).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
it('does not hold a host whose preferred region is elsewhere', async () => {
|
||||
const { store, isolateForRoll, park } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
const other = CELLS.find((cell) => cell.region === 'us-central1' && cell.id !== first.cellId)!
|
||||
await park(other.id, 'migration-only')
|
||||
await isolateForRoll(first.cellId)
|
||||
const regionReserve = vi.fn(async () => onReserve)
|
||||
await expect(
|
||||
store.assign(IDENTITY, 'asia-east2', 'asia-east2', undefined, { regionReserve })
|
||||
).resolves.toMatchObject({ cellId: 'asia-c1' })
|
||||
expect(regionReserve).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
it('takes the dead-cell path when a stamped cell stops heartbeating', async () => {
|
||||
// Why: the fence is the only proof that a cell we cannot reach has stopped
|
||||
// serving the sockets it still holds. A stamp does not make it reachable.
|
||||
const { store, heartbeat, isolateForRoll, setNow } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
await isolateForRoll(first.cellId)
|
||||
|
||||
const stale = START_MS + HEARTBEAT_TTL_MS + 1_000
|
||||
setNow(stale)
|
||||
for (const cell of CELLS) {
|
||||
if (cell.id !== first.cellId) await heartbeat(cell, stale)
|
||||
}
|
||||
|
||||
await expect(store.assign(IDENTITY, 'us-central1')).rejects.toBeInstanceOf(
|
||||
RelayHomeCellUnavailableError
|
||||
)
|
||||
})
|
||||
|
||||
it('leaves the source cell activity leases in place', async () => {
|
||||
// Contrast with the fence and stranded paths, which delete them: an isolated
|
||||
// cell is alive and still owns drainable work behind those leases.
|
||||
const { store, database, isolateForRoll } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
await database.query(
|
||||
`INSERT INTO relay_assignment_activity_leases
|
||||
(user_id, relay_host_id, activity_id, activity_kind, cell_id,
|
||||
request_units, expires_at, updated_at)
|
||||
VALUES (?, ?, 'splice:keep-1', 'splice', ?, 1, ?, ?)`,
|
||||
[IDENTITY.userId, IDENTITY.relayHostId, first.cellId, START_MS + 600_000, START_MS]
|
||||
)
|
||||
await isolateForRoll(first.cellId)
|
||||
|
||||
await store.assign(IDENTITY, 'us-central1')
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT activity_id FROM relay_assignment_activity_leases
|
||||
WHERE user_id = ? AND relay_host_id = ? AND activity_id = 'splice:keep-1'`,
|
||||
[IDENTITY.userId, IDENTITY.relayHostId]
|
||||
)
|
||||
).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('emits nothing when the placement rolls back after the decision', async () => {
|
||||
// Log only committed moves; stdout cannot roll back with a failed lease/reservation transaction.
|
||||
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
@@ -682,169 +249,4 @@ describe('re-placing a host off a cell isolated for a roll', () => {
|
||||
expect(moved.cellId).not.toBe(first.cellId)
|
||||
expect(jsonEvents(warn, 'orca_relay_sticky_replaced_off_isolated_cell')).toHaveLength(1)
|
||||
})
|
||||
describe('a host whose leases span two cells after the move', () => {
|
||||
const NEIGHBOUR = { userId: 'user-b', relayHostId: 'host000000000002' }
|
||||
|
||||
async function reserved(database: RelayDatabase, cellId: string): Promise<number> {
|
||||
const rows = await database.query(
|
||||
`SELECT reserved_requests FROM relay_cells WHERE cell_id = ?`,
|
||||
[cellId]
|
||||
)
|
||||
return Number(rows[0]!['reserved_requests'])
|
||||
}
|
||||
|
||||
async function expectAccounting(database: RelayDatabase): Promise<void> {
|
||||
for (const cell of CELLS) {
|
||||
const leased = await database.query(
|
||||
`SELECT COALESCE(SUM(request_units), 0) AS units
|
||||
FROM relay_assignment_activity_leases WHERE cell_id = ?`,
|
||||
[cell.id]
|
||||
)
|
||||
expect({ cell: cell.id, reserved: await reserved(database, cell.id) }).toEqual({
|
||||
cell: cell.id,
|
||||
reserved: Number(leased[0]!['units'])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function counters(database: RelayDatabase): Promise<number[]> {
|
||||
const rows = await database.query(
|
||||
`SELECT reserved_controls, reserved_splices FROM relay_assignments
|
||||
WHERE user_id = ? AND relay_host_id = ?`,
|
||||
[IDENTITY.userId, IDENTITY.relayHostId]
|
||||
)
|
||||
return [Number(rows[0]!['reserved_controls']), Number(rows[0]!['reserved_splices'])]
|
||||
}
|
||||
|
||||
// us-c1 is isolated with the host's control and splice on it; the host
|
||||
// moves to us-c2, where a neighbour's splice outlives every other lease.
|
||||
async function movedHost(): Promise<Harness> {
|
||||
const harness = await setup()
|
||||
const { store, isolateForRoll } = harness
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
expect(first.cellId).toBe('us-c1')
|
||||
await store.activateControl(IDENTITY, {
|
||||
cellId: 'us-c1',
|
||||
assignmentEpoch: first.assignmentEpoch,
|
||||
generation: 1
|
||||
})
|
||||
await store.acquireActivity(IDENTITY, {
|
||||
activityId: 'splice:keep-1',
|
||||
kind: 'splice',
|
||||
cellId: 'us-c1'
|
||||
})
|
||||
await isolateForRoll('us-c1')
|
||||
expect((await store.assign(NEIGHBOUR, 'us-central1')).cellId).toBe('us-c2')
|
||||
await store.acquireActivity(NEIGHBOUR, {
|
||||
activityId: 'splice:neighbour',
|
||||
kind: 'splice',
|
||||
cellId: 'us-c2',
|
||||
expiresAt: START_MS + 10 * 60 * 60_000
|
||||
})
|
||||
expect((await store.assign(IDENTITY, 'us-central1')).cellId).toBe('us-c2')
|
||||
expect(await counters(harness.database)).toEqual([2, 1])
|
||||
await expectAccounting(harness.database)
|
||||
return harness
|
||||
}
|
||||
|
||||
it('is left to the lease sweep by aggregate expiry', async () => {
|
||||
const { store, database, setNow } = await movedHost()
|
||||
setNow(START_MS + 60 * 60_000)
|
||||
await store.releaseExpiredActivity()
|
||||
expect(await counters(database)).toEqual([2, 1])
|
||||
await expectAccounting(database)
|
||||
await store.releaseExpiredActivityLeases()
|
||||
await store.releaseExpiredActivity()
|
||||
expect(await counters(database)).toEqual([0, 0])
|
||||
expect(await reserved(database, 'us-c1')).toBe(0)
|
||||
expect(await reserved(database, 'us-c2')).toBe(2)
|
||||
await expectAccounting(database)
|
||||
})
|
||||
|
||||
it('frees the source leases on their own cell when the target dies', async () => {
|
||||
const { store, database, setNow, heartbeat, restore } = await movedHost()
|
||||
await restore('us-c1')
|
||||
// Uncapped, so the dead-cell path needs no fence to move off it.
|
||||
await database.query(`DELETE FROM relay_cell_connection_limits WHERE cell_id = 'us-c2'`)
|
||||
setNow(START_MS + HEARTBEAT_TTL_MS + 5_000)
|
||||
await heartbeat(CELLS[0]!)
|
||||
await heartbeat(CELLS[2]!)
|
||||
|
||||
expect((await store.assign(IDENTITY, 'us-central1')).cellId).toBe('us-c1')
|
||||
expect(await counters(database)).toEqual([1, 0])
|
||||
expect(await store.releaseActivity(IDENTITY, 'control:us-c1:1')).toBe(false)
|
||||
expect(await reserved(database, 'us-c1')).toBe(1)
|
||||
expect(await reserved(database, 'us-c2')).toBe(3)
|
||||
await expectAccounting(database)
|
||||
})
|
||||
})
|
||||
it('retries a busy isolated attempt in its own tier, never under the all-rows lock', async () => {
|
||||
const { store, counter, isolateForRoll } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
await isolateForRoll(first.cellId)
|
||||
counter.sql.length = 0
|
||||
// The first attempt finds a target row busy, then its retry finds the host's
|
||||
// lease rows busy after it has already taken the tier's rows.
|
||||
counter.lockUnavailableSequence = [
|
||||
'SELECT * FROM relay_cells WHERE cell_id IN (',
|
||||
'FROM relay_assignment_activity_leases'
|
||||
]
|
||||
|
||||
const moved = await store.assign(IDENTITY, 'us-central1')
|
||||
expect(counter.lockUnavailableSequence).toEqual([])
|
||||
expect(moved).toMatchObject({
|
||||
region: 'us-central1',
|
||||
assignmentEpoch: first.assignmentEpoch + 1
|
||||
})
|
||||
expect(counter.count('SELECT * FROM relay_cells ORDER BY cell_id ASC')).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe('classifying a reconnect whose home is isolated for a roll', () => {
|
||||
const classify = { classifyHomeRollIsolation: true }
|
||||
|
||||
it('reads the classification in the verification query itself', async () => {
|
||||
const { store, counter, isolateForRoll } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
await isolateForRoll(first.cellId)
|
||||
|
||||
counter.sql.length = 0
|
||||
await store.resolve(IDENTITY, classify)
|
||||
|
||||
expect(counter.sql.filter((sql) => sql.includes('FROM relay_assignments'))).toHaveLength(1)
|
||||
expect(counter.count('relay_cell_admission')).toBe(1)
|
||||
})
|
||||
|
||||
it('still treats a host its draining cell already released as a drain return', async () => {
|
||||
// A drain releases the host's control lease before it tells the host, so the redial
|
||||
// finds no activity: the stamp, not a live lease, has to carry the classification.
|
||||
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
const { store, database, isolateForRoll } = await setup()
|
||||
const first = await store.assign(IDENTITY, 'us-central1')
|
||||
await store.activateControl(IDENTITY, {
|
||||
cellId: first.cellId,
|
||||
assignmentEpoch: first.assignmentEpoch,
|
||||
generation: 1
|
||||
})
|
||||
await isolateForRoll(first.cellId)
|
||||
expect(await store.releaseActivity(IDENTITY, `control:${first.cellId}:1`)).toBe(true)
|
||||
expect(
|
||||
await database.query(
|
||||
`SELECT activity_id FROM relay_assignment_activity_leases WHERE user_id = ?`,
|
||||
[IDENTITY.userId]
|
||||
)
|
||||
).toEqual([])
|
||||
|
||||
expect(await store.resolve(IDENTITY, classify)).toMatchObject({
|
||||
cellId: first.cellId,
|
||||
homeCellRollIsolated: true
|
||||
})
|
||||
warn.mockClear()
|
||||
const moved = await store.assign(IDENTITY, 'us-central1')
|
||||
expect(moved.cellId).not.toBe(first.cellId)
|
||||
expect(moved.assignmentEpoch).toBe(first.assignmentEpoch + 1)
|
||||
expect(jsonEvents(warn, 'orca_relay_sticky_replaced_off_isolated_cell')).toMatchObject([
|
||||
{ fromCellId: first.cellId, toCellId: moved.cellId }
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,42 +17,6 @@ vi.mock('../../authentication/relay-token-verifier.js', () => ({
|
||||
import { createRelayApp } from '../../app.js'
|
||||
|
||||
describe('public assignment overload', () => {
|
||||
it('rejects duplicate and excess work before it reaches assignment state', async () => {
|
||||
const hostA = 'aaaaaaaaaaaaaaaa'
|
||||
const hostB = 'bbbbbbbbbbbbbbbb'
|
||||
const hostC = 'cccccccccccccccc'
|
||||
const pending = new Map<string, ReturnType<typeof deferred<RelayAssignment>>>()
|
||||
const assign = vi.fn(async ({ relayHostId }: { relayHostId: string }) => {
|
||||
const operation = deferred<RelayAssignment>()
|
||||
pending.set(relayHostId, operation)
|
||||
return await operation.promise
|
||||
})
|
||||
const app = createRelayApp(config({ publicAssignmentQueueMax: 0 }), {
|
||||
store: {} as never,
|
||||
assignments: { assign } as never,
|
||||
drain: vi.fn(),
|
||||
ready: vi.fn(async () => true)
|
||||
})
|
||||
|
||||
const first = app.request('/v1/assign', assignmentRequest(hostA))
|
||||
await vi.waitFor(() => expect(pending.has(hostA)).toBe(true))
|
||||
const duplicate = await app.request('/v1/assign', assignmentRequest(hostA))
|
||||
expect(duplicate.status).toBe(503)
|
||||
|
||||
const second = app.request('/v1/assign', assignmentRequest(hostB))
|
||||
await vi.waitFor(() => expect(pending.has(hostB)).toBe(true))
|
||||
const excess = await app.request('/v1/assign', assignmentRequest(hostC))
|
||||
expect(excess.status).toBe(503)
|
||||
expect(excess.headers.get('retry-after')).toBe('5')
|
||||
expect(assign).toHaveBeenCalledTimes(2)
|
||||
|
||||
pending.get(hostA)?.resolve(assignment('cell-a', hostA))
|
||||
pending.get(hostB)?.resolve(assignment('cell-b', hostB))
|
||||
expect((await first).status).toBe(200)
|
||||
expect((await second).status).toBe(200)
|
||||
expect((await app.request('/v1/assign', assignmentRequest(hostA))).status).toBe(503)
|
||||
expect(assign).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
|
||||
it('fairly drains a bounded incident-scale burst without raising database concurrency', async () => {
|
||||
const pending = new Map<string, ReturnType<typeof deferred<RelayAssignment>>>()
|
||||
|
||||
@@ -40,37 +40,7 @@ function app(config: RelayConfig = cell) {
|
||||
return { post, postChunked, reserve, demote, routes }
|
||||
}
|
||||
|
||||
const booking = {
|
||||
v: 1,
|
||||
directorId: 'director-a',
|
||||
items: [{ userId: 'user-1', relayHostId: 'abcdefghijklmnop', epoch: 3, ttlMs: 30_000 }]
|
||||
}
|
||||
|
||||
describe('cell reserve routes', () => {
|
||||
it('books for a director holding the rehome credential and refuses everyone else', async () => {
|
||||
const { post, reserve } = app()
|
||||
const ok = await post('/internal/reserve', booking)
|
||||
expect(await ok.json()).toEqual({ v: 1, results: [{ outcome: 'ok' }] })
|
||||
expect((await post('/internal/reserve', booking, 'someone-else')).status).toBe(401)
|
||||
expect((await post('/internal/reserve', { ...booking, items: [] })).status).toBe(400)
|
||||
expect((await post('/internal/reserve', { ...booking, v: 2 })).status).toBe(400)
|
||||
expect(reserve).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('is absent on a director and on a cell without the rehome pair', async () => {
|
||||
expect((await app({ ...cell, role: 'director' }).post('/internal/reserve', booking)).status).toBe(404)
|
||||
const noPair = app({ ...cell, rehomeDirectorServiceAccount: undefined })
|
||||
expect((await noPair.post('/internal/demote', {})).status).toBe(404)
|
||||
})
|
||||
|
||||
it('demotes only a fully named seat', async () => {
|
||||
const { post, demote } = app()
|
||||
const seat = { v: 1, userId: 'user-1', relayHostId: 'abcdefghijklmnop', epoch: 3 }
|
||||
expect((await post('/internal/demote', seat)).status).toBe(400)
|
||||
const reply = await post('/internal/demote', { ...seat, joinedAt: 1_000 })
|
||||
expect(await reply.json()).toEqual({ v: 1, outcome: 'demoted' })
|
||||
expect(demote).toHaveBeenCalledWith({ ...seat, joinedAt: 1_000 })
|
||||
})
|
||||
|
||||
it.each(['/internal/reserve', '/internal/demote'])(
|
||||
'rejects an oversized chunked body on %s without calling the handler',
|
||||
@@ -110,43 +80,4 @@ describe('cell reserve routes', () => {
|
||||
}
|
||||
)
|
||||
|
||||
it.each(['/internal/reserve', '/internal/demote'])(
|
||||
'refuses an unauthorized oversized %s before the size check',
|
||||
async (path) => {
|
||||
const { routes, reserve, demote } = app()
|
||||
const response = await routes.request(path, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
authorization: 'Bearer someone-else',
|
||||
'content-type': 'application/json',
|
||||
'content-length': String(16 * 1024 + 1)
|
||||
},
|
||||
body: '{}'
|
||||
})
|
||||
|
||||
expect(response.status).toBe(401)
|
||||
expect(await response.json()).toEqual({ error: 'invalid_token' })
|
||||
expect(reserve).not.toHaveBeenCalled()
|
||||
expect(demote).not.toHaveBeenCalled()
|
||||
}
|
||||
)
|
||||
|
||||
it.each(['/internal/reserve', '/internal/demote'])(
|
||||
'hides a missing %s route before measuring an oversized body',
|
||||
async (path) => {
|
||||
const { routes } = app({ ...cell, role: 'director' })
|
||||
const response = await routes.request(path, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
authorization: 'Bearer director-token',
|
||||
'content-type': 'application/json',
|
||||
'content-length': String(16 * 1024 + 1)
|
||||
},
|
||||
body: '{}'
|
||||
})
|
||||
|
||||
expect(response.status).toBe(404)
|
||||
expect(await response.json()).toEqual({ error: 'reserve_unavailable' })
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
@@ -1,189 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { loadRelayConfig } from './config.js'
|
||||
import { RELAY_CELL_CONNECTION_HARD_CAP } from '@orca-cloud/relay-contract/admission-budgets'
|
||||
import { RELAY_READINESS_JWKS_GRACE_MS, RELAY_READINESS_SQL_GRACE_MS } from './process-lifecycle/relay-readiness.js'
|
||||
|
||||
function cellEnvironment(capacity: number): NodeJS.ProcessEnv {
|
||||
return {
|
||||
ORCA_RELAY_PUBLIC_URL: 'https://c1.relay.example.com',
|
||||
ORCA_RELAY_CELL_URL: 'https://c1.relay.example.com',
|
||||
ORCA_RELAY_AUTH_ISSUER: 'https://auth.example.com',
|
||||
ORCA_RELAY_JWKS_URL: 'https://auth.example.com/.well-known/jwks.json',
|
||||
ORCA_RELAY_ASSIGNMENT_SIGNING_KEY: 'assignment-key-with-at-least-thirty-two-bytes',
|
||||
ORCA_RELAY_ROLE: 'cell',
|
||||
ORCA_RELAY_CELL_ID: 'gce-c1',
|
||||
ORCA_RELAY_CELL_CAPACITY: String(capacity),
|
||||
ORCA_RELAY_ADMIN_AUDIENCE: 'https://relay.example.com/v1/admin/drain',
|
||||
ORCA_RELAY_DEPLOY_SERVICE_ACCOUNT: 'deploy@example.iam.gserviceaccount.com'
|
||||
}
|
||||
}
|
||||
|
||||
describe('GCE relay capacity configuration', () => {
|
||||
|
||||
it('reads an unset readiness grace variable as the default, never as zero', () => {
|
||||
const env = cellEnvironment(4_000)
|
||||
env.ORCA_RELAY_READINESS_JWKS_GRACE_MS = ''
|
||||
env.ORCA_RELAY_READINESS_SQL_GRACE_MS = ''
|
||||
expect(loadRelayConfig(env)).toMatchObject({
|
||||
readinessJwksGraceMs: RELAY_READINESS_JWKS_GRACE_MS,
|
||||
readinessSqlGraceMs: RELAY_READINESS_SQL_GRACE_MS
|
||||
})
|
||||
})
|
||||
|
||||
it('requires a distinct paired identity and exact audience for regional host drain', () => {
|
||||
const env = cellEnvironment(4_000)
|
||||
env.ORCA_RELAY_REHOME_DIRECTOR_SERVICE_ACCOUNT =
|
||||
'relay-director@example.iam.gserviceaccount.com'
|
||||
expect(() => loadRelayConfig(env)).toThrow(
|
||||
'relay rehome identity and audience must be configured together'
|
||||
)
|
||||
env.ORCA_RELAY_REHOME_AUDIENCE = 'https://relay.example.com/v1/admin/host-drain'
|
||||
expect(loadRelayConfig(env)).toMatchObject({
|
||||
rehomeDirectorServiceAccount: 'relay-director@example.iam.gserviceaccount.com',
|
||||
rehomeAudience: 'https://relay.example.com/v1/admin/host-drain'
|
||||
})
|
||||
env.ORCA_RELAY_REHOME_AUDIENCE = 'https://relay.example.com/v1/admin/drain'
|
||||
expect(() => loadRelayConfig(env)).toThrow(
|
||||
'relay rehome audience must target the host drain route'
|
||||
)
|
||||
env.ORCA_RELAY_REHOME_AUDIENCE = 'https://relay.example.com/v1/admin/host-drain'
|
||||
env.ORCA_RELAY_RUNTIME_SERVICE_ACCOUNT =
|
||||
env.ORCA_RELAY_REHOME_DIRECTOR_SERVICE_ACCOUNT
|
||||
expect(() => loadRelayConfig(env)).toThrow(
|
||||
'relay rehome director identity must differ from the cell runtime identity'
|
||||
)
|
||||
})
|
||||
|
||||
it('keeps legacy cells uncapped and requires a supported hard-cap pair', () => {
|
||||
const env = cellEnvironment(4_000)
|
||||
expect(loadRelayConfig(env)).toMatchObject({
|
||||
connectionHardCap: undefined,
|
||||
connectionUnobservedBound: undefined
|
||||
})
|
||||
|
||||
env.ORCA_RELAY_CELL_CONNECTION_HARD_CAP = String(RELAY_CELL_CONNECTION_HARD_CAP)
|
||||
expect(() => loadRelayConfig(env)).toThrow(
|
||||
'connection hard cap and unobserved bound must be configured together'
|
||||
)
|
||||
env.ORCA_RELAY_CELL_CONNECTION_UNOBSERVED_BOUND = '60'
|
||||
expect(loadRelayConfig(env)).toMatchObject({
|
||||
connectionHardCap: 600,
|
||||
connectionUnobservedBound: 60
|
||||
})
|
||||
env.ORCA_RELAY_CELL_CONNECTION_HARD_CAP = '599'
|
||||
expect(() => loadRelayConfig(env)).toThrow()
|
||||
env.ORCA_RELAY_CELL_CONNECTION_HARD_CAP = '600'
|
||||
env.ORCA_RELAY_CELL_CONNECTION_UNOBSERVED_BOUND = '500'
|
||||
expect(() => loadRelayConfig(env)).toThrow()
|
||||
env.ORCA_RELAY_CELL_CONNECTION_UNOBSERVED_BOUND = '600'
|
||||
expect(() => loadRelayConfig(env)).toThrow()
|
||||
env.ORCA_RELAY_CELL_CONNECTION_HARD_CAP = '1000'
|
||||
env.ORCA_RELAY_CELL_CONNECTION_UNOBSERVED_BOUND = '60'
|
||||
expect(loadRelayConfig(env)).toMatchObject({
|
||||
connectionHardCap: 1_000,
|
||||
connectionUnobservedBound: 60
|
||||
})
|
||||
env.ORCA_RELAY_CELL_CONNECTION_UNOBSERVED_BOUND = '900'
|
||||
expect(() => loadRelayConfig(env)).toThrow()
|
||||
})
|
||||
|
||||
it('fails closed when public request lanes exceed the director database pool', () => {
|
||||
const env = cellEnvironment(4_000)
|
||||
env.ORCA_RELAY_ROLE = 'director'
|
||||
env.ORCA_RELAY_CELLS_JSON = JSON.stringify([
|
||||
{
|
||||
id: 'gce-c1',
|
||||
url: 'https://c1.relay.example.com',
|
||||
capacityRequests: 4_000
|
||||
}
|
||||
])
|
||||
env.ORCA_RELAY_DATABASE_POOL_MAX = '2'
|
||||
|
||||
expect(() => loadRelayConfig(env)).toThrow(
|
||||
'public relay admission must leave database pool headroom'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('relay edge configuration', () => {
|
||||
function directorEnvironment(): NodeJS.ProcessEnv {
|
||||
return {
|
||||
...cellEnvironment(4_000),
|
||||
ORCA_RELAY_PUBLIC_URL: 'https://relay.example.com',
|
||||
ORCA_RELAY_ROLE: 'director',
|
||||
ORCA_RELAY_CELLS_JSON: JSON.stringify([
|
||||
{ id: 'gce-c1', url: 'https://c1.relay.example.com', capacityRequests: 4_000 }
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
it('is off unless a director names an edge URL, and then defaults to no cohort in us-central1', () => {
|
||||
expect(loadRelayConfig(directorEnvironment()).edge).toBeUndefined()
|
||||
expect(
|
||||
loadRelayConfig({ ...cellEnvironment(4_000), ORCA_RELAY_EDGE_CELL_URL: 'https://edge.relay.example.com' }).edge
|
||||
).toBeUndefined()
|
||||
expect(() =>
|
||||
loadRelayConfig({ ...directorEnvironment(), ORCA_RELAY_EDGE_CELL_URL: 'https://edge.relay.example.com' })
|
||||
).toThrow('ORCA_RELAY_EDGE_ADMIN_SIGNING_KEY')
|
||||
const edge = loadRelayConfig({
|
||||
...directorEnvironment(),
|
||||
ORCA_RELAY_EDGE_CELL_URL: 'https://edge.relay.example.com',
|
||||
ORCA_RELAY_EDGE_ADMIN_SIGNING_KEY: 'edge-admin-key-with-at-least-32-bytes!!'
|
||||
}).edge
|
||||
expect(edge).toEqual({
|
||||
cellUrl: 'https://edge.relay.example.com',
|
||||
adminSigningKey: new TextEncoder().encode('edge-admin-key-with-at-least-32-bytes!!'),
|
||||
rolloutPercent: 0,
|
||||
allowHosts: new Set(),
|
||||
allowUsers: new Set(),
|
||||
denyHosts: new Set(),
|
||||
regions: new Set(['us-central1'])
|
||||
})
|
||||
})
|
||||
|
||||
it('parses the cohort and refuses unsafe edge settings', () => {
|
||||
const env = {
|
||||
...directorEnvironment(),
|
||||
ORCA_RELAY_EDGE_CELL_URL: 'https://edge.relay.example.com',
|
||||
ORCA_RELAY_EDGE_ADMIN_SIGNING_KEY: 'edge-admin-key-with-at-least-32-bytes!!',
|
||||
ORCA_RELAY_EDGE_ROLLOUT_PERCENT: '10',
|
||||
ORCA_RELAY_EDGE_ALLOW_HOSTS: 'abcdefghijklmnop, ABCDEFGHIJKLMNOP',
|
||||
ORCA_RELAY_EDGE_DENY_HOSTS: 'zzzzzzzzzzzzzzzz',
|
||||
ORCA_RELAY_EDGE_ALLOW_USERS: ' user_01ABC , 6b1f-uuid ',
|
||||
ORCA_RELAY_EDGE_REGIONS: 'us-central1,asia-east2'
|
||||
}
|
||||
expect(loadRelayConfig(env).edge).toMatchObject({
|
||||
rolloutPercent: 10,
|
||||
allowHosts: new Set(['abcdefghijklmnop', 'ABCDEFGHIJKLMNOP']),
|
||||
allowUsers: new Set(['user_01ABC', '6b1f-uuid']),
|
||||
denyHosts: new Set(['zzzzzzzzzzzzzzzz']),
|
||||
regions: new Set(['us-central1', 'asia-east2'])
|
||||
})
|
||||
expect(() => loadRelayConfig({ ...env, ORCA_RELAY_EDGE_ROLLOUT_PERCENT: '101' })).toThrow()
|
||||
expect(() => loadRelayConfig({ ...env, ORCA_RELAY_EDGE_ALLOW_HOSTS: 'short' })).toThrow()
|
||||
expect(() => loadRelayConfig({ ...env, ORCA_RELAY_EDGE_ALLOW_USERS: 'a b' })).toThrow()
|
||||
expect(() => loadRelayConfig({ ...env, ORCA_RELAY_EDGE_REGIONS: 'europe-west1' })).toThrow()
|
||||
expect(() => loadRelayConfig({ ...env, ORCA_RELAY_EDGE_CELL_URL: 'https://edge.relay.example.com/path' })).toThrow()
|
||||
expect(() => loadRelayConfig({ ...env, ORCA_RELAY_EDGE_CELL_URL: 'https://c1.relay.example.com' })).toThrow()
|
||||
expect(() => loadRelayConfig({ ...env, ORCA_RELAY_EDGE_CELL_URL: 'https://relay.example.com' })).toThrow()
|
||||
})
|
||||
|
||||
it('parses the export skip threshold, leaving the default when unset or empty', () => {
|
||||
const env = {
|
||||
...directorEnvironment(),
|
||||
ORCA_RELAY_EDGE_CELL_URL: 'https://edge.relay.example.com',
|
||||
ORCA_RELAY_EDGE_ADMIN_SIGNING_KEY: 'edge-admin-key-with-at-least-32-bytes!!'
|
||||
}
|
||||
expect(loadRelayConfig(env).edge).not.toHaveProperty('exportSkipAfterMs')
|
||||
expect(loadRelayConfig({ ...env, ORCA_RELAY_EDGE_EXPORT_SKIP_AFTER_MS: '' }).edge).not.toHaveProperty(
|
||||
'exportSkipAfterMs'
|
||||
)
|
||||
expect(loadRelayConfig({ ...env, ORCA_RELAY_EDGE_EXPORT_SKIP_AFTER_MS: '0' }).edge?.exportSkipAfterMs).toBe(0)
|
||||
expect(loadRelayConfig({ ...env, ORCA_RELAY_EDGE_EXPORT_SKIP_AFTER_MS: '300000' }).edge?.exportSkipAfterMs).toBe(
|
||||
300_000
|
||||
)
|
||||
expect(() => loadRelayConfig({ ...env, ORCA_RELAY_EDGE_EXPORT_SKIP_AFTER_MS: '-1' })).toThrow()
|
||||
expect(() => loadRelayConfig({ ...env, ORCA_RELAY_EDGE_EXPORT_SKIP_AFTER_MS: '1.5' })).toThrow()
|
||||
expect(() => loadRelayConfig({ ...env, ORCA_RELAY_EDGE_EXPORT_SKIP_AFTER_MS: 'soon' })).toThrow()
|
||||
})
|
||||
})
|
||||
@@ -1,130 +0,0 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { RelayConfig } from './config.js'
|
||||
import { openInMemoryRelayDatabase, type RelayDatabase } from './database/database.js'
|
||||
import { EdgeAssignments, type EdgeRelayConfig } from './edge-relay.js'
|
||||
|
||||
const fakes = vi.hoisted(() => ({
|
||||
verifyRelayToken: vi.fn(async (token: string) => ({ sub: 'user-1', relayHostId: token }))
|
||||
}))
|
||||
|
||||
vi.mock('./authentication/relay-token-verifier.js', () => ({
|
||||
createRelayTokenVerifier: () => fakes.verifyRelayToken,
|
||||
readBearer: (value: string | undefined) => value?.replace(/^Bearer /, '') ?? null
|
||||
}))
|
||||
|
||||
import { createRelayApp } from './app.js'
|
||||
|
||||
const EDGE_URL = 'https://edge.relay.example.test'
|
||||
const COHORT_HOST = 'edgecohorthost01'
|
||||
|
||||
const databases: RelayDatabase[] = []
|
||||
afterEach(async () => {
|
||||
for (const database of databases.splice(0)) { await database.close() }
|
||||
})
|
||||
|
||||
function config(): RelayConfig {
|
||||
return {
|
||||
port: 8080,
|
||||
publicUrl: 'https://relay.example.test',
|
||||
cellUrl: 'https://relay.example.test',
|
||||
region: 'us-central1',
|
||||
authIssuer: 'https://auth.example.test',
|
||||
authAudience: 'orca-relay',
|
||||
jwksUrl: 'https://auth.example.test/jwks',
|
||||
assignmentSigningKey: new TextEncoder().encode('assignment-key-with-at-least-32-bytes'),
|
||||
role: 'director',
|
||||
cellId: 'director',
|
||||
cells: [],
|
||||
adminAudience: 'https://relay.example.test/v1/admin/drain',
|
||||
deployServiceAccount: 'deploy@example.test',
|
||||
runtimeServiceAccount: 'runtime@example.test',
|
||||
adminJwksUrl: 'https://auth.example.test/jwks',
|
||||
databasePoolMax: 3,
|
||||
publicAssignmentsEnabled: true,
|
||||
regionalPlacementEnabled: true,
|
||||
publicAssignmentConcurrency: 2,
|
||||
publicAssignmentQueueMax: 128,
|
||||
publicAssignmentWaitMs: 4_000,
|
||||
publicResolveConcurrency: 1,
|
||||
publicResolveWaitMs: 5_000,
|
||||
publicAssignmentRetryAfterSeconds: 5,
|
||||
dataDir: './data'
|
||||
}
|
||||
}
|
||||
|
||||
async function harness(options: { seeded?: boolean } = {}) {
|
||||
const database = await openInMemoryRelayDatabase()
|
||||
databases.push(database)
|
||||
const edgeConfig: EdgeRelayConfig = {
|
||||
cellUrl: EDGE_URL,
|
||||
rolloutPercent: 0,
|
||||
allowHosts: new Set([COHORT_HOST]),
|
||||
denyHosts: new Set(),
|
||||
regions: new Set(['us-central1'])
|
||||
}
|
||||
const edge = new EdgeAssignments(database, edgeConfig)
|
||||
if (options.seeded !== false) { await edge.ensureEdgeCell() }
|
||||
const gce = {
|
||||
userId: 'user-1',
|
||||
cellId: 'us-c1',
|
||||
cellUrl: 'https://us-c1.relay.example.test',
|
||||
region: 'us-central1' as const,
|
||||
assignmentEpoch: 3,
|
||||
leaseExpiresAt: Date.now() + 90_000
|
||||
}
|
||||
const assignments = {
|
||||
assign: vi.fn(async (identity: { relayHostId: string }) => ({ ...gce, relayHostId: identity.relayHostId })),
|
||||
resolve: vi.fn(async () => null),
|
||||
exchangeRegionCorrection: vi.fn()
|
||||
}
|
||||
const plan = vi.fn(async () => ({ kind: 'database' }))
|
||||
const raiseEpochFloor = vi.fn()
|
||||
const store = { resolveResume: vi.fn(async () => ({ userId: 'user-1' })) }
|
||||
const app = createRelayApp(config(), {
|
||||
store: store as never,
|
||||
assignments: assignments as never,
|
||||
reservePlacement: { plan, raiseEpochFloor, rowEpochFloor: () => 0 } as never,
|
||||
edgeAssignments: edge,
|
||||
drain: vi.fn(),
|
||||
ready: vi.fn(async () => true)
|
||||
})
|
||||
const assign = async (relayHostId: string, extra: Record<string, unknown> = {}) =>
|
||||
await app.request('/v1/assign', {
|
||||
method: 'POST',
|
||||
headers: { authorization: `Bearer ${relayHostId}`, 'content-type': 'application/json' },
|
||||
body: JSON.stringify({ v: 1, relayHostId, preferredRegion: 'us-central1', ...extra })
|
||||
})
|
||||
const resolve = async (relayHostId: string) =>
|
||||
await app.request('/v1/resolve', {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body: JSON.stringify({ v: 1, relayHostId, resumeToken: 'r'.repeat(43) })
|
||||
})
|
||||
return { database, edge, assignments, plan, raiseEpochFloor, assign, resolve }
|
||||
}
|
||||
|
||||
describe('director routes with the relay edge', () => {
|
||||
|
||||
it('keeps a host still holding units on its old cell there (no 503), moving it on a later ask', async () => {
|
||||
const h = await harness()
|
||||
await h.database.query(
|
||||
`INSERT INTO relay_assignments
|
||||
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at, last_activity_at,
|
||||
reserved_controls, reserved_splices, reserved_invites, pending_installs,
|
||||
pending_confirmations, migration_leases)
|
||||
VALUES ('user-1', ?, 'us-c1', 5, 0, 0, 1, 0, 0, 0, 0, 0)`,
|
||||
[COHORT_HOST]
|
||||
)
|
||||
const response = await h.assign(COHORT_HOST)
|
||||
expect(response.status).toBe(200)
|
||||
expect(await response.json()).toMatchObject({ cellUrl: 'https://us-c1.relay.example.test' })
|
||||
expect(h.assignments.assign).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('never moves a host on a phone resolve', async () => {
|
||||
const h = await harness()
|
||||
const response = await h.resolve(COHORT_HOST)
|
||||
expect(await response.json()).toMatchObject({ cellUrl: 'https://us-c1.relay.example.test' })
|
||||
expect(await h.edge.edgeAssignment({ userId: 'user-1', relayHostId: COHORT_HOST })).toBeNull()
|
||||
})
|
||||
})
|
||||
@@ -50,22 +50,40 @@ export function edgeCohortBucketPermille(relayHostId: string): number {
|
||||
}
|
||||
|
||||
// Mode off or down empties the cohort. Otherwise deny wins, then host allow, then region scope;
|
||||
// within the region, account allow or the rollout share.
|
||||
// within the region, account allow or the rollout share. Region 'any' skips the region scope.
|
||||
export function inEdgeCohort(
|
||||
config: EdgeRelayConfig,
|
||||
relayHostId: string,
|
||||
region: RelayRegion | undefined,
|
||||
region: RelayRegion | undefined | 'any',
|
||||
userId?: string
|
||||
): boolean {
|
||||
const flags = config.control?.() ?? EDGE_CONTROL_DEFAULTS
|
||||
if (flags.mode !== 'on') { return false }
|
||||
if (config.denyHosts.has(relayHostId)) { return false }
|
||||
if (config.allowHosts.has(relayHostId)) { return true }
|
||||
if (!config.regions.has(region ?? RELAY_DEFAULT_REGION)) { return false }
|
||||
if (region !== 'any' && !config.regions.has(region ?? RELAY_DEFAULT_REGION)) { return false }
|
||||
if (userId !== undefined && config.allowUsers?.has(userId)) { return true }
|
||||
return edgeCohortBucketPermille(relayHostId) < edgeRolloutPermille(config.rolloutPercent, flags)
|
||||
}
|
||||
|
||||
// Whether the host's assignment row may be on the edge, so an ask that is not moving it there must
|
||||
// read the row (leave) first. A host reaches the edge only through the cohort (its bucket under the
|
||||
// rollout) or an allow list, and cohorts only grow with the rollout, so a host above the highest
|
||||
// rollout ever applied (leaveCeilingPermille) never had an edge row. Unset: every host may.
|
||||
// Mode is ignored: hosts leave under off and down too.
|
||||
export function mayBeOnEdge(config: EdgeRelayConfig, relayHostId: string, userId?: string): boolean {
|
||||
const flags = config.control?.() ?? EDGE_CONTROL_DEFAULTS
|
||||
if (flags.leaveCeilingPermille === undefined) { return true }
|
||||
if (config.allowHosts.has(relayHostId) || config.denyHosts.has(relayHostId)) { return true }
|
||||
if (userId !== undefined && config.allowUsers?.has(userId)) { return true }
|
||||
const ceiling = Math.max(
|
||||
flags.leaveCeilingPermille,
|
||||
edgeRolloutPermille(config.rolloutPercent, flags),
|
||||
config.rolloutPercent * 10
|
||||
)
|
||||
return edgeCohortBucketPermille(relayHostId) < ceiling
|
||||
}
|
||||
|
||||
// Another director holds the host's row, or the host is on the edge and cannot leave yet (its
|
||||
// desktop is still connected there): retry shortly.
|
||||
export class EdgeMoveBusyError extends Error {
|
||||
|
||||
@@ -17,6 +17,14 @@ export type EdgeControlFlags = {
|
||||
mode: EdgeControlMode
|
||||
// Replaces the env rollout percent when present (1‰ steps).
|
||||
rolloutPermille?: number
|
||||
// Highest rollout (permille) ever applied. Present: a host above it (and above the current
|
||||
// rollout, and on no allow or deny list) cannot have a row on the edge, so its asks skip the
|
||||
// edge row read (mayBeOnEdge). Absent: every host's ask reads it. Operating rules:
|
||||
// - never lower it below a rollout that was applied (a file with it below rolloutPermille is void);
|
||||
// - raise it in its own write, at least a minute (many polls) before a higher rollout, so no
|
||||
// director still skips a host another director has just moved;
|
||||
// - unset it before removing an allow list entry (the ceiling covers buckets, not the lists).
|
||||
leaveCeilingPermille?: number
|
||||
}
|
||||
|
||||
export const EDGE_CONTROL_DEFAULTS: EdgeControlFlags = { mode: 'on' }
|
||||
@@ -25,10 +33,19 @@ export const EDGE_CONTROL_APPLIED_EVENT = 'orca_relay_edge_control_applied'
|
||||
|
||||
const EdgeControlFlagsSchema = z.object({
|
||||
mode: z.enum(['on', 'off', 'down']).default(EDGE_CONTROL_DEFAULTS.mode),
|
||||
rolloutPermille: z.number().int().min(0).max(1_000).optional()
|
||||
rolloutPermille: z.number().int().min(0).max(1_000).optional(),
|
||||
leaveCeilingPermille: z.number().int().min(0).max(1_000).optional()
|
||||
})
|
||||
const KNOWN_FLAG_KEYS = new Set(Object.keys(EdgeControlFlagsSchema.shape))
|
||||
const EdgeControlObjectSchema = z.object({ v: z.literal(1), flags: EdgeControlFlagsSchema })
|
||||
const EdgeControlObjectSchema = z.object({
|
||||
v: z.literal(1),
|
||||
flags: EdgeControlFlagsSchema.refine(
|
||||
(flags) =>
|
||||
flags.leaveCeilingPermille === undefined ||
|
||||
flags.rolloutPermille === undefined ||
|
||||
flags.leaveCeilingPermille >= flags.rolloutPermille
|
||||
)
|
||||
})
|
||||
|
||||
// Unknown keys (a newer writer's, or a typo) are dropped and reported; a known key with a bad value
|
||||
// voids the whole object, so the last applied flags stay.
|
||||
@@ -42,8 +59,15 @@ export const parseEdgeControl: ControlFlagParse<EdgeControlFlags> = (body) => {
|
||||
named !== null && typeof named === 'object'
|
||||
? Object.keys(named).filter((key) => !KNOWN_FLAG_KEYS.has(key)).sort()
|
||||
: []
|
||||
const { mode, rolloutPermille } = parsed.data.flags
|
||||
return { flags: rolloutPermille === undefined ? { mode } : { mode, rolloutPermille }, ignoredKeys }
|
||||
const { mode, rolloutPermille, leaveCeilingPermille } = parsed.data.flags
|
||||
return {
|
||||
flags: {
|
||||
mode,
|
||||
...(rolloutPermille === undefined ? {} : { rolloutPermille }),
|
||||
...(leaveCeilingPermille === undefined ? {} : { leaveCeilingPermille })
|
||||
},
|
||||
ignoredKeys
|
||||
}
|
||||
}
|
||||
|
||||
export type EdgeControl = {
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
import { createHash } from 'node:crypto'
|
||||
import { jwtVerify } from 'jose'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { openInMemoryRelayDatabase, type RelayDatabase } from './database/database.js'
|
||||
import {
|
||||
EDGE_ADMIN_AUDIENCE,
|
||||
EdgeAdminUnavailableError,
|
||||
createEdgeAdmin,
|
||||
type EdgeAdmin,
|
||||
type EdgeDrainResult
|
||||
} from './edge-admin-client.js'
|
||||
import { EDGE_EVACUATION_BUSY_INTERVAL_MS, EDGE_EVACUATION_CONCURRENCY, EDGE_EVACUATION_CONTROL_DELAY_MS, EdgeEvacuation } from './edge-relay-evacuation.js'
|
||||
import { EDGE_CELL_ID, type EdgeRelayConfig } from './edge-relay.js'
|
||||
import type { EdgeControlFlags } from './edge-relay-control.js'
|
||||
|
||||
const EDGE_URL = 'https://edge.relay.example.test'
|
||||
const SIGNING_KEY = new TextEncoder().encode('edge-admin-key-with-at-least-32-bytes!!')
|
||||
|
||||
const databases: RelayDatabase[] = []
|
||||
afterEach(async () => {
|
||||
vi.useRealTimers()
|
||||
vi.restoreAllMocks()
|
||||
for (const database of databases.splice(0)) { await database.close() }
|
||||
})
|
||||
|
||||
function hostId(index: number): string {
|
||||
return `host${String(index).padStart(12, '0')}`
|
||||
}
|
||||
|
||||
class FakeAdmin implements EdgeAdmin {
|
||||
drained: string[] = []
|
||||
unavailable = new Set<string>()
|
||||
answer: EdgeDrainResult = { outcome: 'drained', controls: 1 }
|
||||
// Set: each drain waits for release(), so the test can count drains in flight.
|
||||
holding = false
|
||||
readonly held: (() => void)[] = []
|
||||
|
||||
release(): void {
|
||||
for (const resolve of this.held.splice(0)) { resolve() }
|
||||
}
|
||||
|
||||
async assign(): Promise<never> {
|
||||
throw new Error('unexpected assign')
|
||||
}
|
||||
|
||||
async exportHost(): Promise<never> {
|
||||
throw new Error('unexpected export')
|
||||
}
|
||||
|
||||
async drain(relayHostId: string): Promise<EdgeDrainResult> {
|
||||
if (this.unavailable.has(relayHostId)) { throw new EdgeAdminUnavailableError('status_404') }
|
||||
this.drained.push(relayHostId)
|
||||
if (this.holding) { await new Promise<void>((resolve) => this.held.push(resolve)) }
|
||||
return this.answer
|
||||
}
|
||||
}
|
||||
|
||||
async function harness(overrides: Partial<EdgeRelayConfig> = {}, random = 0.5) {
|
||||
const database = await openInMemoryRelayDatabase()
|
||||
databases.push(database)
|
||||
const config: EdgeRelayConfig = {
|
||||
cellUrl: EDGE_URL,
|
||||
rolloutPercent: 0,
|
||||
allowHosts: new Set(),
|
||||
denyHosts: new Set(),
|
||||
regions: new Set(['us-central1']),
|
||||
...overrides
|
||||
}
|
||||
const admin = new FakeAdmin()
|
||||
const clock = { now: 1_700_000_000_000 }
|
||||
const evacuation = new EdgeEvacuation(database, config, admin, EDGE_CELL_ID, () => clock.now, () => random)
|
||||
const insert = async (relayHostId: string, cellId = EDGE_CELL_ID, userId = 'user-1') =>
|
||||
await database.query(
|
||||
`INSERT INTO relay_assignments
|
||||
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at, last_activity_at,
|
||||
reserved_controls, reserved_splices, reserved_invites, pending_installs,
|
||||
pending_confirmations, migration_leases)
|
||||
VALUES (?, ?, ?, 1, 0, 0, 0, 0, 0, 0, 0, 0)`,
|
||||
[userId, relayHostId, cellId]
|
||||
)
|
||||
const prefer = async (relayHostId: string, region: string, userId = 'user-1') =>
|
||||
await database.query(
|
||||
`INSERT INTO relay_assignment_region_preferences (user_id, relay_host_id, preferred_region, observed_at)
|
||||
VALUES (?, ?, ?, 0)`,
|
||||
[userId, relayHostId, region]
|
||||
)
|
||||
return { database, config, admin, clock, evacuation, insert, prefer }
|
||||
}
|
||||
|
||||
describe('edge evacuation under runtime control', () => {
|
||||
|
||||
it('re-arms after a pass that was running when the control changed', async () => {
|
||||
vi.useFakeTimers()
|
||||
vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
const flags: EdgeControlFlags = { mode: 'on', rolloutPermille: 0 }
|
||||
const h = await harness({ control: () => flags })
|
||||
await h.insert(hostId(1))
|
||||
h.admin.holding = true
|
||||
const sweep = vi.spyOn(h.evacuation, 'sweep')
|
||||
h.evacuation.start()
|
||||
await vi.advanceTimersByTimeAsync(EDGE_EVACUATION_BUSY_INTERVAL_MS)
|
||||
expect(h.admin.held).toHaveLength(1)
|
||||
flags.mode = 'down'
|
||||
h.evacuation.controlChanged()
|
||||
h.admin.release()
|
||||
await vi.advanceTimersByTimeAsync(EDGE_EVACUATION_CONTROL_DELAY_MS)
|
||||
expect(sweep).toHaveBeenCalledTimes(2)
|
||||
h.evacuation.stop()
|
||||
})
|
||||
|
||||
it(`sends at most ${EDGE_EVACUATION_CONCURRENCY} drains at once`, async () => {
|
||||
vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
const h = await harness()
|
||||
for (let index = 0; index < 35; index += 1) { await h.insert(hostId(index)) }
|
||||
h.admin.holding = true
|
||||
let done = false
|
||||
const pass = h.evacuation.sweep().then((answered) => {
|
||||
done = true
|
||||
return answered
|
||||
})
|
||||
let most = 0
|
||||
while (!done) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 0))
|
||||
most = Math.max(most, h.admin.held.length)
|
||||
h.admin.release()
|
||||
}
|
||||
expect(await pass).toBe(35)
|
||||
expect(most).toBe(EDGE_EVACUATION_CONCURRENCY)
|
||||
})
|
||||
})
|
||||
|
||||
describe('edge admin drain call', () => {
|
||||
it('posts the signed drain op and reads both answers; anything else is unavailable', async () => {
|
||||
const answers: [number, unknown][] = [
|
||||
[200, { outcome: 'drained', controls: 2 }],
|
||||
[200, { outcome: 'idle' }],
|
||||
[404, {}],
|
||||
[401, {}],
|
||||
[200, { outcome: 'drained' }]
|
||||
]
|
||||
const requests: { url: string; init: RequestInit }[] = []
|
||||
const admin = createEdgeAdmin({
|
||||
cellUrl: EDGE_URL,
|
||||
signingKey: SIGNING_KEY,
|
||||
issuer: 'https://relay.example.test',
|
||||
fetch: async (url, init) => {
|
||||
requests.push({ url: String(url), init: init! })
|
||||
const [status, body] = answers.shift()!
|
||||
return new Response(JSON.stringify(body), { status })
|
||||
}
|
||||
})
|
||||
expect(await admin.drain(hostId(1))).toEqual({ outcome: 'drained', controls: 2 })
|
||||
expect(await admin.drain(hostId(1))).toEqual({ outcome: 'idle' })
|
||||
await expect(admin.drain(hostId(1))).rejects.toBeInstanceOf(EdgeAdminUnavailableError)
|
||||
await expect(admin.drain(hostId(1))).rejects.toBeInstanceOf(EdgeAdminUnavailableError)
|
||||
await expect(admin.drain(hostId(1))).rejects.toBeInstanceOf(EdgeAdminUnavailableError)
|
||||
const first = requests[0]!
|
||||
expect(first.url).toBe(`${EDGE_URL}/__admin/drain`)
|
||||
expect(first.init.method).toBe('POST')
|
||||
expect(first.init.body).toBe(JSON.stringify({ relayHostId: hostId(1) }))
|
||||
const token = String((first.init.headers as Record<string, string>).authorization).replace('Bearer ', '')
|
||||
const { payload } = await jwtVerify(token, SIGNING_KEY, {
|
||||
audience: EDGE_ADMIN_AUDIENCE,
|
||||
issuer: 'https://relay.example.test'
|
||||
})
|
||||
expect(payload).toMatchObject({
|
||||
purpose: 'edge-admin',
|
||||
op: 'drain',
|
||||
bodySha256: createHash('sha256').update(String(first.init.body)).digest('base64url')
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -3,10 +3,9 @@
|
||||
// rows whose host is no longer in the cohort and asks the edge to drain them; the desktop then
|
||||
// re-asks /v1/assign, and that ask exports its data and places it on a cell (app.ts). Each pass also
|
||||
// retries fences that did not land after a host left (edge-relay-fence.ts).
|
||||
import { RELAY_DEFAULT_REGION, RelayRegionSchema } from '@orca-cloud/relay-contract/relay-regions'
|
||||
import type { RelayDatabase } from './database/database.js'
|
||||
import { EdgeAdminUnavailableError, type EdgeAdmin } from './edge-admin-client.js'
|
||||
import { inEdgeCohort, text, type EdgeRelayConfig, type Identity } from './edge-relay-cohort.js'
|
||||
import { inEdgeCohort, mayBeOnEdge, text, type EdgeRelayConfig, type Identity } from './edge-relay-cohort.js'
|
||||
import { forEachBounded, retryPendingFences } from './edge-relay-fence.js'
|
||||
|
||||
// A cohort change (director/edge.json, or a new revision) re-arms the sweep (controlChanged), so a
|
||||
@@ -116,9 +115,16 @@ export class EdgeEvacuation {
|
||||
for (const row of rows) {
|
||||
const identity = { userId: text(row, 'user_id'), relayHostId: text(row, 'relay_host_id') }
|
||||
pass.cursor = identity
|
||||
const stored = RelayRegionSchema.safeParse(row.preferred_region)
|
||||
const region = stored.success ? stored.data : RELAY_DEFAULT_REGION
|
||||
if (inEdgeCohort(this.config, identity.relayHostId, region, identity.userId)) { continue }
|
||||
// Region scope is the assign path's call alone: it decides with the region the desktop
|
||||
// asks for, which the stored preference can miss or lag. Judging it here too drained
|
||||
// hosts that the next ask put straight back (a drain every few minutes). A host that asks
|
||||
// for a region outside the scope leaves on that ask.
|
||||
if (inEdgeCohort(this.config, identity.relayHostId, 'any', identity.userId)) { continue }
|
||||
if (!mayBeOnEdge(this.config, identity.relayHostId, identity.userId)) {
|
||||
// leaveCeilingPermille is set below a rollout this host was moved under: its asks skip
|
||||
// the leave read, so it would be re-placed without its devices. Raise the ceiling.
|
||||
console.error(JSON.stringify({ event: 'orca_relay_edge_row_above_ceiling' }))
|
||||
}
|
||||
if (this.drainedAt.has(drainKey(identity))) { continue }
|
||||
leaving.push(identity)
|
||||
// Resume after the last host taken, so the rest of the page is read next tick.
|
||||
@@ -143,10 +149,8 @@ export class EdgeEvacuation {
|
||||
private async readPage(pass: Pass) {
|
||||
const { cursor, origin, wrapped } = pass
|
||||
return await this.database.query(
|
||||
`SELECT a.user_id, a.relay_host_id, p.preferred_region
|
||||
`SELECT a.user_id, a.relay_host_id
|
||||
FROM relay_assignments a
|
||||
LEFT JOIN relay_assignment_region_preferences p
|
||||
ON p.user_id = a.user_id AND p.relay_host_id = a.relay_host_id
|
||||
WHERE a.cell_id = ? AND (a.user_id > ? OR (a.user_id = ? AND a.relay_host_id > ?))
|
||||
${wrapped ? 'AND (a.user_id < ? OR (a.user_id = ? AND a.relay_host_id <= ?))' : ''}
|
||||
ORDER BY a.user_id, a.relay_host_id
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { openInMemoryRelayDatabase, type RelayDatabase } from './database/database.js'
|
||||
import { EdgeAdminUnavailableError, type EdgeAdmin, type EdgeAdminCallOptions, type EdgeAssignBody, type EdgeAssignResult } from './edge-admin-client.js'
|
||||
import { EDGE_FENCE_RETRY_BASE_MS, EDGE_FENCE_RETRY_BATCH, recordPendingFence, retryPendingFences } from './edge-relay-fence.js'
|
||||
import type { EdgeAdmin, EdgeAdminCallOptions, EdgeAssignBody, EdgeAssignResult } from './edge-admin-client.js'
|
||||
import { EDGE_FENCE_RETRY_BASE_MS, retryPendingFences } from './edge-relay-fence.js'
|
||||
import { EDGE_CELL_ID, EdgeAssignments, type EdgeRelayConfig } from './edge-relay.js'
|
||||
|
||||
const EDGE_URL = 'https://edge.relay.example.test'
|
||||
@@ -16,31 +16,16 @@ afterEach(async () => {
|
||||
for (const database of databases.splice(0)) { await database.close() }
|
||||
})
|
||||
|
||||
type Answer = EdgeAssignResult['outcome'] | 'down' | 'hang'
|
||||
|
||||
// Answers each assign from `answers` (then 'applied'); 'hang' waits until `release()`.
|
||||
class ScriptedEdge implements EdgeAdmin {
|
||||
answers: Answer[] = []
|
||||
answers: EdgeAssignResult['outcome'][] = []
|
||||
calls: { body: EdgeAssignBody; options?: EdgeAdminCallOptions }[] = []
|
||||
private waiting: (() => void)[] = []
|
||||
|
||||
async assign(body: EdgeAssignBody, options?: EdgeAdminCallOptions): Promise<EdgeAssignResult> {
|
||||
this.calls.push({ body, ...(options ? { options } : {}) })
|
||||
const answer = this.answers.shift() ?? 'applied'
|
||||
if (answer === 'down') { throw new EdgeAdminUnavailableError('network') }
|
||||
if (answer === 'hang') { await new Promise<void>((resolve) => this.waiting.push(resolve)) }
|
||||
const outcome = answer === 'hang' ? 'applied' : answer
|
||||
const outcome = this.answers.shift() ?? 'applied'
|
||||
return { outcome, assignmentEpoch: outcome === 'stale' ? body.assignmentEpoch + 5 : body.assignmentEpoch }
|
||||
}
|
||||
|
||||
get hanging(): number {
|
||||
return this.waiting.length
|
||||
}
|
||||
|
||||
release(): void {
|
||||
for (const resolve of this.waiting.splice(0)) { resolve() }
|
||||
}
|
||||
|
||||
async exportHost(): Promise<never> {
|
||||
throw new Error('unexpected export')
|
||||
}
|
||||
@@ -96,26 +81,6 @@ function logged(spy: { mock: { calls: unknown[][] } }, event: string): Record<st
|
||||
.filter((entry) => entry.event === event)
|
||||
}
|
||||
|
||||
describe('relay edge fence after a host leaves', () => {
|
||||
|
||||
it('records nothing when the fence lands, and a newer failure replaces an older record', async () => {
|
||||
vi.spyOn(console, 'error').mockImplementation(() => {})
|
||||
const h = await harness()
|
||||
h.edge.answers = ['down', 'unchanged']
|
||||
expect(await h.assignments.fenceAway({ userId: USER, relayHostId: HOST }, 'us-c1', 9)).toBe(true)
|
||||
expect(await h.pending()).toEqual([])
|
||||
h.edge.answers = ['down', 'down', 'down']
|
||||
await h.assignments.fenceAway({ userId: USER, relayHostId: HOST }, 'us-c1', 9)
|
||||
await h.database.query(`UPDATE relay_edge_fence_pending SET attempts = 3`)
|
||||
h.clock.now += 5_000
|
||||
h.edge.answers = ['stale']
|
||||
await h.assignments.fenceAway({ userId: USER, relayHostId: HOST }, 'us-c2', 12)
|
||||
expect(await h.pending()).toEqual([
|
||||
{ relayHostId: HOST, cellId: 'us-c2', assignmentEpoch: 12, attempts: 0, nextAttemptAt: h.clock.now + EDGE_FENCE_RETRY_BASE_MS }
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
describe('relay edge pending fence retries', () => {
|
||||
it('re-fences to the current row, not the recorded one, and clears the record once it lands', async () => {
|
||||
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
@@ -137,33 +102,6 @@ describe('relay edge pending fence retries', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it(`retries up to ${EDGE_FENCE_RETRY_BATCH} due fences per pass, 10 in flight at once`, async () => {
|
||||
vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
const h = await harness()
|
||||
const hosts = Array.from({ length: EDGE_FENCE_RETRY_BATCH + 10 }, (_, index) => `fencehost${String(index).padStart(7, '0')}`)
|
||||
for (const host of hosts) {
|
||||
await h.placeRow('us-c1', 9, host)
|
||||
await recordPendingFence(h.database, { userId: USER, relayHostId: host }, 'us-c1', 9, h.clock.now)
|
||||
}
|
||||
h.clock.now += EDGE_FENCE_RETRY_BASE_MS
|
||||
h.edge.answers = hosts.map(() => 'hang')
|
||||
let settled = false
|
||||
const pass = h.retry().then((left) => {
|
||||
settled = true
|
||||
return left
|
||||
})
|
||||
let maxInFlight = 0
|
||||
while (!settled) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 0))
|
||||
maxInFlight = Math.max(maxInFlight, h.edge.hanging)
|
||||
h.edge.release()
|
||||
}
|
||||
expect(await pass).toBe(true)
|
||||
expect(h.edge.calls).toHaveLength(EDGE_FENCE_RETRY_BATCH)
|
||||
expect(maxInFlight).toBe(10)
|
||||
expect(await h.pending()).toHaveLength(10)
|
||||
})
|
||||
|
||||
it('lets only one director claim an attempt', async () => {
|
||||
vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
vi.spyOn(console, 'error').mockImplementation(() => {})
|
||||
|
||||
@@ -41,6 +41,27 @@ export async function recordPendingFence(
|
||||
)
|
||||
}
|
||||
|
||||
// One fence call. `conflict` means the edge holds this very epoch for another placement (a move onto
|
||||
// the edge whose push landed though the director counted it as failed, then a placement elsewhere
|
||||
// minted the same epoch). No later move can produce that (a later move has a higher epoch, which
|
||||
// answers `stale`), so the fence goes once more one epoch above: it lands, and a later move onto
|
||||
// the edge re-mints above it as for any edge epoch (moveToEdge).
|
||||
async function assignFence(
|
||||
admin: EdgeAdmin,
|
||||
fence: Identity & { cellId: string; assignmentEpoch: number }
|
||||
): Promise<{ outcome: string; assignmentEpoch: number }> {
|
||||
const first = await admin.assign(fence)
|
||||
if (first.outcome !== 'conflict' || first.assignmentEpoch !== fence.assignmentEpoch) {
|
||||
return { outcome: first.outcome, assignmentEpoch: fence.assignmentEpoch }
|
||||
}
|
||||
const above = fence.assignmentEpoch + 1
|
||||
const second = await admin.assign({ ...fence, assignmentEpoch: above })
|
||||
console.warn(
|
||||
JSON.stringify({ event: 'orca_relay_edge_fence_above_conflict', outcome: second.outcome, assignmentEpoch: above })
|
||||
)
|
||||
return { outcome: second.outcome, assignmentEpoch: above }
|
||||
}
|
||||
|
||||
// The fence right after a host left (EdgeAssignments.fenceAway). Anything but applied/unchanged
|
||||
// fails: unavailable, `conflict`, or `stale` (the edge holds a newer epoch, so it still claims the
|
||||
// host); the failure is logged and recorded for retry. Returns whether the fence landed.
|
||||
@@ -55,7 +76,7 @@ export async function fenceEdge(
|
||||
let outcome = 'unavailable'
|
||||
for (let attempt = 0; attempt < attempts; attempt += 1) {
|
||||
try {
|
||||
outcome = (await admin.assign(fence)).outcome
|
||||
outcome = (await assignFence(admin, fence)).outcome
|
||||
} catch (error) {
|
||||
if (!(error instanceof EdgeAdminUnavailableError)) { throw error }
|
||||
outcome = error.message
|
||||
@@ -138,7 +159,7 @@ async function retryOne(
|
||||
const assignmentEpoch = integer(row, 'assignment_epoch')
|
||||
let outcome: string
|
||||
try {
|
||||
outcome = (await admin.assign({ ...identity, cellId, assignmentEpoch })).outcome
|
||||
outcome = (await assignFence(admin, { ...identity, cellId, assignmentEpoch })).outcome
|
||||
} catch (error) {
|
||||
if (!(error instanceof EdgeAdminUnavailableError)) { throw error }
|
||||
outcome = error.message
|
||||
|
||||
@@ -37,6 +37,7 @@ export {
|
||||
edgeCohortBucket,
|
||||
inEdgeCohort,
|
||||
mapEpochFloor,
|
||||
mayBeOnEdge,
|
||||
type EdgeRelayConfig
|
||||
} from './edge-relay-cohort.js'
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
||||
id: claude-chat-entrypoint-callers
|
||||
snapshots:
|
||||
"import { withOrcaClaudeChatEntrypoint as stamp } from './claude-chat-entrypoint'":
|
||||
labels:
|
||||
- source: withOrcaClaudeChatEntrypoint
|
||||
style: primary
|
||||
start: 9
|
||||
end: 37
|
||||
'withOrcaClaudeChatEntrypoint(env, platform)':
|
||||
labels:
|
||||
- source: withOrcaClaudeChatEntrypoint
|
||||
style: primary
|
||||
start: 0
|
||||
end: 28
|
||||
@@ -0,0 +1,20 @@
|
||||
id: claude-chat-entrypoint-owner
|
||||
snapshots:
|
||||
"const env = { CLAUDE_CODE_ENTRYPOINT: 'orca' }":
|
||||
labels:
|
||||
- source: CLAUDE_CODE_ENTRYPOINT
|
||||
style: primary
|
||||
start: 14
|
||||
end: 36
|
||||
const identity = 'sdk-cli':
|
||||
labels:
|
||||
- source: sdk-cli
|
||||
style: primary
|
||||
start: 18
|
||||
end: 25
|
||||
"env['claude_code_entrypoint'] = 'other'":
|
||||
labels:
|
||||
- source: claude_code_entrypoint
|
||||
style: primary
|
||||
start: 5
|
||||
end: 27
|
||||
@@ -0,0 +1,14 @@
|
||||
id: claude-entrypoint-key-owner
|
||||
snapshots:
|
||||
"env[CLAUDE_ENTRYPOINT_ENV] = 'orca'":
|
||||
labels:
|
||||
- source: CLAUDE_ENTRYPOINT_ENV
|
||||
style: primary
|
||||
start: 4
|
||||
end: 25
|
||||
"import { CLAUDE_ENTRYPOINT_ENV as key } from './claude-chat-entrypoint'":
|
||||
labels:
|
||||
- source: CLAUDE_ENTRYPOINT_ENV
|
||||
style: primary
|
||||
start: 9
|
||||
end: 30
|
||||
@@ -0,0 +1,6 @@
|
||||
id: claude-chat-entrypoint-callers
|
||||
valid:
|
||||
- 'stripInheritedAgentSessionEnv(env)'
|
||||
invalid:
|
||||
- 'withOrcaClaudeChatEntrypoint(env, platform)'
|
||||
- "import { withOrcaClaudeChatEntrypoint as stamp } from './claude-chat-entrypoint'"
|
||||
@@ -0,0 +1,8 @@
|
||||
id: claude-chat-entrypoint-owner
|
||||
valid:
|
||||
- 'const env = withOrcaClaudeChatEntrypoint(configured, platform)'
|
||||
- "const binary = 'orca'"
|
||||
invalid:
|
||||
- "const env = { CLAUDE_CODE_ENTRYPOINT: 'orca' }"
|
||||
- "env['claude_code_entrypoint'] = 'other'"
|
||||
- "const identity = 'sdk-cli'"
|
||||
@@ -0,0 +1,6 @@
|
||||
id: claude-entrypoint-key-owner
|
||||
valid:
|
||||
- "const binary = 'orca'"
|
||||
invalid:
|
||||
- "env[CLAUDE_ENTRYPOINT_ENV] = 'orca'"
|
||||
- "import { CLAUDE_ENTRYPOINT_ENV as key } from './claude-chat-entrypoint'"
|
||||
@@ -0,0 +1,117 @@
|
||||
id: claude-chat-entrypoint-owner
|
||||
language: typescript
|
||||
severity: error
|
||||
message: Keep the Claude identity literal in claude-chat-entrypoint.ts.
|
||||
files: ['src/**']
|
||||
ignores:
|
||||
- '**/*.test.*'
|
||||
- '**/*.test-fixtures.*'
|
||||
- '**/__fixtures__/**'
|
||||
- 'src/shared/agent-launch/startup/claude-chat-entrypoint.ts'
|
||||
rule:
|
||||
all:
|
||||
- any:
|
||||
- kind: string_fragment
|
||||
- kind: property_identifier
|
||||
- kind: identifier
|
||||
- regex: '(?i)^(CLAUDE_CODE_ENTRYPOINT|sdk-cli)$'
|
||||
---
|
||||
id: claude-chat-entrypoint-owner-tsx
|
||||
language: tsx
|
||||
severity: error
|
||||
message: Keep the Claude identity literal in claude-chat-entrypoint.ts.
|
||||
files: ['src/**']
|
||||
ignores:
|
||||
- '**/*.test.*'
|
||||
- '**/*.test-fixtures.*'
|
||||
- '**/__fixtures__/**'
|
||||
- 'src/shared/agent-launch/startup/claude-chat-entrypoint.ts'
|
||||
rule:
|
||||
all:
|
||||
- any:
|
||||
- kind: string_fragment
|
||||
- kind: property_identifier
|
||||
- kind: identifier
|
||||
- regex: '(?i)^(CLAUDE_CODE_ENTRYPOINT|sdk-cli)$'
|
||||
---
|
||||
id: claude-chat-entrypoint-callers
|
||||
language: typescript
|
||||
severity: error
|
||||
message: Only structured native chat and its own probes may apply the chat identity.
|
||||
files: ['src/**']
|
||||
ignores:
|
||||
- '**/*.test.*'
|
||||
- '**/*.test-fixtures.*'
|
||||
- '**/__fixtures__/**'
|
||||
- 'src/shared/agent-launch/startup/claude-chat-entrypoint.ts'
|
||||
- 'src/main/claude/claude-stream-json-connection.ts'
|
||||
- 'src/main/claude/claude-agent-sdk-process-spawn.ts'
|
||||
- 'src/main/claude/structured/launch/claude-structured-child-env.ts'
|
||||
- 'src/main/claude/claude-model-catalog-probe.ts'
|
||||
rule:
|
||||
all:
|
||||
- any:
|
||||
- kind: string_fragment
|
||||
- kind: property_identifier
|
||||
- kind: identifier
|
||||
- regex: '^withOrcaClaudeChatEntrypoint$'
|
||||
---
|
||||
id: claude-chat-entrypoint-callers-tsx
|
||||
language: tsx
|
||||
severity: error
|
||||
message: Only structured native chat and its own probes may apply the chat identity.
|
||||
files: ['src/**']
|
||||
ignores:
|
||||
- '**/*.test.*'
|
||||
- '**/*.test-fixtures.*'
|
||||
- '**/__fixtures__/**'
|
||||
- 'src/shared/agent-launch/startup/claude-chat-entrypoint.ts'
|
||||
- 'src/main/claude/claude-stream-json-connection.ts'
|
||||
- 'src/main/claude/claude-agent-sdk-process-spawn.ts'
|
||||
- 'src/main/claude/structured/launch/claude-structured-child-env.ts'
|
||||
- 'src/main/claude/claude-model-catalog-probe.ts'
|
||||
rule:
|
||||
all:
|
||||
- any:
|
||||
- kind: string_fragment
|
||||
- kind: property_identifier
|
||||
- kind: identifier
|
||||
- regex: '^withOrcaClaudeChatEntrypoint$'
|
||||
---
|
||||
id: claude-entrypoint-key-owner
|
||||
language: typescript
|
||||
severity: error
|
||||
message: Only the chat identity owner and inherited-session isolation may access this key directly.
|
||||
files: ['src/**']
|
||||
ignores:
|
||||
- '**/*.test.*'
|
||||
- '**/*.test-fixtures.*'
|
||||
- '**/__fixtures__/**'
|
||||
- 'src/shared/agent-launch/startup/claude-chat-entrypoint.ts'
|
||||
- 'src/shared/agent-launch/startup/parent-agent-session-env.ts'
|
||||
rule:
|
||||
all:
|
||||
- any:
|
||||
- kind: string_fragment
|
||||
- kind: property_identifier
|
||||
- kind: identifier
|
||||
- regex: '^CLAUDE_ENTRYPOINT_ENV$'
|
||||
---
|
||||
id: claude-entrypoint-key-owner-tsx
|
||||
language: tsx
|
||||
severity: error
|
||||
message: Only the chat identity owner and inherited-session isolation may access this key directly.
|
||||
files: ['src/**']
|
||||
ignores:
|
||||
- '**/*.test.*'
|
||||
- '**/*.test-fixtures.*'
|
||||
- '**/__fixtures__/**'
|
||||
- 'src/shared/agent-launch/startup/claude-chat-entrypoint.ts'
|
||||
- 'src/shared/agent-launch/startup/parent-agent-session-env.ts'
|
||||
rule:
|
||||
all:
|
||||
- any:
|
||||
- kind: string_fragment
|
||||
- kind: property_identifier
|
||||
- kind: identifier
|
||||
- regex: '^CLAUDE_ENTRYPOINT_ENV$'
|
||||
@@ -0,0 +1,14 @@
|
||||
# Mutations save the domains they change; only startup load and maintenance resume rewrite the whole profile.
|
||||
id: profile-full-save-callers
|
||||
language: typescript
|
||||
severity: error
|
||||
message: Name the profile domains this mutation changed with scheduleSave(owner, [...domains]). scheduleFullProfileSave is for startup load and maintenance resume only.
|
||||
files:
|
||||
- src/**
|
||||
ignores:
|
||||
- '**/*.test.*'
|
||||
- src/main/persistence/loading-store/profile-writing/write-scheduling.ts
|
||||
- src/main/persistence/loading-store/store.ts
|
||||
- src/main/persistence/loading-store/profile-writing/profile-state-maintenance.ts
|
||||
rule:
|
||||
pattern: scheduleFullProfileSave($$$)
|
||||
@@ -82,15 +82,6 @@ focus change, and singleton accessibility/native counts do not establish an atom
|
||||
identity mapping if a window closes or the accessibility tree is stale. The probe
|
||||
covers stable fixtures and detected ambiguity, not those concurrent lifecycle races.
|
||||
|
||||
## Headless contract checks
|
||||
|
||||
```sh
|
||||
ORCA_BACKGROUND_LAUNCH=1 python3 -m unittest discover -s config/benchmarks/computer-use -p 'test_*.py'
|
||||
```
|
||||
|
||||
These checks protect the historical false-success cases and process-tree cleanup.
|
||||
They do not import desktop observers or generate native input.
|
||||
|
||||
Transports, fixtures and observers were adapted from the historical
|
||||
`bench/computer-cua` prototype at `68a68ccf0f16c0a7f952d55adfe21850247b8ee9`.
|
||||
Historical checkouts and result artifacts remain unchanged.
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
"""Regressions for false success claims and unsafe trial reuse in the original benchmark."""
|
||||
import unittest
|
||||
|
||||
from trial_contract import (DECOY, DiscoveryError, MARKER, acknowledged, completed,
|
||||
initial_state, prepared, select_unique, summarize, verdict)
|
||||
|
||||
|
||||
class TaskContractTests(unittest.TestCase):
|
||||
def test_reset_requires_current_command_on_current_fixture(self):
|
||||
state = {**initial_state("targeted_type"), "instance": "new", "pid": 19, "ack": "current"}
|
||||
self.assertTrue(prepared(state, "targeted_type", "new", 19, "current"))
|
||||
for key, value in (("ack", "previous"), ("instance", "old"), ("pid", 20),
|
||||
("logicalFocus", "field"), ("selLen", 1), ("top", 1), ("dropOpen", True),
|
||||
("submittedText", "old"), ("clickedColor", "Blue")):
|
||||
with self.subTest(key=key):
|
||||
self.assertFalse(prepared({**state, key: value}, "targeted_type", "new", 19, "current"))
|
||||
self.assertFalse(acknowledged(state, "new", 19, "previous"))
|
||||
for key in ("submittedText", "clickedColor"):
|
||||
without_payload = {name: value for name, value in state.items() if name != key}
|
||||
self.assertFalse(prepared(without_payload, "targeted_type", "new", 19, "current"))
|
||||
|
||||
def test_selectors_never_substitute_another_control(self):
|
||||
selector = (r"button", r"\bincrement\b")
|
||||
desired = {"role": "button", "label": "Increment"}
|
||||
self.assertEqual(select_unique([{"role": "button", "label": "Delete"}, desired], selector), desired)
|
||||
for elements in ([{"role": "button", "label": "Delete"}],
|
||||
[{"role": "pane", "label": "Increment"}], [desired, dict(desired)], []):
|
||||
with self.subTest(elements=elements), self.assertRaises(DiscoveryError):
|
||||
select_unique(elements, selector)
|
||||
|
||||
def test_completion_requires_exact_raw_text_and_unchanged_decoy(self):
|
||||
final = {**initial_state("targeted_type"), "text": MARKER}
|
||||
self.assertTrue(completed(final, "targeted_type"))
|
||||
for text in ("q" + MARKER, MARKER + "q", "Orca qcafé Ω", ""):
|
||||
with self.subTest(text=text):
|
||||
self.assertFalse(completed({**final, "text": text}, "targeted_type"))
|
||||
self.assertFalse(completed({**final, "decoyText": DECOY + MARKER}, "targeted_type"))
|
||||
|
||||
def test_exactly_once_actions_reject_intermediate_and_duplicate_effects(self):
|
||||
for task, key in (("choose_and_click", "count"), ("type_submit", "returns"), ("replace_submit", "returns")):
|
||||
final = {**initial_state(task), key: 1}
|
||||
if task == "choose_and_click":
|
||||
final["combo"] = "Blue"
|
||||
payload, correct, wrong = "clickedColor", "Blue", "Red"
|
||||
else:
|
||||
final["text"] = MARKER
|
||||
payload, correct, wrong = "submittedText", MARKER, ""
|
||||
final[payload] = correct
|
||||
self.assertTrue(completed(final, task))
|
||||
for value in (wrong, None):
|
||||
with self.subTest(task=task, payload=value):
|
||||
self.assertFalse(completed({**final, payload: value}, task))
|
||||
self.assertFalse(completed({name: value for name, value in final.items() if name != payload}, task))
|
||||
for value in (0, 2):
|
||||
with self.subTest(task=task, value=value):
|
||||
self.assertFalse(completed({**final, key: value}, task))
|
||||
for color in ("Red", "Blue"):
|
||||
self.assertTrue(completed({**initial_state("click_interference"), "count": 1,
|
||||
"clickedColor": color}, "click_interference"))
|
||||
|
||||
def test_observed_completion_is_independent_of_api_errors(self):
|
||||
row = {"prepared": True, "task": "targeted_type", "api_errors": ["timeout"]}
|
||||
self.assertEqual(verdict(row, {**initial_state(row["task"]), "text": MARKER}), "completed")
|
||||
self.assertEqual(verdict(row, initial_state(row["task"])), "failed")
|
||||
self.assertEqual(verdict(row, None), "unobserved")
|
||||
self.assertEqual(verdict({**row, "prepared": False}, None), "invalid_setup")
|
||||
|
||||
def test_invalid_setup_does_not_inflate_scored_completion(self):
|
||||
base = {"engine": "candidate", "task": "targeted_type", "profile": "background"}
|
||||
result = summarize([{**base, "verdict": "invalid_setup"},
|
||||
{**base, "verdict": "failed", "discovery_error": "no field"},
|
||||
{**base, "verdict": "unobserved"},
|
||||
{**base, "verdict": "completed", "api_errors": ["late error"]}])[0]
|
||||
self.assertEqual((result["planned"], result["scored"], result["invalid"], result["completed"]), (4, 3, 1, 1))
|
||||
self.assertEqual((result["discovery_failures"], result["unobserved"], result["api_errors"]), (1, 1, 1))
|
||||
|
||||
def test_partial_failures_cannot_make_task_latency_look_fast(self):
|
||||
base = {"engine": "candidate", "task": "type_submit", "profile": "background"}
|
||||
result = summarize([{**base, "verdict": "completed", "attempt_ms": 400, "action_read_ms": [100, 150]},
|
||||
{**base, "verdict": "failed", "attempt_ms": 2, "action_read_ms": [1]},
|
||||
{**base, "verdict": "unobserved", "attempt_ms": 30000}])[0]
|
||||
self.assertEqual(result["task_ms"], 400)
|
||||
self.assertEqual(result["action_read_ms"], 125)
|
||||
self.assertEqual((result["timed_completions"], result["timed_failures"]), (1, 2))
|
||||
self.assertEqual(result["failed_attempt_ms"], 15001)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,7 +1,7 @@
|
||||
// The CLI loads these paths after electron-vite replaces out/main.
|
||||
export const CLI_MAIN_ENTRY_NAMES = [
|
||||
'agent-hooks/installation/managed-agent-hook-controls',
|
||||
'gitlab/project-ref-parser',
|
||||
'gitlab/projects/project-ref-parser',
|
||||
'orca-profiles/profile-index-store',
|
||||
'claude-accounts/keychain',
|
||||
// The CLI checks a relocated runtime socket dir before it sends the auth token.
|
||||
@@ -15,16 +15,14 @@ export const CLI_MAIN_ENTRY_NAMES = [
|
||||
// `orca vm env doctor` runs its checks in the CLI process.
|
||||
'environment-doctor/environment-doctor',
|
||||
'environment-doctor/environment-doctor-host',
|
||||
...[
|
||||
'access',
|
||||
'active-location',
|
||||
'storage-classification',
|
||||
'offline-settings',
|
||||
'backup-path',
|
||||
'database-recovery',
|
||||
'domain-reader',
|
||||
'recovery-command'
|
||||
].map((module) => `persistence/profile-state/profile-state-${module}`),
|
||||
'persistence/profile-state/access/profile-state-access',
|
||||
'persistence/profile-state/offline-access/profile-state-active-location',
|
||||
'persistence/profile-state/database/profile-state-storage-classification',
|
||||
'persistence/profile-state/offline-access/profile-state-offline-settings',
|
||||
'persistence/profile-state/backup/profile-state-backup-path',
|
||||
'persistence/profile-state/recovery/profile-state-database-recovery',
|
||||
'persistence/profile-state/documents/profile-state-domain-reader',
|
||||
'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'
|
||||
|
||||
@@ -19,7 +19,9 @@ export const MAIN_BUILD_ENTRY_POINTS: Record<string, string> = {
|
||||
),
|
||||
'stt-worker': resolve('src/main/speech/stt-worker.ts'),
|
||||
'warp-theme-parser-worker': resolve('src/main/warp-themes/warp-theme-parser-worker.ts'),
|
||||
'session-search-worker-entry': resolve('src/main/ai-vault-search/session-search-worker-entry.ts'),
|
||||
'session-search-worker-entry': resolve(
|
||||
'src/main/ai-vault-search/worker/session-search-worker-entry.ts'
|
||||
),
|
||||
'foreign-sqlite-reader-entry': resolve(
|
||||
'src/main/foreign-sqlite-readers/foreign-sqlite-reader-entry.ts'
|
||||
),
|
||||
@@ -39,7 +41,7 @@ export const MAIN_BUILD_ENTRY_POINTS: Record<string, string> = {
|
||||
'src/main/worker-thread-child-process/worker-thread-child-process-entry.ts'
|
||||
),
|
||||
// Usage scans synchronously walk histories/SQLite; keep them off the main loop.
|
||||
'usage-scan-worker-entry': resolve('src/main/usage/usage-scan-worker-entry.ts'),
|
||||
'usage-scan-worker-entry': resolve('src/main/usage/scan-worker/usage-scan-worker-entry.ts'),
|
||||
'workspace-space-scan-worker-entry': resolve(
|
||||
'src/main/workspaces/space-analysis/workspace-space-scan-worker-entry.ts'
|
||||
),
|
||||
@@ -48,10 +50,10 @@ export const MAIN_BUILD_ENTRY_POINTS: Record<string, string> = {
|
||||
'src/main/claude-accounts/claude-profile-setup-worker-entry.ts'
|
||||
),
|
||||
'profile-state-backup-worker-entry': resolve(
|
||||
'src/main/persistence/profile-state/profile-state-backup-worker-entry.ts'
|
||||
'src/main/persistence/profile-state/backup/profile-state-backup-worker-entry.ts'
|
||||
),
|
||||
'profile-state-writer-worker-entry': resolve(
|
||||
'src/main/persistence/profile-state/profile-state-writer-worker-entry.ts'
|
||||
'src/main/persistence/profile-state/writer/profile-state-writer-worker-entry.ts'
|
||||
),
|
||||
// Isolate native @parcel/watcher faults from main (#7547).
|
||||
'parcel-watcher-process-entry': resolve(
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
// Why: import.meta.url, not dirname — electron-vite's config bundle rewrites only the former.
|
||||
const REPO_ROOT = fileURLToPath(new URL('../..', import.meta.url))
|
||||
|
||||
export const UNCOMPILED_LIST = 'config/react-compiler-uncompiled-files.txt'
|
||||
// Hand-kept list plus every file still in a hazard ratchet; compiled, these would run differently.
|
||||
export const UNCOMPILED_FILE_LISTS = [
|
||||
UNCOMPILED_LIST,
|
||||
'config/render-path-translate-baseline.txt',
|
||||
'config/react-compiler-hazard-baseline.txt'
|
||||
]
|
||||
|
||||
/** Repo-relative paths from a list or count baseline: `[count ]path[#detail][ # note]`. */
|
||||
export function parseListedFiles(text) {
|
||||
return text
|
||||
.split('\n')
|
||||
.map((line) => line.trim())
|
||||
.filter((line) => line && !line.startsWith('#'))
|
||||
.map((line) =>
|
||||
line
|
||||
.replace(/^\d+\s+/, '')
|
||||
.split('#')[0]
|
||||
.trim()
|
||||
)
|
||||
}
|
||||
|
||||
export function readListedFiles(list, root = REPO_ROOT) {
|
||||
return parseListedFiles(readFileSync(resolve(root, list), 'utf8'))
|
||||
}
|
||||
|
||||
export function reactCompilerExcludedFiles(root = REPO_ROOT) {
|
||||
return [...new Set(UNCOMPILED_FILE_LISTS.flatMap((list) => readListedFiles(list, root)))]
|
||||
}
|
||||
@@ -1,25 +1,5 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import type { Options } from '@vitejs/plugin-react'
|
||||
|
||||
// Hand-kept list plus every file still in a hazard ratchet; compiled, these would run differently.
|
||||
const UNCOMPILED_FILE_LISTS = [
|
||||
'config/react-compiler-uncompiled-files.txt',
|
||||
'config/render-path-translate-baseline.txt',
|
||||
'config/react-compiler-hazard-baseline.txt'
|
||||
]
|
||||
|
||||
function listedFiles(list: string): string[] {
|
||||
return readFileSync(resolve(list), 'utf8')
|
||||
.split('\n')
|
||||
.map((line) => line.trim())
|
||||
.filter((line) => line && !line.startsWith('#'))
|
||||
.map((line) => line.replace(/^\d+\s+/, '').split('#')[0])
|
||||
}
|
||||
|
||||
export function reactCompilerExcludedFiles(): string[] {
|
||||
return [...new Set(UNCOMPILED_FILE_LISTS.flatMap(listedFiles))]
|
||||
}
|
||||
import { reactCompilerExcludedFiles } from './react-compiler-uncompiled-files.mjs'
|
||||
|
||||
export function isReactCompilerEnabled(): boolean {
|
||||
return process.env.ORCA_REACT_COMPILER !== '0'
|
||||
|
||||
@@ -4,13 +4,13 @@ param(
|
||||
[Parameter(Mandatory=$true)][hashtable]$Context,
|
||||
[Parameter(Mandatory=$true)][ValidateSet('win32-arm64','win32-x64')][string]$Target,
|
||||
[Parameter(Mandatory=$true)][string]$ReceiptRoot,
|
||||
[ValidateSet('orcad-cmd','orcad-powershell','orcad-convert','orcad-cli-managed','orcad-cli-convert')][string[]]$Cells=@('orcad-cmd','orcad-powershell')
|
||||
[ValidateSet('orcad-cmd','orcad-powershell','orcad-cli-managed')][string[]]$Cells=@('orcad-cmd','orcad-powershell')
|
||||
)
|
||||
$ErrorActionPreference='Stop'
|
||||
if($env:GITHUB_ACTIONS -ne 'true' -or $env:ORCA_ISOLATED_SSH_CI -ne '1'){throw 'Disposable CI only'}
|
||||
$shells=@{'orcad-cmd'='cmd';'orcad-powershell'='powershell';'orcad-convert'='cmd';'orcad-cli-managed'='cmd';'orcad-cli-convert'='cmd'}
|
||||
$shells=@{'orcad-cmd'='cmd';'orcad-powershell'='powershell';'orcad-cli-managed'='cmd'}
|
||||
# App-level cells drive the e2e build (and the bundled CLI) against the host; each greps one tagged test.
|
||||
$appCells=@{'orcad-convert'=@('tests/e2e/ssh-orcad-auto-convert.spec.ts','');'orcad-cli-managed'=@('tests/e2e/ssh-orcad-windows-cli-matrix.spec.ts','@orcad-cli-managed');'orcad-cli-convert'=@('tests/e2e/ssh-orcad-windows-cli-matrix.spec.ts','@orcad-cli-convert')}
|
||||
$appCells=@{'orcad-cli-managed'=@('tests/e2e/ssh-orcad-windows-cli-matrix.spec.ts','@orcad-cli-managed')}
|
||||
$electronBuilt=$false
|
||||
if($Context.accounts.Count -lt $Cells.Count){throw 'Each cell needs its own private account'}
|
||||
$seenApp=$false
|
||||
|
||||
@@ -341,7 +341,7 @@ module.exports = {
|
||||
'out/main/cursor/**',
|
||||
'out/main/droid/**',
|
||||
'out/main/gemini/**',
|
||||
'out/main/gitlab/project-ref-parser.js',
|
||||
'out/main/gitlab/projects/project-ref-parser.js',
|
||||
'out/main/grok/**',
|
||||
'out/main/hermes/**',
|
||||
'out/main/filesystem/asar-transparent-fs.js',
|
||||
|
||||
@@ -2,18 +2,16 @@
|
||||
# This is a RATCHET: counts may only go DOWN. Run `pnpm lint:ast-grep:flaky-tests` to list them.
|
||||
# Prune after a fix: pnpm check:flaky-test-pattern-ratchet --prune
|
||||
1 test-no-in-test-import-actual:src/cli/runtime/launch-serve-replaced-app-restart.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/bitbucket/credential-connection.test.ts
|
||||
4 test-no-in-test-import-actual:src/main/bitbucket/credential-store.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/bitbucket/status-no-decrypt.test.ts
|
||||
2 test-no-in-test-import-actual:src/main/browser/cookies/browser-cookie-import.comet.test.ts
|
||||
3 test-no-in-test-import-actual:src/main/claude-usage/scanner-scan.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/claude/claude-agent-sdk-process-spawn.test.ts
|
||||
5 test-no-in-test-import-actual:src/main/daemon/endpoint/publication/testing/daemon-endpoint-publish.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/daemon/history/storage/testing/terminal-history-permissions.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/git/command-runner/spawned-command-tree-kill.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/ipc/filesystem/filesystem-content-search-cancellation.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/linear/client.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/linear/linear-description-images.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/linear/accounts/linear-account-client.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/linear/issues/linear-description-images.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/omp/omp-session-cwd-lookup.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/orcad/electron-serve-provider-selection.test.ts
|
||||
1 test-no-in-test-import-actual:src/main/pty/scrollback/overlay-mirror.test.ts
|
||||
@@ -29,9 +27,6 @@
|
||||
1 test-no-in-test-import-actual:src/renderer/src/components/terminal-pane/pty-connection/notifications/pty-connection-hook-idle-arbitration.test.ts
|
||||
3 test-no-in-test-import-actual:src/renderer/src/components/terminal-pane/snapshots/remote-snapshot-alt-screen-host-chain.test.ts
|
||||
1 test-no-in-test-import-actual:src/renderer/src/hooks/useIpcEvents-agent-status-pane-teardown.test.ts
|
||||
1 test-no-in-test-import-actual:src/renderer/src/hooks/useIpcEvents-agent-status-snapshot-hydration.test.ts
|
||||
1 test-no-in-test-import-actual:src/renderer/src/hooks/useIpcEvents-rate-limit-hydration.test.ts
|
||||
1 test-no-in-test-import-actual:src/renderer/src/lib/agent-session/launch/new-tab/agent-launch-caller-routing.test.ts
|
||||
1 test-no-polling-loop:src/main/browser/cookies/browser-cookie-import-concurrency.test.ts
|
||||
1 test-no-polling-loop:src/main/claude/claude-stop-ack-race.test.ts
|
||||
1 test-no-polling-loop:src/main/claude/claude-stream-json-connection.test.ts
|
||||
@@ -41,7 +36,6 @@
|
||||
1 test-no-polling-loop:src/main/claude/structured/claude-structured-real-cli-stop-task.test.ts
|
||||
5 test-no-polling-loop:src/main/claude/structured/claude-structured-real-cli.test.ts
|
||||
1 test-no-polling-loop:src/main/claude/structured/launch/claude-structured-real-cli-options.test.ts
|
||||
3 test-no-polling-loop:src/main/cli/packaged-cli-assets.test.ts
|
||||
1 test-no-polling-loop:src/main/codex/hooks/reconciliation/codex-hook-toggle-off-wins.test.ts
|
||||
1 test-no-polling-loop:src/main/codex/structured/launch/codex-structured-real-cli-command-env.test.ts
|
||||
1 test-no-polling-loop:src/main/daemon/providers/adapter/testing/daemon-self-retirement-respawn.test.ts
|
||||
@@ -96,7 +90,6 @@
|
||||
1 test-no-polling-loop:tests/e2e/fixtures/daemon-generation-reconnect-client.ts
|
||||
2 test-no-polling-loop:tests/e2e/floating-workspace-reopen-webgl-recovery.spec.ts
|
||||
1 test-no-polling-loop:tests/e2e/floating-workspace-shared-glyph-atlas.spec.ts
|
||||
1 test-no-polling-loop:tests/e2e/golden-core-flows.spec.ts
|
||||
1 test-no-polling-loop:tests/e2e/helpers/computer-cli-driver.ts
|
||||
2 test-no-polling-loop:tests/e2e/helpers/computer-driver.ts
|
||||
1 test-no-polling-loop:tests/e2e/helpers/daemon-generation-processes.ts
|
||||
@@ -153,7 +146,6 @@
|
||||
1 test-no-real-time-wait:src/main/antigravity/windows-hook-payload-delivery.test.ts
|
||||
1 test-no-real-time-wait:src/main/browser/cdp/input/guest-focused-frame-route.test.ts
|
||||
3 test-no-real-time-wait:src/main/browser/cookies/browser-cookie-import-concurrency.test.ts
|
||||
2 test-no-real-time-wait:src/main/browser/guest-lifecycle/popups/compatibility/browser-popup-compatibility.electron.test.ts
|
||||
1 test-no-real-time-wait:src/main/browser/guest-lifecycle/popups/compatibility/browser-popup-native-compatibility.electron.test.ts
|
||||
1 test-no-real-time-wait:src/main/browser/identity/wire-probes/browser-session-ua-wire-identity-cross-context.electron.test.ts
|
||||
1 test-no-real-time-wait:src/main/browser/identity/wire-probes/browser-session-ua-wire-identity.electron.test.ts
|
||||
@@ -174,14 +166,11 @@
|
||||
2 test-no-real-time-wait:src/main/claude/structured/claude-structured-real-cli-stop-task.test.ts
|
||||
5 test-no-real-time-wait:src/main/claude/structured/claude-structured-real-cli.test.ts
|
||||
1 test-no-real-time-wait:src/main/claude/structured/launch/claude-structured-real-cli-options.test.ts
|
||||
3 test-no-real-time-wait:src/main/cli/packaged-cli-assets.test.ts
|
||||
3 test-no-real-time-wait:src/main/codex/hooks/installation/hook-service-concurrent-launch-install.test.ts
|
||||
1 test-no-real-time-wait:src/main/codex/hooks/reconciliation/codex-hook-reconcile.test.ts
|
||||
1 test-no-real-time-wait:src/main/codex/hooks/reconciliation/codex-hook-toggle-off-wins.test.ts
|
||||
1 test-no-real-time-wait:src/main/codex/structured/launch/codex-structured-real-cli-command-env.test.ts
|
||||
1 test-no-real-time-wait:src/main/codex/structured/turns/codex-structured-turn-open-wait.test.ts
|
||||
1 test-no-real-time-wait:src/main/codex/trust/hooks/codex-hook-hash-lookup.test.ts
|
||||
1 test-no-real-time-wait:src/main/computer/macos-computer-use-permission-status.test.ts
|
||||
1 test-no-real-time-wait:src/main/daemon/executable-host/windows/testing/daemon-host-file-hash-cache.test.ts
|
||||
4 test-no-real-time-wait:src/main/daemon/providers/adapter/testing/daemon-pty-adapter-history-checkpoints.test.ts
|
||||
2 test-no-real-time-wait:src/main/daemon/providers/adapter/testing/daemon-pty-adapter-history-recovery.test.ts
|
||||
@@ -203,10 +192,8 @@
|
||||
3 test-no-real-time-wait:src/main/daemon/transport/client/testing/client.test.ts
|
||||
1 test-no-real-time-wait:src/main/git/refs/maintenance/local-repo-ref-maintenance.test.ts
|
||||
4 test-no-real-time-wait:src/main/git/refs/maintenance/repo-ref-maintenance-real-git.test.ts
|
||||
1 test-no-real-time-wait:src/main/git/worktrees/creation/worktree-configured-paths-concurrency.test.ts
|
||||
1 test-no-real-time-wait:src/main/git/worktrees/removal/remove-worktree-branch-cleanup.test.ts
|
||||
1 test-no-real-time-wait:src/main/git/worktrees/removal/worktree-prune-guard.test.ts
|
||||
1 test-no-real-time-wait:src/main/gitlab/work-item-details.test.ts
|
||||
1 test-no-real-time-wait:src/main/grok/grok-hook-stdin-no-eof.test.ts
|
||||
1 test-no-real-time-wait:src/main/ipc/filesystem/watcher-process/parcel-watcher-shallow-file-subscription.test.ts
|
||||
1 test-no-real-time-wait:src/main/ipc/filesystem/watcher-process/rebinding-file-watch-noise.test.ts
|
||||
@@ -257,23 +244,19 @@
|
||||
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
|
||||
1 test-no-real-time-wait:src/main/worker-thread-child-process/worker-thread-child-process.test.ts
|
||||
1 test-no-real-time-wait:src/main/workspaces/creation/preparation/worktree-create-preparation-cancellation.test.ts
|
||||
1 test-no-real-time-wait:src/main/workspaces/removal/local-worktree-removal-recovery-live.test.ts
|
||||
2 test-no-real-time-wait:src/main/wsl/execution/wsl-command-loop.test.ts
|
||||
2 test-no-real-time-wait:src/main/wsl/orcad/wsl-orcad-real-distro-lane.test.ts
|
||||
4 test-no-real-time-wait:src/renderer/src/components/activity/activity-auto-mark-read-loop.react185.test.tsx
|
||||
1 test-no-real-time-wait:src/renderer/src/components/editor/DiagramViewerModal.test.tsx
|
||||
1 test-no-real-time-wait:src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-stale-analysis-work-budget.test.tsx
|
||||
4 test-no-real-time-wait:src/renderer/src/components/native-chat/drafts/native-chat-composer-draft-store.test.ts
|
||||
1 test-no-real-time-wait:src/renderer/src/components/terminal-pane/layout/split/resolve-split-cwd.test.ts
|
||||
2 test-no-real-time-wait:src/renderer/src/components/terminal-pane/pty-connection/emulation/fish-color-scheme-child-stdin.node-pty.test.ts
|
||||
1 test-no-real-time-wait:src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-connect-failure-recovery.test.ts
|
||||
2 test-no-real-time-wait:src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-host-exit-record.test.ts
|
||||
3 test-no-real-time-wait:src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-subscribe-ack-input.test.ts
|
||||
1 test-no-real-time-wait:src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-subscribe-ack-input.test.ts
|
||||
1 test-no-real-time-wait:src/renderer/src/components/terminal-pane/viewport/terminal-fit-restore.test.ts
|
||||
1 test-no-real-time-wait:src/renderer/src/hooks/runtime-project-refresh-scheduler.test.ts
|
||||
1 test-no-real-time-wait:src/renderer/src/lib/agent-session/resume/cli-fork/native-chat-cli-fork-preparation.test.ts
|
||||
1 test-no-real-time-wait:src/renderer/src/lib/orca-yaml-trust-prompt-slot-eviction.test.ts
|
||||
2 test-no-real-time-wait:src/renderer/src/store/slices/workspace-cleanup/workspace-cleanup-removal-preflight.test.ts
|
||||
2 test-no-real-time-wait:src/shared/__tests__/process-host/windows-tree-kill-late-taskkill.win32.test.ts
|
||||
1 test-no-real-time-wait:src/shared/darwin-process-table-capture.test.ts
|
||||
@@ -298,7 +281,6 @@
|
||||
1 test-no-real-time-wait:tests/e2e/codex-ctrl-c-status.spec.ts
|
||||
4 test-no-real-time-wait:tests/e2e/combined-diff-scroll-restore.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/computer-windows.e2e.ts
|
||||
1 test-no-real-time-wait:tests/e2e/cross-version-wire/cross-version-agent-session-wire.unit.test.ts
|
||||
3 test-no-real-time-wait:tests/e2e/cross-version-wire/host-model-catalog-released-phone.unit.test.ts
|
||||
1 test-no-real-time-wait:tests/e2e/cross-version-wire/legacy-relay-bridge.unit.test.ts
|
||||
1 test-no-real-time-wait:tests/e2e/cross-version-wire/released-relay-daemon.ts
|
||||
@@ -315,7 +297,6 @@
|
||||
4 test-no-real-time-wait:tests/e2e/floating-workspace-reopen-webgl-recovery.spec.ts
|
||||
4 test-no-real-time-wait:tests/e2e/floating-workspace-shared-glyph-atlas.spec.ts
|
||||
2 test-no-real-time-wait:tests/e2e/github-project-board.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/golden-core-flows.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/headless-paired-remote-terminal-reveal-grid.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/headless-paired-remote-terminal-viewer-size.spec.ts
|
||||
2 test-no-real-time-wait:tests/e2e/helpers/computer-cli-driver.ts
|
||||
@@ -384,10 +365,8 @@
|
||||
2 test-no-real-time-wait:tests/e2e/sidebar-sort-stamps.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/sidebar-unread-older-paired-host.spec.ts
|
||||
2 test-no-real-time-wait:tests/e2e/slept-workspace-remount-wake.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/sparse-preset-proof.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/ssh-orcad-explorer-selected-host.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/ssh-orcad-idle-exit.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/ssh-orcad-legacy-relay-bridge.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/ssh-orcad-pairing-repair.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/ssh-orcad-relay-tab-only-shell.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/ssh-orcad-sleep-disconnected.spec.ts
|
||||
@@ -455,20 +434,16 @@
|
||||
5 test-no-wall-clock:src/cli/runtime/serve-pid1-init-reaper.test.ts
|
||||
1 test-no-wall-clock:src/cli/runtime/status-caller.test.ts
|
||||
2 test-no-wall-clock:src/main/agent-hooks/installation/scripts/managed-hook-timeout.test.ts
|
||||
2 test-no-wall-clock:src/main/agent-hooks/installation/scripts/posix-hook-json-stdin-reader.test.ts
|
||||
1 test-no-wall-clock:src/main/agent-hooks/server/testing/http/server-endpoint-file-lifecycle.test.ts
|
||||
3 test-no-wall-clock:src/main/agent-hooks/server/testing/structured-ingress/server-ingest-structured-status.test.ts
|
||||
4 test-no-wall-clock:src/main/agent-hooks/server/testing/identity/server-launch-resume-identity.test.ts
|
||||
5 test-no-wall-clock:src/main/agent-hooks/server/testing/replay/spool.test.ts
|
||||
2 test-no-wall-clock:src/main/agent-hooks/installation/commands/windows-native-hook-exe-hosts.test.ts
|
||||
2 test-no-wall-clock:src/main/ai-vault-search/session-search-indexer.test.ts
|
||||
1 test-no-wall-clock:src/main/ai-vault/parse-cache/session-parse-cache-preview-upgrade.test.ts
|
||||
1 test-no-wall-clock:src/main/ai-vault/scanners/copilot/session-scanner-copilot-cache-upgrade.test.ts
|
||||
2 test-no-wall-clock:src/main/ai-vault/scanners/copilot/session-scanner-copilot-parser.test.ts
|
||||
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
|
||||
3 test-no-wall-clock:src/main/ai-vault/scanners/jcode/session-scanner-jcode-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
|
||||
@@ -485,11 +460,8 @@
|
||||
3 test-no-wall-clock:src/main/claude/structured/claude-structured-real-cli-stop-task.test.ts
|
||||
10 test-no-wall-clock:src/main/claude/structured/claude-structured-real-cli.test.ts
|
||||
3 test-no-wall-clock:src/main/claude/structured/launch/claude-structured-real-cli-options.test.ts
|
||||
1 test-no-wall-clock:src/main/cli/appimage-generation-lease.test.ts
|
||||
6 test-no-wall-clock:src/main/cli/packaged-cli-assets.test.ts
|
||||
1 test-no-wall-clock:src/main/codex-accounts/legacy-wsl-runtime-auth-drain-rollback-script.test.ts
|
||||
6 test-no-wall-clock:src/main/codex/app-server/codex-app-server-client.test.ts
|
||||
1 test-no-wall-clock:src/main/codex/structured/catalog/codex-usage-limits.test.ts
|
||||
2 test-no-wall-clock:src/main/codex/structured/launch/codex-structured-real-cli-command-env.test.ts
|
||||
2 test-no-wall-clock:src/main/codex/trust/hooks/codex-hook-trust-derivation.test.ts
|
||||
1 test-no-wall-clock:src/main/daemon/admission/testing/terminal-spawn-gate-legacy-restores.test.ts
|
||||
@@ -515,7 +487,6 @@
|
||||
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
|
||||
1 test-no-wall-clock:src/main/github/pr-refresh-coordinator-error-cadence.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
|
||||
@@ -532,22 +503,17 @@
|
||||
3 test-no-wall-clock:src/main/managed-server/install/remote-node-runtime-store-gc.test.ts
|
||||
1 test-no-wall-clock:src/main/native-chat/agent-session-attachments/agent-session-attachment-sweep.test.ts
|
||||
1 test-no-wall-clock:src/main/observability/bundle.test.ts
|
||||
1 test-no-wall-clock:src/main/opencode/opencode-launch-model-context-supervision.test.ts
|
||||
1 test-no-wall-clock:src/main/opencode/overlay-dir-gc.test.ts
|
||||
2 test-no-wall-clock:src/main/orca-profiles/profile-cloud-service-connect-overlap.test.ts
|
||||
2 test-no-wall-clock:src/main/orca-profiles/profile-cloud-service-sign-out-connect-race.test.ts
|
||||
1 test-no-wall-clock:src/main/opencode/status-hooks/overlay-dir-gc.test.ts
|
||||
2 test-no-wall-clock:src/main/orca-profiles/cloud-auth/profile-cloud-service-connect-overlap.test.ts
|
||||
2 test-no-wall-clock:src/main/orca-profiles/cloud-auth/profile-cloud-service-sign-out-connect-race.test.ts
|
||||
2 test-no-wall-clock:src/main/orcad/orcad-artifact-cache-retention.test.ts
|
||||
1 test-no-wall-clock:src/main/orcad/orcad-artifact-materializer.test.ts
|
||||
6 test-no-wall-clock:src/main/orcad/orcad-serve-parity.integration.test.ts
|
||||
1 test-no-wall-clock:src/main/orcad/orcad-stale-lock-reclaim.test.ts
|
||||
3 test-no-wall-clock:src/main/orcad/orcad-stop-request-shutdown.integration.test.ts
|
||||
1 test-no-wall-clock:src/main/persistence/closed-terminal-tab-write-fence.test.ts
|
||||
1 test-no-wall-clock:src/main/persistence/loading-store/profile-state-temp-cleanup-lifetime.test.ts
|
||||
1 test-no-wall-clock:src/main/persistence/loading-store/pty-spawn-restore-durability.test.ts
|
||||
1 test-no-wall-clock:src/main/persistence/profile-state/profile-state-backup-rotation.test.ts
|
||||
2 test-no-wall-clock:src/main/persistence/profile-state/profile-state-backup-temporary-files.test.ts
|
||||
1 test-no-wall-clock:src/main/persistence/profile-state/profile-state-pre-migration-backup.test.ts
|
||||
1 test-no-wall-clock:src/main/persistence/profile-state/profile-state-section-repair.test.ts
|
||||
1 test-no-wall-clock:src/main/persistence/profile-state/backup/profile-state-backup-rotation.test.ts
|
||||
1 test-no-wall-clock:src/main/persistence/profile-state/recovery/profile-state-section-repair.test.ts
|
||||
2 test-no-wall-clock:src/main/persistence/tracking-repos/persistence-deregistered-repo-residue.test.ts
|
||||
1 test-no-wall-clock:src/main/persistence/tracking-repos/worktree-metadata-normalization.test.ts
|
||||
2 test-no-wall-clock:src/main/provider-process/provider-group-orphan-guard.integration.test.ts
|
||||
@@ -566,7 +532,6 @@
|
||||
2 test-no-wall-clock:src/main/runtime/agent-session/structured-agent-session-held-signal.test.ts
|
||||
1 test-no-wall-clock:src/main/runtime/agent-session/structured-child-records-switch.test.ts
|
||||
1 test-no-wall-clock:src/main/runtime/mobile-cloud-relay/mobile-relay-e2ee.integration.test.ts
|
||||
1 test-no-wall-clock:src/main/runtime/mobile-cloud-relay/relay-http-client.test.ts
|
||||
2 test-no-wall-clock:src/main/runtime/orchestration/mailbox/terminal-pointer/orchestration-codex-real-pty.integration.test.ts
|
||||
2 test-no-wall-clock:src/main/runtime/orchestration/workers/archives/worker-output-archive.test.ts
|
||||
3 test-no-wall-clock:src/main/runtime/orchestration/workers/archives/worker-terminal-archive-release.test.ts
|
||||
@@ -622,7 +587,6 @@
|
||||
3 test-no-wall-clock:src/main/windows/windows-msys-job.win32.test.ts
|
||||
1 test-no-wall-clock:src/main/windows/windows-process-table-native-addon.win32.test.ts
|
||||
2 test-no-wall-clock:src/main/windows/windows-pty-job.win32.test.ts
|
||||
2 test-no-wall-clock:src/main/workspace-hooks/hook-archive-timeout-observation.test.ts
|
||||
2 test-no-wall-clock:src/main/workspaces/removal/local-worktree-removal-recovery-live.test.ts
|
||||
1 test-no-wall-clock:src/main/workspaces/removal/worktree-removal-close-records.test.ts
|
||||
2 test-no-wall-clock:src/main/wsl/execution/wsl-runner.wsl.test.ts
|
||||
@@ -630,36 +594,20 @@
|
||||
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
|
||||
2 test-no-wall-clock:src/renderer/src/components/dashboard/useLiveDashboardSnapshot.test.ts
|
||||
1 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.opening-send.test.tsx
|
||||
1 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.queued-turn-order.test.tsx
|
||||
2 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/turns/NativeChatMessageList.turn-indicator.test.tsx
|
||||
3 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/turns/NativeChatResolvedView.turn-status.test.tsx
|
||||
1 test-no-wall-clock:src/renderer/src/components/native-chat/session/structured/delivery/NativeChatMessageList.unsent-message.test.tsx
|
||||
3 test-no-wall-clock:src/renderer/src/components/native-chat/surfaces/integration/NativeChatMessageList.test.tsx
|
||||
2 test-no-wall-clock:src/renderer/src/components/native-chat/tools/tasks/NativeChatStructuredSessionStatus.test.tsx
|
||||
3 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/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
|
||||
2 test-no-wall-clock:src/renderer/src/components/task-page/jira/task-page-jira-cache-selectors.test.ts
|
||||
2 test-no-wall-clock:src/renderer/src/components/terminal-pane/pty-connection/emulation/fish-color-scheme-child-stdin.node-pty.test.ts
|
||||
2 test-no-wall-clock:src/renderer/src/components/terminal-pane/snapshots/remote-snapshot-alt-screen-host-chain.test.ts
|
||||
1 test-no-wall-clock:src/renderer/src/components/terminal/initial-terminal-structured-launch.test.tsx
|
||||
2 test-no-wall-clock:src/renderer/src/components/workspace-cleanup/use-workspace-cleanup-removal.agent-stop.test.tsx
|
||||
1 test-no-wall-clock:src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.behavior.test.tsx
|
||||
4 test-no-wall-clock:src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.test.tsx
|
||||
2 test-no-wall-clock:src/renderer/src/hooks/ipc-events/agent-status-terminal-title-tab-write.test.ts
|
||||
1 test-no-wall-clock:src/renderer/src/hooks/useIpcEvents-agent-status-hook-titles.test.ts
|
||||
1 test-no-wall-clock:src/renderer/src/lib/paired-runtime-closed-tab-resume.test.ts
|
||||
2 test-no-wall-clock:src/renderer/src/lib/use-tab-agent-observed-signal-dispatch.test.tsx
|
||||
2 test-no-wall-clock:src/renderer/src/lib/wake-sleeping-agents-live-unmounted-pane.test.ts
|
||||
1 test-no-wall-clock:src/renderer/src/lib/workspace/ownership/workspace-terminal-host-authority.test.ts
|
||||
1 test-no-wall-clock:src/renderer/src/lib/workspace/activation/worktree-activation-emptied-workspace-reseed.test.ts
|
||||
2 test-no-wall-clock:src/renderer/src/runtime/native-chat/tab-retirement/structured-agent-session-tab-retirement.test.ts
|
||||
2 test-no-wall-clock:src/renderer/src/store/github/pull-requests/github-pr-branch-linked-pr-divergence.test.ts
|
||||
6 test-no-wall-clock:src/renderer/src/store/slices/jira/jira.test.ts
|
||||
5 test-no-wall-clock:src/renderer/src/store/slices/worktrees/metadata/worktree-meta-hosted-review.test.ts
|
||||
1 test-no-wall-clock:src/renderer/src/store/slices/worktrees/session/worktrees-terminal-reference-origins.test.ts
|
||||
1 test-no-wall-clock:src/renderer/src/store/terminals/store-sleep-exact-runtime-stop.test.ts
|
||||
1 test-no-wall-clock:src/shared/__tests__/process-host/windows-cmd-shim-resolution.test.ts
|
||||
7 test-no-wall-clock:src/shared/__tests__/process-host/windows-tree-kill-late-taskkill.win32.test.ts
|
||||
1 test-no-wall-clock:src/shared/agent-hook-listener/transport/agent-hook-spool-drain.test.ts
|
||||
@@ -677,18 +625,13 @@
|
||||
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
|
||||
2 test-no-wall-clock:tests/e2e/omp-child-session-recovery.unit.test.ts
|
||||
1 test-no-wall-clock:tests/e2e/structured-session-tab-close-regressions.unit.test.ts
|
||||
2 test-timeout-needs-reason:mobile/src/terminal/document/native-document-bundle.test.ts
|
||||
1 test-timeout-needs-reason:mobile/src/test-support/rpc-recording/family-recordings.test.ts
|
||||
1 test-timeout-needs-reason:mobile/src/test-support/rpc-recording/mutants/family-mutants.test.ts
|
||||
1 test-timeout-needs-reason:src/cli/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
|
||||
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
|
||||
1 test-timeout-needs-reason:src/main/ai-vault/parse-cache/session-parse-cache-large-scan.test.ts
|
||||
1 test-timeout-needs-reason:src/main/antigravity/native-macos-credentials.real.test.ts
|
||||
1 test-timeout-needs-reason:src/main/antigravity/posix-hook-invocation.test.ts
|
||||
2 test-timeout-needs-reason:src/main/antigravity/windows-hook-json-post.test.ts
|
||||
@@ -745,7 +688,6 @@
|
||||
1 test-timeout-needs-reason:src/main/orcad/orcad-stop-request-shutdown.integration.test.ts
|
||||
1 test-timeout-needs-reason:src/main/orcad/orcad-windows-conpty-breakaway.integration.test.ts
|
||||
1 test-timeout-needs-reason:src/main/persistence/applying-settings/persistence-source-control-ai-migration.test.ts
|
||||
1 test-timeout-needs-reason:src/main/persistence/profile-state/profile-state-writer-stall.electron.test.ts
|
||||
1 test-timeout-needs-reason:src/main/plugins/workers/plugin-worker-supervision.integration.test.ts
|
||||
2 test-timeout-needs-reason:src/main/providers/agent-foreground-process-git-bash.win32.test.ts
|
||||
1 test-timeout-needs-reason:src/main/providers/local-pty/local-pty-child-process-verdict.test.ts
|
||||
@@ -773,7 +715,7 @@
|
||||
1 test-timeout-needs-reason:src/main/windows/windows-msys-job.win32.test.ts
|
||||
2 test-timeout-needs-reason:src/main/windows/windows-pty-job.win32.test.ts
|
||||
5 test-timeout-needs-reason:src/main/worker-thread-child-process/worker-thread-child-process.test.ts
|
||||
2 test-timeout-needs-reason:src/main/workspace-hooks/hook-archive-timeout-observation.test.ts
|
||||
1 test-timeout-needs-reason:src/main/workspace-hooks/hook-archive-timeout-observation.test.ts
|
||||
2 test-timeout-needs-reason:src/main/workspace-hooks/hook-termination-real-process.test.ts
|
||||
2 test-timeout-needs-reason:src/main/workspaces/removal/local-worktree-filesystem-wsl-banner.wsl.test.ts
|
||||
4 test-timeout-needs-reason:src/main/wsl/execution/wsl-runner.wsl.test.ts
|
||||
@@ -822,7 +764,7 @@
|
||||
1 test-timeout-needs-reason:tests/e2e/headless-serve-chat-tab-placement.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/headless-serve-cli-terminal-retention-parity.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/headless-serve-mobile-markdown.spec.ts
|
||||
3 test-timeout-needs-reason:tests/e2e/headless-serve-mobile-native-chat-identity.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/headless-serve-mobile-native-chat-identity.spec.ts
|
||||
4 test-timeout-needs-reason:tests/e2e/helpers/electron-process-shutdown.unit.test.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/host-parked-pane-remote-viewer.spec.ts
|
||||
2 test-timeout-needs-reason:tests/e2e/host-terminal-agent-phone-push.spec.ts
|
||||
@@ -871,7 +813,6 @@
|
||||
2 test-timeout-needs-reason:tests/e2e/paired-host-usage-credentials.spec.ts
|
||||
7 test-timeout-needs-reason:tests/e2e/paired-instant-browser-tab.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/paired-mobile-desktop-mirror-files-git-review.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/paired-mobile-desktop-mirror-server-browser.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/paired-mobile-desktop-mirror-workspace-visibility.spec.ts
|
||||
2 test-timeout-needs-reason:tests/e2e/paired-mobile-desktop-mirror.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/paired-mobile-desktop-tab-composition.spec.ts
|
||||
@@ -900,7 +841,7 @@
|
||||
1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-probe-gap-recovery.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-reconnect-idle-frame.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-retention-memory.spec.ts
|
||||
2 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-serve-restart-binding.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-serve-restart-binding.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-stall-recovery.spec.ts
|
||||
2 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-truncated-tail-first-paint.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-wide-viewport.spec.ts
|
||||
@@ -913,7 +854,7 @@
|
||||
1 test-timeout-needs-reason:tests/e2e/paired-two-client-emptied-workspace-reseed.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/paired-usage-owner-placeholders.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/paired-worktree-activation-isolation.spec.ts
|
||||
5 test-timeout-needs-reason:tests/e2e/persisted-session-production-upgrade.spec.ts
|
||||
3 test-timeout-needs-reason:tests/e2e/persisted-session-production-upgrade.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/pr11346-selected-runtime-add.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/profile-state-automatic-backup-recovery.spec.ts
|
||||
3 test-timeout-needs-reason:tests/e2e/relay-region-correction.unit.test.ts
|
||||
@@ -935,7 +876,6 @@
|
||||
2 test-timeout-needs-reason:tests/e2e/sidebar-unread-older-paired-host.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/sidebar-workspace-rows.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/source-control-large-file-count.spec.ts
|
||||
5 test-timeout-needs-reason:tests/e2e/ssh-orcad-auto-convert.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/ssh-orcad-browser-drop-owner.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/ssh-orcad-browser-routing.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/ssh-orcad-browser-service-status.spec.ts
|
||||
@@ -946,7 +886,7 @@
|
||||
1 test-timeout-needs-reason:tests/e2e/ssh-orcad-explorer-selected-host.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/ssh-orcad-explorer-watch-recovery.spec.ts
|
||||
4 test-timeout-needs-reason:tests/e2e/ssh-orcad-idle-exit.spec.ts
|
||||
3 test-timeout-needs-reason:tests/e2e/ssh-orcad-legacy-relay-bridge.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/ssh-orcad-legacy-relay-bridge.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/ssh-orcad-markdown-conversion.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/ssh-orcad-markdown-link-refresh.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/ssh-orcad-markdown-live-documents.spec.ts
|
||||
@@ -965,7 +905,7 @@
|
||||
1 test-timeout-needs-reason:tests/e2e/ssh-orcad-terminal-root-owner.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/ssh-orcad-unbindable-tunnel-port.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/ssh-orcad-update-anyway.spec.ts
|
||||
2 test-timeout-needs-reason:tests/e2e/ssh-orcad-windows-cli-matrix.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/ssh-orcad-windows-cli-matrix.spec.ts
|
||||
4 test-timeout-needs-reason:tests/e2e/ssh-orcad-workspace-tools.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/staging-skill-sharing.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/structured-chat-tabs-open-close.spec.ts
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
3 src/renderer/src/components/LinearIssueTextEditor.tsx
|
||||
3 src/renderer/src/components/LinearIssueWorkspace.tsx
|
||||
5 src/renderer/src/components/LinearItemDrawer.tsx
|
||||
1 src/renderer/src/components/NativeChatResumeOnRestartGroups.tsx
|
||||
1 src/renderer/src/components/native-chat-recovery/tree/NativeChatResumeOnRestartGroups.tsx
|
||||
1 src/renderer/src/components/activity/ActivityPrototypePage.tsx
|
||||
1 src/renderer/src/components/activity/activity-scope-filter-controls.tsx
|
||||
2 src/renderer/src/components/activity/activity-thread-actions.ts
|
||||
1 src/renderer/src/components/activity/use-agent-pane-thread-store-data.ts
|
||||
1 src/renderer/src/components/activity/use-agent-pane-threads.ts
|
||||
4 src/renderer/src/components/agent/AgentSettingsDialog.tsx
|
||||
1 src/renderer/src/components/automations/automation-host-client.ts
|
||||
1 src/renderer/src/components/automations/hosts/automation-host-client.ts
|
||||
1 src/renderer/src/components/automations/automations-page-fixtures.ts
|
||||
1 src/renderer/src/components/automations/use-automations-page-controller.ts
|
||||
1 src/renderer/src/components/automations/use-automations-page-destination-form.ts
|
||||
1 src/renderer/src/components/automations/authoring/use-automations-page-destination-form.ts
|
||||
1 src/renderer/src/components/browser-pane/ReopenBrowserPageOnServerButton.tsx
|
||||
1 src/renderer/src/components/browser-pane/browser-reopen-on-server.ts
|
||||
1 src/renderer/src/components/browser-pane/stream-remote/use-remote-browser-page-stream.ts
|
||||
@@ -204,11 +204,11 @@
|
||||
1 src/renderer/src/hooks/ipc-events/runtime-environment-subscription-selection.ts
|
||||
1 src/renderer/src/hooks/ipc-events/settings-sidebar-ipc-bridge.ts
|
||||
1 src/renderer/src/hooks/ipc-events/terminal-request-ipc-bridge.ts
|
||||
1 src/renderer/src/hooks/use-active-skill-discovery-runtime-target.ts
|
||||
1 src/renderer/src/hooks/skills/discovery/use-active-skill-discovery-runtime-target.ts
|
||||
2 src/renderer/src/hooks/use-integration-provider-status-refresh.ts
|
||||
1 src/renderer/src/hooks/useActiveProjectSkillRuntime.ts
|
||||
1 src/renderer/src/hooks/skills/runtime/useActiveProjectSkillRuntime.ts
|
||||
1 src/renderer/src/hooks/useEditorExternalWatch.ts
|
||||
1 src/renderer/src/hooks/useInstalledAgentSkills.ts
|
||||
1 src/renderer/src/hooks/skills/discovery/useInstalledAgentSkills.ts
|
||||
1 src/renderer/src/hooks/useIpcEvents.ts
|
||||
4 src/renderer/src/hooks/useIssueMetadata.ts
|
||||
2 src/renderer/src/hooks/useLinearIssuePublication.ts
|
||||
@@ -220,21 +220,21 @@
|
||||
1 src/renderer/src/lib/browser/navigation/http-link-localhost-route.ts # extracted from http-link-routing.ts
|
||||
1 src/renderer/src/lib/browser/navigation/http-link-routing.ts
|
||||
2 src/renderer/src/lib/browser/workspace/workspace-browser-tab-open.ts
|
||||
1 src/renderer/src/lib/client-creation-action-error.ts
|
||||
2 src/renderer/src/lib/client-creation-action-policy.ts
|
||||
1 src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-error.ts
|
||||
2 src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-policy.ts
|
||||
1 src/renderer/src/runtime/hosts/selection/default-creation-host.ts # the sanctioned reader of the default host
|
||||
1 src/renderer/src/lib/launch-ai-vault-session.ts
|
||||
1 src/renderer/src/lib/local-preflight-context.ts
|
||||
1 src/renderer/src/lib/agent-session/resume/history/launch-ai-vault-session.ts
|
||||
1 src/renderer/src/runtime/hosts/preflight/local-preflight-context.ts
|
||||
2 src/renderer/src/runtime/hosts/observations/provider-runtime-context.ts
|
||||
2 src/renderer/src/lib/workspace/ownership/repo-runtime-owner.ts
|
||||
1 src/renderer/src/lib/workspace/ownership/runtime-session-mirror-owners.ts
|
||||
1 src/renderer/src/lib/runtime-session-mirror-targets.ts
|
||||
1 src/renderer/src/runtime/web-session-tabs-sync/subscriptions/runtime-session-mirror-targets.ts
|
||||
1 src/renderer/src/lib/workspace/ownership/single-runtime-legacy-owner.ts
|
||||
1 src/renderer/src/lib/skill-runtime-command.ts
|
||||
1 src/renderer/src/lib/terminal-close-route.ts
|
||||
4 src/renderer/src/lib/terminal-worktree-route.ts # resolveTerminalPtyOwner: teardown, close and PTY identity read spawn's attribution (round 3 F8), which retired the deprecated resolver's readers
|
||||
3 src/renderer/src/lib/unread-badge-count-selector.ts
|
||||
1 src/renderer/src/lib/web-runtime-worktree-terminal-after-wake.ts
|
||||
1 src/renderer/src/lib/skills/runtime/skill-runtime-command.ts
|
||||
1 src/renderer/src/lib/workspace/ownership/terminal-close-route.ts
|
||||
4 src/renderer/src/lib/workspace/ownership/terminal-worktree-route.ts # resolveTerminalPtyOwner: teardown, close and PTY identity read spawn's attribution (round 3 F8), which retired the deprecated resolver's readers
|
||||
3 src/renderer/src/attention/unread/unread-badge-count-selector.ts
|
||||
1 src/renderer/src/runtime/hosted-terminals/restoration/web-runtime-worktree-terminal-after-wake.ts
|
||||
1 src/renderer/src/lib/work-items/linear/linear-issue-url-lookup.ts
|
||||
1 src/renderer/src/lib/work-items/linear/linear-issue-write.ts
|
||||
1 src/renderer/src/lib/workspace/activation/worktree-activation.ts
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# JSX mapped straight over a host collection, per file, outside components/host-picker.
|
||||
# This is a RATCHET: counts may only go DOWN. Draw host lists with HostCombobox or
|
||||
# useBoundedHostRows. Prune after a fix: pnpm check:host-list-render-ratchet --prune
|
||||
1 src/renderer/src/components/automations/AutomationRunsDashboard.tsx
|
||||
1 src/renderer/src/components/automations/runs/AutomationRunsDashboard.tsx
|
||||
1 src/renderer/src/components/right-sidebar/ai-vault/panel/AiVaultPanelControls.tsx
|
||||
1 src/renderer/src/components/right-sidebar/source-control/ai/SourceControlAgentActionDialogForm.tsx
|
||||
1 src/renderer/src/components/settings/browser/profiles/BrowserSessionCookiesSection.tsx
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
# This is a RATCHET: entries may only be REMOVED. Take RepoHostTarget or HostWorktreeTarget,
|
||||
# or match the row by id AND host (getRepoExecutionHostId).
|
||||
# Prune after a fix: pnpm check:id-only-store-write-ratchet --prune
|
||||
lookup:src/main/persistence/loading-store/terminal-binding-recovery.ts#getConnectionIdForWorktree
|
||||
lookup:src/main/persistence/loading-store/terminal-bindings/terminal-binding-recovery.ts#getConnectionIdForWorktree
|
||||
lookup:src/main/persistence/tracking-repos/project-host-operations.ts#getRepo
|
||||
|
||||
+3
-3
@@ -41,11 +41,11 @@
|
||||
"src/main/plugins/testing/plugin-test-register.ts",
|
||||
"src/main/ai-vault/scan-service/session-scanner-service-entry.ts",
|
||||
"src/main/native-chat/wsl-transcript-fs-process-entry.ts",
|
||||
"src/main/usage/usage-scan-worker-entry.ts",
|
||||
"src/main/usage/scan-worker/usage-scan-worker-entry.ts",
|
||||
"src/main/workspaces/space-analysis/workspace-space-scan-worker-entry.ts",
|
||||
"src/main/claude-accounts/claude-profile-setup-worker-entry.ts",
|
||||
"src/main/persistence/profile-state/profile-state-backup-worker-entry.ts",
|
||||
"src/main/persistence/profile-state/profile-state-writer-worker-entry.ts",
|
||||
"src/main/persistence/profile-state/backup/profile-state-backup-worker-entry.ts",
|
||||
"src/main/persistence/profile-state/writer/profile-state-writer-worker-entry.ts",
|
||||
"src/main/orcad/orcad-local-serve-selection-entry.ts",
|
||||
"src/main/orcad/launcher.ts",
|
||||
"src/main/claude-accounts/claude-profile-wsl-entry.ts",
|
||||
|
||||
@@ -12,7 +12,6 @@ src/main/runtime/orchestration/terminal-authority/verify-orchestration-compatibi
|
||||
src/main/runtime/orchestration/terminal-authority/orchestration-compatibility-authority.ts
|
||||
src/main/managed-server/migration/cutover/orcad-migration-delta-move.test.ts
|
||||
src/main/managed-server/migration/cutover/orcad-migration-delta-move.ts
|
||||
src/main/managed-server/migration/linking/orcad-migration-repository-link.test.ts
|
||||
src/main/ssh/migration-source/orcad-migration-terminal-gate.test.ts
|
||||
src/main/ssh/migration-source/orcad-migration-terminal-gate.ts
|
||||
src/main/ssh/host-server/ssh-host-server-on-connect.ts
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# The relay retirement (2027-01-15) deletes the folder and edits exactly these files.
|
||||
# Prune: pnpm check:legacy-relay-fence-ratchet --prune
|
||||
src/main/ipc/runtime-environments/orcad-delta-move-handlers.ts
|
||||
src/main/ipc/pty/runtime/kill-legacy-relay-bridged.test.ts
|
||||
src/main/ipc/pty/runtime/kill.ts
|
||||
src/main/ipc/ssh/ssh-connect-decision-cancellation.test.ts
|
||||
src/main/ipc/ssh/ssh-connect-flow.ts
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
# Legacy synchronous sqlite uses per file; counts may only go DOWN.
|
||||
# Only explicit worker/utility entry files are exempt; their imports remain guarded.
|
||||
8 src/main/ai-vault-search/session-search-index-generation.ts
|
||||
6 src/main/ai-vault-search/session-search-index-writer.ts
|
||||
10 src/main/ai-vault-search/session-search-message-rows.ts
|
||||
3 src/main/ai-vault-search/session-search-query-schema.ts
|
||||
17 src/main/ai-vault-search/session-search-retention-delete.ts
|
||||
13 src/main/ai-vault-search/session-search-schema.ts
|
||||
2 src/main/ai-vault-search/session-search-snippet.ts
|
||||
2 src/main/ai-vault-search/session-search-source-presence.ts
|
||||
16 src/main/ai-vault-search/session-search-store.ts
|
||||
13 src/main/ai-vault-search/session-search-tool-purge.ts
|
||||
2 src/main/ai-vault-search/session-search-typo-repair.ts
|
||||
8 src/main/ai-vault-search/session-search-write-buffer.ts
|
||||
2 src/main/ai-vault-search/query/session-search-snippet.ts
|
||||
2 src/main/ai-vault-search/query/session-search-source-presence.ts
|
||||
2 src/main/ai-vault-search/query/session-search-typo-repair.ts
|
||||
8 src/main/ai-vault-search/storage/session-search-index-generation.ts
|
||||
6 src/main/ai-vault-search/storage/session-search-index-writer.ts
|
||||
10 src/main/ai-vault-search/storage/session-search-message-rows.ts
|
||||
3 src/main/ai-vault-search/storage/session-search-query-schema.ts
|
||||
17 src/main/ai-vault-search/storage/session-search-retention-delete.ts
|
||||
13 src/main/ai-vault-search/storage/session-search-schema.ts
|
||||
16 src/main/ai-vault-search/storage/session-search-store.ts
|
||||
13 src/main/ai-vault-search/storage/session-search-tool-purge.ts
|
||||
8 src/main/ai-vault-search/storage/session-search-write-buffer.ts
|
||||
19 src/main/ai-vault/parse-cache/session-parse-cache-database.ts
|
||||
13 src/main/ai-vault/parse-cache/session-scope-cwds-table.ts
|
||||
2 src/main/ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-capture.ts
|
||||
@@ -51,28 +51,28 @@
|
||||
10 src/main/native-chat/transcript-opencode2-sqlite.ts
|
||||
10 src/main/opencode-usage/opencode-usage-row-queries.ts
|
||||
1 src/main/opencode-usage/scanner.ts
|
||||
12 src/main/persistence/moving-wsl-projects/wsl-move-orchestration-history-rewrite.ts
|
||||
12 src/main/persistence/moving-wsl-projects/desktop-state/wsl-move-orchestration-history-rewrite.ts
|
||||
8 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs-migration.ts
|
||||
3 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs-reader.ts
|
||||
6 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs-storage.ts
|
||||
2 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs-validation.ts
|
||||
8 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs-writer.ts
|
||||
2 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs.ts
|
||||
3 src/main/persistence/profile-state/database/profile-state-database-snapshot.ts
|
||||
4 src/main/persistence/profile-state/database/profile-state-database-validation.ts
|
||||
6 src/main/persistence/profile-state/database/profile-state-database.ts
|
||||
3 src/main/persistence/profile-state/database/profile-state-read-snapshot.ts
|
||||
4 src/main/persistence/profile-state/database/profile-state-revision.ts
|
||||
3 src/main/persistence/profile-state/database/profile-state-write-transaction.ts
|
||||
2 src/main/persistence/profile-state/document-parts/profile-state-document-parts-reader.ts
|
||||
23 src/main/persistence/profile-state/document-parts/profile-state-document-parts-storage.ts
|
||||
3 src/main/persistence/profile-state/document-parts/profile-state-document-parts.ts
|
||||
4 src/main/persistence/profile-state/document-parts/profile-state-legacy-document-refresh.ts
|
||||
1 src/main/persistence/profile-state/documents/profile-state-document-reader.ts
|
||||
7 src/main/persistence/profile-state/documents/profile-state-documents.ts
|
||||
8 src/main/persistence/profile-state/documents/profile-state-domain-writes.ts
|
||||
4 src/main/persistence/profile-state/legacy-json/profile-state-json-acceptance.ts
|
||||
8 src/main/persistence/profile-state/profile-state-automation-runs-migration.ts
|
||||
3 src/main/persistence/profile-state/profile-state-automation-runs-reader.ts
|
||||
6 src/main/persistence/profile-state/profile-state-automation-runs-storage.ts
|
||||
2 src/main/persistence/profile-state/profile-state-automation-runs-validation.ts
|
||||
8 src/main/persistence/profile-state/profile-state-automation-runs-writer.ts
|
||||
2 src/main/persistence/profile-state/profile-state-automation-runs.ts
|
||||
3 src/main/persistence/profile-state/profile-state-database-snapshot.ts
|
||||
4 src/main/persistence/profile-state/profile-state-database-validation.ts
|
||||
6 src/main/persistence/profile-state/profile-state-database.ts
|
||||
2 src/main/persistence/profile-state/profile-state-document-parts-reader.ts
|
||||
23 src/main/persistence/profile-state/profile-state-document-parts-storage.ts
|
||||
3 src/main/persistence/profile-state/profile-state-document-parts.ts
|
||||
1 src/main/persistence/profile-state/profile-state-document-reader.ts
|
||||
7 src/main/persistence/profile-state/profile-state-documents.ts
|
||||
8 src/main/persistence/profile-state/profile-state-domain-writes.ts
|
||||
4 src/main/persistence/profile-state/profile-state-legacy-document-refresh.ts
|
||||
3 src/main/persistence/profile-state/profile-state-read-snapshot.ts
|
||||
4 src/main/persistence/profile-state/profile-state-revision.ts
|
||||
1 src/main/persistence/profile-state/profile-state-section-repair.ts
|
||||
3 src/main/persistence/profile-state/profile-state-write-transaction.ts
|
||||
1 src/main/persistence/profile-state/recovery/profile-state-section-repair.ts
|
||||
3 src/main/rate-limits/providers/opencode-go/opencode-go-api-key-source.ts
|
||||
2 src/main/runtime/agent-session/records/agent-session-record-lineage.ts
|
||||
34 src/main/runtime/agent-session/records/agent-session-record-rows.ts
|
||||
@@ -81,6 +81,7 @@
|
||||
9 src/main/runtime/orchestration/db/lifecycle-transition.ts
|
||||
7 src/main/runtime/orchestration/db/mutation-receipts/mutation-receipt-capacity.ts
|
||||
5 src/main/runtime/orchestration/db/orchestration-db.ts
|
||||
4 src/main/runtime/orchestration/db/peer-runs/peer-run-queue-sql.ts
|
||||
10 src/main/runtime/orchestration/db/reset/removed-orchestration-work-read.ts
|
||||
6 src/main/runtime/orchestration/db/reset/removed-orchestration-work-store.ts
|
||||
4 src/main/runtime/orchestration/db/runs/run-coordinator-mail-routing.ts
|
||||
@@ -89,6 +90,6 @@
|
||||
5 src/main/runtime/orchestration/db/worker-dispatch/worker-dispatch-settlement.ts
|
||||
4 src/main/runtime/orchestration/workers/lifecycle/context-only-dispatch-release.ts
|
||||
19 src/main/sqlite/row-cache/keyed-json-row-cache.ts
|
||||
2 src/main/sqlite/sync-database.ts
|
||||
5 src/main/sqlite/sync-database.ts
|
||||
8 src/main/sqlite/versioned-cache-database.ts
|
||||
12 src/main/wsl/filesystem/wsl-drive-unc-conversion-stores.ts
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
"src/main/claude/claude-conversation-fork-worker-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/speech/stt-worker.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/warp-themes/warp-theme-parser-worker.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/ai-vault-search/session-search-worker-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/ai-vault-search/worker/session-search-worker-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/foreign-sqlite-readers/foreign-sqlite-reader-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/ports/port-scan-command-worker-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/ipc/command-path/command-path-directory-worker-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/worker-thread-child-process/worker-thread-child-process-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/usage/usage-scan-worker-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/usage/scan-worker/usage-scan-worker-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/workspaces/space-analysis/workspace-space-scan-worker-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/claude-accounts/claude-profile-setup-worker-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/persistence/profile-state/profile-state-backup-worker-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/persistence/profile-state/profile-state-writer-worker-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/persistence/profile-state/backup/profile-state-backup-worker-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/persistence/profile-state/writer/profile-state-writer-worker-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/hang-watchdog/main-thread-hang-watchdog-entry.ts": "Dedicated worker-thread entry; blocking work stays off Electron main.",
|
||||
"src/main/browser/extensions/native-messaging/browser-extension-native-host-supervisor-entry.ts": "Dedicated utility/child-process entry; blocking work stays off Electron main.",
|
||||
"src/main/daemon/daemon-entry.ts": "Dedicated utility/child-process entry; blocking work stays off Electron main.",
|
||||
|
||||
@@ -11,37 +11,37 @@
|
||||
1 src/main/ipc/runtime-environments/runtime-environment-removal-cleanup.ts
|
||||
1 src/main/ipc/runtime-environments/runtime-environment-session-reconcile.ts
|
||||
2 src/main/ipc/session.ts
|
||||
6 src/main/orca-profiles/profile-project-session-state.ts
|
||||
4 src/main/orca-profiles/profile-project-source-removal.ts
|
||||
2 src/main/orca-profiles/profile-project-state-file.ts
|
||||
4 src/main/orca-profiles/profile-project-transfer-payload.ts
|
||||
2 src/main/orca-profiles/profile-project-transfer.ts
|
||||
9 src/main/orca-profiles/profile-session-owner-transfer.ts
|
||||
6 src/main/orca-profiles/project-transfer/profile-project-session-state.ts
|
||||
4 src/main/orca-profiles/project-transfer/profile-project-source-removal.ts
|
||||
2 src/main/orca-profiles/project-transfer/profile-project-state-file.ts
|
||||
4 src/main/orca-profiles/project-transfer/profile-project-transfer-payload.ts
|
||||
2 src/main/orca-profiles/project-transfer/profile-project-transfer.ts
|
||||
9 src/main/orca-profiles/project-transfer/profile-session-owner-transfer.ts
|
||||
3 src/main/persistence/leasing-ssh-ptys/ssh-pty-binding-cleanup.ts
|
||||
1 src/main/persistence/loading-store/loaded-state-parsing.ts
|
||||
1 src/main/persistence/loading-store/metadata-lineage-operations.ts
|
||||
1 src/main/persistence/loading-store/mobile-tab-selection-persistence.ts
|
||||
1 src/main/persistence/loading-store/normalize-loaded-profile-state.ts
|
||||
8 src/main/persistence/loading-store/pty-binding-persistence.ts
|
||||
10 src/main/persistence/loading-store/pty-binding-session-update.ts
|
||||
10 src/main/persistence/loading-store/repo-lifecycle-operations.ts
|
||||
10 src/main/persistence/loading-store/session-host-partitions.ts
|
||||
9 src/main/persistence/loading-store/session-snapshot-operations.ts
|
||||
3 src/main/persistence/loading-store/state-serialization-secret-handling.ts
|
||||
4 src/main/persistence/loading-store/workspace-session-snapshot-publication.ts
|
||||
4 src/main/persistence/loading-store/workspace-session-terminal-binding-replay.ts
|
||||
2 src/main/persistence/migrating-orcad-catalog/orcad-destination-client-state.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/orcad-destination-workspace-session.ts
|
||||
3 src/main/persistence/migrating-orcad-catalog/orcad-dormant-state-records.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/orcad-migration-source-retention.ts
|
||||
2 src/main/persistence/migrating-orcad-catalog/orcad-source-client-subtraction.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/orcad-source-dormant-state.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/orcad-source-scrollback-state.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/orcad-source-workspace-session-eligibility.ts
|
||||
3 src/main/persistence/migrating-orcad-catalog/orcad-source-workspace-session-layout.ts
|
||||
4 src/main/persistence/migrating-orcad-catalog/orcad-source-workspace-session-subtraction.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/orcad-source-workspace-session.ts
|
||||
2 src/main/persistence/moving-wsl-projects/wsl-move-main-rewrite-stores.ts
|
||||
1 src/main/persistence/loading-store/profile-loading/loaded-state-parsing.ts
|
||||
1 src/main/persistence/loading-store/workspace-lineage/metadata-lineage-operations.ts
|
||||
1 src/main/persistence/loading-store/profile-preferences/mobile-tab-selection-persistence.ts
|
||||
1 src/main/persistence/loading-store/profile-loading/normalize-loaded-profile-state.ts
|
||||
8 src/main/persistence/loading-store/terminal-bindings/pty-binding-persistence.ts
|
||||
10 src/main/persistence/loading-store/terminal-bindings/pty-binding-session-update.ts
|
||||
10 src/main/persistence/loading-store/project-catalog/repo-lifecycle-operations.ts
|
||||
10 src/main/persistence/loading-store/workspace-sessions/session-host-partitions.ts
|
||||
9 src/main/persistence/loading-store/workspace-sessions/session-snapshot-operations.ts
|
||||
2 src/main/persistence/loading-store/profile-writing/state-serialization-secret-handling.ts
|
||||
4 src/main/persistence/loading-store/workspace-sessions/workspace-session-snapshot-publication.ts
|
||||
4 src/main/persistence/loading-store/workspace-sessions/workspace-session-terminal-binding-replay.ts
|
||||
2 src/main/persistence/migrating-orcad-catalog/destination/orcad-destination-client-state.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/destination/orcad-destination-workspace-session.ts
|
||||
3 src/main/persistence/migrating-orcad-catalog/destination/orcad-dormant-state-records.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/retained-source/orcad-migration-source-retention.ts
|
||||
2 src/main/persistence/migrating-orcad-catalog/source/clients/orcad-source-client-subtraction.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/source/dormancy/orcad-source-dormant-state.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/source/scrollback/orcad-source-scrollback-state.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/source/sessions/orcad-source-workspace-session-eligibility.ts
|
||||
3 src/main/persistence/migrating-orcad-catalog/source/sessions/orcad-source-workspace-session-layout.ts
|
||||
4 src/main/persistence/migrating-orcad-catalog/source/sessions/orcad-source-workspace-session-subtraction.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/source/sessions/orcad-source-workspace-session.ts
|
||||
2 src/main/persistence/moving-wsl-projects/desktop-state/wsl-move-main-rewrite-stores.ts
|
||||
1 src/main/persistence/restoring-sessions/folder-workspace-operations.ts
|
||||
1 src/main/persistence/restoring-sessions/invalid-workspace-layout-purge.ts
|
||||
5 src/main/persistence/restoring-sessions/session-owner-fields.ts
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
14 src/main/agent-launch/trust/agent-trust-presets.ts
|
||||
2 src/main/agent-launch/trust/antigravity-workspace-trust-ownership.ts
|
||||
1 src/main/agent-launch/trust/execution-host-workspace-trust.ts
|
||||
1 src/main/ai-vault-search/session-search-worker-client.ts
|
||||
1 src/main/ai-vault-search/worker/session-search-worker-client.ts
|
||||
4 src/main/ai-vault/parse-cache/session-parse-cache-legacy-json.ts
|
||||
2 src/main/ai-vault/scan-service/session-scanner-service-entry-path.ts
|
||||
1 src/main/ai-vault/scan-service/session-scanner-service-spawn.ts
|
||||
1 src/main/ai-vault/scanners/omp/omp-session-root.ts
|
||||
3 src/main/ai-vault/scanners/omp/omp-session-root.ts # small fixed profile-dir probes mirroring OMP dirs.ts; one readdir + per-profile candidate checks, not a per-file sweep
|
||||
1 src/main/ai-vault/scanners/opencode/reader-transport/opencode-wsl-runtime-preparation.ts
|
||||
2 src/main/ai-vault/scanners/opencode/reader-transport/session-scanner-opencode-sqlite-worker-spawn.ts
|
||||
8 src/main/amp/hook-service.ts
|
||||
@@ -97,18 +97,18 @@
|
||||
1 src/main/claude/hook-service.ts
|
||||
3 src/main/claude/statusline-install.ts
|
||||
6 src/main/claude/windows-hook-files.ts
|
||||
1 src/main/cli/appimage-copy-pre-extraction.ts
|
||||
3 src/main/cli/appimage-extracted-root.ts
|
||||
1 src/main/cli/appimage-extraction-pruning.ts
|
||||
2 src/main/cli/appimage-generation-lease.ts
|
||||
4 src/main/cli/appimage-generation-residency.ts
|
||||
16 src/main/cli/appimage-stable-launcher.ts
|
||||
1 src/main/cli/cli-command-inspection.ts
|
||||
1 src/main/cli/cli-dev-launcher.ts
|
||||
3 src/main/cli/cli-install-location.ts
|
||||
2 src/main/cli/linux-bare-orca-dispatcher.ts
|
||||
7 src/main/cli/linux-terminal-orca-cli-shim.ts
|
||||
2 src/main/cli/wsl-managed-cli.ts
|
||||
1 src/main/cli/appimage/appimage-copy-pre-extraction.ts
|
||||
3 src/main/cli/appimage/appimage-extracted-root.ts
|
||||
1 src/main/cli/appimage/appimage-extraction-pruning.ts
|
||||
2 src/main/cli/appimage/appimage-generation-lease.ts
|
||||
4 src/main/cli/appimage/appimage-generation-residency.ts
|
||||
16 src/main/cli/appimage/appimage-stable-launcher.ts
|
||||
1 src/main/cli/installation/cli-command-inspection.ts
|
||||
3 src/main/cli/installation/cli-install-location.ts
|
||||
1 src/main/cli/launchers/cli-dev-launcher.ts
|
||||
2 src/main/cli/launchers/linux-bare-orca-dispatcher.ts
|
||||
7 src/main/cli/launchers/linux-terminal-orca-cli-shim.ts
|
||||
2 src/main/cli/wsl/wsl-managed-cli.ts
|
||||
2 src/main/codex-accounts/codex-account-identity.ts
|
||||
3 src/main/codex-accounts/codex-account-registration.ts
|
||||
4 src/main/codex-accounts/codex-config-mirror.ts
|
||||
@@ -165,14 +165,14 @@
|
||||
1 src/main/codex/trust/identity/codex-trust-identity.ts
|
||||
1 src/main/codex/trust/toml/config-toml-project-trust.ts
|
||||
7 src/main/codex/trust/toml/config-toml-trust.ts
|
||||
2 src/main/computer/desktop-script-provider-paths.ts
|
||||
1 src/main/computer/macos-native-provider-client.ts
|
||||
3 src/main/computer/macos-native-provider-paths.ts
|
||||
5 src/main/computer/macos-native-provider-transport.ts
|
||||
1 src/main/computer/sidecar-client.ts
|
||||
2 src/main/computer/desktop-script/desktop-script-provider-paths.ts
|
||||
1 src/main/computer/macos-native/macos-native-provider-client.ts
|
||||
3 src/main/computer/macos-native/macos-native-provider-paths.ts
|
||||
5 src/main/computer/macos-native/macos-native-provider-transport.ts
|
||||
1 src/main/computer/sidecar-transport/sidecar-client.ts
|
||||
3 src/main/connector-cloud/connector-turn-events.ts
|
||||
1 src/main/copilot/hook-service.ts
|
||||
4 src/main/crash-reporting/appimage-crashpad-handler-exit.ts
|
||||
4 src/main/crash-reporting/capture/appimage-crashpad-handler-exit.ts
|
||||
2 src/main/credentials/credential-file-protection.ts
|
||||
6 src/main/credentials/encrypted-api-key-file-store.ts
|
||||
10 src/main/credentials/integration-credential-file.ts
|
||||
@@ -296,10 +296,10 @@
|
||||
3 src/main/kiro/hook-service.ts
|
||||
1 src/main/kiro/standalone-hooks.ts
|
||||
3 src/main/lib/hidden-probe-cwd.ts
|
||||
4 src/main/linear/linear-credential-paths.ts
|
||||
3 src/main/linear/linear-legacy-viewer-store.ts
|
||||
1 src/main/linear/linear-token-store.ts
|
||||
3 src/main/linear/linear-workspace-registry.ts
|
||||
4 src/main/linear/accounts/linear-credential-paths.ts
|
||||
3 src/main/linear/accounts/linear-legacy-viewer-store.ts
|
||||
1 src/main/linear/accounts/linear-token-store.ts
|
||||
3 src/main/linear/accounts/linear-workspace-registry.ts
|
||||
1 src/main/macos-permissions/macos-tcc-prompt-notice.ts
|
||||
3 src/main/managed-data-accounts/credential-capture.ts
|
||||
18 src/main/managed-data-accounts/profile-removal.ts
|
||||
@@ -323,22 +323,22 @@
|
||||
1 src/main/observability/bounded-log-file-writer.ts
|
||||
2 src/main/observability/bundle.ts
|
||||
6 src/main/observability/local-file-sink.ts
|
||||
14 src/main/opencode/hook-service.ts
|
||||
1 src/main/opencode/legacy-plugin-acl-retry.ts
|
||||
2 src/main/opencode/opencode-overlay-manifest.ts
|
||||
1 src/main/opencode/opencode-plugin-config-writer.ts
|
||||
1 src/main/opencode/opencode-private-server.ts
|
||||
1 src/main/opencode/opencode-wsl-text-task.ts
|
||||
2 src/main/orca-profiles/new-profile-state.ts
|
||||
3 src/main/orca-profiles/other-profile-workspace-catalog.ts
|
||||
3 src/main/orca-profiles/profile-artifact-cloud-cleanup.ts
|
||||
1 src/main/orca-profiles/profile-cloud-index.ts
|
||||
4 src/main/orca-profiles/profile-cloud-session-store.ts
|
||||
14 src/main/opencode/status-hooks/hook-service.ts
|
||||
1 src/main/opencode/status-hooks/legacy-plugin-acl-retry.ts
|
||||
2 src/main/opencode/status-hooks/opencode-overlay-manifest.ts
|
||||
1 src/main/opencode/status-hooks/opencode-plugin-config-writer.ts
|
||||
1 src/main/opencode/text-tasks/wsl/opencode-wsl-text-task.ts
|
||||
3 src/main/orca-profiles/catalog/other-profile-workspace-catalog.ts
|
||||
3 src/main/orca-profiles/cloud-auth/profile-artifact-cloud-cleanup.ts
|
||||
1 src/main/orca-profiles/cloud-auth/profile-cloud-index.ts
|
||||
4 src/main/orca-profiles/cloud-session/profile-cloud-session-store.ts
|
||||
12 src/main/orca-profiles/profile-index-store.ts
|
||||
5 src/main/orca-profiles/profile-legacy-state-import.ts
|
||||
4 src/main/orca-profiles/profile-project-move-intent.ts
|
||||
3 src/main/orca-profiles/profile-project-move-record.ts
|
||||
4 src/main/orca-profiles/profile-project-state-file.ts
|
||||
4 src/main/orca-profiles/project-transfer/profile-project-move-intent.ts
|
||||
3 src/main/orca-profiles/project-transfer/profile-project-move-record.ts
|
||||
4 src/main/orca-profiles/project-transfer/profile-project-state-file.ts
|
||||
2 src/main/orca-profiles/storage/new-profile-state.ts
|
||||
5 src/main/orca-profiles/storage/profile-legacy-state-import.ts
|
||||
2 src/main/orcad/launcher.ts
|
||||
7 src/main/orcad/node-pty-prebuilt-slot.ts
|
||||
2 src/main/orcad/node-pty-precondition.ts
|
||||
@@ -375,52 +375,52 @@
|
||||
1 src/main/orcad/serve-profile-ssh-targets.ts
|
||||
6 src/main/persistence/atomic-snapshot-writer.ts
|
||||
5 src/main/persistence/loading-store/user-data-path.ts
|
||||
9 src/main/persistence/migrating-orcad-catalog/migration-journal-directory.ts
|
||||
4 src/main/persistence/migrating-orcad-catalog/orcad-migration-blob-installers.ts
|
||||
3 src/main/persistence/migrating-orcad-catalog/orcad-migration-blob-staging.ts
|
||||
17 src/main/persistence/migrating-orcad-catalog/orcad-migration-staged-file.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/orcad-scrollback-snapshot-transfer.ts
|
||||
11 src/main/persistence/migrating-orcad-catalog/orcad-shell-history-installer.ts
|
||||
7 src/main/persistence/migrating-orcad-catalog/orcad-terminal-history-installer.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/orcad-terminal-restore-hint-store.ts
|
||||
1 src/main/persistence/moving-wsl-projects/wsl-move-orchestration-history-rewrite.ts
|
||||
1 src/main/persistence/moving-wsl-projects/wsl-move-orchestrator-store.ts
|
||||
6 src/main/persistence/moving-wsl-projects/wsl-move-slept-scrollback.ts
|
||||
2 src/main/persistence/moving-wsl-projects/wsl-move-slept-spool-sweep.ts
|
||||
4 src/main/persistence/migrating-orcad-catalog/blob-transfer/orcad-migration-blob-installers.ts
|
||||
3 src/main/persistence/migrating-orcad-catalog/blob-transfer/orcad-migration-blob-staging.ts
|
||||
17 src/main/persistence/migrating-orcad-catalog/blob-transfer/orcad-migration-staged-file.ts
|
||||
9 src/main/persistence/migrating-orcad-catalog/cutover-journals/migration-journal-directory.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/terminal-history/orcad-scrollback-snapshot-transfer.ts
|
||||
11 src/main/persistence/migrating-orcad-catalog/terminal-history/orcad-shell-history-installer.ts
|
||||
7 src/main/persistence/migrating-orcad-catalog/terminal-history/orcad-terminal-history-installer.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/terminal-history/orcad-terminal-restore-hint-store.ts
|
||||
1 src/main/persistence/moving-wsl-projects/desktop-state/wsl-move-orchestration-history-rewrite.ts
|
||||
1 src/main/persistence/moving-wsl-projects/orchestration/wsl-move-orchestrator-store.ts
|
||||
6 src/main/persistence/moving-wsl-projects/terminal-state/wsl-move-slept-scrollback.ts
|
||||
2 src/main/persistence/moving-wsl-projects/terminal-state/wsl-move-slept-spool-sweep.ts
|
||||
5 src/main/persistence/preferences/active-view-preference.ts
|
||||
5 src/main/persistence/profile-state/access/profile-state-access-identity.ts
|
||||
12 src/main/persistence/profile-state/access/profile-state-access-owner.ts
|
||||
3 src/main/persistence/profile-state/access/profile-state-access.ts
|
||||
2 src/main/persistence/profile-state/backup/profile-state-backup-path.ts
|
||||
2 src/main/persistence/profile-state/backup/profile-state-backup-worker.ts
|
||||
1 src/main/persistence/profile-state/database/profile-state-authority-marker.ts
|
||||
2 src/main/persistence/profile-state/database/profile-state-database.ts
|
||||
2 src/main/persistence/profile-state/database/profile-state-storage-classification.ts
|
||||
4 src/main/persistence/profile-state/legacy-json/profile-state-authority-exports.ts
|
||||
2 src/main/persistence/profile-state/legacy-json/profile-state-export-path.ts
|
||||
1 src/main/persistence/profile-state/legacy-json/profile-state-legacy-backup-path.ts
|
||||
2 src/main/persistence/profile-state/legacy-json/profile-state-legacy-import.ts
|
||||
8 src/main/persistence/profile-state/legacy-json/profile-state-recovery.ts
|
||||
6 src/main/persistence/profile-state/legacy-json/profile-state-versioned-export.ts
|
||||
5 src/main/persistence/profile-state/profile-state-access-identity.ts
|
||||
12 src/main/persistence/profile-state/profile-state-access-owner.ts
|
||||
3 src/main/persistence/profile-state/profile-state-access.ts
|
||||
2 src/main/persistence/profile-state/profile-state-active-location.ts
|
||||
5 src/main/persistence/profile-state/profile-state-authority-bootstrap.ts
|
||||
1 src/main/persistence/profile-state/profile-state-authority-marker.ts
|
||||
2 src/main/persistence/profile-state/profile-state-backup-path.ts
|
||||
2 src/main/persistence/profile-state/profile-state-backup-worker.ts
|
||||
5 src/main/persistence/profile-state/profile-state-database-quarantine.ts
|
||||
9 src/main/persistence/profile-state/profile-state-database-recovery.ts
|
||||
2 src/main/persistence/profile-state/profile-state-database.ts
|
||||
4 src/main/persistence/profile-state/profile-state-migration.ts
|
||||
6 src/main/persistence/profile-state/profile-state-offline-settings.ts
|
||||
6 src/main/persistence/profile-state/profile-state-recovery-command.ts
|
||||
8 src/main/persistence/profile-state/profile-state-recovery-copy.ts
|
||||
2 src/main/persistence/profile-state/profile-state-recovery-crash-process.ts
|
||||
1 src/main/persistence/profile-state/profile-state-recovery-required.ts
|
||||
2 src/main/persistence/profile-state/profile-state-section-repair.ts
|
||||
2 src/main/persistence/profile-state/offline-access/profile-state-active-location.ts
|
||||
6 src/main/persistence/profile-state/offline-access/profile-state-offline-settings.ts
|
||||
2 src/main/persistence/profile-state/profile-state-sqlite-authority.ts
|
||||
1 src/main/persistence/profile-state/profile-state-startup-recovery-dialog.ts
|
||||
2 src/main/persistence/profile-state/profile-state-storage-classification.ts
|
||||
1 src/main/persistence/profile-state/profile-state-writer-worker-path.ts
|
||||
5 src/main/persistence/profile-state/recovery/profile-state-database-quarantine.ts
|
||||
9 src/main/persistence/profile-state/recovery/profile-state-database-recovery.ts
|
||||
6 src/main/persistence/profile-state/recovery/profile-state-recovery-command.ts
|
||||
8 src/main/persistence/profile-state/recovery/profile-state-recovery-copy.ts
|
||||
2 src/main/persistence/profile-state/recovery/profile-state-recovery-crash-process.ts
|
||||
1 src/main/persistence/profile-state/recovery/profile-state-recovery-required.ts
|
||||
2 src/main/persistence/profile-state/recovery/profile-state-section-repair.ts
|
||||
5 src/main/persistence/profile-state/startup/profile-state-authority-bootstrap.ts
|
||||
4 src/main/persistence/profile-state/startup/profile-state-migration.ts
|
||||
1 src/main/persistence/profile-state/startup/profile-state-startup-recovery-dialog.ts
|
||||
1 src/main/persistence/profile-state/writer/profile-state-writer-worker-path.ts
|
||||
2 src/main/persistence/restoring-sessions/floating-workspace-normalization.ts
|
||||
1 src/main/persistence/tracking-repos/worktree-metadata-normalization.ts
|
||||
1 src/main/persistence/window-save-divergence.ts
|
||||
8 src/main/pi/legacy-omp-overlay-migration.ts
|
||||
5 src/main/pi/titlebar-extension-service.ts
|
||||
8 src/main/pi/managed-extensions/legacy-omp-overlay-migration.ts
|
||||
5 src/main/pi/managed-extensions/titlebar-extension-service.ts
|
||||
3 src/main/plugins/appearance/plugin-appearance-service.ts
|
||||
2 src/main/plugins/installation/plugin-install-staging.ts
|
||||
1 src/main/plugins/installation/plugin-install.ts
|
||||
@@ -478,7 +478,7 @@
|
||||
2 src/main/runtime/mobile-cloud-relay/relay-revoke-outbox.ts
|
||||
1 src/main/runtime/orchestration/db/runtime-orchestration-database-access.ts
|
||||
2 src/main/runtime/push/push-unregister-outbox.ts
|
||||
2 src/main/runtime/rpc/methods/mobile-delivery/bundled-mobile-web-bundle.ts
|
||||
1 src/main/runtime/rpc/methods/mobile-delivery/bundled-mobile-web-bundle.ts
|
||||
1 src/main/runtime/rpc/server/network-source-policy-store.ts
|
||||
2 src/main/runtime/rpc/server/pairing/device-registry-corruption.ts
|
||||
2 src/main/runtime/rpc/server/pairing/device-registry-disk-merge.ts
|
||||
@@ -492,9 +492,9 @@
|
||||
1 src/main/runtime/workspaces/persisted-surfaces/crew-operations.ts
|
||||
1 src/main/server/serve-pairing-output.ts
|
||||
2 src/main/speech/model-cache-path.ts
|
||||
9 src/main/speech/model-manager.ts
|
||||
7 src/main/speech/model-manager.ts
|
||||
10 src/main/speech/openai-api-key-store.ts
|
||||
2 src/main/speech/speech-model-download-cleanup.ts
|
||||
1 src/main/speech/speech-model-download-cleanup.ts
|
||||
1 src/main/speech/speech-model-download-transport.ts
|
||||
1 src/main/speech/speech-model-files.ts
|
||||
2 src/main/speech/speech-model-http-download.ts
|
||||
@@ -538,8 +538,8 @@
|
||||
1 src/main/updater/linux-package/linux-package-install-command.ts
|
||||
1 src/main/updater/linux-package/linux-update-package-type.ts
|
||||
6 src/main/updater/serve-update-handoff.ts
|
||||
2 src/main/usage/usage-provider-store-lifecycle.ts
|
||||
1 src/main/usage/usage-scan-worker-spawn.ts
|
||||
2 src/main/usage/provider-lifecycle/usage-provider-store-lifecycle.ts
|
||||
1 src/main/usage/scan-worker/usage-scan-worker-spawn.ts
|
||||
1 src/main/warp-themes/discovery.ts
|
||||
1 src/main/window/desktop-integration/custom-app-icon.ts
|
||||
3 src/main/window/desktop-integration/macos-press-and-hold-default.ts
|
||||
@@ -550,7 +550,6 @@
|
||||
2 src/main/worker-threads/forked-child-entry-path.ts
|
||||
4 src/main/workspace-hooks/hooks.ts
|
||||
10 src/main/workspace-hooks/issue-command-file.ts
|
||||
4 src/main/workspace-hooks/worktree-runner-script.ts
|
||||
1 src/main/workspaces/catalog/folder-repo-git-conversion.ts
|
||||
2 src/main/workspaces/catalog/folder-upgrade-worktree-path.ts
|
||||
3 src/main/workspaces/execution-host/project-runtime-git-router.ts
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
1 src/main/codex-accounts/runtime-home-service-home-routing.ts
|
||||
1 src/main/codex-accounts/runtime-home-service-wsl.ts
|
||||
1 src/main/codex-accounts/service.ts
|
||||
1 src/main/computer/macos-computer-use-permissions.ts
|
||||
1 src/main/computer/macos-permissions/macos-computer-use-permissions.ts
|
||||
1 src/main/daemon/endpoint/identity/daemon-process-identity-query.ts
|
||||
1 src/main/daemon/endpoint/identity/daemon-process-start-time.ts
|
||||
2 src/main/daemon/process-scopes/daemon-cgroup-scope.ts
|
||||
@@ -28,11 +28,11 @@
|
||||
1 src/main/git/runner.ts
|
||||
1 src/main/ipc/worktree-logic.ts
|
||||
1 src/main/network/macos-tailscale-dns-diagnostic.ts
|
||||
1 src/main/opencode/legacy-plugin-acl-retry.ts
|
||||
1 src/main/opencode/status-hooks/legacy-plugin-acl-retry.ts
|
||||
2 src/main/orcad/node-pty-precondition.ts
|
||||
1 src/main/orcad/orcad-data-root-privacy.ts
|
||||
2 src/main/persistence/profile-state/profile-state-access-identity.ts
|
||||
1 src/main/persistence/profile-state/profile-state-recovery-copy.ts
|
||||
2 src/main/persistence/profile-state/access/profile-state-access-identity.ts
|
||||
1 src/main/persistence/profile-state/recovery/profile-state-recovery-copy.ts
|
||||
1 src/main/plugins/catalog/plugin-private-marketplace-ssh-shim.cjs
|
||||
1 src/main/pty/process-retirement/posix-pty-process-table.ts
|
||||
1 src/main/pty/shell-startup/pwsh.ts
|
||||
|
||||
@@ -7,8 +7,6 @@ const nodeFiles = [
|
||||
'src/mock-server-key-pair.test.ts',
|
||||
'src/mobile-release/prepare-android-release-script.test.ts',
|
||||
'src/navigation/query-string-named-exports.test.ts',
|
||||
'src/components/mobile-markdown-parser-progress.test.ts',
|
||||
'src/components/rich-markdown/native-document-bundle.test.ts',
|
||||
'src/terminal/document/native-document-bundle.test.ts',
|
||||
'src/transport/encryption/mobile-e2ee-v2-client-session.test.ts',
|
||||
'src/transport/encryption/mobile-e2ee-v2-physical-channel.test.ts',
|
||||
|
||||
@@ -42,70 +42,70 @@
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"filePath": "mobile/src/components/accounts-snapshot.ts",
|
||||
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "Claude limits use the wrong provider identity",
|
||||
"dynamic": false,
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"filePath": "mobile/src/components/accounts-snapshot.ts",
|
||||
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "Codex limits use the wrong provider identity",
|
||||
"dynamic": false,
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"filePath": "mobile/src/components/accounts-snapshot.ts",
|
||||
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "Host Codex accounts cannot name a WSL distro",
|
||||
"dynamic": false,
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"filePath": "mobile/src/components/accounts-snapshot.ts",
|
||||
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "Host rate-limit targets cannot name a WSL distro",
|
||||
"dynamic": false,
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"filePath": "mobile/src/components/accounts-snapshot.ts",
|
||||
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "Inactive Claude limits use the wrong provider identity",
|
||||
"dynamic": false,
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"filePath": "mobile/src/components/accounts-snapshot.ts",
|
||||
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "Inactive Codex limits use the wrong provider identity",
|
||||
"dynamic": false,
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"filePath": "mobile/src/components/accounts-snapshot.ts",
|
||||
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "WSL Codex accounts require an exact distro",
|
||||
"dynamic": false,
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"filePath": "mobile/src/components/accounts-snapshot.ts",
|
||||
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "WSL rate-limit targets require an exact distro",
|
||||
"dynamic": false,
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"filePath": "mobile/src/components/codex-reset-credit-reply-schema.ts",
|
||||
"filePath": "mobile/src/accounts/usage/codex-reset-credit-reply-schema.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "Host reset scopes cannot name a WSL distro",
|
||||
"dynamic": false,
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"filePath": "mobile/src/components/codex-reset-credit-reply-schema.ts",
|
||||
"filePath": "mobile/src/accounts/usage/codex-reset-credit-reply-schema.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "WSL reset scopes require an exact distro",
|
||||
"dynamic": false,
|
||||
@@ -560,21 +560,21 @@
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"filePath": "mobile/src/transport/hosts/mobile-relay-host-overlay.ts",
|
||||
"filePath": "mobile/src/host-catalog/mobile-relay-host-overlay.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "Expected exactly one endpoint for configured relay metadata",
|
||||
"dynamic": false,
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"filePath": "mobile/src/transport/hosts/mobile-relay-host-overlay.ts",
|
||||
"filePath": "mobile/src/host-catalog/mobile-relay-host-overlay.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "Relay host identity mismatch",
|
||||
"dynamic": false,
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"filePath": "mobile/src/transport/hosts/mobile-relay-host-overlay.ts",
|
||||
"filePath": "mobile/src/host-catalog/mobile-relay-host-overlay.ts",
|
||||
"kind": "object-property:message",
|
||||
"text": "Relay identity and endpoint must coexist",
|
||||
"dynamic": false,
|
||||
|
||||
@@ -14,11 +14,11 @@ src/main/browser/network/egress/browser-route-egress-electron-launch.ts
|
||||
src/main/codex-accounts/legacy-wsl-runtime-auth-drain-recovery-script-harness.ts
|
||||
src/main/codex-accounts/legacy-wsl-runtime-auth-drain-script-harness.ts
|
||||
src/main/codex-accounts/service.ts
|
||||
src/main/computer/desktop-script-provider-bridge.ts
|
||||
src/main/computer/macos-computer-use-permission-status.ts
|
||||
src/main/computer/macos-computer-use-permissions.ts
|
||||
src/main/computer/macos-native-provider-transport.ts
|
||||
src/main/computer/sidecar-client.ts
|
||||
src/main/computer/desktop-script/desktop-script-provider-bridge.ts
|
||||
src/main/computer/macos-permissions/macos-computer-use-permission-status.ts
|
||||
src/main/computer/macos-permissions/macos-computer-use-permissions.ts
|
||||
src/main/computer/macos-native/macos-native-provider-transport.ts
|
||||
src/main/computer/sidecar-transport/sidecar-client.ts
|
||||
src/main/daemon/endpoint/identity/daemon-process-identity-query.ts
|
||||
src/main/daemon/endpoint/identity/daemon-process-inspection.ts
|
||||
src/main/daemon/endpoint/identity/daemon-process-start-time.ts
|
||||
|
||||
@@ -28,27 +28,27 @@
|
||||
1 src/renderer/src/components/artifacts/ArtifactPublishButton.tsx
|
||||
2 src/renderer/src/components/artifacts/ArtifactsPage.tsx
|
||||
2 src/renderer/src/components/artifacts/useArtifactPagination.ts
|
||||
2 src/renderer/src/components/automations/AutomationEditorPromptEditor.tsx
|
||||
1 src/renderer/src/components/automations/AutomationHostFilterNotice.tsx
|
||||
1 src/renderer/src/components/automations/AutomationProjectCombobox.tsx
|
||||
1 src/renderer/src/components/automations/AutomationRunHistory.tsx
|
||||
1 src/renderer/src/components/automations/AutomationRunsDashboard.tsx
|
||||
1 src/renderer/src/components/automations/AutomationRunsTable.tsx
|
||||
2 src/renderer/src/components/automations/authoring/AutomationEditorPromptEditor.tsx
|
||||
1 src/renderer/src/components/automations/hosts/AutomationHostFilterNotice.tsx
|
||||
1 src/renderer/src/components/automations/authoring/AutomationProjectCombobox.tsx
|
||||
1 src/renderer/src/components/automations/runs/AutomationRunHistory.tsx
|
||||
1 src/renderer/src/components/automations/runs/AutomationRunsDashboard.tsx
|
||||
1 src/renderer/src/components/automations/runs/AutomationRunsTable.tsx
|
||||
1 src/renderer/src/components/automations/AutomationsPageSurface.tsx
|
||||
1 src/renderer/src/components/automations/use-automation-agent-picker-entries.ts
|
||||
2 src/renderer/src/components/automations/use-automation-create-destination.ts
|
||||
4 src/renderer/src/components/automations/use-automation-host-catalog.ts
|
||||
4 src/renderer/src/components/automations/use-automation-list-search.ts
|
||||
2 src/renderer/src/components/automations/use-automation-migrate-action.ts
|
||||
1 src/renderer/src/components/automations/use-automation-runs-dashboard.ts
|
||||
1 src/renderer/src/components/automations/use-automations-page-list-state.ts
|
||||
1 src/renderer/src/components/automations/authoring/use-automation-agent-picker-entries.ts
|
||||
2 src/renderer/src/components/automations/authoring/use-automation-create-destination.ts
|
||||
4 src/renderer/src/components/automations/hosts/use-automation-host-catalog.ts
|
||||
4 src/renderer/src/components/automations/listing/use-automation-list-search.ts
|
||||
2 src/renderer/src/components/automations/authoring/use-automation-migrate-action.ts
|
||||
1 src/renderer/src/components/automations/runs/use-automation-runs-dashboard.ts
|
||||
1 src/renderer/src/components/automations/listing/use-automations-page-list-state.ts
|
||||
1 src/renderer/src/components/automations/use-automations-page-local-state.ts
|
||||
1 src/renderer/src/components/automations/use-automations-page-refresh.ts
|
||||
1 src/renderer/src/components/automations/use-automations-page-setup-state.ts
|
||||
1 src/renderer/src/components/automations/authoring/use-automations-page-setup-state.ts
|
||||
1 src/renderer/src/components/automations/use-automations-page-store-state.ts
|
||||
1 src/renderer/src/components/automations/use-external-automation-scope-retention.ts
|
||||
2 src/renderer/src/components/automations/use-scoped-external-automations.ts
|
||||
16 src/renderer/src/components/automations/use-selected-automation-run-history.ts
|
||||
1 src/renderer/src/components/automations/external/use-external-automation-scope-retention.ts
|
||||
2 src/renderer/src/components/automations/external/use-scoped-external-automations.ts
|
||||
16 src/renderer/src/components/automations/runs/use-selected-automation-run-history.ts
|
||||
7 src/renderer/src/components/browser-extension-install-dialog.tsx
|
||||
1 src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsx
|
||||
2 src/renderer/src/components/browser-pane/annotate/MarkupOverlay.tsx
|
||||
@@ -99,18 +99,17 @@
|
||||
1 src/renderer/src/components/editor/combined-diff/resolve-changes/use-combined-diff-section-row-keys.ts
|
||||
1 src/renderer/src/components/editor/combined-diff/review-controls/use-combined-diff-notes-actions.ts
|
||||
1 src/renderer/src/components/editor/combined-diff/scroll-viewport/use-combined-diff-virtualizer.ts
|
||||
1 src/renderer/src/components/editor/csv/CsvGrid.tsx
|
||||
1 src/renderer/src/components/editor/csv/grid/CsvGrid.tsx
|
||||
1 src/renderer/src/components/editor/csv/CsvViewer.tsx
|
||||
1 src/renderer/src/components/editor/csv/useCsvClipboard.ts
|
||||
1 src/renderer/src/components/editor/csv/useCsvPagedPreview.ts
|
||||
3 src/renderer/src/components/editor/csv/useCsvTableEditor.ts
|
||||
1 src/renderer/src/components/editor/csv/editing/clipboard/useCsvClipboard.ts
|
||||
1 src/renderer/src/components/editor/csv/preview/useCsvPagedPreview.ts
|
||||
3 src/renderer/src/components/editor/csv/editing/useCsvTableEditor.ts
|
||||
1 src/renderer/src/components/editor/diff/large-files/useDiffViewerLargeDiffLifecycle.ts
|
||||
3 src/renderer/src/components/editor/diff/monaco-view/DiffViewer.tsx
|
||||
1 src/renderer/src/components/editor/diff/review/DiffNotesSendMenu.tsx
|
||||
1 src/renderer/src/components/editor/editor-header-file-rename.ts
|
||||
1 src/renderer/src/components/editor/external-changes/ExternalFileChangeCompareDialog.tsx
|
||||
1 src/renderer/src/components/editor/git-graph/git-graph-filter.tsx
|
||||
1 src/renderer/src/components/editor/git-graph/git-graph-tab.tsx
|
||||
1 src/renderer/src/components/editor/markdown-preview/render-tree/use-markdown-preview-components.tsx
|
||||
1 src/renderer/src/components/editor/markdown-preview/review/MarkdownPreviewAnnotationComposer.tsx
|
||||
1 src/renderer/src/components/editor/markdown-preview/surface/MarkdownPreview.tsx
|
||||
@@ -145,7 +144,7 @@
|
||||
3 src/renderer/src/components/editor/useEditorPanelFileContentLoader.ts
|
||||
4 src/renderer/src/components/editor/useLocalLogTail.ts
|
||||
1 src/renderer/src/components/editor/usePreserveSectionDuringExternalEdit.ts
|
||||
7 src/renderer/src/components/emulator-pane/emulator-screen-stream-content.tsx
|
||||
1 src/renderer/src/components/emulator-pane/emulator-screen-stream-content.tsx
|
||||
3 src/renderer/src/components/emulator-pane/use-emulator-pane-session.ts
|
||||
1 src/renderer/src/components/emulator-pane/use-emulator-pane-shutdown.ts
|
||||
1 src/renderer/src/components/emulator-pane/use-emulator-video-stream.ts
|
||||
@@ -206,7 +205,7 @@
|
||||
1 src/renderer/src/components/mobile/WindowsFirewallNotice.tsx
|
||||
2 src/renderer/src/components/mobile/use-mobile-page-paired-devices.ts
|
||||
1 src/renderer/src/components/mobile/use-mobile-pairing-generation.ts
|
||||
1 src/renderer/src/components/native-chat-restart-runtimes.ts
|
||||
1 src/renderer/src/components/native-chat-recovery/offers/native-chat-restart-runtimes.ts
|
||||
1 src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
|
||||
8 src/renderer/src/components/native-chat/attachments/chips/use-native-chat-composer-attachments.ts
|
||||
2 src/renderer/src/components/native-chat/attachments/intake/use-native-chat-resolved-path-attachments.ts
|
||||
@@ -542,16 +541,16 @@
|
||||
4 src/renderer/src/components/sidebar/worktree-list/viewport/use-row-measurement.ts
|
||||
1 src/renderer/src/components/sidebar/worktree-list/viewport/use-scroll-to-top.ts
|
||||
1 src/renderer/src/components/sidebar/worktree-list/viewport/use-virtualizer.ts
|
||||
1 src/renderer/src/components/skills/SkillBundleInstallFlow.tsx
|
||||
2 src/renderer/src/components/skills/SkillInstallDialog.tsx
|
||||
4 src/renderer/src/components/skills/SkillInstallManagementDialog.tsx
|
||||
1 src/renderer/src/components/skills/SkillShareDialog.tsx
|
||||
1 src/renderer/src/components/skills/SkillSharedLinkRow.tsx
|
||||
1 src/renderer/src/components/skills/installation/SkillBundleInstallFlow.tsx
|
||||
2 src/renderer/src/components/skills/installation/SkillInstallDialog.tsx
|
||||
4 src/renderer/src/components/skills/installation/SkillInstallManagementDialog.tsx
|
||||
1 src/renderer/src/components/skills/sharing/SkillShareDialog.tsx
|
||||
1 src/renderer/src/components/skills/sharing/SkillSharedLinkRow.tsx
|
||||
1 src/renderer/src/components/skills/SkillsPage.tsx
|
||||
1 src/renderer/src/components/skills/setup/WslAgentSkillSetupPanel.tsx
|
||||
2 src/renderer/src/components/skills/use-owned-skill-shares.ts
|
||||
1 src/renderer/src/components/skills/use-reviewed-skill-plan.ts
|
||||
1 src/renderer/src/components/skills/use-skill-delete-flow.ts
|
||||
2 src/renderer/src/components/skills/sharing/use-owned-skill-shares.ts
|
||||
1 src/renderer/src/components/skills/freshness/use-reviewed-skill-plan.ts
|
||||
1 src/renderer/src/components/skills/deletion/use-skill-delete-flow.ts
|
||||
1 src/renderer/src/components/sparse/SparseCheckoutPresetSelect.tsx
|
||||
1 src/renderer/src/components/ssh-host-recovery/SshHostMoveAnywayAction.tsx
|
||||
2 src/renderer/src/components/star-nag/StarNagAgentValueMomentObserver.tsx
|
||||
@@ -651,7 +650,7 @@
|
||||
2 src/renderer/src/components/terminal-pane/mobile-driver/MobileDriverOverlay.tsx
|
||||
1 src/renderer/src/components/terminal-pane/mobile-driver/TerminalPaneMobileDriverPortals.tsx
|
||||
1 src/renderer/src/components/terminal-pane/mounting/use-terminal-pane-mount-lifecycle.ts
|
||||
2 src/renderer/src/components/terminal-pane/parking/lifecycle/use-terminal-tab-cold-parking.ts
|
||||
1 src/renderer/src/components/terminal-pane/parking/lifecycle/use-terminal-tab-cold-parking.ts
|
||||
1 src/renderer/src/components/terminal-pane/parking/retention/terminal-pending-startup-park-presence.ts
|
||||
1 src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/recovery/TerminalPaneRecoveryPortals.tsx
|
||||
2 src/renderer/src/components/terminal-pane/session-fork/TerminalAgentSessionForkDialog.tsx
|
||||
@@ -693,21 +692,21 @@
|
||||
1 src/renderer/src/hooks/composer-state/workspace-identity-state.ts
|
||||
3 src/renderer/src/hooks/linear-issue-committed-state.ts
|
||||
1 src/renderer/src/hooks/use-audio-capture.ts
|
||||
1 src/renderer/src/hooks/use-bundled-skill-install.ts
|
||||
1 src/renderer/src/hooks/skills/installation/use-bundled-skill-install.ts
|
||||
2 src/renderer/src/hooks/useDetectedAgents.ts
|
||||
2 src/renderer/src/hooks/useGitHubTaskItems.ts
|
||||
2 src/renderer/src/hooks/useImmediateMutation.ts
|
||||
6 src/renderer/src/hooks/useInstalledAgentSkills.ts
|
||||
6 src/renderer/src/hooks/skills/discovery/useInstalledAgentSkills.ts
|
||||
1 src/renderer/src/hooks/useIssueMetadata.ts
|
||||
3 src/renderer/src/hooks/useLinearIssuePublication.ts
|
||||
1 src/renderer/src/hooks/useMacTccAttributionSeveredNotice.ts
|
||||
1 src/renderer/src/hooks/useSettingsNavigationMetadata.ts
|
||||
4 src/renderer/src/hooks/useSkillFreshness.ts
|
||||
4 src/renderer/src/hooks/skills/freshness/useSkillFreshness.ts
|
||||
1 src/renderer/src/hooks/useTaskPageGitHubWorkItemMutation.ts
|
||||
6 src/renderer/src/hooks/useVirtualizedScrollAnchor.ts
|
||||
1 src/renderer/src/lib/host-chat-program-acquisition.ts
|
||||
1 src/renderer/src/lib/quick-open-file-history.ts
|
||||
2 src/renderer/src/lib/worker-auto-close.ts
|
||||
1 src/renderer/src/lib/agent-session/launch/inventory/host-chat-program-acquisition.ts
|
||||
1 src/renderer/src/lib/files/search/quick-open-file-history.ts
|
||||
2 src/renderer/src/runtime/agent-orchestration/worker-auto-close.ts
|
||||
1 src/renderer/src/runtime/native-chat/naming/structured-chat-name-observation.ts
|
||||
1 src/renderer/src/store/plugins/appearance/plugin-icon-themes.ts
|
||||
5 src/renderer/src/store/retained-views/app-state-view.ts
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Grandfathered code React Compiler would run differently (<file>#<function>:<hazard>).
|
||||
# Generated; never hand-edit. Lower after a fix: pnpm check:react-compiler-compat-ratchet --prune
|
||||
1 src/renderer/src/components/agent/agent-launch-picker-drafts.ts#useAgentPickerSetup:discarded-subscription
|
||||
1 src/renderer/src/components/native-chat-restart-runtimes.ts#useNativeChatRestartRuntimes:discarded-subscription
|
||||
1 src/renderer/src/components/native-chat-recovery/offers/native-chat-restart-runtimes.ts#useNativeChatRestartRuntimes:discarded-subscription
|
||||
1 src/renderer/src/components/right-sidebar/source-control/ai/use-source-control-action-agent-choice.ts#useSourceControlActionAgentChoice:store-read-in-memo-block
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
1 src/main/browser/extensions/native-messaging/browser-extension-native-ports.ts
|
||||
1 src/main/browser/extensions/web-store/browser-extension-webstore-updater.ts
|
||||
1 src/main/claude/agent-view/agent-view-bridge.ts
|
||||
1 src/main/cli/appimage-serve-preparation.ts
|
||||
1 src/main/cli/appimage/appimage-serve-preparation.ts
|
||||
1 src/main/codex-accounts/codex-login-session.ts
|
||||
1 src/main/codex/configuration/homes/codex-windows-sandbox-read-grant.ts
|
||||
1 src/main/crash-reporting/pre-gone-host-memory.ts
|
||||
1 src/main/crash-reporting/process-gone-diagnostics.ts
|
||||
1 src/main/crash-reporting/renderer-heap-allocation-profile.ts
|
||||
1 src/main/crash-reporting/memory/pre-gone-host-memory.ts
|
||||
1 src/main/crash-reporting/process-exits/process-gone-diagnostics.ts
|
||||
1 src/main/crash-reporting/memory/renderer-heap-allocation-profile.ts
|
||||
1 src/main/daemon/admission/host-terminal-ledger.ts
|
||||
1 src/main/daemon/admission/host-terminal-policy.ts
|
||||
1 src/main/daemon/endpoint/publication/daemon-endpoint-lifecycle.ts
|
||||
@@ -72,7 +72,6 @@
|
||||
1 src/renderer/src/app-shell/use-app-session-persistence.ts
|
||||
1 src/renderer/src/components/browser-pane/browser-client-page-position-driver.ts
|
||||
1 src/renderer/src/components/contextual-tours/use-contextual-tour.ts
|
||||
1 src/renderer/src/components/editor/setup-contextual-copy.ts
|
||||
1 src/renderer/src/components/right-sidebar/plugin-panels/health/plugin-panel-watchdog.ts
|
||||
1 src/renderer/src/components/sidebar/SeveredTerminalDaemonBanner.tsx
|
||||
1 src/renderer/src/components/sidebar/StalledTerminalDaemonBanner.tsx
|
||||
@@ -85,9 +84,9 @@
|
||||
1 src/renderer/src/components/terminal-pane/render-health/terminal-render-desync-sentinel.ts
|
||||
1 src/renderer/src/hooks/use-now.ts
|
||||
1 src/renderer/src/lib/agent-session/hibernation/agent-hibernation-coordinator.ts
|
||||
1 src/renderer/src/lib/crash-diagnostics.ts
|
||||
1 src/renderer/src/lib/window-visibility-interval.ts
|
||||
1 src/renderer/src/lib/worker-auto-close.ts
|
||||
1 src/renderer/src/diagnostics/crash-reporting/crash-diagnostics.ts
|
||||
1 src/renderer/src/lib/window-activity/window-visibility-interval.ts
|
||||
1 src/renderer/src/runtime/agent-orchestration/worker-auto-close.ts
|
||||
1 src/renderer/src/runtime/hosts/wsl/wsl-refused-read-watch.ts
|
||||
1 src/shared/remote-runtime/control/remote-runtime-shared-control-app-heartbeat.ts
|
||||
1 src/shared/remote-runtime/remote-runtime-socket-liveness.ts
|
||||
|
||||
+702
-1021
File diff suppressed because one or more lines are too long
@@ -2,7 +2,7 @@
|
||||
# This is a RATCHET: counts may only go DOWN. Use useTranslate()/useIntlLocale() from
|
||||
# @/i18n/use-translate. Prune after a fix: pnpm check:render-path-translate-ratchet --prune
|
||||
2 src/renderer/src/components/agent/AgentLaunchPromptComposer.tsx
|
||||
5 src/renderer/src/components/automations/use-external-automation-actions.ts
|
||||
5 src/renderer/src/components/automations/external/use-external-automation-actions.ts
|
||||
1 src/renderer/src/components/diff-comments/useDiffCommentDecorator.tsx
|
||||
2 src/renderer/src/components/editor/markdown-preview/render-tree/use-markdown-preview-components.tsx
|
||||
1 src/renderer/src/components/tab-group/useTabGroupCreationCommands.ts
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
4 src/renderer/src/components/terminal-pane/render-health/recovery/terminal-recovery-ledger-test-store.ts
|
||||
3 src/renderer/src/components/worktree-jump/worktree-jump-palette-status-inputs.ts
|
||||
1 src/renderer/src/lib/agent-session/hibernation/agent-hibernation-coordinator.ts
|
||||
4 src/renderer/src/lib/floating-workspace-terminal-actions.ts
|
||||
1 src/renderer/src/lib/pane-manager/client-hosted-browser-row-state.ts
|
||||
4 src/renderer/src/components/floating-terminal/floating-workspace-terminal-actions.ts
|
||||
1 src/renderer/src/runtime/browser/client-hosting/client-hosted-browser-row-state.ts
|
||||
4 src/renderer/src/lib/workspace/persistence/session-write-subscriber.ts
|
||||
1 src/renderer/src/lib/workspace/persistence/workspace-session-browser-tabs.ts
|
||||
7 src/renderer/src/lib/workspace/persistence/workspace-session-host-hydration.ts
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
1 src/main/ipc/worktrees/removal/register-worktree-removal-handlers.ts
|
||||
1 src/main/ipc/worktrees/removal/registered-worktree-root-owner.ts
|
||||
1 src/main/ipc/worktrees/repo-host-ownership.ts
|
||||
2 src/main/orca-profiles/profile-project-transfer-payload.ts
|
||||
1 src/main/orca-profiles/profile-project-worktree-identity.ts
|
||||
2 src/main/orca-profiles/project-transfer/profile-project-transfer-payload.ts
|
||||
1 src/main/orca-profiles/project-transfer/profile-project-worktree-identity.ts
|
||||
1 src/main/persistence/leasing-ssh-ptys/ssh-target-reassignment.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/orcad-source-ownership.ts
|
||||
1 src/main/persistence/migrating-orcad-catalog/source/catalog/orcad-source-ownership.ts
|
||||
2 src/main/persistence/restoring-sessions/folder-scope-migration.ts
|
||||
1 src/main/persistence/restoring-sessions/tab-terminal-pane-binding-repair.ts
|
||||
1 src/main/persistence/tracking-repos/local-worktree-metadata-scan-expectation.ts
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import { readFile, readdir } from 'node:fs/promises'
|
||||
import { readRouteSnapshot } from '../../mobile-web-app/mobile-web-app-route-snapshot.mjs'
|
||||
import { MOBILE_WEB_APP_DEPENDENCY_PATH } from '../../mobile-web-app/mobile-web-app-bundle-dependencies.mjs'
|
||||
import { existsSync, realpathSync } from 'node:fs'
|
||||
@@ -457,6 +457,32 @@ export async function mobileWebAppModuleClosure(entryModules, { absWorkingDir }
|
||||
|
||||
// One lazily imported chunk per UI language; the page fetches only the active one after init.
|
||||
const LOCALE_CATALOG_INPUT = /(^|\/)src\/i18n\/locales\/[^/]+\.json$/
|
||||
const localeCatalogDir = join(mobileDir, 'src', 'i18n', 'locales')
|
||||
|
||||
// The same catalogs as JSON for the host to serve one at a time, to shells that skip the chunks;
|
||||
// English is the page's inline fallback, so it has none.
|
||||
export async function readLocaleCatalogs(directory = localeCatalogDir) {
|
||||
const names = (await readdir(directory))
|
||||
.filter((name) => name.endsWith('.json') && name !== 'en.json')
|
||||
.sort()
|
||||
return Promise.all(
|
||||
names.map(async (name) => {
|
||||
// Minify: the host sends and the phone keeps the parsed object, not the source layout.
|
||||
const bytes = Buffer.from(
|
||||
JSON.stringify(JSON.parse(await readFile(join(directory, name), 'utf8'))),
|
||||
'utf8'
|
||||
)
|
||||
const sha256 = sha256Hex(bytes)
|
||||
return {
|
||||
locale: name.slice(0, -'.json'.length),
|
||||
bytes,
|
||||
path: `catalogs/${sha256}.json`,
|
||||
sha256,
|
||||
byteLength: bytes.byteLength
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
function localeCatalogOutputs(metafile) {
|
||||
return new Set(
|
||||
@@ -586,11 +612,13 @@ export async function buildMobileWebAppBundle({
|
||||
desktopVersion,
|
||||
protocolWindow,
|
||||
{ script, chunks, images, catalogChunks, entryStaticBytes, chunkCount, routeChunks, routeKeys },
|
||||
catalogs,
|
||||
scrollbarStyle
|
||||
] = await Promise.all([
|
||||
readDesktopVersion(),
|
||||
readProtocolWindow(),
|
||||
bundleMobileWebApp({ appDir }),
|
||||
readLocaleCatalogs(),
|
||||
readFile(join(projectDir, 'src/shared/styles/scrollbar-sleek.css'), 'utf8').then((style) =>
|
||||
// The shared desktop stylesheet can be checked out as CRLF on Windows.
|
||||
style.replace(/\r\n/g, '\n')
|
||||
@@ -598,9 +626,14 @@ export async function buildMobileWebAppBundle({
|
||||
])
|
||||
// Names already hash final bytes, so hashedAsset must reproduce them.
|
||||
const scriptAsset = hashedAsset(script, 'js')
|
||||
const catalogChunkSet = new Set(catalogChunks)
|
||||
const written = [
|
||||
scriptAsset,
|
||||
...[...chunks, ...images].map(({ name, bytes }) => hashedAsset(bytes, extname(name).slice(1)))
|
||||
...[...chunks, ...images].map((output) => ({
|
||||
...hashedAsset(output.bytes, extname(output.name).slice(1)),
|
||||
// Shells that read catalogs from the host skip these; older shells download them as before.
|
||||
...(catalogChunkSet.has(output) ? { kind: 'catalog' } : {})
|
||||
}))
|
||||
]
|
||||
|
||||
// Root-absolute URLs survive nested routes; CSP allows only about: base. ESM entry/chunks load under existing self policy.
|
||||
@@ -624,6 +657,7 @@ export async function buildMobileWebAppBundle({
|
||||
const { manifest } = await writeMobileWebBundleTree({
|
||||
outDir,
|
||||
written: [indexAsset, ...written],
|
||||
catalogs,
|
||||
desktopVersion,
|
||||
protocolWindow,
|
||||
routes: resolveMobileWebPageRoutes(routeKeys, pageRoutes),
|
||||
|
||||
@@ -133,6 +133,8 @@ async function compressWithBrotli(written) {
|
||||
export async function writeMobileWebBundleTree({
|
||||
outDir,
|
||||
written,
|
||||
// Host-only JSON outside `assets` and buildId, served one at a time over RPC.
|
||||
catalogs = [],
|
||||
desktopVersion,
|
||||
protocolWindow,
|
||||
// Empty route list makes shell render every screen natively.
|
||||
@@ -143,14 +145,15 @@ export async function writeMobileWebBundleTree({
|
||||
}) {
|
||||
const brotliCopies = brotli ? await compressWithBrotli(written) : new Map()
|
||||
const assets = written
|
||||
.map(({ path, sha256, byteLength, contentType }) => {
|
||||
.map(({ path, sha256, byteLength, contentType, kind }) => {
|
||||
const copy = brotliCopies.get(path)
|
||||
return {
|
||||
path,
|
||||
sha256,
|
||||
byteLength,
|
||||
contentType,
|
||||
...(copy === undefined ? {} : { brotliByteLength: copy.byteLength })
|
||||
...(copy === undefined ? {} : { brotliByteLength: copy.byteLength }),
|
||||
...(kind === undefined ? {} : { kind })
|
||||
}
|
||||
})
|
||||
.sort((left, right) => (left.path < right.path ? -1 : left.path > right.path ? 1 : 0))
|
||||
@@ -164,14 +167,27 @@ export async function writeMobileWebBundleTree({
|
||||
entrypoint: MOBILE_WEB_BUNDLE_ENTRYPOINT,
|
||||
totalBytes: assets.reduce((total, asset) => total + asset.byteLength, 0),
|
||||
assets,
|
||||
routes
|
||||
routes,
|
||||
...(catalogs.length === 0
|
||||
? {}
|
||||
: {
|
||||
catalogs: catalogs.map(({ locale, path, sha256, byteLength }) => ({
|
||||
locale,
|
||||
path,
|
||||
sha256,
|
||||
byteLength
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
// Clear entire output or stale unreferenced assets ship inside asar.
|
||||
await rm(outDir, { recursive: true, force: true })
|
||||
await mkdir(join(outDir, 'assets'), { recursive: true })
|
||||
for (const asset of written) {
|
||||
await writeFile(join(outDir, asset.path), asset.bytes)
|
||||
if (catalogs.length > 0) {
|
||||
await mkdir(join(outDir, 'catalogs'), { recursive: true })
|
||||
}
|
||||
for (const file of [...written, ...catalogs]) {
|
||||
await writeFile(join(outDir, file.path), file.bytes)
|
||||
}
|
||||
for (const [path, copy] of brotliCopies) {
|
||||
await writeFile(join(outDir, mobileWebBundleBrotliPath(path)), copy)
|
||||
|
||||
@@ -29,6 +29,8 @@ export function mobileWebAppBundleMaxAssets(routeCount, imageCount, catalogChunk
|
||||
// fetched only for the active language, never before the first route. Code keeps its own fence.
|
||||
export const MOBILE_WEB_APP_BUNDLE_MAX_CATALOG_CHUNKS = 10
|
||||
export const MOBILE_WEB_APP_BUNDLE_MAX_CATALOG_BYTES = 3 * 1024 * 1024
|
||||
// The host sends a catalog's JSON in one reply, which must fit a 1 MiB relay frame once encrypted.
|
||||
export const MOBILE_WEB_APP_HOST_CATALOG_MAX_BYTES = 384 * 1024
|
||||
|
||||
// Our own fence on the page's code, well inside the phone contract (32 MiB total, 10 MiB per asset in
|
||||
// manifest-contract.ts); it fails the build before the code weighs more than any one asset may.
|
||||
@@ -185,6 +187,23 @@ export async function verifyMobileWebAppBundle({ bundleDir = defaultBundleDir }
|
||||
`${String(MOBILE_WEB_APP_BUNDLE_MAX_CATALOG_BYTES)} bytes`
|
||||
)
|
||||
}
|
||||
// buildId leaves the host's JSON catalogs out, so a stale copy shows only here.
|
||||
const hostCatalogsOf = (built) => JSON.stringify(built.catalogs ?? [])
|
||||
if (hostCatalogsOf(first.manifest) !== hostCatalogsOf(second.manifest)) {
|
||||
fail('host language catalogs are not reproducible')
|
||||
}
|
||||
if (hostCatalogsOf(first.manifest) !== hostCatalogsOf(manifest)) {
|
||||
fail(`${bundleDir} is stale: its host language catalogs differ from a fresh build's`)
|
||||
}
|
||||
const oversized = (manifest.catalogs ?? []).find(
|
||||
(catalog) => catalog.byteLength > MOBILE_WEB_APP_HOST_CATALOG_MAX_BYTES
|
||||
)
|
||||
if (oversized) {
|
||||
fail(
|
||||
`the ${oversized.locale} host catalog is ${String(oversized.byteLength)} bytes, over the ` +
|
||||
`${String(MOBILE_WEB_APP_HOST_CATALOG_MAX_BYTES)} one reply carries`
|
||||
)
|
||||
}
|
||||
const budgetBytes = mobileWebAppBundleBudgetBytes(manifest) - first.catalogBytes
|
||||
if (budgetBytes > MOBILE_WEB_APP_BUNDLE_MAX_TOTAL_BYTES) {
|
||||
fail(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -51,7 +51,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/persistence/profile-state/profile-state-writer-stall.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',
|
||||
|
||||
+20
-2
@@ -106,6 +106,19 @@ function parseManifest(bundleDir) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (manifest.catalogs !== undefined && !Array.isArray(manifest.catalogs)) {
|
||||
throw failure('manifest catalogs is not a list')
|
||||
}
|
||||
for (const catalog of manifest.catalogs ?? []) {
|
||||
if (typeof catalog !== 'object' || catalog === null || typeof catalog.locale !== 'string') {
|
||||
throw failure('manifest catalog entry has no locale')
|
||||
}
|
||||
assertSafeRelativePath(catalog.path)
|
||||
if (typeof catalog.sha256 !== 'string' || !SHA256_PATTERN.test(catalog.sha256)) {
|
||||
throw failure(`manifest catalog ${catalog.path} has no sha256 digest`)
|
||||
}
|
||||
assertInteger(catalog.byteLength, `catalogs[${catalog.path}].byteLength`)
|
||||
}
|
||||
if (!manifest.assets.some((asset) => asset.path === manifest.entrypoint)) {
|
||||
throw failure(`manifest entrypoint ${manifest.entrypoint} is not one of its assets`)
|
||||
}
|
||||
@@ -126,6 +139,11 @@ function parseManifest(bundleDir) {
|
||||
return manifest
|
||||
}
|
||||
|
||||
// Assets go to the phone; catalogs stay on the host, which serves one on request.
|
||||
function servedFiles(manifest) {
|
||||
return [...manifest.assets, ...(manifest.catalogs ?? [])]
|
||||
}
|
||||
|
||||
function listBundleFiles(directory, prefix = '') {
|
||||
const found = []
|
||||
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
||||
@@ -164,7 +182,7 @@ function assertNoUnlistedFiles(bundleDir, manifest) {
|
||||
const listed = new Set([
|
||||
'manifest.json',
|
||||
...darkBuildMarkerFileNames(),
|
||||
...manifest.assets.map((asset) => asset.path),
|
||||
...servedFiles(manifest).map((file) => file.path),
|
||||
...brotliCopies(manifest).map((asset) => brotliPath(asset))
|
||||
])
|
||||
const strays = listBundleFiles(bundleDir).filter((path) => !listed.has(path))
|
||||
@@ -180,7 +198,7 @@ function assertNoUnlistedFiles(bundleDir, manifest) {
|
||||
function assertMobileWebBundleBuilt(bundleDir = MOBILE_WEB_BUNDLE_DIR) {
|
||||
const manifest = parseManifest(bundleDir)
|
||||
assertNoUnlistedFiles(bundleDir, manifest)
|
||||
for (const asset of manifest.assets) {
|
||||
for (const asset of servedFiles(manifest)) {
|
||||
const assetPath = join(bundleDir, asset.path)
|
||||
const size = statSize(bundleDir, asset.path)
|
||||
if (size !== asset.byteLength) {
|
||||
|
||||
-45
@@ -8,8 +8,6 @@ import { writeMobileWebBundleFixtureTree } from '../../build/mobile-web-app/mobi
|
||||
|
||||
const require = createRequire(import.meta.url)
|
||||
const { assertMobileWebBundleBuilt } = require('./verify-packaged-mobile-web-bundle.cjs')
|
||||
const electronBuilderConfig = require('../../../electron-builder.config.cjs')
|
||||
const { darkBuildMarkers } = require('../../../dark-build-switches.cjs')
|
||||
|
||||
async function withBundle(run, { brotli = false } = {}) {
|
||||
const scratch = await mkdtemp(join(tmpdir(), 'orca-mobile-web-guard-'))
|
||||
@@ -37,16 +35,6 @@ describe('assertMobileWebBundleBuilt', () => {
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
||||
it('fails on a file the manifest does not list, so no stale asset ships inside asar', async () => {
|
||||
await withBundle(async ({ bundleDir }) => {
|
||||
// Dropped content-addressed assets never overwrite themselves; reject leftovers rather than pack unverified unreachable bytes.
|
||||
await writeFile(join(bundleDir, 'assets', 'stale.js'), '// from an earlier build\n', 'utf8')
|
||||
expect(() => assertMobileWebBundleBuilt(bundleDir)).toThrow(
|
||||
/does not list: assets\/stale\.js/
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
it('fails when an asset is tampered with on disk', async () => {
|
||||
await withBundle(async ({ bundleDir, manifest }) => {
|
||||
const asset = manifest.assets.find((entry) => entry.path.endsWith('.js'))
|
||||
@@ -58,14 +46,6 @@ describe('assertMobileWebBundleBuilt', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('fails when a listed asset was never written', async () => {
|
||||
await withBundle(async ({ bundleDir, manifest }) => {
|
||||
const asset = manifest.assets.find((entry) => entry.path.endsWith('.png'))
|
||||
await rm(join(bundleDir, asset.path))
|
||||
expect(() => assertMobileWebBundleBuilt(bundleDir)).toThrow(/which is missing from/)
|
||||
})
|
||||
})
|
||||
|
||||
it('accepts the brotli copies the manifest lists, and fails one that inflates to other bytes', async () => {
|
||||
await withBundle(
|
||||
async ({ bundleDir, manifest }) => {
|
||||
@@ -84,29 +64,4 @@ describe('assertMobileWebBundleBuilt', () => {
|
||||
{ brotli: true }
|
||||
)
|
||||
})
|
||||
|
||||
it('refuses an asset path that escapes the bundle directory', async () => {
|
||||
await withBundle(async ({ bundleDir }) => {
|
||||
await rewriteManifest(bundleDir, (manifest) => {
|
||||
manifest.assets[0].path = '../outside.js'
|
||||
})
|
||||
expect(() => assertMobileWebBundleBuilt(bundleDir)).toThrow(/not a safe relative path/)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('electron-builder packaging wiring', () => {
|
||||
it('verifies a dark page build, and refuses to package it', async () => {
|
||||
await withBundle(async ({ bundleDir }) => {
|
||||
const [marker] = darkBuildMarkers({ ORCA_SIDEBAR_INPUTS: 'main' })
|
||||
await writeFile(join(bundleDir, marker.fileName), marker.text, 'utf8')
|
||||
expect(() => assertMobileWebBundleBuilt(bundleDir)).not.toThrow()
|
||||
expect(() =>
|
||||
electronBuilderConfig.beforePack(
|
||||
{ electronPlatformName: process.platform, arch: process.arch === 'arm64' ? 3 : 1 },
|
||||
bundleDir
|
||||
)
|
||||
).toThrow(`${bundleDir} holds an ORCA_SIDEBAR_INPUTS=main build`)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -32,6 +32,9 @@ export const CJK_LATIN_SPACED_TERMS = [
|
||||
'Kimi',
|
||||
'OpenCode',
|
||||
'Orca',
|
||||
'Artifacts',
|
||||
'Artifact',
|
||||
'Relay',
|
||||
'Cursor',
|
||||
'Bitbucket',
|
||||
'Tailscale',
|
||||
|
||||
@@ -152,7 +152,7 @@ export const JA_UNIFIED_VALUES = {
|
||||
'The GitLab CLI is installed but not authenticated. Run this command in a terminal:':
|
||||
'GitLab CLI はインストールされていますが、認証されていません。ターミナルで次のコマンドを実行してください:',
|
||||
'Install GitLab CLI': 'GitLab CLI をインストール',
|
||||
'CLI.': 'CLI。',
|
||||
'CLI.': 'CLI',
|
||||
'The GitHub CLI is installed but not authenticated. Run this command in a terminal:':
|
||||
'GitHub CLI はインストールされていますが、認証されていません。ターミナルで次のコマンドを実行してください:',
|
||||
'Install GitHub CLI': 'GitHub CLI をインストール',
|
||||
|
||||
@@ -116,7 +116,7 @@ const BASE_LOCALE_KEY_OVERRIDES = {
|
||||
},
|
||||
'auto.components.settings.SettingsSidebar.82db1b7de4': {
|
||||
ko: '온보딩 체크리스트, {{value0}}/{{value1}} 완료. 설정 가이드 보기.',
|
||||
zh: '入门清单,已完成 {{value0}}/{{value1}}。显示设置指南。',
|
||||
zh: '入门清单,已完成 {{value0}}/{{value1}}。显示设置指南',
|
||||
ja: 'オンボーディングチェックリスト、{{value0}}/{{value1}} 完了。セットアップガイドを表示。'
|
||||
},
|
||||
'auto.components.settings.ShortcutFilterRail.02dc7d4251': {
|
||||
@@ -307,12 +307,12 @@ const BASE_LOCALE_KEY_OVERRIDES = {
|
||||
},
|
||||
'settings.appearance.statusBar.kimiToggleDescription': {
|
||||
ko: '활성 워크스페이스의 Kimi 구독 사용량을 표시합니다.',
|
||||
zh: '显示当前工作区的 Kimi 订阅使用情况。',
|
||||
zh: '显示当前工作区的 Kimi 订阅使用情况',
|
||||
ja: 'アクティブなワークスペースの Kimi サブスクリプション使用状況を表示します。'
|
||||
},
|
||||
'auto.components.mobile.MobileHero.cd4e5e816f': {
|
||||
ko: '주머니 속의 워크스페이스.',
|
||||
zh: '您的工作区就在您的口袋里。',
|
||||
zh: '您的工作区就在您的口袋里',
|
||||
ja: 'ワークスペースをポケットに。'
|
||||
},
|
||||
'auto.components.GitHubItemDialog.dbe5e2448e': {
|
||||
@@ -332,12 +332,12 @@ const BASE_LOCALE_KEY_OVERRIDES = {
|
||||
},
|
||||
'auto.components.JiraIssueWorkspace.857bd2f88f': {
|
||||
ko: '선택한 이슈를 미리보기하고, 편집하고, 작업을 시작하세요.',
|
||||
zh: '预览、编辑并从选定的议题开始工作。',
|
||||
zh: '预览、编辑并从选定的议题开始工作',
|
||||
ja: '選択したイシューをプレビュー・編集し、そこから作業を開始します。'
|
||||
},
|
||||
'auto.components.LinearIssueWorkspace.ad5dec37b7': {
|
||||
ko: '선택한 이슈를 미리보기하고, 편집하고, 작업을 시작하세요.',
|
||||
zh: '预览、编辑并从选定的议题开始工作。',
|
||||
zh: '预览、编辑并从选定的议题开始工作',
|
||||
ja: '選択したイシューをプレビュー・編集し、そこから作業を開始します。'
|
||||
},
|
||||
'auto.components.TaskPage.67662ade50': {
|
||||
@@ -352,12 +352,12 @@ const BASE_LOCALE_KEY_OVERRIDES = {
|
||||
},
|
||||
'auto.components.TaskPage.1e1b2ad8f2': {
|
||||
ko: '이 이슈를 등록하기 전에 프로젝트 워크스페이스에서 팀을 선택하세요.',
|
||||
zh: '在提交此议题之前,请从项目工作区选择一个团队。',
|
||||
zh: '在提交此议题之前,请从项目工作区选择一个团队',
|
||||
ja: 'このイシューを登録する前に、プロジェクトワークスペースからチームを選択してください。'
|
||||
},
|
||||
'auto.components.TaskPage.94d900518d': {
|
||||
ko: '선택한 프리셋과 일치하는 이슈가 없습니다.',
|
||||
zh: '没有与所选预设匹配的议题。',
|
||||
zh: '没有与所选预设匹配的议题',
|
||||
ja: '選択したプリセットに一致するイシューはありません。'
|
||||
},
|
||||
'auto.components.linear.project.view.surfaces.3ad562bdf4': {
|
||||
@@ -392,7 +392,7 @@ const BASE_LOCALE_KEY_OVERRIDES = {
|
||||
},
|
||||
'auto.components.onboarding.OnboardingFlow.04ae28d8ca': {
|
||||
ko: '몇 시간 내내 보고 싶은 테마를 선택하세요.',
|
||||
zh: '选择你想盯着看几个小时的主题。',
|
||||
zh: '选择你想盯着看几个小时的主题',
|
||||
ja: '何時間も眺めていたくなるテーマを選んでください。'
|
||||
},
|
||||
'auto.components.GitLabItemDialog.e089f62594': {
|
||||
@@ -402,12 +402,12 @@ const BASE_LOCALE_KEY_OVERRIDES = {
|
||||
},
|
||||
'auto.components.right.sidebar.source.control.primary.action.3d5dccef0b': {
|
||||
ko: '커밋할 것이 없습니다. PR은 이미 병합되었습니다.',
|
||||
zh: '没有可提交的内容。PR 已合并。',
|
||||
zh: '没有可提交的内容。PR 已合并',
|
||||
ja: 'コミットするものはありません。PR はすでにマージされています。'
|
||||
},
|
||||
'auto.components.settings.integrations.search.16a486a49d': {
|
||||
ko: 'Linear에 연결해 이슈를 탐색하고 연결합니다.',
|
||||
zh: '连接 Linear 以浏览和链接议题。',
|
||||
zh: '连接 Linear 以浏览和链接议题',
|
||||
ja: 'Linear に接続してイシューを参照し、リンクします。'
|
||||
},
|
||||
'menu.showTitlebarAppName': {
|
||||
@@ -422,7 +422,7 @@ const BASE_LOCALE_KEY_OVERRIDES = {
|
||||
},
|
||||
'auto.lib.fix.checks.agent.launch.9f00d7df0c': {
|
||||
ko: '검사 프롬프트가 비어 있습니다. 소스 제어 AI 설정을 업데이트하세요.',
|
||||
zh: '检查提示为空。请更新源代码管理 AI 设置。',
|
||||
zh: '检查提示为空。请更新源代码管理 AI 设置',
|
||||
ja: 'チェック プロンプトが空です。ソース管理 AI 設定を更新してください。'
|
||||
},
|
||||
'auto.components.TaskPage.2af3ab5c58': {
|
||||
@@ -442,7 +442,7 @@ const BASE_LOCALE_KEY_OVERRIDES = {
|
||||
},
|
||||
'auto.components.TaskPage.25ff84769a': {
|
||||
ko: '이 Linear 컨텍스트와 일치하는 이슈가 없습니다.',
|
||||
zh: '没有议题与此 Linear 上下文匹配。',
|
||||
zh: '没有议题与此 Linear 上下文匹配',
|
||||
ja: 'この Linear コンテキストに一致するイシューはありません。'
|
||||
},
|
||||
'auto.components.GitHubItemDialog.8c45901789': {
|
||||
@@ -512,7 +512,7 @@ const BASE_LOCALE_KEY_OVERRIDES = {
|
||||
},
|
||||
'auto.components.GitHubItemDialog.a341343303': {
|
||||
ko: '리뷰 댓글이 추가되었습니다.',
|
||||
zh: '已添加评审评论。',
|
||||
zh: '已添加评审评论',
|
||||
ja: 'レビューコメントを追加しました。'
|
||||
},
|
||||
// Port forwarding "Forward" is 転送, not the browser-navigation 進む.
|
||||
|
||||
@@ -446,9 +446,6 @@
|
||||
"auto.components.Terminal.5b2c1a9e44": {
|
||||
"ko": "agent CLI를 찾지 못했습니다. 하나를 설치하거나 설정에서 기본 agent를 선택하세요."
|
||||
},
|
||||
"auto.components.Terminal.7958465754": {
|
||||
"ko": "실행 중인 프로세스가 있는 terminals이 있습니다. 그래도 창을 닫으시겠습니까?"
|
||||
},
|
||||
"auto.components.Terminal.e57db40c11": {
|
||||
"ko": "{{value0}} 실행 명령을 만들 수 없습니다."
|
||||
},
|
||||
@@ -518,9 +515,6 @@
|
||||
"auto.components.automations.AutomationDetail.29baf8f4c2": {
|
||||
"ko": "소스"
|
||||
},
|
||||
"auto.components.automations.AutomationDetail.620b22145e": {
|
||||
"ko": "유예 시간"
|
||||
},
|
||||
"auto.components.automations.AutomationEditorDialog.a2e688226d": {
|
||||
"ko": "워크트리"
|
||||
},
|
||||
|
||||
@@ -9,13 +9,13 @@ export const MACOS_TCC_KEY_OVERRIDES = {
|
||||
es: 'Los mensajes de permisos de macOS pueden aparecer cuando un agente o una herramienta de terminal que se ejecuta en Orca intenta acceder a archivos protegidos. Concede acceso total al disco en Ajustes para reducir estos avisos.',
|
||||
ja: 'Orca で実行中のエージェントやターミナルツールが保護されたファイルにアクセスしようとすると、macOS の権限メッセージが表示されることがあります。これらの確認を減らすには、設定でフルディスクアクセスを許可してください。',
|
||||
ko: 'Orca에서 실행 중인 에이전트나 터미널 도구가 보호된 파일에 접근하려고 하면 macOS 권한 메시지가 표시될 수 있습니다. 이러한 요청을 줄이려면 설정에서 전체 디스크 접근 권한을 허용하세요.',
|
||||
zh: '当 Orca 中运行的智能体或终端工具尝试访问受保护的文件时,macOS 可能会显示权限信息。请在“设置”中授予“完全磁盘访问权限”,以减少此类提示。'
|
||||
zh: '当 Orca 中运行的智能体或终端工具尝试访问受保护的文件时,macOS 可能会显示权限信息。请在“设置”中授予“完全磁盘访问权限”,以减少此类提示'
|
||||
},
|
||||
'auto.components.settings.DeveloperPermissionsPane.7ca17b62c8': {
|
||||
es: 'Cuando los agentes que ejecuta Orca leen datos de otras apps, macOS muestra el nombre de Orca porque es el proceso responsable de los comandos de terminal. Concede este permiso a Orca para reducir esos avisos. Después, cierra y vuelve a abrir Orca.',
|
||||
ja: 'Orca が実行するエージェントがほかのアプリのデータを読み取ると、ターミナルコマンドの実行元プロセスである Orca の名前が macOS に表示されます。これらの確認を減らすには、Orca にこの権限を許可してください。その後、Orca を終了して再度開いてください。',
|
||||
ko: 'Orca가 실행하는 에이전트가 다른 앱의 데이터를 읽으면, macOS는 터미널 명령을 실행하는 프로세스인 Orca를 표시합니다. 이러한 요청을 줄이려면 Orca에 이 권한을 허용하세요. 그런 다음 Orca를 종료했다가 다시 여세요.',
|
||||
zh: '当 Orca 运行的智能体读取其他应用的数据时,macOS 会显示 Orca,因为 Orca 是执行终端命令的进程。请为 Orca 授予此权限,以减少此类提示。然后退出并重新打开 Orca。'
|
||||
zh: '当 Orca 运行的智能体读取其他应用的数据时,macOS 会显示 Orca,因为 Orca 是执行终端命令的进程。请为 Orca 授予此权限,以减少此类提示。然后退出并重新打开 Orca'
|
||||
},
|
||||
'auto.components.settings.DeveloperPermissionsPane.c566bca278': {
|
||||
ko: '전체 디스크 접근 권한',
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { repairTranslatedValue } from './locale-translation-policy.mjs'
|
||||
|
||||
describe('locale-translation-policy ko round 5', () => {
|
||||
it('re-glues Korean particles after Latin terms without gluing content words', () => {
|
||||
// A wrong space before the 에 particle is re-glued onto the Latin term.
|
||||
expect(
|
||||
repairTranslatedValue({
|
||||
key: 'auto.components.StarNagCard.cf82170065',
|
||||
enValue: 'Could not star the repo. Make sure',
|
||||
localeValue: 'repo 에 스타를 표시할 수 없습니다. 다음을 확인하세요',
|
||||
locale: 'ko'
|
||||
})
|
||||
).toBe('repo에 스타를 표시할 수 없습니다. 다음을 확인하세요')
|
||||
expect(
|
||||
repairTranslatedValue({
|
||||
key: 'auto.components.github.project.ProjectCell.4b5b871da8',
|
||||
enValue: 'No labels in this repo.',
|
||||
localeValue: '이 repo 에는 라벨이 없습니다.',
|
||||
locale: 'ko'
|
||||
})
|
||||
).toBe('이 repo에는 라벨이 없습니다.')
|
||||
expect(
|
||||
repairTranslatedValue({
|
||||
key: 'auto.components.terminal.pane.CloseTerminalDialog.6b9a6975f8',
|
||||
enValue:
|
||||
'The terminal still has a running process. If you close the terminal, the process will be killed.',
|
||||
localeValue:
|
||||
'terminal 에는 여전히 실행 중인 프로세스가 있습니다. terminal을 닫으면 프로세스가 종료됩니다.',
|
||||
locale: 'ko'
|
||||
})
|
||||
).toBe(
|
||||
'terminal에는 여전히 실행 중인 프로세스가 있습니다. terminal을 닫으면 프로세스가 종료됩니다.'
|
||||
)
|
||||
// A correct space before a content word that merely starts with a particle syllable is kept.
|
||||
expect(
|
||||
repairTranslatedValue({
|
||||
key: 'auto.components.JiraIssueWorkspace.76513c7898',
|
||||
enValue: 'Close Jira issue preview',
|
||||
localeValue: 'Jira 이슈 미리보기 닫기',
|
||||
locale: 'ko'
|
||||
})
|
||||
).toBe('Jira 이슈 미리보기 닫기')
|
||||
expect(
|
||||
repairTranslatedValue({
|
||||
key: 'auto.components.GitHubItemDialog.3ab6ac0fc8',
|
||||
enValue: 'Preview and edit the selected GitHub issue or pull request.',
|
||||
localeValue: '선택한 GitHub 이슈 또는 PR을 미리보기하고 편집합니다.',
|
||||
locale: 'ko'
|
||||
})
|
||||
).toBe('선택한 GitHub 이슈 또는 PR을 미리보기하고 편집합니다.')
|
||||
})
|
||||
})
|
||||
@@ -1,76 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { repairTranslatedValue, shouldPreserveEnglishValue } from './locale-translation-policy.mjs'
|
||||
|
||||
const ja = (enValue, localeValue, key = 'auto.test.relocalization') =>
|
||||
repairTranslatedValue({ key, enValue, localeValue, locale: 'ja' })
|
||||
|
||||
describe('locale-translation-policy ja relocalization', () => {
|
||||
it('leaves the second word of a two-word command in Latin', () => {
|
||||
expect(ja('a commit hook or git commit fails', 'コミットフックまたは git commit が失敗')).toBe(
|
||||
'コミットフックまたは git commit が失敗'
|
||||
)
|
||||
expect(ja('Run orca terminal', 'orca terminal を実行')).toBe('orca terminal を実行')
|
||||
expect(ja('Install with pnpm install', 'pnpm install でインストール')).toBe(
|
||||
'pnpm install でインストール'
|
||||
)
|
||||
})
|
||||
|
||||
it('leaves identifiers, flags, filenames, and Latin-only labels alone', () => {
|
||||
expect(ja('Pass --agent to select one.', '--agent を渡して選択します。')).toBe(
|
||||
'--agent を渡して選択します。'
|
||||
)
|
||||
expect(ja('Edit agents.md', 'agents.md を編集')).toBe('agents.md を編集')
|
||||
expect(ja('Agent SDK settings', 'Agent SDK の設定')).toBe('Agent SDK の設定')
|
||||
expect(ja('Agent SDK settings', 'この Agent SDK の設定')).toBe('この Agent SDK の設定')
|
||||
expect(ja('Run git commit -m', 'git commit -m を実行')).toBe('git commit -m を実行')
|
||||
})
|
||||
|
||||
it('repairs translated code examples back to executable values', () => {
|
||||
expect(ja('--model sonnet', '--モデルソネット')).toBe('--model sonnet')
|
||||
expect(
|
||||
ja("gh pr list --json number -q '.[0].number'", "gh pr list --json 番号 -q '.[0].number'")
|
||||
).toBe("gh pr list --json number -q '.[0].number'")
|
||||
expect(ja('{basePrompt}', '{ベースプロンプト}')).toBe('{basePrompt}')
|
||||
expect(ja('/pricing', '/価格設定')).toBe('/pricing')
|
||||
})
|
||||
|
||||
it('keeps style blocks in English because a translated selector breaks the view', () => {
|
||||
expect(shouldPreserveEnglishValue('.pp-card[data-card="starter"] .pp-cta')).toBe(true)
|
||||
expect(shouldPreserveEnglishValue('@keyframes browser-flash { to { opacity: 1; } }')).toBe(true)
|
||||
expect(shouldPreserveEnglishValue('.card { background: var(--card); }')).toBe(true)
|
||||
// Why: the declaration requirement is what keeps prose containing braces translatable.
|
||||
expect(shouldPreserveEnglishValue('e.g. {{value0}}')).toBe(false)
|
||||
})
|
||||
|
||||
it('leaves ranges and token samples out of the ellipsis rule', () => {
|
||||
expect(ja('Compare main...HEAD', 'main...HEAD を比較')).toBe('main...HEAD を比較')
|
||||
})
|
||||
|
||||
it('preserves a selector that has no declaration block', () => {
|
||||
for (const value of [
|
||||
'div.pricing-grid > div.card.starter:nth-of-type(1) > a.cta',
|
||||
'.pp-cta',
|
||||
'#dialog',
|
||||
'.pp-card[data-card="starter"] .pp-cta',
|
||||
'button.primary',
|
||||
'a:hover',
|
||||
'input[type="text"]',
|
||||
'localhost:3000'
|
||||
]) {
|
||||
expect(shouldPreserveEnglishValue(value)).toBe(true)
|
||||
}
|
||||
// Why: two ordinary sentences carry two periods, which must not read as selector joins.
|
||||
for (const value of [
|
||||
'Open Settings > Git and try again.',
|
||||
'Show live workspace ports. Click it for workspace-scoped ports and external listeners.',
|
||||
'orca.yaml + local',
|
||||
'.gitignore',
|
||||
'Status:',
|
||||
'Done.',
|
||||
'#{{value0}}'
|
||||
]) {
|
||||
expect(shouldPreserveEnglishValue(value)).toBe(false)
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -197,8 +197,8 @@ export const LOCALE_VALUE_OVERRIDES = {
|
||||
Next: '下一步',
|
||||
Beta: '测试版',
|
||||
Dismiss: '关闭',
|
||||
Artifacts: '工件',
|
||||
artifacts: '工件',
|
||||
Artifacts: '产物',
|
||||
artifacts: '产物',
|
||||
Native: '原生',
|
||||
Bundled: '内置',
|
||||
Quarter: '季度',
|
||||
|
||||
@@ -22,7 +22,7 @@ export const ZH_VALUE_OVERRIDES = {
|
||||
reviewer: '评审人',
|
||||
review: '评审',
|
||||
Review: '评审',
|
||||
'No matching reviewers.': '没有匹配的评审人。',
|
||||
'No matching reviewers.': '没有匹配的评审人',
|
||||
'Request up to 15 reviewers': '最多请求 15 名评审人',
|
||||
'No reviewers requested.': '未请求评审人',
|
||||
'Remove reviewer {{value0}}': '移除评审人 {{value0}}',
|
||||
@@ -39,8 +39,8 @@ export const ZH_VALUE_OVERRIDES = {
|
||||
'Enter a reviewer': '输入评审人',
|
||||
'Add reviewer': '添加评审人',
|
||||
'No reviewers.': '没有评审人',
|
||||
'Open the PR details to view current reviewers.': '打开 PR 详情以查看当前评审人。',
|
||||
'Review comment added.': '已添加评审评论。',
|
||||
'Open the PR details to view current reviewers.': '打开 PR 详情以查看当前评审人',
|
||||
'Review comment added.': '已添加评审评论',
|
||||
'Loading labels': '加载标签',
|
||||
// Why: MT rendered the "Pin Tab" action as "引脚标签" (noun reading of "pin"); pair it with 取消固定标签.
|
||||
'Pin Tab': '固定标签',
|
||||
@@ -57,12 +57,12 @@ export const ZH_VALUE_OVERRIDES = {
|
||||
'Markdown Review Notes': 'Markdown 评审笔记',
|
||||
'Reviewed by': '评审人',
|
||||
'Review from': '评审来自',
|
||||
'Reviewer id is unavailable for this GitLab user.': '此 GitLab 用户无法获取评审人 ID。',
|
||||
'Create a {{value0}} to start checks and review.': '创建 {{value0}} 以开始检查和评审。',
|
||||
'Reviewer id is unavailable for this GitLab user.': '此 GitLab 用户无法获取评审人 ID',
|
||||
'Create a {{value0}} to start checks and review.': '创建 {{value0}} 以开始检查和评审',
|
||||
'Conflicted files are reviewed separately': '冲突文件单独评审',
|
||||
'This review snapshot no longer has any live unresolved conflicts.':
|
||||
'此评审快照不再有任何未解决的实时冲突。',
|
||||
'Skill command copied and inserted below for review.': '技能命令已复制并插入到下方以供评审。',
|
||||
'此评审快照不再有任何未解决的实时冲突',
|
||||
'Skill command copied and inserted below for review.': '技能命令已复制并插入到下方以供评审',
|
||||
'Release readiness review': '发布就绪评审',
|
||||
'Recurring review': '定期评审',
|
||||
Completed: '已完成',
|
||||
@@ -91,9 +91,9 @@ export const ZH_VALUE_OVERRIDES = {
|
||||
'Quick actions': '快捷操作',
|
||||
'action recipes': '操作方案',
|
||||
'Repository action recipes. Global settings are used until this repository customizes them.':
|
||||
'仓库操作方案。在此仓库自定义之前,将使用全局设置。',
|
||||
'仓库操作方案。在此仓库自定义之前,将使用全局设置',
|
||||
'Adds action recipes for Source Control commit, pull request, branch-name, and fix actions.':
|
||||
'为源代码管理的提交、拉取请求、分支命名和修复操作添加操作方案。',
|
||||
'为源代码管理的提交、拉取请求、分支命名和修复操作添加操作方案',
|
||||
// Picker siblings are translated; English pins here would regenerate half-Chinese UI.
|
||||
Play: '播放',
|
||||
Flag: '标记',
|
||||
@@ -121,39 +121,39 @@ export const ZH_VALUE_OVERRIDES = {
|
||||
'floating terminal': '浮动终端',
|
||||
'New Issue': '新建议题',
|
||||
'No issues match the selected filters. Clear a filter or try different criteria.':
|
||||
'没有议题符合所选筛选条件。请清除筛选条件或尝试其他条件。',
|
||||
'没有议题符合所选筛选条件。请清除筛选条件或尝试其他条件',
|
||||
'No issues in this workspace scope. Try searching or adjusting teams.':
|
||||
'此工作区范围内没有议题。请尝试搜索或调整团队。',
|
||||
'此工作区范围内没有议题。请尝试搜索或调整团队',
|
||||
'Close as duplicate': '作为重复议题关闭',
|
||||
'Reply in this review thread': '在此评审线程中回复',
|
||||
'Failed to add review comment.': '添加评审评论失败。',
|
||||
'Failed to add review comment.': '添加评审评论失败',
|
||||
'Localhost Worktree Labels': 'localhost 工作树标签',
|
||||
'Open workspace ports as worktree-specific Orca localhost URLs so browser tabs are easier to tell apart.':
|
||||
'将工作区端口作为工作树专属的 Orca localhost URL 打开,便于区分浏览器标签页。',
|
||||
'将工作区端口作为工作树专属的 Orca localhost URL 打开,便于区分浏览器标签页',
|
||||
'Permanently deletes the remote Git worktrees and their branches. Cannot be undone.':
|
||||
'永久删除远程 Git 工作树及其分支。此操作不可撤销。',
|
||||
'永久删除远程 Git 工作树及其分支。此操作不可撤销',
|
||||
'Clears them from Orca only. Remote files, worktrees, and branches are left untouched.':
|
||||
'仅从 Orca 中清除。远程文件、工作树和分支均不受影响。',
|
||||
'仅从 Orca 中清除。远程文件、工作树和分支均不受影响',
|
||||
'GitHub reports this pull request is blocked': 'GitHub 报告此拉取请求已被阻塞',
|
||||
'GitHub requires review approval before this pull request can merge':
|
||||
'GitHub 需要评审批准才能合并此拉取请求',
|
||||
'Used by repositories that inherit global hosted-review defaults.':
|
||||
'由继承全局托管评审默认值的仓库使用。',
|
||||
'由继承全局托管评审默认值的仓库使用',
|
||||
'Use review template when available': '可用时使用评审模板',
|
||||
'Create hosted reviews as drafts unless changed in the composer.':
|
||||
'除非在编辑器中更改,否则将托管评审创建为草稿。',
|
||||
'Start an agent from failed hosted-review checks.': '从失败的托管评审检查中启动智能体。',
|
||||
'除非在编辑器中更改,否则将托管评审创建为草稿',
|
||||
'Start an agent from failed hosted-review checks.': '从失败的托管评审检查中启动智能体',
|
||||
'Checks require a Git branch and hosted review context': '检查需要 Git 分支和托管评审上下文',
|
||||
'Resolve Review Conflicts With AI': '使用 AI 解决评审冲突',
|
||||
'Hosted review operation in progress…': '托管评审操作进行中…',
|
||||
'Hosted review creation defaults': '托管评审创建默认值',
|
||||
'Open hosted review after creation': '创建后打开托管评审',
|
||||
'Hosted review creation defaults used when the hosted review editor opens.':
|
||||
'打开托管评审编辑器时使用的托管评审创建默认值。',
|
||||
'打开托管评审编辑器时使用的托管评审创建默认值',
|
||||
'Run hosted review detail generation once when the editor opens.':
|
||||
'编辑器打开时运行一次托管评审详情生成。',
|
||||
'编辑器打开时运行一次托管评审详情生成',
|
||||
'Show local Markdown review notes controls in rich editor mode.':
|
||||
'在富文本编辑器模式下显示本地 Markdown 评审笔记控件。',
|
||||
'在富文本编辑器模式下显示本地 Markdown 评审笔记控件',
|
||||
'Orca IDE': 'Orca IDE',
|
||||
'Orca first': 'Orca 优先',
|
||||
'Orca Mobile': 'Orca Mobile',
|
||||
@@ -169,57 +169,57 @@ export const ZH_VALUE_OVERRIDES = {
|
||||
'Active Codex Account': '活跃 Codex 账户',
|
||||
'Claude Accounts': 'Claude 账户',
|
||||
'Remove Claude Account?': '删除 Claude 账户?',
|
||||
'Claude account updated.': 'Claude 账户已更新。',
|
||||
'Claude account update failed.': 'Claude 账户更新失败。',
|
||||
'Could not load Claude accounts.': '无法加载 Claude 账户。',
|
||||
'Claude sign-in failed.': 'Claude 登录失败。',
|
||||
'Claude account added.': '已添加 Claude 账户。',
|
||||
'Claude account updated.': 'Claude 账户已更新',
|
||||
'Claude account update failed.': 'Claude 账户更新失败',
|
||||
'Could not load Claude accounts.': '无法加载 Claude 账户',
|
||||
'Claude sign-in failed.': 'Claude 登录失败',
|
||||
'Claude account added.': '已添加 Claude 账户',
|
||||
'Claude Code session started': 'Claude Code 会话已开始',
|
||||
'Codex session started': 'Codex 会话已开始',
|
||||
'Enable Codex': '启用 Codex',
|
||||
'Most recent local Codex sessions in this scope.': '此范围内最近的本地 Codex 会话。',
|
||||
'Most recent local Codex sessions in this scope.': '此范围内最近的本地 Codex 会话',
|
||||
'Hosted-review creation defaults': '托管评审创建默认值',
|
||||
'Defaults used when the hosted-review composer opens.': '打开托管评审编辑器时使用的默认值。',
|
||||
'Defaults used when the hosted-review composer opens.': '打开托管评审编辑器时使用的默认值',
|
||||
'Run hosted-review detail generation once when the composer opens.':
|
||||
'编辑器打开时运行一次托管评审详情生成。',
|
||||
'编辑器打开时运行一次托管评审详情生成',
|
||||
'Show local markdown review note controls in rich editor mode.':
|
||||
'在富文本编辑器模式下显示本地 Markdown 评审笔记控件。',
|
||||
'在富文本编辑器模式下显示本地 Markdown 评审笔记控件',
|
||||
'Start an agent for local or hosted-review merge conflicts.':
|
||||
'启动用于解决本地或托管评审合并冲突的智能体。',
|
||||
'启动用于解决本地或托管评审合并冲突的智能体',
|
||||
'changed since you last approved. Re-review before it runs':
|
||||
'自您上次批准以来已发生变化。运行前请重新评审',
|
||||
'Run the weekly dependency audit and summarize risky changes.':
|
||||
'每周运行依赖项审计并总结有风险的更改。',
|
||||
'每周运行依赖项审计并总结有风险的更改',
|
||||
'This turns on a process-wide Electron networking switch after restart. Use it for corporate VPNs or proxies that reject HTTP/2 update downloads.':
|
||||
'这将在重启后启用进程级 Electron 网络开关。适用于拒绝 HTTP/2 更新下载的企业 VPN 或代理。',
|
||||
'这将在重启后启用进程级 Electron 网络开关。适用于拒绝 HTTP/2 更新下载的企业 VPN 或代理',
|
||||
'Use only when a corporate VPN or proxy breaks update downloads with HTTP/2 protocol errors. It affects all Electron networking after restart.':
|
||||
'仅当企业 VPN 或代理因 HTTP/2 协议错误而中断更新下载时使用。重启后会影响所有 Electron 网络。',
|
||||
'仅当企业 VPN 或代理因 HTTP/2 协议错误而中断更新下载时使用。重启后会影响所有 Electron 网络',
|
||||
'Use HTTP/1.1 for Electron networking when HTTP/2 fails behind a proxy.':
|
||||
'当 HTTP/2 在代理后面失败时,使用 HTTP/1.1 进行 Electron 网络。',
|
||||
'当 HTTP/2 在代理后面失败时,使用 HTTP/1.1 进行 Electron 网络',
|
||||
'Proxy Bypass Rules': '代理绕过规则',
|
||||
'Hosts that should bypass the configured HTTP proxy.': '应绕过配置的 HTTP 代理的主机。',
|
||||
'Hosts that should bypass the configured HTTP proxy.': '应绕过配置的 HTTP 代理的主机',
|
||||
'Leave empty to use system proxy settings and inherited proxy environment variables.':
|
||||
'留空以使用系统代理设置和继承的代理环境变量。',
|
||||
'留空以使用系统代理设置和继承的代理环境变量',
|
||||
'Proxy Command': '代理命令',
|
||||
"Give agents direct access to Orca's browser so they can test pages, capture screenshots, and act on what they see.":
|
||||
'让智能体直接访问 Orca 的浏览器,以便测试页面、捕获屏幕截图并根据所见内容执行操作。',
|
||||
'让智能体直接访问 Orca 的浏览器,以便测试页面、捕获屏幕截图并根据所见内容执行操作',
|
||||
'X finishes, send it the review task.”': 'X 完成后,把评审任务发给它。”',
|
||||
'Branch naming, base refs, and Git AI Author.': '分支命名、基础引用和 Git AI Author。',
|
||||
'Branch naming, base refs, and Git AI Author.': '分支命名、基础引用和 Git AI Author',
|
||||
'You have unsaved Git AI Author changes. Leaving will discard them.':
|
||||
'您有未保存的 Git AI Author 更改。离开将丢弃它们。',
|
||||
'您有未保存的 Git AI Author 更改。离开将丢弃它们',
|
||||
'Discard unsaved Git AI Author changes?': '放弃未保存的 Git AI Author 更改?',
|
||||
'Create a Linear project for the selected team.': '为所选团队创建 Linear 项目。',
|
||||
'Create a Linear project for the selected team.': '为所选团队创建 Linear 项目',
|
||||
'Linear task mode': 'Linear 任务模式',
|
||||
'Failed to switch Linear workspace.': '无法切换 Linear 工作区。',
|
||||
'Linear project is missing workspace context.': 'Linear 项目缺少工作区上下文。',
|
||||
'Failed to switch Linear workspace.': '无法切换 Linear 工作区',
|
||||
'Linear project is missing workspace context.': 'Linear 项目缺少工作区上下文',
|
||||
'No Linear projects found': '未找到 Linear 项目',
|
||||
'Unable to load Linear projects': '无法加载 Linear 项目',
|
||||
'Change Linear state from {{value0}}': '将 Linear 状态从 {{value0}} 更改为',
|
||||
'GitHub & Linear tasks': 'GitHub 和 Linear 任务',
|
||||
'Each connected Linear workspace has one key stored by the active runtime. Full-access keys can cover all teams the key owner can access; restricted keys can be replaced any time.':
|
||||
'每个已连接的 Linear 工作区都有一个由活动运行时存储的密钥。全权限密钥可覆盖密钥所有者可访问的所有团队;受限密钥可随时更换。',
|
||||
'每个已连接的 Linear 工作区都有一个由活动运行时存储的密钥。全权限密钥可覆盖密钥所有者可访问的所有团队;受限密钥可随时更换',
|
||||
'Show Linear in the Tasks source picker and sidebar shortcuts.':
|
||||
'在任务源选择器和侧边栏快捷方式中显示 Linear。',
|
||||
'在任务源选择器和侧边栏快捷方式中显示 Linear',
|
||||
'Local project, Git repo, or folder with many repos': '本地项目、Git 仓库或包含多个仓库的文件夹',
|
||||
'Staged Changes': '已暂存的更改',
|
||||
Changes: '更改',
|
||||
@@ -231,12 +231,12 @@ export const ZH_VALUE_OVERRIDES = {
|
||||
'Split Terminal Down': '向下拆分终端',
|
||||
'Split Terminal Right': '向右拆分终端',
|
||||
'Optional account switching for Claude while preserving shared chat context.':
|
||||
'Claude 的可选账户切换,同时保留共享聊天上下文。',
|
||||
'Claude 的可选账户切换,同时保留共享聊天上下文',
|
||||
'Countdown timer showing time until prompt cache expires (Claude agents).':
|
||||
'显示提示词缓存到期倒计时的计时器(Claude 智能体)。',
|
||||
'显示提示词缓存到期倒计时的计时器(Claude 智能体)',
|
||||
'Claude caches your conversation to reduce costs. When idle too long the cache expires and the next message resends full context at higher cost. This shows a countdown so you know when to resume.':
|
||||
'Claude 会缓存对话以降低成本。空闲过久后缓存会过期,下一条消息将以更高成本重新发送完整上下文。此倒计时可帮助您了解何时继续。',
|
||||
'from Orca. It is still on your disk.': '来自 Orca。它仍保留在您的磁盘上。',
|
||||
'Claude 会缓存对话以降低成本。空闲过久后缓存会过期,下一条消息将以更高成本重新发送完整上下文。此倒计时可帮助您了解何时继续',
|
||||
'from Orca. It is still on your disk.': '来自 Orca。它仍保留在您的磁盘上',
|
||||
'Pull request reopened': '拉取请求已重新打开',
|
||||
'Reopen PR': '重新打开 PR',
|
||||
'Reopened MR !{{value0}}': '已重新打开 MR !{{value0}}',
|
||||
|
||||
@@ -6,10 +6,11 @@ import process from 'node:process'
|
||||
// TypeScript 7 is a native CLI; AST consumers still need the legacy JavaScript API.
|
||||
import ts from 'typescript-api'
|
||||
import { isTestOnlySourcePath } from '../../static-analysis/process-boundaries/test-only-source-path.mjs'
|
||||
import { isVisibleObjectKey } from './localization-visible-object-keys.mjs'
|
||||
|
||||
const SOURCE_EXTENSIONS = new Set(['.ts', '.tsx', '.js', '.jsx', '.mts', '.cts'])
|
||||
const SKIP_PATH_PARTS = new Set(['.git', 'dist', 'node_modules', 'out', '__snapshots__', 'assets'])
|
||||
const LOCALIZATION_CALL_NAMES = new Set(['t', 'translate'])
|
||||
const LOCALIZATION_CALL_NAMES = new Set(['t', 'translate', 'translateMain'])
|
||||
const CLASS_PROPERTY_NAMES = new Set(['className', 'classNames'])
|
||||
// Why: the children of these elements are CSS or code, never copy a translator should see.
|
||||
const NON_COPY_JSX_ELEMENTS = new Set(['style', 'script'])
|
||||
@@ -35,31 +36,13 @@ const USER_VISIBLE_JSX_ATTRIBUTES = new Set([
|
||||
'toggleDescription',
|
||||
'tooltip'
|
||||
])
|
||||
const USER_VISIBLE_OBJECT_KEYS = new Set([
|
||||
'accessibilityHint',
|
||||
'accessibilityLabel',
|
||||
'ariaLabel',
|
||||
'badge',
|
||||
'description',
|
||||
'emptyText',
|
||||
'error',
|
||||
'headerTitle',
|
||||
'helperText',
|
||||
'keywords',
|
||||
'label',
|
||||
'message',
|
||||
'placeholder',
|
||||
'subtitle',
|
||||
'title',
|
||||
'toggleDescription',
|
||||
'tooltip'
|
||||
])
|
||||
const USER_VISIBLE_FUNCTION_NAMES = new Set([
|
||||
'alert',
|
||||
'confirm',
|
||||
'prompt',
|
||||
'showError',
|
||||
'showToast'
|
||||
'showToast',
|
||||
'toast'
|
||||
])
|
||||
const USER_VISIBLE_OBJECT_METHODS = new Set([
|
||||
'error',
|
||||
@@ -331,7 +314,7 @@ function isInsideNonCopyJsxElement(node) {
|
||||
return Boolean(element && NON_COPY_JSX_ELEMENTS.has(element.openingElement.tagName.getText()))
|
||||
}
|
||||
|
||||
function classifyStringNode(node) {
|
||||
function classifyStringNode(node, includeNativeDialogFields = false) {
|
||||
if (
|
||||
hasAncestorObjectPropertyName(node, CLASS_PROPERTY_NAMES) ||
|
||||
isInsideNonCopyJsxElement(node)
|
||||
@@ -369,12 +352,15 @@ function classifyStringNode(node) {
|
||||
}
|
||||
|
||||
const objectPropertyName = nearestObjectPropertyName(node)
|
||||
if (objectPropertyName && !USER_VISIBLE_OBJECT_KEYS.has(objectPropertyName)) {
|
||||
if (objectPropertyName && !isVisibleObjectKey(objectPropertyName, includeNativeDialogFields)) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const ancestorObjectPropertyName = nearestAncestorObjectPropertyName(node)
|
||||
if (ancestorObjectPropertyName && !USER_VISIBLE_OBJECT_KEYS.has(ancestorObjectPropertyName)) {
|
||||
if (
|
||||
ancestorObjectPropertyName &&
|
||||
!isVisibleObjectKey(ancestorObjectPropertyName, includeNativeDialogFields)
|
||||
) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
@@ -407,7 +393,12 @@ function areaForFile(relativePath) {
|
||||
return `renderer/${parts[0] ?? 'root'}`
|
||||
}
|
||||
|
||||
export function collectLocalizationCandidates(filePath, sourceText, root = process.cwd()) {
|
||||
export function collectLocalizationCandidates(
|
||||
filePath,
|
||||
sourceText,
|
||||
root = process.cwd(),
|
||||
options = {}
|
||||
) {
|
||||
const sourceKind =
|
||||
filePath.endsWith('.tsx') || filePath.endsWith('.jsx') ? ts.ScriptKind.TSX : ts.ScriptKind.TS
|
||||
const sourceFile = ts.createSourceFile(
|
||||
@@ -450,7 +441,7 @@ export function collectLocalizationCandidates(filePath, sourceText, root = proce
|
||||
ts.isNoSubstitutionTemplateLiteral(node) ||
|
||||
ts.isTemplateExpression(node)
|
||||
) {
|
||||
const kind = classifyStringNode(node)
|
||||
const kind = classifyStringNode(node, options.includeNativeDialogFields)
|
||||
if (kind) {
|
||||
for (const part of stringParts(node)) {
|
||||
pushReport(node, kind, part.text, part.dynamic)
|
||||
@@ -521,6 +512,7 @@ function parseArgs(argv) {
|
||||
allowlistPath: path.join('config', 'localization-coverage-allowlist.json'),
|
||||
check: false,
|
||||
format: 'summary',
|
||||
includeNativeDialogFields: false,
|
||||
outputPath: null,
|
||||
sourceRoots: []
|
||||
}
|
||||
@@ -531,6 +523,8 @@ function parseArgs(argv) {
|
||||
options.format = 'json'
|
||||
} else if (arg === '--markdown') {
|
||||
options.format = 'markdown'
|
||||
} else if (arg === '--native-dialog-fields') {
|
||||
options.includeNativeDialogFields = true
|
||||
} else if (arg === '--check') {
|
||||
options.check = true
|
||||
} else if (arg === '--allowlist') {
|
||||
@@ -616,7 +610,7 @@ export async function main(root = process.cwd(), argv = process.argv.slice(2)) {
|
||||
|
||||
for (const filePath of files) {
|
||||
const sourceText = await fs.readFile(filePath, 'utf8')
|
||||
reports.push(...collectLocalizationCandidates(filePath, sourceText, root))
|
||||
reports.push(...collectLocalizationCandidates(filePath, sourceText, root, options))
|
||||
}
|
||||
|
||||
if (options.check) {
|
||||
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { mkdtemp, mkdir, rm, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { collectLocalizationCandidates, main } from './audit-localization-coverage.mjs'
|
||||
|
||||
const path = '/repo/src/main/startup/dialog.ts'
|
||||
const source = `
|
||||
const options = {
|
||||
message: translateMain('message', 'Translated message'),
|
||||
detail: 'Untranslated detail',
|
||||
buttons: ['Proceed', translateMain('cancel', 'Cancel')],
|
||||
body: 'Untranslated body',
|
||||
buttonLabel: 'Retry',
|
||||
checkboxLabel: 'Remember choice'
|
||||
}
|
||||
`
|
||||
|
||||
describe('native dialog localization coverage', () => {
|
||||
it('finds untranslated native dialog fields while ignoring translated copy', () => {
|
||||
const candidates = collectLocalizationCandidates(path, source, '/repo', {
|
||||
includeNativeDialogFields: true
|
||||
})
|
||||
expect(candidates.map(({ kind, text }) => [kind, text])).toEqual([
|
||||
['object-property:detail', 'Untranslated detail'],
|
||||
['object-property:buttons', 'Proceed'],
|
||||
['object-property:body', 'Untranslated body'],
|
||||
['object-property:buttonLabel', 'Retry'],
|
||||
['object-property:checkboxLabel', 'Remember choice']
|
||||
])
|
||||
})
|
||||
|
||||
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(() => {})
|
||||
try {
|
||||
await mkdir(join(root, 'src'))
|
||||
await writeFile(join(root, 'src', 'dialog.ts'), "const options = { detail: 'Raw detail' }")
|
||||
await writeFile(join(root, 'allowlist.json'), '[]')
|
||||
await expect(
|
||||
main(root, [
|
||||
'--check',
|
||||
'--native-dialog-fields',
|
||||
'--source-root',
|
||||
'src',
|
||||
'--allowlist',
|
||||
'allowlist.json'
|
||||
])
|
||||
).resolves.toBe(1)
|
||||
} finally {
|
||||
report.mockRestore()
|
||||
await rm(root, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
})
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user