Merge origin/main into nwparker/expo-58-upgrade

This commit is contained in:
Kelvin Amoaba
2026-11-11 23:19:26 +00:00
1072 changed files with 8411 additions and 529946 deletions
@@ -25,7 +25,6 @@ on:
- 'src/main/codex-usage/codex-rollout-file-lifetime.test.ts'
- 'src/main/codex-usage/scanner-incremental-append.test.ts'
- 'src/main/usage/source-input/jsonl/jsonl-file-reader.test.ts'
- 'src/main/claude-usage/scanner-incremental-append.test.ts'
permissions:
contents: read
@@ -1,45 +0,0 @@
import { EventEmitter } from 'node:events'
import { expect, it, vi } from 'vitest'
const mocks = vi.hoisted(() => ({
connect: vi.fn(),
read: vi.fn(async () => ({ status: 200, body: '' }))
}))
vi.mock('node:http2', async (original) => ({
...(await original<typeof import('node:http2')>()),
connect: mocks.connect
}))
vi.mock('./apns-stream-response.js', () => ({ readApnsStreamResponse: mocks.read }))
import { createApnsHttp2Transport } from './apns-http2-transport.js'
it('keeps the replacement cached when the draining session closes later', async () => {
const sessions: Array<
EventEmitter & {
closed: boolean
destroyed: boolean
request: ReturnType<typeof vi.fn>
close: ReturnType<typeof vi.fn>
}
> = []
mocks.connect.mockImplementation(() => {
const session = Object.assign(new EventEmitter(), {
closed: false,
destroyed: false,
request: vi.fn(() => ({})),
close: vi.fn()
})
sessions.push(session)
return session
})
const transport = createApnsHttp2Transport()
const request = { host: 'api.push.apple.com', path: '/synthetic', headers: {}, body: '{}' }
await transport(request)
sessions[0]!.closed = true
await transport(request)
sessions[0]!.emit('close')
sessions[0]!.emit('error', new Error('old-session'))
await transport(request)
expect(sessions).toHaveLength(2)
expect(sessions[1]!.request).toHaveBeenCalledTimes(2)
transport.close()
expect(sessions[1]!.close).toHaveBeenCalledOnce()
})
+1 -1
View File
@@ -1,4 +1,4 @@
import { PUSH_DEFAULTS } from '@orca-cloud/push-contract'
import { PUSH_DEFAULTS } from '@orca-cloud/push-contract/push-limits'
import { z } from 'zod'
export const PUSH_DATABASE_POOL_MAX = 10
@@ -1,4 +1,4 @@
import type { PushDatabase } from './push-database.js'
import type { CloudDatabase as PushDatabase } from '@orca-cloud/cloud-database/cloud-database'
// Caps worker and prune traffic at poolMax - 1 connections so request-path lookups always find one.
export function reserveRequestConnection(database: PushDatabase, poolMax: number): PushDatabase {
@@ -3,15 +3,17 @@ import {
openInMemoryCloudDatabase,
type CloudDatabase,
type OpenCloudDatabaseInput
} from '@orca-cloud/cloud-database'
} from '@orca-cloud/cloud-database/cloud-database'
import { pushSchemaStatements } from './push-schema.js'
export type { CloudDatabase as PushDatabase, SqlRow } from '@orca-cloud/cloud-database'
export async function openPushDatabase(
input: Omit<OpenCloudDatabaseInput, 'service' | 'schemaStatements'>
): Promise<CloudDatabase> {
return await openCloudDatabase({ ...input, service: 'push', schemaStatements: pushSchemaStatements() })
return await openCloudDatabase({
...input,
service: 'push',
schemaStatements: pushSchemaStatements()
})
}
export async function openInMemoryPushDatabase(): Promise<CloudDatabase> {
@@ -1,73 +1,19 @@
import { afterEach, expect, it } from 'vitest'
import type { PushDatabase } from './push-database.js'
import type { CloudDatabase as PushDatabase } from '@orca-cloud/cloud-database/cloud-database'
import { DELIVERY_LEASE_MS, DurablePushStore } from './durable-push-store.js'
import { reserveRequestConnection } from './push-background-database.js'
import { cleanupDurablePushFixtures, DEVICE_HEAD_SQL, durablePushTestDatabaseUrl, fixture, notification, pauseAfter, within } from './durable-push-store.test-fixture.js'
import {
cleanupDurablePushFixtures,
DEVICE_HEAD_SQL,
durablePushTestDatabaseUrl,
fixture,
notification,
pauseAfter,
within
} from './durable-push-store.test-fixture.js'
afterEach(cleanupDurablePushFixtures)
it.skipIf(!durablePushTestDatabaseUrl)(
'leaves completion, renewal, requests and another store independent of queued claims',
async () => {
const { db, store, clock, advance } = await fixture({ poolMax: 6 })
await store.accept('host', 'finished', notification(1))
const finished = await store.claim()
await store.accept('host', 'renewed', notification(2))
const renewed = await store.claim()
if (!finished || !renewed) throw new Error('setup_claim_missing')
await store.accept('host', 'phone-a', notification(3))
advance(1)
await store.accept('host', 'phone-b', notification(4))
advance(1)
await store.accept('host', 'phone-c', notification(5))
advance(1)
await store.accept('host', 'phone-d', notification(6))
const background = reserveRequestConnection(db, 6)
const held = [pauseAfter(background), pauseAfter(background), pauseAfter(background)] as const
let admitted = 0
const observed: PushDatabase = {
...background,
transaction: (run) => (held[admitted++]?.wrapped ?? background).transaction(run)
}
const limited = new DurablePushStore(db, clock, observed)
const first = limited.claim()
await held[0].atCandidate
const second = limited.claim()
await held[1].atCandidate
const third = limited.claim()
await held[2].atCandidate
const waiting = Array.from({ length: 3 }, () => limited.claim())
try {
advance(10)
const [, , rows, other] = await within(
Promise.all([
limited.finish(finished),
limited.renew(renewed),
db.query('SELECT COUNT(*) AS total FROM push_devices'),
store.claim()
]),
2_000
)
expect(Number(rows[0]?.total)).toBe(0)
expect(other?.registrationId).toBe('phone-d')
const [lease] = await db.query(
'SELECT lease_until FROM push_delivery_batches WHERE batch_id = ?',
[renewed.id]
)
expect(Number(lease?.lease_until)).toBe(clock() + DELIVERY_LEASE_MS)
expect(await store.pendingCount('finished')).toBe(0)
} finally {
for (const pause of held) pause.release()
await Promise.allSettled([first, second, third, ...waiting])
}
expect((await first)?.registrationId).toBe('phone-a')
expect((await second)?.registrationId).toBe('phone-b')
expect((await third)?.registrationId).toBe('phone-c')
expect(await Promise.all(waiting)).toEqual([null, null, null])
}
)
it.skipIf(!durablePushTestDatabaseUrl)(
'rolls back a failed claim and admits a fourth waiter while the other claims stay held',
async () => {
@@ -117,8 +63,6 @@ it.skipIf(!durablePushTestDatabaseUrl)(
}
)
it('leases exactly one delivery per device across concurrent claimers', async () => {
const { db, store, clock, advance } = await fixture()
for (let seq = 1; seq <= 5; seq++) {
@@ -197,11 +141,6 @@ it.skipIf(!durablePushTestDatabaseUrl)(
// Only the TTL term keeps the candidate scan off an unpruned backlog; expires_at is not indexed first.
it('frees a device held by a crashed worker once its lease lapses', async () => {
const { db, store, clock, advance } = await fixture()
await store.accept('host', 'phone', notification(1))
@@ -5,7 +5,6 @@ import {
fixture,
within
} from './durable-push-store.test-fixture.js'
import { PRUNE_BATCH_ROWS } from './durable-push-store.js'
afterEach(cleanupDurablePushFixtures)
@@ -27,26 +26,6 @@ const retentionTables = [
}
] as const
it.each(retentionTables)(
'prunes expired $table rows across batches and preserves the cutoff',
async ({ table, columns, values }) => {
const { db, store, clock } = await fixture()
const cutoff = clock() - 24 * 60 * 60_000
const expired = PRUNE_BATCH_ROWS + 3
await db.query(
`INSERT INTO ${table} (${columns})
WITH RECURSIVE seq(n) AS (SELECT 1 UNION ALL SELECT n + 1 FROM seq WHERE n < ?),
rows AS (SELECT n, CASE WHEN n <= ? THEN ? ELSE ? + n - ? - 1 END AS created_at FROM seq)
SELECT ${values} FROM rows`,
[expired + 2, expired, cutoff - 1, cutoff, expired]
)
expect(await store.prune()).toEqual({ deleted: expired, saturated: false })
const preserved = await db.query(`SELECT created_at FROM ${table} ORDER BY created_at`)
expect(preserved.map((row) => Number(row.created_at))).toEqual([cutoff, cutoff + 1])
expect(await store.prune()).toEqual({ deleted: 0, saturated: false })
}
)
it.skipIf(!durablePushTestDatabaseUrl).each(retentionTables)(
'skips a locked oldest $table row until its transaction releases it',
async ({ table, columns, values }) => {
@@ -1,7 +1,8 @@
import { randomUUID } from 'node:crypto'
import pg from 'pg'
import type { PushNotification } from '@orca-cloud/push-contract'
import { openInMemoryPushDatabase, openPushDatabase, type PushDatabase } from './push-database.js'
import type { PushNotification } from '@orca-cloud/push-contract/send-messages'
import { openInMemoryPushDatabase, openPushDatabase } from '../database/push-database.js'
import type { CloudDatabase as PushDatabase } from '@orca-cloud/cloud-database/cloud-database'
import { DurablePushStore } from './durable-push-store.js'
export const durablePushTestDatabaseUrl =
@@ -1,5 +1,5 @@
import { afterEach, describe, expect, it } from 'vitest'
import { openPushDatabase } from './push-database.js'
import { openPushDatabase } from '../database/push-database.js'
import { DurablePushStore, DELIVERY_LEASE_MS } from './durable-push-store.js'
import {
cleanupDurablePushFixtures,
@@ -89,8 +89,6 @@ describe('durable push acceptance', () => {
await store.finish(fresh!)
})
it('rolls quota and payload back together if persistence fails', async () => {
const { db, store } = await fixture()
await db.query('ALTER TABLE push_delivery_batches RENAME TO push_delivery_batches_unavailable')
@@ -1,10 +1,14 @@
import { isDismissedAlert, reconcileQueuedDismissal } from './push-queued-dismissal.js'
import { parsePushDeliveryPayload } from './push-delivery-payload.js'
import { createHash, randomUUID } from 'node:crypto'
import { PUSH_LIMITS, type PushNotification } from '@orca-cloud/push-contract'
import { PUSH_LIMITS } from '@orca-cloud/push-contract/push-limits'
import type { PushNotification } from '@orca-cloud/push-contract/send-messages'
import { WORKER_DRAINS } from './push-worker-concurrency.js'
import type { PushDatabase, SqlRow } from './push-database.js'
import { limitPushDatabaseConcurrency } from './push-background-database.js'
import type {
CloudDatabase as PushDatabase,
SqlRow
} from '@orca-cloud/cloud-database/cloud-database'
import { limitPushDatabaseConcurrency } from '../database/push-background-database.js'
const RETENTION_MS = 24 * 60 * 60_000
// accept() caps expires_at at due_at + TTL, so older due_at is expired: scans skip an unpruned backlog.
@@ -1,13 +1,12 @@
import { afterEach, expect, it, vi } from 'vitest'
import type { PushNotification } from '@orca-cloud/push-contract'
import type { PushNotification } from '@orca-cloud/push-contract/send-messages'
import { DurablePushStore } from './durable-push-store.js'
import { DurablePushWorker } from './durable-push-worker.js'
import { PushDispatcher } from './push-dispatcher.js'
import { PushDeviceRegistryStore } from './device-registry-store.js'
import { openInMemoryPushDatabase } from './push-database.js'
import { PushDeviceRegistryStore } from '../devices/device-registry-store.js'
import { openInMemoryPushDatabase } from '../database/push-database.js'
import type { PushDelivery } from './push-delivery-message.js'
import type { PushProviderOutcome } from './push-provider-outcome.js'
import type { PushProviderOutcome } from '../providers/push-provider-outcome.js'
import { pauseAfter, within } from './durable-push-store.test-fixture.js'
@@ -69,52 +68,6 @@ async function fixture() {
}
}
it('preserves provider retry delay when waking a restarted worker', async () => {
const h = await fixture()
vi.useFakeTimers()
h.send.mockResolvedValueOnce({
status: 'error',
reason: 'busy',
retryable: true,
retryAfterMs: 10000
})
await h.accept(note(1))
await h.worker.runDue()
expect(h.send).toHaveBeenCalledOnce()
await h.worker.stop()
const restarted = new DurablePushWorker(h.store, h.dispatcher, { now: h.now, onRetry: h.onRetry })
restarted.start()
h.advance(9999)
restarted.wake()
await restarted.runDue()
expect(h.send).toHaveBeenCalledOnce()
h.advance(1)
restarted.wake()
await restarted.runDue()
expect(h.send).toHaveBeenCalledTimes(2)
expect(h.send.mock.calls.map(([delivery]) => delivery.expiresAt)).toEqual([1_300_000, 1_300_000])
expect(h.onRetry).toHaveBeenCalledOnce()
expect(await h.store.pendingCount(h.registrationId)).toBe(0)
await restarted.stop()
})
it('expires instead of shortening a provider delay beyond the delivery lifetime', async () => {
const h = await fixture()
h.send.mockResolvedValue({
status: 'error',
reason: 'busy',
retryable: true,
retryAfterMs: 600000
})
await h.accept(note(1))
await h.worker.runDue()
h.advance(600000)
await h.worker.runDue()
expect(h.send).toHaveBeenCalledOnce()
expect(await h.store.pendingCount(h.registrationId)).toBe(0)
expect(h.onRetry).not.toHaveBeenCalled()
})
it('rechecks the device before a persisted retry and does not send after unregistration', async () => {
const h = await fixture()
h.send.mockResolvedValue({ status: 'error', reason: 'timeout', retryable: true })
@@ -127,46 +80,6 @@ it('rechecks the device before a persisted retry and does not send after unregis
expect(await h.store.pendingCount(h.registrationId)).toBe(0)
})
it('joins active work on shutdown and leaves unclaimed work for the next instance', async () => {
const h = await fixture()
vi.useFakeTimers()
let finish!: (outcome: PushProviderOutcome) => void
let started!: () => void
const entered = new Promise<void>((resolve) => {
started = resolve
})
h.send.mockImplementationOnce(() => {
started()
return new Promise((resolve) => {
finish = resolve
})
})
await h.accept(note(1))
h.worker.start()
h.worker.wake()
const pending = h.worker.runDue()
await entered
await h.accept(note(2))
h.worker.wake()
let stopped = false
const stopping = h.worker.stop().then(() => {
stopped = true
})
await Promise.resolve()
expect(stopped).toBe(false)
finish({ status: 'sent' })
await Promise.all([pending, stopping])
expect(stopped).toBe(true)
expect(h.send).toHaveBeenCalledOnce()
expect(vi.getTimerCount()).toBe(0)
const resumed = new DurablePushWorker(h.store, h.dispatcher, { now: h.now })
resumed.start()
await vi.advanceTimersByTimeAsync(1000)
await resumed.runDue()
expect(h.send).toHaveBeenCalledTimes(2)
await resumed.stop()
})
it('stops queued claim admissions without leasing the remaining device', async () => {
const h = await fixture()
const other = await h.devices.upsert({
@@ -1,5 +1,5 @@
import { createHash } from 'node:crypto'
import { type PushNotification } from '@orca-cloud/push-contract'
import type { PushNotification } from '@orca-cloud/push-contract/send-messages'
export type PushOrcaData = {
kind?: 'alert' | 'dismiss'
@@ -1,4 +1,4 @@
import type { PushNotification } from '@orca-cloud/push-contract'
import type { PushNotification } from '@orca-cloud/push-contract/send-messages'
export function parsePushDeliveryPayload(payload: string): PushNotification {
const value: unknown = JSON.parse(payload)
@@ -1,9 +1,9 @@
import type { ApnsClient } from './apns-client.js'
import type { PushDeviceRegistryStore } from './device-registry-store.js'
import type { FcmClient } from './fcm-client.js'
import { fingerprintLogPrefix } from './host-fingerprint.js'
import type { ApnsClient } from '../providers/apns/apns-client.js'
import type { PushDeviceRegistryStore } from '../devices/device-registry-store.js'
import type { FcmClient } from '../providers/fcm/fcm-client.js'
import { fingerprintLogPrefix } from '../host-auth/host-fingerprint.js'
import type { PushDelivery } from './push-delivery-message.js'
import type { PushProviderOutcome } from './push-provider-outcome.js'
import type { PushProviderOutcome } from '../providers/push-provider-outcome.js'
export type PushDispatcherOptions = {
devices: PushDeviceRegistryStore
@@ -1,5 +1,5 @@
import type { PushNotification } from '@orca-cloud/push-contract'
import type { PushDatabase } from './push-database.js'
import type { PushNotification } from '@orca-cloud/push-contract/send-messages'
import type { CloudDatabase as PushDatabase } from '@orca-cloud/cloud-database/cloud-database'
import { parsePushDeliveryPayload } from './push-delivery-payload.js'
export async function reconcileQueuedDismissal(
@@ -1,92 +0,0 @@
import { expect, it, vi } from 'vitest'
import { openPushDatabase, type PushDatabase } from './push-database.js'
import { PushDeviceRegistryStore } from './device-registry-store.js'
const databaseUrl = process.env.ORCA_PUSH_TEST_DATABASE_URL
it.skipIf(!databaseUrl)(
'serializes deletion with a registration that has already read its row',
async () => {
if (!process.env.CI && new URL(databaseUrl!).port !== '55440')
throw new Error('isolated_postgres_port_required')
const database = await openPushDatabase({
databaseUrl,
dataDir: '',
poolMax: 4,
applicationName: 'push-delete-race'
})
let release!: () => void
const paused = new Promise<void>((resolve) => {
release = resolve
})
let read = false
let pause = false
const wrapped: PushDatabase = {
dialect: database.dialect,
query: database.query.bind(database),
close: database.close.bind(database),
lockQuotaScope: database.lockQuotaScope.bind(database),
tryLockScope: database.tryLockScope.bind(database),
tryLockSharedScope: database.tryLockSharedScope.bind(database),
transaction: (run) =>
database.transaction((tx) =>
run({
dialect: tx.dialect,
close: tx.close.bind(tx),
transaction: tx.transaction.bind(tx),
lockQuotaScope: tx.lockQuotaScope.bind(tx),
tryLockScope: tx.tryLockScope.bind(tx),
tryLockSharedScope: tx.tryLockSharedScope.bind(tx),
query: async (sql, params) => {
const rows = await tx.query(sql, params)
if (pause && sql.startsWith('SELECT registration_id FROM push_devices')) {
read = true
await paused
}
return rows
}
})
)
}
const devices = new PushDeviceRegistryStore(wrapped)
const input = {
hostFingerprint: 'delete-race-host',
deviceId: 'phone',
platform: 'android' as const,
token: 'synthetic'
}
let registration: Promise<unknown> | undefined
let deletion: Promise<boolean> | undefined
try {
await database.query('DELETE FROM push_devices WHERE host_fingerprint = ?', [
input.hostFingerprint
])
const first = await devices.upsert(input)
if (!first.ok) throw new Error('registration refused')
pause = true
registration = devices.upsert(input)
await vi.waitFor(() => expect(read).toBe(true))
let deleted = false
deletion = devices.deleteOwned(input.hostFingerprint, first.registrationId).then((value) => {
deleted = true
return value
})
await vi.waitFor(async () => {
const rows = await database.query(
"SELECT 1 FROM pg_stat_activity WHERE application_name = 'push-delete-race' AND wait_event_type = 'Lock'"
)
expect(deleted || rows.length > 0).toBe(true)
})
expect(deleted).toBe(false)
release()
expect(await registration).toEqual(first)
expect(await deletion).toBe(true)
} finally {
release()
await Promise.allSettled([registration, deletion])
await database.query('DELETE FROM push_devices WHERE host_fingerprint = ?', [
input.hostFingerprint
])
await database.close()
}
}
)
@@ -1,7 +1,8 @@
import { PUSH_LIMITS } from '@orca-cloud/push-contract'
import { PUSH_LIMITS } from '@orca-cloud/push-contract/push-limits'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { PushDeviceRegistryStore, type PushDeviceUpsert } from './device-registry-store.js'
import { openInMemoryPushDatabase, type PushDatabase } from './push-database.js'
import { openInMemoryPushDatabase } from '../database/push-database.js'
import type { CloudDatabase as PushDatabase } from '@orca-cloud/cloud-database/cloud-database'
const OWNER = 'abcdefghijklmnop'
const OTHER = 'ponmlkjihgfedcba'
@@ -117,28 +118,6 @@ describe('push device registry store', () => {
expect(await devices.findOwned(OWNER, [])).toEqual(new Map())
})
it('refuses a new device once the host reaches its registration cap', async () => {
for (let index = 0; index < PUSH_LIMITS.maxDevicesPerHost; index++) {
await upsertOk(androidDevice(`device-${index}`))
}
expect(await devices.upsert(androidDevice('one-too-many'))).toEqual({
ok: false,
reason: 'too_many_devices'
})
expect(await devices.list(OWNER)).toHaveLength(PUSH_LIMITS.maxDevicesPerHost)
})
it('still lets a capped host re-register a device it already owns', async () => {
for (let index = 0; index < PUSH_LIMITS.maxDevicesPerHost; index++) {
await upsertOk(androidDevice(`device-${index}`))
}
const rotated = await devices.upsert({ ...androidDevice('device-0'), token: 'rotated-token' })
expect(rotated.ok).toBe(true)
expect(await devices.list(OWNER)).toHaveLength(PUSH_LIMITS.maxDevicesPerHost)
})
it('counts the cap per host, not across the whole table', async () => {
for (let index = 0; index < PUSH_LIMITS.maxDevicesPerHost; index++) {
await upsertOk(androidDevice(`device-${index}`))
@@ -1,11 +1,14 @@
import { randomUUID } from 'node:crypto'
import {
PUSH_LIMITS,
type ApnsEnvironment,
type PushDeviceSummary,
type PushPlatform
} from '@orca-cloud/push-contract'
import type { PushDatabase, SqlRow } from './push-database.js'
import { PUSH_LIMITS } from '@orca-cloud/push-contract/push-limits'
import type {
ApnsEnvironment,
PushDeviceSummary,
PushPlatform
} from '@orca-cloud/push-contract/device-registration-messages'
import type {
CloudDatabase as PushDatabase,
SqlRow
} from '@orca-cloud/cloud-database/cloud-database'
const DEVICE_CAP_LOCK_PREFIX = 'orca-push-device-cap:'
@@ -1,103 +0,0 @@
import { afterEach, expect, it, vi } from 'vitest'
import type { PushDatabase } from './push-database.js'
import { DELIVERY_LEASE_MS, DurablePushStore } from './durable-push-store.js'
import {
cleanupDurablePushFixtures,
durablePushTestDatabaseUrl,
fixture,
notification,
pauseAfter,
within
} from './durable-push-store.test-fixture.js'
afterEach(cleanupDurablePushFixtures)
const LEASE_SQL = 'UPDATE push_delivery_batches SET lease_token'
// The previous revision's claim statements, in order, with a hook between its candidate scan and re-read.
function previousRevisionClaim(
db: PushDatabase,
clock: () => number,
afterCandidate: () => Promise<void>
): Promise<string | null> {
return db.transaction(async (tx) => {
await tx.lockQuotaScope('push-worker-claim')
const now = clock()
const [candidate] = await tx.query(
`SELECT * FROM push_delivery_batches WHERE state = 'pending' AND lease_until <= ? AND expires_at > ? AND due_at <= ? AND NOT EXISTS (SELECT 1 FROM push_delivery_batches busy WHERE busy.registration_id = push_delivery_batches.registration_id AND busy.lease_until > ?)
ORDER BY due_at, created_at, batch_id LIMIT 1`,
[now, now, now, now]
)
await afterCandidate()
if (!candidate) return null
await tx.lockQuotaScope(`push-events:${String(candidate.host_fingerprint)}`)
const [row] = await tx.query('SELECT * FROM push_delivery_batches WHERE batch_id = ?', [
candidate.batch_id
])
if (!row || row.state !== 'pending' || Number(row.expires_at) <= now) return null
await tx.query(
'UPDATE push_delivery_batches SET lease_token = ?, lease_until = ?, attempts = attempts + 1 WHERE batch_id = ?',
['previous', now + DELIVERY_LEASE_MS, row.batch_id]
)
return 'previous'
})
}
it.skipIf(!durablePushTestDatabaseUrl)(
'keeps a previous-revision claim from re-leasing a delivery this revision leased',
async () => {
const { db, store, clock } = await fixture({ ownDatabase: true })
await store.accept('host', 'phone', notification(1))
const paused = pauseAfter(db, LEASE_SQL)
const current = new DurablePushStore(paused.wrapped, clock).claim()
await paused.atCandidate
let committed!: () => void
const currentCommitted = new Promise<void>((resolve) => (committed = resolve))
const previous = previousRevisionClaim(db, clock, () => currentCommitted)
try {
await vi.waitFor(async () => {
const waiting = await db.query(
"SELECT 1 FROM pg_stat_activity WHERE datname = current_database() AND wait_event_type = 'Lock' AND wait_event = 'advisory'"
)
expect(waiting).toHaveLength(1)
})
} finally {
paused.release()
try {
await current
} finally {
committed()
await previous
}
}
const leased = await current
expect(await previous).toBeNull()
const [row] = await db.query('SELECT lease_token FROM push_delivery_batches')
expect(leased?.lease).toBeTruthy()
expect(row?.lease_token).toBe(leased?.lease)
}
)
it.skipIf(!durablePushTestDatabaseUrl)(
'yields to a previous-revision claim that already holds the claim lock',
async () => {
const { db, store, clock } = await fixture({ ownDatabase: true })
await store.accept('host', 'phone', notification(1))
let scanned!: () => void
const atCandidate = new Promise<void>((resolve) => (scanned = resolve))
let release!: () => void
const released = new Promise<void>((resolve) => (release = resolve))
const previous = previousRevisionClaim(db, clock, async () => {
scanned()
await released
})
await atCandidate
try {
expect(await within(store.claim(), 2_000)).toBeNull()
} finally {
release()
}
expect(await previous).toBe('previous')
expect(await store.claim()).toBeNull()
}
)
@@ -2,9 +2,9 @@ import { createHmac, timingSafeEqual } from 'node:crypto'
import {
PUSH_HOST_CHALLENGE_PLAINTEXT_DOMAIN,
PUSH_HOST_PROOF_TRANSCRIPT_DOMAIN,
PUSH_HOST_PROOF_TRANSCRIPT_FIELD_COUNT,
PUSH_LIMITS
} from '@orca-cloud/push-contract'
PUSH_HOST_PROOF_TRANSCRIPT_FIELD_COUNT
} from '@orca-cloud/push-contract/push-host-proof-transcript'
import { PUSH_LIMITS } from '@orca-cloud/push-contract/push-limits'
import nacl from 'tweetnacl'
import { decodeCanonicalBase64 } from './canonical-base64.js'
import { deriveHostFingerprint } from './host-fingerprint.js'
@@ -63,7 +63,10 @@ function parseTranscript(transcript: Uint8Array): Map<string, Uint8Array> | null
function readUint64(value: Uint8Array | undefined): number | null {
if (!value || value.byteLength !== 8) return null
const parsed = new DataView(value.buffer, value.byteOffset, value.byteLength).getBigUint64(0, false)
const parsed = new DataView(value.buffer, value.byteOffset, value.byteLength).getBigUint64(
0,
false
)
return parsed <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(parsed) : null
}
@@ -98,14 +101,17 @@ function validateTranscript(
],
['not-expired', now - PUSH_LIMITS.clockSkewToleranceMs <= challenge.expiresAt],
['issuedAt-before-expiry', issuedAt === null || issuedAt <= challenge.expiresAt],
[
'window',
issuedAt === null || challenge.expiresAt - issuedAt <= PUSH_LIMITS.challengeTtlMs
],
['window', issuedAt === null || challenge.expiresAt - issuedAt <= PUSH_LIMITS.challengeTtlMs],
['expiry-consistent', expiresAt === challenge.expiresAt],
['protocol', equal(fields.get('protocol'), textEncoder.encode(PUSH_HOST_PROOF_TRANSCRIPT_DOMAIN))],
[
'protocol',
equal(fields.get('protocol'), textEncoder.encode(PUSH_HOST_PROOF_TRANSCRIPT_DOMAIN))
],
['version', equal(fields.get('version'), new Uint8Array([1]))],
['gatewayOrigin', equal(fields.get('gatewayOrigin'), textEncoder.encode(context.gatewayOrigin))],
[
'gatewayOrigin',
equal(fields.get('gatewayOrigin'), textEncoder.encode(context.gatewayOrigin))
],
['gatewayEphemeralPublicKey', equal(fields.get('gatewayEphemeralPublicKey'), gatewayKey)],
['challengeNonce', equal(fields.get('challengeNonce'), nonce)],
['challengeId', equal(fields.get('challengeId'), textEncoder.encode(challenge.challengeId))],
@@ -125,7 +131,9 @@ export function answerPushHostChallenge(
const gatewayKey = decodeCanonicalBase64(challenge.gatewayEphemeralPublicKeyB64, 32)
const nonce = decodeCanonicalBase64(challenge.nonceB64, 24)
const ciphertext = Buffer.from(challenge.ciphertextB64, 'base64')
if (!gatewayKey || !nonce || ciphertext.toString('base64') !== challenge.ciphertextB64) return null
if (!gatewayKey || !nonce || ciphertext.toString('base64') !== challenge.ciphertextB64) {
return null
}
const plaintext = nacl.box.open(ciphertext, nonce, gatewayKey, context.keypair.secretKey)
if (!plaintext) {
context.onInvalid?.('challenge-box-open')
@@ -1,4 +1,4 @@
import { PUSH_LIMITS } from '@orca-cloud/push-contract'
import { PUSH_LIMITS } from '@orca-cloud/push-contract/push-limits'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import {
answerPushHostChallenge,
@@ -7,7 +7,8 @@ import {
} from './host-challenge-answering.test-fixture.js'
import { PushHostChallengeStore } from './host-challenge-store.js'
import { openInMemoryPushDatabase, type PushDatabase } from './push-database.js'
import { openInMemoryPushDatabase } from '../database/push-database.js'
import type { CloudDatabase as PushDatabase } from '@orca-cloud/cloud-database/cloud-database'
const GATEWAY_ORIGIN = 'https://push.onorca.dev'
@@ -26,12 +27,6 @@ describe('push host challenge store', () => {
await database.close()
})
it('rejects a challenge the moment its own ttl elapses', async () => {
const host = createPushHostKeypair(4)
const challenge = await store.issue(hostPublicKeyB64(host))
@@ -47,10 +42,6 @@ describe('push host challenge store', () => {
})
})
it('refuses a wrong host: the box will not open and a foreign proof will not match', async () => {
const owner = createPushHostKeypair(6)
const intruder = createPushHostKeypair(7)
@@ -74,6 +65,4 @@ describe('push host challenge store', () => {
reason: 'proof_mismatch'
})
})
})
@@ -2,13 +2,13 @@ import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from
import {
buildPushHostChallengePlaintext,
buildPushHostProofMacInput,
buildPushHostProofTranscript,
PUSH_LIMITS
} from '@orca-cloud/push-contract'
buildPushHostProofTranscript
} from '@orca-cloud/push-contract/push-host-proof-transcript'
import { PUSH_LIMITS } from '@orca-cloud/push-contract/push-limits'
import nacl from 'tweetnacl'
import { decodeCanonicalBase64 } from './canonical-base64.js'
import { deriveHostFingerprint } from './host-fingerprint.js'
import type { PushDatabase } from './push-database.js'
import type { CloudDatabase as PushDatabase } from '@orca-cloud/cloud-database/cloud-database'
export type IssuedPushChallenge = {
challengeId: string
@@ -1,5 +1,5 @@
import { createHash } from 'node:crypto'
import { PUSH_HOST_FINGERPRINT_LENGTH } from '@orca-cloud/push-contract'
import { PUSH_HOST_FINGERPRINT_LENGTH } from '@orca-cloud/push-contract/push-limits'
// Identical derivation to deriveRelayHostId on the desktop, so a host and a
// phone reach the same fingerprint from the same X25519 public key.
@@ -1,5 +1,5 @@
import { expect, it } from 'vitest'
import { openInMemoryPushDatabase, openPushDatabase } from './push-database.js'
import { openInMemoryPushDatabase, openPushDatabase } from '../database/push-database.js'
import { PushHostChallengeStore } from './host-challenge-store.js'
import {
answerPushHostChallenge,
@@ -1,7 +1,8 @@
import { PUSH_LIMITS } from '@orca-cloud/push-contract'
import { PUSH_LIMITS } from '@orca-cloud/push-contract/push-limits'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { PushHostSessionStore } from './host-session-store.js'
import { openInMemoryPushDatabase, type PushDatabase } from './push-database.js'
import { openInMemoryPushDatabase } from '../database/push-database.js'
import type { CloudDatabase as PushDatabase } from '@orca-cloud/cloud-database/cloud-database'
const HOST = 'abcdefghijklmnop'
@@ -20,18 +21,6 @@ describe('push host session store', () => {
await database.close()
})
it('mints a 24 hour session and stores only its hash', async () => {
const session = await sessions.create(HOST)
expect(session.expiresAt).toBe(clock + PUSH_LIMITS.sessionTtlMs)
expect(Buffer.from(session.sessionToken, 'base64url').byteLength).toBe(32)
const [row] = await database.query('SELECT token_hash FROM push_sessions')
expect(String(row?.token_hash)).not.toBe(session.sessionToken)
await expect(sessions.resolve(session.sessionToken)).resolves.toMatchObject({
ok: true,
hostFingerprint: HOST
})
})
it('reports expiry separately from an unknown token', async () => {
const session = await sessions.create(HOST)
clock += PUSH_LIMITS.sessionTtlMs + 1
@@ -45,8 +34,6 @@ describe('push host session store', () => {
})
})
it('keeps one live session per host and prunes it once expired', async () => {
const first = await sessions.create(HOST)
const second = await sessions.create(HOST)
@@ -1,6 +1,6 @@
import { createHash, randomBytes } from 'node:crypto'
import { PUSH_LIMITS } from '@orca-cloud/push-contract'
import type { PushDatabase } from './push-database.js'
import { PUSH_LIMITS } from '@orca-cloud/push-contract/push-limits'
import type { CloudDatabase as PushDatabase } from '@orca-cloud/cloud-database/cloud-database'
export type IssuedPushSession = {
sessionToken: string
@@ -1,7 +1,8 @@
import { randomUUID } from 'node:crypto'
import { tmpdir } from 'node:os'
import { afterEach, describe, expect, it } from 'vitest'
import { openInMemoryPushDatabase, openPushDatabase, type PushDatabase } from './push-database.js'
import { openInMemoryPushDatabase, openPushDatabase } from '../database/push-database.js'
import type { CloudDatabase as PushDatabase } from '@orca-cloud/cloud-database/cloud-database'
import { PushHostSessionStore } from './host-session-store.js'
const databases: PushDatabase[] = []
afterEach(async () => {
@@ -31,16 +32,6 @@ it('serializes sessions on SQLite', async () => {
await concurrentSessions(await openInMemoryPushDatabase())
})
it('enforces one session per host directly in the schema', async () => {
const db = await openInMemoryPushDatabase()
databases.push(db)
await db.query('INSERT INTO push_sessions VALUES (?, ?, ?, ?)', ['first', 'host', 100, 1])
await expect(
db.query('INSERT INTO push_sessions VALUES (?, ?, ?, ?)', ['second', 'host', 100, 2])
).rejects.toThrow()
expect(await db.query('SELECT token_hash FROM push_sessions')).toEqual([{ token_hash: 'first' }])
})
describe.skipIf(!process.env.ORCA_PUSH_TEST_DATABASE_URL)('PostgreSQL push sessions', () => {
it('leaves exactly one live token after concurrent creates', async () => {
await concurrentSessions(
@@ -50,16 +41,4 @@ describe.skipIf(!process.env.ORCA_PUSH_TEST_DATABASE_URL)('PostgreSQL push sessi
})
)
})
it('allows concurrent schema startup', async () => {
const opened = await Promise.all(
Array.from({ length: 4 }, () =>
openPushDatabase({
databaseUrl: process.env.ORCA_PUSH_TEST_DATABASE_URL!,
dataDir: tmpdir()
})
)
)
databases.push(...opened)
for (const db of opened) expect(await db.query('SELECT 1 AS ok')).toEqual([{ ok: 1 }])
})
})
@@ -1,4 +1,4 @@
import { PUSH_LIMITS } from '@orca-cloud/push-contract'
import { PUSH_LIMITS } from '@orca-cloud/push-contract/push-limits'
import { Hono } from 'hono'
import { describe, expect, it } from 'vitest'
import { ClientIpRateLimiter, clientIpRateLimit } from './client-ip-rate-limit.js'
@@ -14,18 +14,6 @@ function limiterApp(limiter: ClientIpRateLimiter, trustedProxyHops = 0): Hono {
}
describe('client ip rate limiter', () => {
it('buckets on the last forwarded hop, the only one the platform appended', async () => {
const app = limiterApp(new ClientIpRateLimiter({ now: () => 1_000 }))
for (let index = 0; index < CAPACITY; index++) {
@@ -1,4 +1,4 @@
import { PUSH_LIMITS } from '@orca-cloud/push-contract'
import { PUSH_LIMITS } from '@orca-cloud/push-contract/push-limits'
import type { Context, MiddlewareHandler } from 'hono'
const REFILL_WINDOW_MS = 60_000
@@ -1,6 +1,6 @@
import { PUSH_LIMITS } from '@orca-cloud/push-contract'
import { PUSH_LIMITS } from '@orca-cloud/push-contract/push-limits'
import { expect, it } from 'vitest'
import { createPushHostKeypair } from './host-challenge-answering.test-fixture.js'
import { createPushHostKeypair } from '../host-auth/host-challenge-answering.test-fixture.js'
import { createPushServerHarness, FCM_TOKEN } from './push-server-harness.test-fixture.js'
it('bounds valid hosts together across routes without letting key rotation reset the IP budget', async () => {
@@ -1,4 +1,4 @@
import type { PushDatabase } from './push-database.js'
import type { CloudDatabase as PushDatabase } from '@orca-cloud/cloud-database/cloud-database'
export type PushReadinessOptions = {
cacheMs?: number
@@ -1,6 +1,6 @@
import { afterEach, expect, it } from 'vitest'
import { createPushServerHarness, notification } from './push-server-harness.test-fixture.js'
import { createPushHostKeypair } from './host-challenge-answering.test-fixture.js'
import { createPushHostKeypair } from '../host-auth/host-challenge-answering.test-fixture.js'
const harnesses: Awaited<ReturnType<typeof createPushServerHarness>>[] = []
afterEach(async () => {
await Promise.all(harnesses.splice(0).map((h) => h.close()))
@@ -34,31 +34,3 @@ it('returns queued for concurrent retries without double quota or delivery', asy
await h.flushDeliveries()
expect(h.fcmRequests).toHaveLength(2)
})
it.each([false, true])(
'accepts default alert kind equivalently through the API (explicit first: %s)',
async (explicitFirst) => {
const h = await createPushServerHarness()
harnesses.push(h)
const token = await h.signIn(createPushHostKeypair(3))
const registrationId = await h.registerAndroid(token)
const implicit = notification()
const explicit = { kind: 'alert', ...implicit }
for (const event of explicitFirst ? [explicit, implicit] : [implicit, explicit]) {
const response = await h.post(
'/v1/send',
{ v: 1, registrationIds: [registrationId], notification: event },
token
)
expect(await response.json()).toEqual({ results: [{ registrationId, status: 'queued' }] })
}
await h.flushDeliveries()
expect(h.fcmRequests).toHaveLength(1)
const changed = await h.post(
'/v1/send',
{ v: 1, registrationIds: [registrationId], notification: { ...explicit, body: 'changed' } },
token
)
expect(await changed.json()).toEqual({ results: [{ registrationId, status: 'error' }] })
}
)
@@ -1,8 +1,8 @@
import { PUSH_LIMITS } from '@orca-cloud/push-contract'
import { PUSH_LIMITS } from '@orca-cloud/push-contract/push-limits'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { createPushHostKeypair } from './host-challenge-answering.test-fixture.js'
import type { PushDatabase } from './push-database.js'
import { createPushServer } from './push-server.js'
import { createPushHostKeypair } from '../host-auth/host-challenge-answering.test-fixture.js'
import type { CloudDatabase as PushDatabase } from '@orca-cloud/cloud-database/cloud-database'
import { createPushServer } from '../push-server.js'
import { createPushServerHarness, testPushConfig } from './push-server-harness.test-fixture.js'
describe('push gateway authentication and device routes', () => {
@@ -1,15 +1,17 @@
import { generateKeyPairSync } from 'node:crypto'
import { expect } from 'vitest'
import type { ApnsRequest, ApnsResponse } from './apns-http2-transport.js'
import type { PushConfig } from './config.js'
import type { FcmRequest, FcmResponse } from './fcm-client.js'
import type { ApnsRequest } from '../providers/apns/apns-http2-transport.js'
import type { ApnsResponse } from '../providers/apns/apns-stream-response.js'
import type { PushConfig } from '../config.js'
import type { FcmRequest, FcmResponse } from '../providers/fcm/fcm-client.js'
import {
answerPushHostChallenge,
hostPublicKeyB64,
type PushHostKeypair
} from './host-challenge-answering.test-fixture.js'
import { openInMemoryPushDatabase, type PushDatabase } from './push-database.js'
import { createPushServer } from './push-server.js'
} from '../host-auth/host-challenge-answering.test-fixture.js'
import { openInMemoryPushDatabase } from '../database/push-database.js'
import type { CloudDatabase as PushDatabase } from '@orca-cloud/cloud-database/cloud-database'
import { createPushServer } from '../push-server.js'
export const GATEWAY_ORIGIN = 'https://push.onorca.dev'
export const APNS_TOKEN = 'a'.repeat(64)
@@ -1,11 +1,10 @@
import { PUSH_LIMITS } from '@orca-cloud/push-contract'
import { PUSH_LIMITS } from '@orca-cloud/push-contract/push-limits'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { createPushHostKeypair, hostPublicKeyB64 } from './host-challenge-answering.test-fixture.js'
import {
createPushServerHarness,
FCM_TOKEN,
notification
} from './push-server-harness.test-fixture.js'
createPushHostKeypair,
hostPublicKeyB64
} from '../host-auth/host-challenge-answering.test-fixture.js'
import { createPushServerHarness, notification } from './push-server-harness.test-fixture.js'
const CLIENT_IP = '203.0.113.7'
const OTHER_CLIENT_IP = '198.51.100.9'
@@ -177,51 +176,6 @@ describe('push gateway request limits', () => {
expect(challenge.status).toBe(200)
})
it('stops repeated forged bearers after the invalid-auth budget is exhausted', async () => {
const headers = { 'x-forwarded-for': CLIENT_IP }
const [before] = await harness.database.query('SELECT COUNT(*) AS sessions FROM push_sessions')
for (let index = 0; index < PUSH_LIMITS.unauthenticatedRequestsPerMinutePerIp; index++) {
const refused = await harness.authorized('/v1/send', { method: 'POST', headers }, 'forged')
expect(refused.status).toBe(401)
}
const limited = await harness.authorized('/v1/send', { method: 'POST', headers }, 'forged')
expect(limited.status).toBe(429)
expect(await limited.json()).toEqual({ error: 'rate_limited' })
expect(harness.server.unauthenticatedIps.trackedIpCount()).toBe(0)
const [after] = await harness.database.query('SELECT COUNT(*) AS sessions FROM push_sessions')
expect(Number(after?.sessions)).toBe(Number(before?.sessions))
})
it('answers 409 once a host has registered its device allowance', async () => {
const sessionToken = await harness.signIn(createPushHostKeypair(66))
for (let index = 0; index < PUSH_LIMITS.maxDevicesPerHost; index++) {
const accepted = await harness.post(
'/v1/devices',
{
v: 1,
deviceId: `device-${index}`,
platform: 'android',
token: FCM_TOKEN
},
sessionToken
)
expect(accepted.status).toBe(200)
}
const refused = await harness.post(
'/v1/devices',
{ v: 1, deviceId: 'one-too-many', platform: 'android', token: FCM_TOKEN },
sessionToken
)
expect(refused.status).toBe(409)
expect(await refused.json()).toEqual({ error: 'too_many_devices' })
const listed = await harness.authorized('/v1/devices', {}, sessionToken)
expect(((await listed.json()) as { devices: unknown[] }).devices).toHaveLength(
PUSH_LIMITS.maxDevicesPerHost
)
})
// Why: a database error carries the failing row in its message. The response
// and the log must both stop at the error's name.
it('answers an unexpected route failure with a bare 500 and logs only the name', async () => {
@@ -1,7 +1,7 @@
import { PushNotificationSchema } from '@orca-cloud/push-contract'
import { PUSH_LIMITS } from '@orca-cloud/push-contract'
import { PushNotificationSchema } from '@orca-cloud/push-contract/send-messages'
import { PUSH_LIMITS } from '@orca-cloud/push-contract/push-limits'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { createPushHostKeypair } from './host-challenge-answering.test-fixture.js'
import { createPushHostKeypair } from '../host-auth/host-challenge-answering.test-fixture.js'
import {
APNS_TOKEN,
createPushServerHarness,
@@ -0,0 +1,46 @@
import { afterEach, expect, it, vi } from 'vitest'
import { startPushBackground } from '../push-background.js'
import { createPushHostKeypair } from '../host-auth/host-challenge-answering.test-fixture.js'
import { createPushServerHarness, notification } from './push-server-harness.test-fixture.js'
const cleanups: (() => Promise<void>)[] = []
afterEach(async () => {
for (const cleanup of cleanups.splice(0)) {
await cleanup()
}
vi.useRealTimers()
vi.restoreAllMocks()
})
async function fixture() {
const h = await createPushServerHarness()
const token = await h.signIn(createPushHostKeypair(31))
const registrationId = await h.registerAndroid(token)
let stop = async () => {}
cleanups.push(async () => {
await stop()
await h.close()
})
vi.useFakeTimers()
return {
...h,
registrationId,
start: () => {
stop = startPushBackground({ mode: 'active' }, h.server)
},
send: (event = notification(), ids = [registrationId]) =>
h.post('/v1/send', { v: 1, registrationIds: ids, notification: event }, token),
invalid: () => h.post('/v1/send', { v: 1 }, token)
}
}
it('keeps concurrent accepted retries idempotent while automatic delivery runs', async () => {
const h = await fixture()
h.start()
await Promise.all(Array.from({ length: 10 }, () => h.send()))
await vi.waitFor(() => expect(h.fcmRequests).toHaveLength(1))
await h.send()
await h.server.worker.runDue()
expect(h.fcmRequests).toHaveLength(1)
expect(await h.server.deliveryStore.pendingCount(h.registrationId)).toBe(0)
})
+1 -1
View File
@@ -1,6 +1,6 @@
import { startPushBackground } from './push-background.js'
import { loadPushConfig } from './config.js'
import { openPushDatabase } from './push-database.js'
import { openPushDatabase } from './database/push-database.js'
import { createPushServer } from './push-server.js'
const config = loadPushConfig()
@@ -1,5 +1,5 @@
import { createPrivateKey, type KeyObject, sign } from 'node:crypto'
import type { ApnsCredentials } from './config.js'
import type { ApnsCredentials } from '../../config.js'
// Apple rejects a provider token older than an hour and throttles reissue
// under about 20 minutes, so 50 minutes is the safe rotation point.
@@ -2,9 +2,10 @@ import { generateKeyPairSync } from 'node:crypto'
import { expect, it } from 'vitest'
import { ApnsClient } from './apns-client.js'
import type { ApnsRequest, ApnsResponse } from './apns-http2-transport.js'
import type { ApnsCredentials } from './config.js'
import { buildPushDelivery } from './push-delivery-message.js'
import type { ApnsRequest } from './apns-http2-transport.js'
import type { ApnsResponse } from './apns-stream-response.js'
import type { ApnsCredentials } from '../../config.js'
import { buildPushDelivery } from '../../delivery/push-delivery-message.js'
const HOST = 'abcdefghijklmnop'
@@ -46,10 +47,6 @@ function fakeTransport(response: ApnsResponse) {
}
}
it('does not collapse background dismissals with visible alerts', async () => {
const fake = fakeTransport({ status: 200, body: '' })
const apns = new ApnsClient({
@@ -72,29 +69,3 @@ it('does not collapse background dismissals with visible alerts', async () => {
})
expect(JSON.parse(fake.requests[0]!.body).aps).toEqual({ 'content-available': 1 })
})
it('keeps the absolute deadline across retries and refuses expired delivery', async () => {
let now = 1_700_000_000_000
const fake = fakeTransport({ status: 503, body: '{}' })
const client = new ApnsClient({
topic: 'test',
credentials: credentials(),
now: () => now,
transport: fake.transport
})
const pending = delivery(now)
const device = { token: 'test', apnsEnvironment: 'sandbox' as const }
await client.send(pending, device)
now += 60_000
await client.send(pending, device)
expect(fake.requests.map((request) => request.headers['apns-expiration'])).toEqual([
String(pending.expiresAt / 1000),
String(pending.expiresAt / 1000)
])
now = pending.expiresAt
await expect(client.send(pending, device)).resolves.toEqual({
status: 'error',
reason: 'expired'
})
expect(fake.requests).toHaveLength(2)
})
@@ -1,9 +1,9 @@
import type { ApnsEnvironment } from '@orca-cloud/push-contract'
import type { ApnsEnvironment } from '@orca-cloud/push-contract/device-registration-messages'
import { ApnsAuthenticationToken } from './apns-authentication-token.js'
import type { ApnsTransport } from './apns-http2-transport.js'
import type { ApnsCredentials } from './config.js'
import type { PushDelivery } from './push-delivery-message.js'
import type { PushProviderOutcome } from './push-provider-outcome.js'
import type { ApnsCredentials } from '../../config.js'
import type { PushDelivery } from '../../delivery/push-delivery-message.js'
import type { PushProviderOutcome } from '../push-provider-outcome.js'
const APNS_HOSTS: Record<ApnsEnvironment, string> = {
production: 'api.push.apple.com',
@@ -8,7 +8,6 @@ export type ApnsRequest = {
body: string
}
export type { ApnsResponse }
export type ApnsTransport = (request: ApnsRequest) => Promise<ApnsResponse>
// Cache APNs HTTP/2 sessions per host until socket loss; long-lived connections avoid reconnect overhead.
@@ -28,8 +28,6 @@ function fakeApnsStream(): FakeStream {
}
describe('apns stream response', () => {
it('rejects when the peer resets the stream without an end or an error', async () => {
const stream = fakeApnsStream()
const pending = readApnsStreamResponse(stream, 'body')
@@ -38,12 +36,4 @@ describe('apns stream response', () => {
stream.emit('close')
await expect(pending).rejects.toThrow('apns_stream_closed')
})
})
@@ -1,5 +1,5 @@
import type { EventEmitter } from 'node:events'
import { providerRetryAfter } from './provider-retry-delay.js'
import { providerRetryAfter } from '../provider-retry-delay.js'
import { constants } from 'node:http2'
export type ApnsResponse = { status: number; body: string; retryAfterMs?: number }
@@ -1,10 +1,10 @@
import { expect, it } from 'vitest'
import { createPushHostKeypair } from './host-challenge-answering.test-fixture.js'
import { createPushHostKeypair } from '../../host-auth/host-challenge-answering.test-fixture.js'
import {
APNS_TOKEN,
createPushServerHarness,
notification
} from './push-server-harness.test-fixture.js'
} from '../../http/push-server-harness.test-fixture.js'
it('delivers again after a topic error without re-registering the phone', async () => {
const h = await createPushServerHarness()
@@ -1,7 +1,6 @@
import { describe, expect, it } from 'vitest'
import { FcmClient, type FcmRequest, type FcmResponse } from './fcm-client.js'
import { buildPushDelivery } from './push-delivery-message.js'
import { buildPushDelivery } from '../../delivery/push-delivery-message.js'
const NOW = 1_700_000_000_000
const HOST = 'abcdefghijklmnop'
@@ -51,9 +50,6 @@ function client(response: FcmResponse) {
}
describe('fcm client', () => {
it('marks an invalid-argument that names the token dead, and others an error', async () => {
const named = client({
status: 400,
@@ -78,8 +74,6 @@ describe('fcm client', () => {
retryAfterMs: 10000
})
})
})
it('does not send when credential refresh crosses the absolute expiry', async () => {
@@ -100,33 +94,3 @@ it('does not send when credential refresh crosses the absolute expiry', async ()
})
expect(fake.requests).toHaveLength(0)
})
it('decreases retry TTL and refuses expired delivery before refreshing credentials', async () => {
let now = NOW
let refreshes = 0
const fake = fakeTransport({ status: 503, body: '{}' })
const fcm = new FcmClient({
projectId: 'test',
now: () => now,
accessToken: async () => {
refreshes++
return 'test-token'
},
transport: fake.transport
})
const pending = delivery()
await fcm.send(pending, { token: TOKEN })
now += 60_000
await fcm.send(pending, { token: TOKEN })
expect(fake.requests.map((request) => JSON.parse(request.body).message.android.ttl)).toEqual([
'300s',
'240s'
])
now = pending.expiresAt
await expect(fcm.send(pending, { token: TOKEN })).resolves.toEqual({
status: 'error',
reason: 'expired'
})
expect(fake.requests).toHaveLength(2)
expect(refreshes).toBe(2)
})
@@ -1,7 +1,7 @@
import { providerRetryAfter } from './provider-retry-delay.js'
import { PUSH_DEFAULTS } from '@orca-cloud/push-contract'
import { orcaDataStrings, type PushDelivery } from './push-delivery-message.js'
import type { PushProviderOutcome } from './push-provider-outcome.js'
import { providerRetryAfter } from '../provider-retry-delay.js'
import { PUSH_DEFAULTS } from '@orca-cloud/push-contract/push-limits'
import { orcaDataStrings, type PushDelivery } from '../../delivery/push-delivery-message.js'
import type { PushProviderOutcome } from '../push-provider-outcome.js'
export const FCM_SCOPE = 'https://www.googleapis.com/auth/firebase.messaging'
+5 -4
View File
@@ -1,5 +1,5 @@
import type { PushConfig } from './config.js'
import type { PushPruneSweep } from './durable-push-store.js'
import type { PushPruneSweep } from './delivery/durable-push-store.js'
import type { createPushServer } from './push-server.js'
const CHALLENGE_PRUNE_INTERVAL_MS = 60_000
@@ -45,9 +45,10 @@ function prune(label: string, run: () => Promise<PushPruneSweep>, intervalMs: nu
}
// One DELETE under a statement timeout: there is no batch budget for it to exhaust.
const unbatchedSweep =
(run: () => Promise<number>) =>
async (): Promise<PushPruneSweep> => ({ deleted: await run(), saturated: false })
const unbatchedSweep = (run: () => Promise<number>) => async (): Promise<PushPruneSweep> => ({
deleted: await run(),
saturated: false
})
export function startPushBackground(
config: Pick<PushConfig, 'mode'>,
@@ -1,101 +0,0 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { randomUUID } from 'node:crypto'
const fakes = vi.hoisted(() => ({
configs: [] as Array<Record<string, unknown>>,
lifecycle: [] as string[],
query: vi.fn(async (_sql: string) => ({ rows: [], rowCount: 0 })),
release: vi.fn()
}))
vi.mock('pg', () => ({
default: {
Pool: class {
on = vi.fn()
connect = vi.fn(async () => ({ query: fakes.query, release: fakes.release }))
private readonly label: string
constructor(config: Record<string, unknown>) {
fakes.configs.push(config)
this.label = `max=${String(config.max)} statement_timeout=${String(config.statement_timeout)}`
fakes.lifecycle.push(`open ${this.label}`)
}
async end(): Promise<void> {
fakes.lifecycle.push(`end ${this.label}`)
}
}
}
}))
import { openPushDatabase } from './push-database.js'
import { pushSchemaStatements } from './push-schema.js'
describe('PostgreSQL push gateway startup', () => {
beforeEach(() => {
fakes.configs.length = 0
fakes.lifecycle.length = 0
fakes.query.mockClear()
})
afterEach(() => {
vi.restoreAllMocks()
})
const socketPassword = `${randomUUID()}@/`
const socketUrl = `postgresql://push:${encodeURIComponent(socketPassword)}@/orca_push?host=/cloudsql/test:region:instance`
it('passes the Terraform socket URL unchanged to both active pools', async () => {
const database = await openPushDatabase({ databaseUrl: socketUrl, dataDir: '/unused' })
expect(fakes.configs.map((config) => config.connectionString)).toEqual([socketUrl, socketUrl])
await database.close()
})
it('parses socket credentials and query options before enforcing validation read-only', async () => {
const options = '-c search_path=validation -c default_transaction_read_only=off'
const database = await openPushDatabase({
databaseUrl: `${socketUrl}&port=5433&sslmode=disable&options=${encodeURIComponent(options)}`,
dataDir: '/unused',
readOnly: true
})
expect(fakes.configs).toHaveLength(1)
expect(fakes.configs[0]).toMatchObject({
host: '/cloudsql/test:region:instance',
user: 'push',
password: socketPassword,
database: 'orca_push',
port: 5433,
ssl: false,
options: `${options} -c default_transaction_read_only=on`
})
expect(fakes.configs[0]).not.toHaveProperty('connectionString')
expect(fakes.query).not.toHaveBeenCalled()
await database.close()
})
// Growing-table CREATE INDEX can exceed request deadlines; inheriting them makes startup fail forever at the same DDL.
it('applies the schema on an untimed pool that is gone before the serving pool opens', async () => {
const database = await openPushDatabase({
databaseUrl: 'postgresql://push@localhost:55440/orca_push',
dataDir: '/unused',
poolMax: 2,
applicationName: 'orca-push'
})
expect(fakes.lifecycle).toEqual([
'open max=1 statement_timeout=0',
'end max=1 statement_timeout=0',
'open max=2 statement_timeout=5000'
])
expect(fakes.configs[0]).toMatchObject({
application_name: 'orca-push/schema',
lock_timeout: 1_000,
idle_in_transaction_session_timeout: 5_000
})
expect(
fakes.query.mock.calls.map(([sql]) => sql).slice(0, pushSchemaStatements().length)
).toEqual(pushSchemaStatements())
await database.close()
})
})
@@ -1,12 +1,13 @@
import { afterEach, expect, it, vi } from 'vitest'
import { Hono } from 'hono'
import { PushRequestDrain } from './push-request-drain.js'
import { PushDispatcher } from './push-dispatcher.js'
import { PushDeviceRegistryStore } from './device-registry-store.js'
import { openInMemoryPushDatabase, type PushDatabase } from './push-database.js'
import { buildPushDelivery } from './push-delivery-message.js'
import { PushNotificationSchema } from '@orca-cloud/push-contract'
import { notification } from './push-server-harness.test-fixture.js'
import { PushRequestDrain } from './http/push-request-drain.js'
import { PushDispatcher } from './delivery/push-dispatcher.js'
import { PushDeviceRegistryStore } from './devices/device-registry-store.js'
import { openInMemoryPushDatabase } from './database/push-database.js'
import type { CloudDatabase as PushDatabase } from '@orca-cloud/cloud-database/cloud-database'
import { buildPushDelivery } from './delivery/push-delivery-message.js'
import { PushNotificationSchema } from '@orca-cloud/push-contract/send-messages'
import { notification } from './http/push-server-harness.test-fixture.js'
const databases: PushDatabase[] = []
afterEach(async () => {
@@ -1,31 +0,0 @@
import { expect, it } from 'vitest'
import { apnsBody } from './apns-client.js'
import { fcmMessageBody } from './fcm-client.js'
import { buildPushDelivery } from './push-delivery-message.js'
it('dismissal provider payloads cannot display a new alert or play a sound', () => {
const delivery = buildPushDelivery({
expiresAt: Date.now() + 300_000,
registrationId: 'reg',
hostFingerprint: 'host',
notification: {
kind: 'dismiss',
notificationId: 'note',
notificationSeq: 2,
notificationEpoch: 'epoch',
source: 'agent-task-complete',
agentState: null,
title: 'Orca',
body: ''
}
})
expect(JSON.parse(apnsBody(delivery)).aps).toEqual({ 'content-available': 1 })
const android = JSON.parse(fcmMessageBody({ delivery, token: 'test', channelId: 'test' })).message
expect(android).not.toHaveProperty('notification')
expect(android.android).not.toHaveProperty('notification')
expect(android.android).not.toHaveProperty('collapse_key')
expect(android.data).not.toHaveProperty('title')
expect(android.data).not.toHaveProperty('message')
expect(android.data).not.toHaveProperty('sound')
expect(android.data.kind).toBe('dismiss')
})
@@ -1,33 +0,0 @@
import { expect, it } from 'vitest'
import { apnsBody } from './apns-client.js'
import { fcmMessageBody } from './fcm-client.js'
import { buildPushDelivery } from './push-delivery-message.js'
import { PushNotificationSchema } from '@orca-cloud/push-contract'
it('carries a silent preference through validation to APNs and Android payloads', () => {
const notification = PushNotificationSchema.parse({
notificationSeq: 1,
notificationEpoch: 'epoch',
source: 'terminal-bell',
agentState: null,
title: 'Bell',
body: '',
sound: false
})
const delivery = buildPushDelivery({
expiresAt: Date.now() + 300_000,
registrationId: 'reg',
hostFingerprint: 'host',
notification
})
expect(JSON.parse(apnsBody(delivery)).aps).not.toHaveProperty('sound')
expect(
JSON.parse(fcmMessageBody({ delivery, token: 'test-token', channelId: 'orca-desktop' })).message
.data.channelId
).toBe('orca-desktop-silent')
expect(
JSON.parse(fcmMessageBody({ delivery, token: 'test-token', channelId: 'orca-desktop' })).message
.data.sound
).toBe('')
expect(JSON.parse(apnsBody({ ...delivery, sound: undefined })).aps.sound).toBe('default')
})
@@ -1,56 +0,0 @@
import { randomUUID } from 'node:crypto'
import pg from 'pg'
import { afterEach, expect, it, vi } from 'vitest'
import { openPushDatabase } from './push-database.js'
import { durablePushTestDatabaseUrl } from './durable-push-store.test-fixture.js'
const QUEUE_INDEXES = ['push_batches_pending_device']
const cleanups: (() => Promise<void>)[] = []
afterEach(async () => {
vi.restoreAllMocks()
for (const cleanup of cleanups.splice(0).reverse()) await cleanup()
})
// Push applies its schema with retryLockTimeout, so a lock timeout is retried, never deferred:
// the new revision either boots with every index or does not boot at all.
it.skipIf(!durablePushTestDatabaseUrl)(
'creates the queue index after waiting out a writer that holds the table',
async () => {
const admin = new pg.Client({ connectionString: durablePushTestDatabaseUrl })
await admin.connect()
const schema = `boot_${randomUUID().replaceAll('-', '')}`
cleanups.push(async () => {
await admin.query(`DROP SCHEMA IF EXISTS ${schema} CASCADE`)
await admin.end()
})
await admin.query(`CREATE SCHEMA ${schema}`)
const url = new URL(durablePushTestDatabaseUrl!)
url.searchParams.set('options', `-c search_path=${schema}`)
await (await openPushDatabase({ databaseUrl: url.toString(), dataDir: '' })).close()
await admin.query(
`DROP INDEX ${QUEUE_INDEXES.map((name) => `${schema}.${name}`).join(', ')}`
)
const writer = new pg.Client({ connectionString: url.toString() })
await writer.connect()
cleanups.push(() => writer.end())
await writer.query('BEGIN')
await writer.query('LOCK TABLE push_delivery_batches IN ROW EXCLUSIVE MODE')
const warnings: string[] = []
vi.spyOn(console, 'warn').mockImplementation((line: string) => warnings.push(line))
vi.spyOn(console, 'log').mockImplementation(() => undefined)
const held = setTimeout(() => void writer.query('COMMIT'), 2_500)
cleanups.push(async () => clearTimeout(held))
const booted = await openPushDatabase({ databaseUrl: url.toString(), dataDir: '' })
await booted.close()
const { rows } = await admin.query(
'SELECT indexname FROM pg_indexes WHERE schemaname = $1 AND indexname = ANY($2) ORDER BY 1',
[schema, QUEUE_INDEXES]
)
expect(rows.map((row) => row.indexname)).toEqual(QUEUE_INDEXES)
const events = warnings.map((line) => JSON.parse(line).event)
expect(events).toContain('orca_push_postgres_schema_retry')
expect(events).not.toContain('orca_push_postgres_schema_object_deferred')
}
)
@@ -1,111 +0,0 @@
import { afterEach, expect, it, vi } from 'vitest'
import { startPushBackground } from './push-background.js'
import { createPushHostKeypair } from './host-challenge-answering.test-fixture.js'
import { createPushServerHarness, notification } from './push-server-harness.test-fixture.js'
const cleanups: (() => Promise<void>)[] = []
afterEach(async () => {
for (const cleanup of cleanups.splice(0)) await cleanup()
vi.useRealTimers()
vi.restoreAllMocks()
})
async function fixture() {
const h = await createPushServerHarness()
const token = await h.signIn(createPushHostKeypair(31))
const registrationId = await h.registerAndroid(token)
let stop = async () => {}
cleanups.push(async () => {
await stop()
await h.close()
})
vi.useFakeTimers()
return {
...h,
registrationId,
start: () => {
stop = startPushBackground({ mode: 'active' }, h.server)
},
send: (event = notification(), ids = [registrationId]) =>
h.post('/v1/send', { v: 1, registrationIds: ids, notification: event }, token),
invalid: () => h.post('/v1/send', { v: 1 }, token)
}
}
it('delivers a committed send before the next poll without waiting in the HTTP handler', async () => {
const h = await fixture()
h.start()
const startedAt = Date.now()
const claim = h.server.deliveryStore.claim.bind(h.server.deliveryStore)
const release = Promise.withResolvers<void>()
vi.spyOn(h.server.deliveryStore, 'claim').mockImplementation(async () => {
await release.promise
return claim()
})
try {
const response = await h.send()
expect(await response.json()).toEqual({
results: [{ registrationId: h.registrationId, status: 'queued' }]
})
expect(h.fcmRequests).toHaveLength(0)
release.resolve()
await vi.waitFor(() => expect(h.fcmRequests).toHaveLength(1))
expect(Date.now() - startedAt).toBeLessThan(1000)
expect(JSON.parse(h.fcmRequests[0]!.body).message.data.notificationSeq).toBe('1')
} finally {
release.resolve()
}
})
it('keeps concurrent accepted retries idempotent while automatic delivery runs', async () => {
const h = await fixture()
h.start()
await Promise.all(Array.from({ length: 10 }, () => h.send()))
await vi.waitFor(() => expect(h.fcmRequests).toHaveLength(1))
await h.send()
await h.server.worker.runDue()
expect(h.fcmRequests).toHaveLength(1)
expect(await h.server.deliveryStore.pendingCount(h.registrationId)).toBe(0)
})
it('does not wake for invalid, unowned or dead registrations', async () => {
const h = await fixture()
h.start()
const wake = vi.spyOn(h.server.worker, 'wake')
expect((await h.invalid()).status).toBe(400)
expect(await (await h.send(notification(), ['unknown'])).json()).toEqual({
results: [{ registrationId: 'unknown', status: 'error' }]
})
const device = await h.server.devices.findById(h.registrationId)
if (!device) throw new Error('registration missing')
await h.server.devices.markDead(device)
expect(await (await h.send()).json()).toEqual({
results: [{ registrationId: h.registrationId, status: 'dead' }]
})
expect(wake).not.toHaveBeenCalled()
expect(h.fcmRequests).toHaveLength(0)
})
it.each(['queued', 'sent'] as const)(
'preserves dismissal of an already %s alert',
async (phase) => {
const h = await fixture()
if (phase === 'sent') h.start()
await h.send()
if (phase === 'sent') await vi.waitFor(() => expect(h.fcmRequests).toHaveLength(1))
await h.send(notification({ kind: 'dismiss', notificationSeq: 2, sound: false }))
if (phase === 'queued') {
h.start()
await vi.advanceTimersByTimeAsync(1000)
}
await vi.waitFor(() => expect(h.fcmRequests).toHaveLength(phase === 'sent' ? 2 : 1))
const last = h.fcmRequests.at(-1)
if (!last) throw new Error('dismissal missing')
const message = JSON.parse(last.body).message
expect(message.data.kind).toBe('dismiss')
expect(message.data.notificationId).toBe('note-1')
expect(message.data.notificationSeq).toBe('2')
expect(message.data.title).toBeUndefined()
expect(message.data.sound).toBeUndefined()
}
)
+32 -22
View File
@@ -1,32 +1,42 @@
import { PushAuthAdmission } from './push-auth-admission.js'
import { PushAuthAdmission } from './http/push-auth-admission.js'
import { createAdaptorServer } from '@hono/node-server'
import { PUSH_LIMITS } from '@orca-cloud/push-contract/push-limits'
import { PushDeviceRegistrationRequestSchema } from '@orca-cloud/push-contract/device-registration-messages'
import {
PUSH_LIMITS,
PushDeviceRegistrationRequestSchema,
PushHostChallengeRequestSchema,
PushHostSessionRequestSchema,
PushSendRequestSchema,
type PushSendResult
} from '@orca-cloud/push-contract'
PushHostSessionRequestSchema
} from '@orca-cloud/push-contract/host-auth-messages'
import { PushSendRequestSchema, type PushSendResult } from '@orca-cloud/push-contract/send-messages'
import { Hono, type MiddlewareHandler } from 'hono'
import { bodyLimit } from 'hono/body-limit'
import { ApnsClient } from './apns-client.js'
import { createApnsHttp2Transport, type ApnsTransport } from './apns-http2-transport.js'
import { clientIpRateLimit, ClientIpRateLimiter, readClientIp } from './client-ip-rate-limit.js'
import { DurablePushStore } from './durable-push-store.js'
import { DurablePushWorker } from './durable-push-worker.js'
import { ApnsClient } from './providers/apns/apns-client.js'
import {
createApnsHttp2Transport,
type ApnsTransport
} from './providers/apns/apns-http2-transport.js'
import {
clientIpRateLimit,
ClientIpRateLimiter,
readClientIp
} from './http/client-ip-rate-limit.js'
import { DurablePushStore } from './delivery/durable-push-store.js'
import { DurablePushWorker } from './delivery/durable-push-worker.js'
import type { PushConfig } from './config.js'
import { PushDeviceRegistryStore } from './device-registry-store.js'
import { createFcmAccessTokenProvider } from './fcm-access-token.js'
import { createFcmFetchTransport, FcmClient, type FcmTransport } from './fcm-client.js'
import { PushHostChallengeStore } from './host-challenge-store.js'
import { PushHostSessionStore } from './host-session-store.js'
import type { PushDatabase } from './push-database.js'
import { PushDispatcher } from './push-dispatcher.js'
import { PushDeviceRegistryStore } from './devices/device-registry-store.js'
import { createFcmAccessTokenProvider } from './providers/fcm/fcm-access-token.js'
import {
createFcmFetchTransport,
FcmClient,
type FcmTransport
} from './providers/fcm/fcm-client.js'
import { PushHostChallengeStore } from './host-auth/host-challenge-store.js'
import { PushHostSessionStore } from './host-auth/host-session-store.js'
import type { CloudDatabase as PushDatabase } from '@orca-cloud/cloud-database/cloud-database'
import { PushDispatcher } from './delivery/push-dispatcher.js'
import { PushObservability } from './push-observability.js'
import { reserveRequestConnection } from './push-background-database.js'
import { createPushReadiness } from './push-readiness.js'
import { PushRequestDrain } from './push-request-drain.js'
import { reserveRequestConnection } from './database/push-background-database.js'
import { createPushReadiness } from './http/push-readiness.js'
import { PushRequestDrain } from './http/push-request-drain.js'
export type PushServerOptions = {
now?: () => number
@@ -1,90 +0,0 @@
import { expect, it, vi } from 'vitest'
import { loadPushConfig } from './config.js'
import { openPushDatabase } from './push-database.js'
import { createPushServer } from './push-server.js'
import { startPushBackground } from './push-background.js'
it('fails closed on an invalid validation mode', () => {
for (const mode of ['typo', '', ' ']) {
expect(() =>
loadPushConfig({
ORCA_PUSH_FCM_PROJECT_ID: 'onorca-cloud',
ORCA_PUSH_PUBLIC_URL: 'https://push.onorca.dev',
ORCA_PUSH_MODE: mode
})
).toThrow()
}
})
const databaseUrl = process.env.ORCA_PUSH_TEST_DATABASE_URL
it.skipIf(!databaseUrl)(
'validation cannot write PostgreSQL and starts no consumers or pruners',
async () => {
if (!process.env.CI && new URL(databaseUrl!).port !== '55440')
throw new Error('isolated_postgres_port_required')
const active = await openPushDatabase({ databaseUrl, dataDir: '' })
const schema = `validation_${Date.now()}`
await active.query(`CREATE SCHEMA ${schema}`)
const isolatedUrl = new URL(databaseUrl!)
isolatedUrl.searchParams.set(
'options',
`-c search_path=${schema} -c default_transaction_read_only=off`
)
isolatedUrl.searchParams.set('host', isolatedUrl.hostname)
isolatedUrl.searchParams.set('port', isolatedUrl.port)
const hostlessUrl = `postgresql://${isolatedUrl.username}:${isolatedUrl.password}@${isolatedUrl.pathname}?${isolatedUrl.searchParams}`
const database = await openPushDatabase({
databaseUrl: hostlessUrl,
dataDir: '',
readOnly: true
})
const config = loadPushConfig({
ORCA_PUSH_FCM_PROJECT_ID: 'onorca-cloud',
ORCA_PUSH_PUBLIC_URL: 'https://push.onorca.dev',
ORCA_PUSH_MODE: 'validation'
})
const runtime = createPushServer(config, database)
let stop: (() => Promise<void>) | undefined
try {
const [setting] = await database.query(
"SELECT current_setting('default_transaction_read_only') AS default_transaction_read_only"
)
expect(setting!.default_transaction_read_only).toBe('on')
await expect(
database.query(`CREATE TABLE ${schema}.forbidden (id integer)`)
).rejects.toMatchObject({ code: '25006' })
// An empty schema stays empty: validation must not run startup DDL.
expect(
await active.query('SELECT tablename FROM pg_tables WHERE schemaname = ?', [schema])
).toEqual([])
const calls = vi.spyOn(database, 'query')
const claim = vi.spyOn(runtime.deliveryStore, 'claim')
const send = vi.spyOn(runtime.worker, 'start')
vi.useFakeTimers()
stop = startPushBackground(config, runtime)
await vi.advanceTimersByTimeAsync(31 * 60_000)
expect(calls).not.toHaveBeenCalled()
expect(claim).not.toHaveBeenCalled()
expect(send).not.toHaveBeenCalled()
vi.useRealTimers()
expect(await (await runtime.app.request('/health')).json()).toMatchObject({
mode: 'validation'
})
expect((await runtime.app.request('/ready')).status).toBe(200)
expect((await runtime.app.request('/v1/host/challenge', { method: 'POST' })).status).toBe(503)
expect((await runtime.app.request('/v1/send', { method: 'POST' })).status).toBe(503)
expect(calls.mock.calls.map(([sql]) => sql)).toEqual(['SELECT 1 AS ready'])
await expect(
database.query('DELETE FROM public.push_challenges WHERE false')
).rejects.toMatchObject({ code: '25006' })
} finally {
vi.useRealTimers()
await stop?.()
runtime.closeTransports()
await database.close()
await active.query(`DROP SCHEMA ${schema} CASCADE`)
await active.close()
vi.restoreAllMocks()
}
}
)
@@ -1,101 +0,0 @@
import { mkdtempSync, rmSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { DatabaseSync } from 'node:sqlite'
import { setImmediate } from 'node:timers/promises'
import { expect, it, vi } from 'vitest'
import { openPushDatabase } from './push-database.js'
it('releases queued work and close after a SQLite transaction cannot acquire its lock', async () => {
const dataDir = mkdtempSync(join(tmpdir(), 'orca-push-sqlite-queue-'))
let connection: DatabaseSync | undefined
const prepare = DatabaseSync.prototype.prepare
// Keep the native handle reachable for cleanup even if a queue regression strands close().
const capture = vi
.spyOn(DatabaseSync.prototype, 'prepare')
.mockImplementation(function (this: DatabaseSync, sql) {
connection = this
return prepare.call(this, sql)
})
const database = await openPushDatabase({ dataDir })
capture.mockRestore()
const blocker = new DatabaseSync(join(dataDir, 'orca-push.sqlite'))
try {
await database.query('CREATE TABLE queue_progress (value INTEGER)')
await database.query('INSERT INTO queue_progress VALUES (0)')
blocker.exec('BEGIN IMMEDIATE')
const operation = vi.fn(async () => undefined)
await expect(database.transaction(operation)).rejects.toThrow('database is locked')
let lockFailures = 0
const blocked = Array.from({ length: 5 }, () =>
database.transaction(operation).catch(() => {
lockFailures += 1
})
)
await setImmediate()
expect(lockFailures).toBe(5)
await Promise.all(blocked)
expect(operation).not.toHaveBeenCalled()
blocker.exec('ROLLBACK')
let completed = 0
const pending = Array.from({ length: 100 }, () =>
database.transaction(async (transaction) => {
await transaction.query('UPDATE queue_progress SET value = value + 1')
completed += 1
})
)
for (const request of pending) void request.catch(() => undefined)
await setImmediate()
expect(completed).toBe(100)
await Promise.all(pending)
expect(await database.query('SELECT value FROM queue_progress')).toEqual([{ value: 100 }])
let closed = false
const closing = database.close().then(() => {
closed = true
})
await setImmediate()
expect(closed).toBe(true)
await closing
} finally {
capture.mockRestore()
blocker.close()
if (connection?.isOpen) connection.close()
rmSync(dataDir, { recursive: true, force: true })
}
})
it('does not roll back a transaction when BEGIN failed before taking ownership', async () => {
const dataDir = mkdtempSync(join(tmpdir(), 'orca-push-sqlite-owner-'))
let connection: DatabaseSync | undefined
const prepare = DatabaseSync.prototype.prepare
const capture = vi
.spyOn(DatabaseSync.prototype, 'prepare')
.mockImplementation(function (this: DatabaseSync, sql) {
connection = this
return prepare.call(this, sql)
})
const database = await openPushDatabase({ dataDir })
capture.mockRestore()
try {
await database.query('CREATE TABLE queue_owner (value INTEGER)')
await database.query('BEGIN IMMEDIATE')
await database.query('INSERT INTO queue_owner VALUES (7)')
await expect(database.transaction(async () => undefined)).rejects.toThrow(
'cannot start a transaction within a transaction'
)
expect(connection?.isTransaction).toBe(true)
let rows: unknown
void database.query('SELECT value FROM queue_owner').then((result) => {
rows = result
})
await setImmediate()
expect(rows).toEqual([{ value: 7 }])
await database.query('ROLLBACK')
expect(await database.query('SELECT value FROM queue_owner')).toEqual([])
await database.close()
} finally {
capture.mockRestore()
if (connection?.isOpen) connection.close()
rmSync(dataDir, { recursive: true, force: true })
}
})
+11 -1
View File
@@ -1,10 +1,20 @@
{
"name": "@orca-cloud/cloud-database",
"private": true,
"version": "0.0.0",
"private": true,
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./cloud-database": {
"types": "./dist/cloud-database.d.ts",
"default": "./dist/cloud-database.js"
}
},
"scripts": {
"build": "tsc -p tsconfig.build.json",
"clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
+31 -1
View File
@@ -1,10 +1,40 @@
{
"name": "@orca-cloud/push-contract",
"private": true,
"version": "0.0.0",
"private": true,
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./device-registration-messages": {
"types": "./dist/device-registration-messages.d.ts",
"default": "./dist/device-registration-messages.js"
},
"./host-auth-messages": {
"types": "./dist/host-auth-messages.d.ts",
"default": "./dist/host-auth-messages.js"
},
"./push-host-proof-transcript": {
"types": "./dist/push-host-proof-transcript.d.ts",
"default": "./dist/push-host-proof-transcript.js"
},
"./push-limits": {
"types": "./dist/push-limits.d.ts",
"default": "./dist/push-limits.js"
},
"./send-messages": {
"types": "./dist/send-messages.d.ts",
"default": "./dist/send-messages.js"
},
"./wire-scalars": {
"types": "./dist/wire-scalars.d.ts",
"default": "./dist/wire-scalars.js"
}
},
"scripts": {
"build": "pnpm clean && tsc -p tsconfig.build.json",
"clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
+1 -1
View File
@@ -3,7 +3,7 @@ export const CLI_MAIN_ENTRY_NAMES = [
'agent-hooks/installation/managed-agent-hook-controls',
'gitlab/projects/project-ref-parser',
'orca-profiles/profile-index-store',
'claude-accounts/keychain',
'claude-accounts/runtime-auth/keychain',
// The CLI checks a relocated runtime socket dir before it sends the auth token.
'daemon/endpoint/publication/daemon-socket-endpoint-path',
'skills/bundled-skill-install/bundled-skill-local-host',
@@ -47,7 +47,7 @@ export const MAIN_BUILD_ENTRY_POINTS: Record<string, string> = {
),
// Why: a first account setup can merge a large history tree with sync fs calls.
'claude-profile-setup-worker-entry': resolve(
'src/main/claude-accounts/claude-profile-setup-worker-entry.ts'
'src/main/claude-accounts/profiles/setup/claude-profile-setup-worker-entry.ts'
),
'profile-state-backup-worker-entry': resolve(
'src/main/persistence/profile-state/backup/profile-state-backup-worker-entry.ts'
-12
View File
@@ -151,11 +151,6 @@
1 test-no-real-time-wait:src/main/browser/identity/wire-probes/browser-session-ua-wire-identity.electron.test.ts
1 test-no-real-time-wait:src/main/browser/network/tunnels/execution-route-socket-duplex.test.ts
1 test-no-real-time-wait:src/main/browser/network/tunnels/remote-browser-socks-server.test.ts
1 test-no-real-time-wait:src/main/claude-accounts/claude-login-session.test.ts
1 test-no-real-time-wait:src/main/claude-accounts/claude-profile-router.test.ts
1 test-no-real-time-wait:src/main/claude-accounts/claude-profile-wsl-router.test.ts
1 test-no-real-time-wait:src/main/claude-accounts/runtime-auth-service.test.ts
1 test-no-real-time-wait:src/main/claude-usage/scanner-incremental-reader.test.ts
1 test-no-real-time-wait:src/main/claude/claude-agent-sdk-exit-proof.test.ts
1 test-no-real-time-wait:src/main/claude/claude-agent-sdk-user-message-queue.test.ts
1 test-no-real-time-wait:src/main/claude/claude-stop-ack-race.test.ts
@@ -195,9 +190,6 @@
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/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
1 test-no-real-time-wait:src/main/ipc/filesystem/watcher-process/rebinding-file-watch.test.ts
4 test-no-real-time-wait:src/main/ipc/runtime-environments/runtime-environment-request-connections.test.ts
1 test-no-real-time-wait:src/main/ipc/worktrees/creation/worktree-base-directory-poller-marker-fanout.test.ts
2 test-no-real-time-wait:src/main/ipc/worktrees/git/worktree-git-status-attribution-real-git.test.ts
@@ -625,9 +617,6 @@
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-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
@@ -648,7 +637,6 @@
1 test-timeout-needs-reason:src/main/browser/guest-lifecycle/find/browser-find-frame-traversal.electron.test.ts
1 test-timeout-needs-reason:src/main/browser/identity/wire-probes/browser-session-ua-wire-identity-cross-context.electron.test.ts
1 test-timeout-needs-reason:src/main/browser/identity/wire-probes/browser-session-ua-wire-identity.electron.test.ts
3 test-timeout-needs-reason:src/main/claude-usage/scanner-incremental-reader.test.ts
1 test-timeout-needs-reason:src/main/claude/claude-agent-sdk-exit-proof.test.ts
1 test-timeout-needs-reason:src/main/claude/claude-background-run-isolation-real-cli.test.ts
2 test-timeout-needs-reason:src/main/claude/claude-status-line-windows.test.ts
+3 -3
View File
@@ -16,7 +16,7 @@
"src/main/ipc/filesystem/watcher-process/parcel-watcher-process-entry.ts",
"src/main/hang-watchdog/main-thread-hang-watchdog-entry.ts",
"src/main/agent-hooks/installation/managed-agent-hook-controls.ts",
"src/main/claude-accounts/keychain.ts",
"src/main/claude-accounts/runtime-auth/keychain.ts",
"src/renderer/src/main.tsx",
"src/renderer/src/popout.tsx",
"src/renderer/src/web/main.tsx",
@@ -43,12 +43,12 @@
"src/main/native-chat/wsl-transcript-fs-process-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/claude-accounts/profiles/setup/claude-profile-setup-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",
"src/main/claude-accounts/profiles/wsl/claude-profile-wsl-entry.ts",
"src/main/ai-vault/scanners/opencode/reader-transport/session-scanner-opencode-sqlite-process-entry.ts",
"src/wsl-guest/wsl-browser-network-relay.ts",
"src/renderer/src/space.tsx",
+24 -24
View File
@@ -72,22 +72,22 @@
4 src/main/browser/routing/partitions/browser-route-partition-pending-deletes.ts
4 src/main/browser/sessions/profiles/browser-session-meta-store.ts
2 src/main/browser/site-settings/browser-profile-site-store.ts
7 src/main/claude-accounts/claude-account-folder.ts
1 src/main/claude-accounts/claude-observed-config-dirs.ts
14 src/main/claude-accounts/claude-profile-history.ts
2 src/main/claude-accounts/claude-profile-homes.ts
1 src/main/claude-accounts/claude-profile-launch-preparation.ts
7 src/main/claude-accounts/claude-profile-paths.ts
26 src/main/claude-accounts/claude-profile-prompt-history.ts
5 src/main/claude-accounts/claude-profile-provisioning.ts
5 src/main/claude-accounts/claude-profile-router.ts
1 src/main/claude-accounts/claude-profile-settings.ts
1 src/main/claude-accounts/claude-profile-setup-worker.ts
1 src/main/claude-accounts/claude-profile-setup.ts
12 src/main/claude-accounts/claude-profile-sharing.ts
1 src/main/claude-accounts/claude-profile-wsl-router.ts
2 src/main/claude-accounts/keychain.ts
1 src/main/claude-accounts/runtime-paths.ts
7 src/main/claude-accounts/sign-in/claude-account-folder.ts
1 src/main/claude-accounts/profiles/routing/claude-observed-config-dirs.ts
14 src/main/claude-accounts/profiles/setup/claude-profile-history.ts
2 src/main/claude-accounts/profiles/claude-profile-homes.ts
1 src/main/claude-accounts/profiles/routing/claude-profile-launch-preparation.ts
7 src/main/claude-accounts/profiles/claude-profile-paths.ts
26 src/main/claude-accounts/profiles/setup/claude-profile-prompt-history.ts
5 src/main/claude-accounts/profiles/setup/claude-profile-provisioning.ts
5 src/main/claude-accounts/profiles/routing/claude-profile-router.ts
1 src/main/claude-accounts/profiles/setup/claude-profile-settings.ts
1 src/main/claude-accounts/profiles/setup/claude-profile-setup-worker.ts
1 src/main/claude-accounts/profiles/setup/claude-profile-setup.ts
12 src/main/claude-accounts/profiles/setup/claude-profile-sharing.ts
1 src/main/claude-accounts/profiles/wsl/claude-profile-wsl-router.ts
2 src/main/claude-accounts/runtime-auth/keychain.ts
1 src/main/claude-accounts/runtime-auth/runtime-paths.ts
3 src/main/claude/agent-view/agent-view-install.ts
1 src/main/claude/claude-diff-panel-auto-open.ts
14 src/main/claude/claude-folder-trust-file.ts
@@ -273,15 +273,15 @@
1 src/main/ipc/command-path/command-path-resolver.ts
4 src/main/ipc/diagnostics.ts
2 src/main/ipc/filesystem/access/filesystem-path-containment.ts
2 src/main/ipc/filesystem/watcher-process/parcel-watcher-canary-directory.ts
1 src/main/ipc/filesystem/watcher-process/parcel-watcher-child-launch.ts
4 src/main/ipc/filesystem/watcher-process/parcel-watcher-delivery-canary.ts
2 src/main/ipc/filesystem/watcher-process/child-lifecycle/parcel-watcher-canary-directory.ts
1 src/main/ipc/filesystem/watcher-process/child-lifecycle/parcel-watcher-child-launch.ts
4 src/main/ipc/filesystem/watcher-process/event-delivery/parcel-watcher-delivery-canary.ts
3 src/main/ipc/filesystem/watcher-process/parcel-watcher-entry-path.ts
1 src/main/ipc/filesystem/watcher-process/parcel-watcher-shallow-file-subscription.ts
1 src/main/ipc/filesystem/watcher-process/parcel-watcher-shallow-subscription.ts
1 src/main/ipc/filesystem/watcher-process/parcel-watcher-supervisor-subscribe.ts
1 src/main/ipc/filesystem/watcher-process/rebinding-file-watch.ts
1 src/main/ipc/filesystem/watcher-process/watcher-event-root-path-rewrite.ts
1 src/main/ipc/filesystem/watcher-process/native-subscriptions/parcel-watcher-shallow-file-subscription.ts
1 src/main/ipc/filesystem/watcher-process/native-subscriptions/parcel-watcher-shallow-subscription.ts
1 src/main/ipc/filesystem/watcher-process/supervision/parcel-watcher-supervisor-subscribe.ts
1 src/main/ipc/filesystem/watcher-process/native-subscriptions/rebinding-file-watch.ts
1 src/main/ipc/filesystem/watcher-process/root-paths/watcher-event-root-path-rewrite.ts
1 src/main/ipc/floating-workspace-directory.ts
1 src/main/ipc/macos-keyboard-layout-snapshot.ts
1 src/main/ipc/notification-authorization-status.ts
@@ -39,7 +39,7 @@ src/main/git/wsl-git-read-environment.ts
src/main/github/gh-utils.ts
src/main/workspace-hooks/hooks.ts
src/main/ipc/developer-permissions.ts
src/main/ipc/filesystem/watcher-process/parcel-watcher-child-launch.ts
src/main/ipc/filesystem/watcher-process/child-lifecycle/parcel-watcher-child-launch.ts
src/main/ipc/local-network-connection-test.ts
src/main/ipc/macos-keyboard-input-source.ts
src/main/ipc/macos-keyboard-layout-snapshot.ts
+2 -2
View File
@@ -27,8 +27,8 @@
1 src/main/git/refs/maintenance/pack-refs-lock-ownership.ts
1 src/main/hang-watchdog/main-thread-hang-watchdog-entry.ts
1 src/main/hang-watchdog/main-thread-hang-watchdog.ts
2 src/main/ipc/filesystem/watcher-process/parcel-watcher-shallow-file-subscription.ts
1 src/main/ipc/filesystem/watcher-process/parcel-watcher-shallow-subscription.ts
2 src/main/ipc/filesystem/watcher-process/native-subscriptions/parcel-watcher-shallow-file-subscription.ts
1 src/main/ipc/filesystem/watcher-process/native-subscriptions/parcel-watcher-shallow-subscription.ts
1 src/main/ipc/runtime-environments/runtime-environment-preference.ts
1 src/main/ipc/worktrees/git/worktree-git-common-narrow-watch.ts
1 src/main/ipc/worktrees/git/worktree-git-common-native-upgrade-poll.ts
File diff suppressed because one or more lines are too long
@@ -309,9 +309,7 @@
"src/cli/command-suggestion-budget.test.ts": 132,
"src/cli/command-suggestion-destructive-families.test.ts": 226,
"src/cli/command-suggestion.test.ts": 68,
"src/cli/computer-format.test.ts": 135,
"src/cli/computer-tree-query.test.ts": 79,
"src/cli/emulator-logcat-format.test.ts": 69,
"src/cli/format-recovery.test.ts": 413,
"src/cli/format.test.ts": 446,
"src/cli/handler-group-manifest.test.ts": 3610,
@@ -446,7 +444,6 @@
"src/cli/specs/account.test.ts": 95,
"src/cli/specs/cli-command-names-parity.test.ts": 205,
"src/cli/specs/profile-state.test.ts": 102,
"src/cli/terminal-format.test.ts": 84,
"src/cli/terminal-read-screen.test.ts": 660,
"src/cli/worktree-ps-program-status.test.ts": 65,
"src/cli/worktree-ps-terminal-verdict.test.ts": 60,
@@ -1035,33 +1032,27 @@
"src/main/browser/network/execution-routes/wsl-browser-network-execution-route.test.ts": 678,
"src/main/browser/network/execution-routes/wsl-browser-network-relay-launch.test.ts": 146,
"src/main/browser/routing/local-host-partitions/wsl-host-browser-route-partition.test.ts": 753,
"src/main/claude-accounts/claude-account-folder.test.ts": 153,
"src/main/claude-accounts/sign-in/claude-account-folder.test.ts": 153,
"src/main/claude-accounts/claude-account-service.test.ts": 1207,
"src/main/claude-accounts/claude-command-process-windows-only.test.ts": 90,
"src/main/claude-accounts/claude-launch-routing.test.ts": 516,
"src/main/claude-accounts/claude-login-session.test.ts": 1048,
"src/main/claude-accounts/claude-pasted-code-login.test.ts": 238,
"src/main/claude-accounts/claude-profile-history-windows.test.ts": 121,
"src/main/claude-accounts/claude-profile-history.test.ts": 173,
"src/main/claude-accounts/claude-profile-paths.test.ts": 82,
"src/main/claude-accounts/claude-profile-provisioning.test.ts": 854,
"src/main/claude-accounts/claude-profile-router.test.ts": 1091,
"src/main/claude-accounts/claude-profile-setup-worker.test.ts": 410,
"src/main/claude-accounts/claude-profile-setup.test.ts": 405,
"src/main/claude-accounts/claude-profile-wsl-router.test.ts": 919,
"src/main/claude-accounts/claude-sign-in-browser.test.ts": 314,
"src/main/claude-accounts/claude-structured-auth-policy.test.ts": 52,
"src/main/claude-accounts/host-sign-in-real-cli.test.ts": 222,
"src/main/claude-accounts/keychain-config-directory-aliases.test.ts": 51,
"src/main/claude-accounts/runtime-auth-service.test.ts": 305,
"src/main/claude-accounts/runtime-selection.test.ts": 41,
"src/main/claude-accounts/windows-command-invocation.test.ts": 48,
"src/main/claude-accounts/sign-in/claude-command-process-windows-only.test.ts": 90,
"src/main/claude-accounts/sign-in/claude-login-session.test.ts": 1048,
"src/main/claude-accounts/sign-in/claude-pasted-code-login.test.ts": 238,
"src/main/claude-accounts/profiles/setup/claude-profile-history-windows.test.ts": 121,
"src/main/claude-accounts/profiles/setup/claude-profile-history.test.ts": 173,
"src/main/claude-accounts/profiles/claude-profile-paths.test.ts": 82,
"src/main/claude-accounts/profiles/setup/claude-profile-provisioning.test.ts": 854,
"src/main/claude-accounts/profiles/routing/claude-profile-router.test.ts": 1091,
"src/main/claude-accounts/profiles/setup/claude-profile-setup-worker.test.ts": 410,
"src/main/claude-accounts/profiles/setup/claude-profile-setup.test.ts": 405,
"src/main/claude-accounts/profiles/wsl/claude-profile-wsl-router.test.ts": 919,
"src/main/claude-accounts/sign-in/claude-sign-in-browser.test.ts": 314,
"src/main/claude-accounts/runtime-auth/claude-structured-auth-policy.test.ts": 52,
"src/main/claude-accounts/runtime-auth/keychain-config-directory-aliases.test.ts": 51,
"src/main/claude-accounts/selection/runtime-selection.test.ts": 41,
"src/main/claude-accounts/sign-in/windows-command-invocation.test.ts": 48,
"src/main/claude-usage/claude-model-pricing.test.ts": 74,
"src/main/claude-usage/claude-usage-report-aggregation.test.ts": 57,
"src/main/claude-usage/persisted-source-authority.test.ts": 491,
"src/main/claude-usage/scanner-incremental-append.test.ts": 235,
"src/main/claude-usage/scanner-incremental-ownership.test.ts": 545,
"src/main/claude-usage/scanner-incremental-reader.test.ts": 819,
"src/main/claude-usage/scanner-long-context.test.ts": 186,
"src/main/claude-usage/scanner-scan.test.ts": 295,
"src/main/claude-usage/scanner.test.ts": 80,
@@ -1164,7 +1155,6 @@
"src/main/claude/structured/journal/claude-structured-prompt-ownership.test.ts": 944,
"src/main/claude/structured/launch/claude-structured-applied-options.test.ts": 956,
"src/main/claude/structured/launch/claude-structured-child-env.test.ts": 126,
"src/main/claude/structured/launch/claude-structured-launch-account-routing.test.ts": 1800,
"src/main/claude/structured/launch/claude-structured-launch-resolution.test.ts": 672,
"src/main/claude/structured/launch/claude-structured-launch-visuals.test.ts": 565,
"src/main/claude/structured/launch/claude-structured-message-options.test.ts": 1586,
@@ -2043,28 +2033,22 @@
"src/main/ipc/filesystem/local-disk-write-precondition.test.ts": 8407,
"src/main/ipc/filesystem/local-file-range-read.test.ts": 56,
"src/main/ipc/filesystem/local-regular-file-read.test.ts": 78,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-child-launch.test.ts": 57,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-child-registry.test.ts": 93,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-crash-fuse.test.ts": 54,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-disconnect-termination.test.ts": 145,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-event-cancellation.test.ts": 58,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-event-delivery.test.ts": 162,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-native-error-retirement.test.ts": 120,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-owned-children.test.ts": 59,
"src/main/ipc/filesystem/watcher-process/child-lifecycle/parcel-watcher-child-registry.test.ts": 93,
"src/main/ipc/filesystem/watcher-process/supervision/parcel-watcher-crash-fuse.test.ts": 54,
"src/main/ipc/filesystem/watcher-process/supervision/parcel-watcher-disconnect-termination.test.ts": 145,
"src/main/ipc/filesystem/watcher-process/event-delivery/parcel-watcher-event-delivery.test.ts": 162,
"src/main/ipc/filesystem/watcher-process/supervision/parcel-watcher-native-error-retirement.test.ts": 120,
"src/main/ipc/filesystem/watcher-process/child-lifecycle/parcel-watcher-owned-children.test.ts": 59,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-process-dispose.test.ts": 51,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-process.test.ts": 519,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-root-path-rewrite.test.ts": 135,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-shallow-subscription.test.ts": 241,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-supervisor-capacity.test.ts": 235,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-supervisor-disposal.test.ts": 106,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-unsubscribe-timeout.test.ts": 135,
"src/main/ipc/filesystem/watcher-process/root-paths/parcel-watcher-root-path-rewrite.test.ts": 135,
"src/main/ipc/filesystem/watcher-process/native-subscriptions/parcel-watcher-shallow-subscription.test.ts": 241,
"src/main/ipc/filesystem/watcher-process/supervision/parcel-watcher-supervisor-capacity.test.ts": 235,
"src/main/ipc/filesystem/watchers/filesystem-watcher-document-lifetime.test.ts": 557,
"src/main/ipc/filesystem/watchers/filesystem-watcher-event-batch.test.ts": 59,
"src/main/ipc/filesystem/watchers/filesystem-watcher-ignore-real.test.ts": 707,
"src/main/ipc/filesystem/watchers/filesystem-watcher-large-batch.test.ts": 306,
"src/main/ipc/filesystem/watchers/filesystem-watcher-local-unsubscribe.test.ts": 1252,
"src/main/ipc/filesystem/watchers/filesystem-watcher-native-capacity.test.ts": 411,
"src/main/ipc/filesystem/watchers/filesystem-watcher-real.test.ts": 613,
"src/main/ipc/filesystem/watchers/filesystem-watcher-stat-lifecycle.test.ts": 297,
"src/main/ipc/filesystem/watchers/filesystem-watcher-wsl-stat-stop.test.ts": 107,
"src/main/ipc/filesystem/watchers/filesystem-watcher-wsl.test.ts": 119,
@@ -2093,9 +2077,8 @@
"src/main/ipc/notifications-message-formatting.test.ts": 229,
"src/main/ipc/notifications-subject-retirement.test.ts": 304,
"src/main/ipc/profiles/orca-profiles-switch-persistence.test.ts": 2761,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-crash-fuse-recovery.test.ts": 128,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-delivery-health.test.ts": 110,
"src/main/ipc/filesystem/watcher-process/parcel-watcher-shallow-file-subscription.test.ts": 4531,
"src/main/ipc/filesystem/watcher-process/supervision/parcel-watcher-crash-fuse-recovery.test.ts": 128,
"src/main/ipc/filesystem/watcher-process/event-delivery/parcel-watcher-delivery-health.test.ts": 110,
"src/main/ipc/pets/pet-bundle.test.ts": 48,
"src/main/ipc/pets/pet.test.ts": 268,
"src/main/ipc/plugin-marketplaces.test.ts": 430,
@@ -2135,8 +2118,7 @@
"src/main/ipc/pty/pty-write-ipc-validation.test.ts": 5157,
"src/main/ipc/pty/runtime/kill-same-id-respawn.test.ts": 3784,
"src/main/ipc/pty/runtime/spawn-preflight-wsl-background-hold.test.ts": 1568,
"src/main/ipc/filesystem/watcher-process/rebinding-file-watch-noise.test.ts": 317,
"src/main/ipc/filesystem/watcher-process/rebinding-file-watch.test.ts": 4226,
"src/main/ipc/filesystem/watcher-process/native-subscriptions/rebinding-file-watch-noise.test.ts": 317,
"src/main/ipc/worktrees/removal/registered-worktree-root-ownership.test.ts": 498,
"src/main/ipc/worktrees/removal/registered-worktree-root-refresh.test.ts": 224,
"src/main/ipc/worktrees/removal/registered-worktree-root-stopped-distro.test.ts": 168,
@@ -2168,9 +2150,6 @@
"src/main/ipc/runtime-environments/runtime-environments-repair.test.ts": 4122,
"src/main/ipc/runtime-environments/runtime-environments-subscription-lifecycle.test.ts": 5098,
"src/main/ipc/runtime-upload-file-stream.test.ts": 144,
"src/main/ipc/filesystem/watcher-process/runtime-watcher-disposal-owners.test.ts": 47,
"src/main/ipc/filesystem/watcher-process/runtime-watcher-pending-assignment.test.ts": 290,
"src/main/ipc/filesystem/watcher-process/runtime-watcher-pool-shutdown.test.ts": 103,
"src/main/ipc/runtime.test.ts": 3323,
"src/main/ipc/sender-scoped-request-cancellation.test.ts": 80,
"src/main/ipc/session-window-view-save.test.ts": 1998,
@@ -2188,7 +2167,7 @@
"src/main/ipc/terminal-preview-output-stream.test.ts": 53,
"src/main/ipc/terminal-render-desync-evidence.test.ts": 78,
"src/main/ipc/terminal-startup-color-query-replies.test.ts": 265,
"src/main/ipc/filesystem/watcher-process/watcher-event-root-path-rewrite.test.ts": 48,
"src/main/ipc/filesystem/watcher-process/root-paths/watcher-event-root-path-rewrite.test.ts": 48,
"src/main/workspaces/removal/watcher-removal-gate.test.ts": 384,
"src/main/ipc/workspace-cleanup/workspace-cleanup-activity.test.ts": 76,
"src/main/ipc/workspace-cleanup/workspace-cleanup-document-lifetime.test.ts": 1130,
@@ -2401,7 +2380,6 @@
"src/main/native-chat/agent-session-wire/operations/testing/structured-agent-session-ended-prompt-cancel.test.ts": 1466,
"src/main/native-chat/agent-session-wire/termination/testing/structured-agent-session-eviction.test.ts": 478,
"src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-exit-delivery.test.ts": 2327,
"src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-failed-create-owner-verdict.test.ts": 2022,
"src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-fork-rewind.test.ts": 1797,
"src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-held-child-lease-renewal.test.ts": 957,
"src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-input-order-rewind.test.ts": 1509,
@@ -2727,9 +2705,7 @@
"src/main/pi/managed-extensions/agent-status/agent-status-extension-session-change.test.ts": 613,
"src/main/pi/managed-extensions/agent-status/agent-status-input-redaction.test.ts": 573,
"src/main/pi/managed-extensions/agent-status/omp-model-command-source.test.ts": 640,
"src/main/pi/rpc/launch/rpc-launch.test.ts": 305,
"src/main/pi/rpc/prompts/rpc-prompt-delivery.test.ts": 204,
"src/main/pi/rpc/prompts/rpc-prompt.test.ts": 228,
"src/main/pi/rpc/rpc-session-rename.test.ts": 1172,
"src/main/pi/rpc/rpc-session-startup.test.ts": 4955,
"src/main/pi/rpc/rpc-turn-races.test.ts": 2191,
@@ -3641,7 +3617,6 @@
"src/main/runtime/session-tabs/session-tabs-main-rows-parity.test.ts": 4606,
"src/main/runtime/session-tabs/session-tabs-phone-layout-moves.test.ts": 4153,
"src/main/runtime/session-tabs/session-tabs-windowed-main-change.test.ts": 4444,
"src/main/runtime/session-tabs/structured-session-account-home-location.test.ts": 935,
"src/main/runtime/orchestration/terminal-authority/settled-worker-process-replacement.test.ts": 5013,
"src/main/runtime/sidebar-inputs/cached-scan.test.ts": 106,
"src/main/runtime/sidebar-inputs/desktop-sidebar-facts.test.ts": 378,
@@ -4487,14 +4462,12 @@
"src/renderer/src/components/dashboard-popout/dashboard-preview-link-composition.test.tsx": 8657,
"src/renderer/src/components/dashboard-popout/preview-terminal-box-fit-lifecycle.test.ts": 192,
"src/renderer/src/components/dashboard-popout/preview-terminal-ime-bridge-kitty-bytes.test.ts": 479,
"src/renderer/src/components/dashboard-popout/useDashboardSnapshot.test.tsx": 432,
"src/renderer/src/components/dashboard/AgentDashboardDrawer.focus.test.tsx": 2567,
"src/renderer/src/components/dashboard/AgentDashboardDrawer.test.tsx": 1981,
"src/renderer/src/components/dashboard/agent-dashboard-open-mode.test.ts": 48,
"src/renderer/src/components/dashboard/agent-destination-navigation.integration.test.tsx": 3232,
"src/renderer/src/components/dashboard/agent-row-lineage-model.test.ts": 107,
"src/renderer/src/components/dashboard/build-dashboard-bucket-counts.equivalence.test.ts": 722,
"src/renderer/src/components/dashboard/build-dashboard-snapshot-folder-workspace.test.ts": 2150,
"src/renderer/src/components/dashboard/build-dashboard-snapshot.test.ts": 2121,
"src/renderer/src/components/dashboard/reveal-dashboard-agent.test.ts": 1098,
"src/renderer/src/components/dashboard/useRetainedAgents.test.ts": 2028,
@@ -4530,7 +4503,6 @@
"src/renderer/src/components/editor/model-lifetime/retention/closed-editor-tab-disposal.test.ts": 121,
"src/renderer/src/components/editor/model-lifetime/retention/closed-editor-view-state-retention.test.ts": 9012,
"src/renderer/src/components/editor/closed-unsaved-files-toast.test.ts": 448,
"src/renderer/src/components/editor/combined-diff/scroll-viewport/combined-diff-cursor-reveal.test.tsx": 3685,
"src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-load-scheduler.test.ts": 53,
"src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-metadata-retention.test.tsx": 1151,
"src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-section-connection.test.ts": 1699,
@@ -4582,7 +4554,6 @@
"src/renderer/src/components/editor/image-png-export.chromium.test.ts": 212,
"src/renderer/src/components/editor/image-png-export.test.ts": 50,
"src/renderer/src/components/editor/image-viewer-zoom-ownership.test.tsx": 2268,
"src/renderer/src/components/editor/image-viewer-zoom.test.ts": 47,
"src/renderer/src/components/editor/notebook/kernel/ipynb-kernel-outputs.test.ts": 307,
"src/renderer/src/components/editor/notebook/kernel/ipynb-kernel-session-start-lifetime.test.ts": 140,
"src/renderer/src/components/editor/notebook/kernel/ipynb-kernel-session.test.ts": 180,
@@ -4721,7 +4692,6 @@
"src/renderer/src/components/emulator-pane/use-emulator-pane-session.test.tsx": 1968,
"src/renderer/src/components/emulator-pane/use-mobile-emulator-tab-intro-actions.test.tsx": 1828,
"src/renderer/src/components/feature-tips/ChatUiHereFeatureTipVisual.test.tsx": 1093,
"src/renderer/src/components/feature-tips/feature-tip-modal-state.test.ts": 244,
"src/renderer/src/components/feature-wall/FeatureWallSetupWorkflowActions.test.tsx": 2028,
"src/renderer/src/components/feature-wall/FullDiskAccessSetupPrompt.test.ts": 466,
"src/renderer/src/components/floating-terminal/floating-workspace-tab-reorder.test.ts": 2520,
@@ -4731,13 +4701,11 @@
"src/renderer/src/components/github-item-dialog/load-item-details/use-github-item-dialog-details.test.tsx": 2850,
"src/renderer/src/components/github-item-dialog/load-item-details/use-github-task-refresh.test.tsx": 1070,
"src/renderer/src/components/github-item-dialog/open-dialog/github-item-dialog.task-record.test.tsx": 1391,
"src/renderer/src/components/github-project/GhAuthErrorHelp.test.ts": 479,
"src/renderer/src/components/github-project/ProjectBoard.test.tsx": 988,
"src/renderer/src/components/github-project/github-project-picker-filter.test.ts": 53,
"src/renderer/src/components/github-project/group-sort.test.ts": 75,
"src/renderer/src/components/github-project/project-dialog-state.test.ts": 48,
"src/renderer/src/components/github-project/project-picker-input.test.ts": 338,
"src/renderer/src/components/github-project/project-row-filtering.test.ts": 65,
"src/renderer/src/components/github-project/project-view-wrapper-source-context-boundary.test.ts": 46,
"src/renderer/src/components/github/GitHubMarkdownComposer.test.tsx": 1571,
"src/renderer/src/components/github/PRFilterPickers.test.ts": 291,
@@ -5097,7 +5065,6 @@
"src/renderer/src/components/settings/runtime-environments/pairing/RuntimePairingGeneratorForm.test.tsx": 461,
"src/renderer/src/components/settings/appearance/fonts/FontAutocomplete.test.tsx": 1202,
"src/renderer/src/components/settings/form-controls/SettingsFormControls.segmented-control.test.tsx": 730,
"src/renderer/src/components/settings/shortcuts/ShortcutFilterRail.test.ts": 273,
"src/renderer/src/components/settings/shortcuts/ShortcutsPane.provenance.test.tsx": 2302,
"src/renderer/src/components/settings/repository/worktrees/SparsePresetSettingsSection.test.tsx": 744,
"src/renderer/src/components/settings/ssh/server-actions/SshHostDeltaMoveDialog.test.tsx": 438,
@@ -5163,7 +5130,6 @@
"src/renderer/src/components/sidebar/Sidebar.test.tsx": 833,
"src/renderer/src/components/sidebar/SidebarAgentsList.test.tsx": 2985,
"src/renderer/src/components/sidebar/StalledTerminalDaemonBanner.test.tsx": 320,
"src/renderer/src/components/sidebar/workspace-board/viewport/WorkspaceKanbanLaneGrid.test.tsx": 360,
"src/renderer/src/components/sidebar/workspace-card/surface/WorktreeCard.single-reference-details.test.tsx": 2032,
"src/renderer/src/components/sidebar/workspace-actions/context-menu/WorktreeContextMenu.closed-menu-work.test.tsx": 1753,
"src/renderer/src/components/sidebar/workspace-actions/context-menu/WorktreeContextMenu.test.ts": 299,
@@ -5185,7 +5151,6 @@
"src/renderer/src/components/sidebar/workspace-creation/folder/folder-workspace-composer-submit-host-platform.test.ts": 2264,
"src/renderer/src/components/sidebar/workspace-creation/folder/folder-workspace-composer-submit.test.ts": 2665,
"src/renderer/src/components/sidebar/worktree-list/drag/host-header-drag.test.tsx": 281,
"src/renderer/src/components/sidebar/worktree-list/grouping/host-section-reveal.test.tsx": 2294,
"src/renderer/src/components/sidebar/worktree-list/listing/manual-sort-switch-toast.test.ts": 1753,
"src/renderer/src/components/sidebar/mobile-sidebar-onboarding-badge.test.ts": 230,
"src/renderer/src/components/sidebar/worktree-list/grouping/pinned-section-worktrees.test.ts": 446,
@@ -5782,7 +5747,6 @@
"src/renderer/src/lib/agent-session/launch/background/launch-agent-background-session-launch-parity.test.ts": 2792,
"src/renderer/src/lib/agent-session/launch/background/launch-agent-background-session.test.ts": 1040,
"src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-new-tab-host-route-readiness.test.ts": 489,
"src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-picker-contract.test.ts": 3592,
"src/renderer/src/lib/agent-session/launch/continuation/launch-agent-session-continuation-toast.test.tsx": 2347,
"src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-accepted.test.tsx": 2754,
"src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-defaults.test.ts": 1594,
@@ -7,7 +7,7 @@ import { build } from 'esbuild'
const ENTRY_PATH = resolve('out/main/parcel-watcher-process-entry.js')
const SUPERVISOR_SOURCE = resolve(
'src/main/ipc/filesystem/watcher-process/parcel-watcher-process-supervisor.ts'
'src/main/ipc/filesystem/watcher-process/supervision/parcel-watcher-process-supervisor.ts'
)
const WAIT_TIMEOUT_MS = 15_000
const require = createRequire(import.meta.url)
@@ -9,13 +9,13 @@ import { build } from 'esbuild'
const ENTRY_PATH = resolve('out/main/parcel-watcher-process-entry.js')
const POOL_SOURCE = resolve(
'src/main/ipc/filesystem/watcher-process/runtime-watcher-process-pool.ts'
'src/main/ipc/filesystem/watcher-process/runtime-pool/runtime-watcher-process-pool.ts'
)
const FAILURE_SOURCE = resolve(
'src/main/ipc/filesystem/watcher-process/parcel-watcher-process-failure.ts'
)
const REGISTRY_SOURCE = resolve(
'src/main/ipc/filesystem/watcher-process/parcel-watcher-child-registry.ts'
'src/main/ipc/filesystem/watcher-process/child-lifecycle/parcel-watcher-child-registry.ts'
)
const MAX_CHILD_RSS_KIB = 128 * 1024
const MAX_CHILD_CPU_PERCENT = 50
@@ -446,9 +446,6 @@
"auto.components.Terminal.5b2c1a9e44": {
"ko": "agent CLI를 찾지 못했습니다. 하나를 설치하거나 설정에서 기본 agent를 선택하세요."
},
"auto.components.Terminal.7958465754": {
"ko": "실행 중인 프로세스가 있는 terminals이 있습니다. 그래도 창을 닫으시겠습니까?"
},
"auto.components.Terminal.e57db40c11": {
"ko": "{{value0}} 실행 명령을 만들 수 없습니다."
},
@@ -27,7 +27,8 @@ export const ORCAD_CHILD_ENTRY_POINTS = {
sessionScanner: 'src/main/ai-vault/scan-service/session-scanner-service-entry.ts',
workerThreadChildProcess:
'src/main/worker-thread-child-process/worker-thread-child-process-entry.ts',
claudeProfileSetup: 'src/main/claude-accounts/claude-profile-setup-worker-entry.ts',
claudeProfileSetup:
'src/main/claude-accounts/profiles/setup/claude-profile-setup-worker-entry.ts',
claudeConversationFork: 'src/main/claude/claude-conversation-fork-worker-entry.ts',
sttWorker: 'src/main/speech/stt-worker.ts',
computerSidecar: 'src/main/computer/computer-sidecar.ts'
@@ -55,7 +55,7 @@ stampVersion('wsl-browser-network-relay.js', '.browser-network-version')
console.log(`Built WSL browser network relay → ${outDir}/wsl-browser-network-relay.js`)
await bundle(
'src/main/claude-accounts/claude-profile-wsl-entry.ts',
'src/main/claude-accounts/profiles/wsl/claude-profile-wsl-entry.ts',
WSL_CLAUDE_PROFILE_HELPER_FILENAME
)
await bundle(
@@ -1,4 +1,5 @@
// Clear the launching terminal’s inherited Orca identity so test branches depend on fixture env, not which agent launched runner.
// Clear the launching terminal's identity too: macOS /etc/zshrc and /etc/bashrc source /etc/{zsh,bash}rc_$TERM_PROGRAM.
for (const name of [
'ORCA_AGENT_SESSION_ID',
'ORCA_STRUCTURED_SESSION',
@@ -6,7 +7,10 @@ for (const name of [
'ORCA_WORKSPACE_ID',
'ORCA_RUNTIME_SOURCE_ID',
'ORCA_RUNTIME_SOURCE_INCARNATION',
'ORCA_RUNTIME_SOURCE_PROFILE_PATH'
'ORCA_RUNTIME_SOURCE_PROFILE_PATH',
'TERM_PROGRAM',
'TERM_PROGRAM_VERSION',
'TERM_SESSION_ID'
]) {
delete process.env[name]
}
@@ -0,0 +1,64 @@
import { execFileSync } from 'node:child_process'
import { createHash } from 'node:crypto'
import { existsSync, mkdirSync, renameSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join, resolve } from 'node:path'
// Per-checkout, user-owned: a predictable name in a shared /tmp could be planted by another user.
const CACHE_DIR = resolve(import.meta.dirname, '../../../../node_modules/.cache')
function signsByDefault(env) {
try {
const values = execFileSync(
'git',
[
'config',
'--type=bool',
'--get-regexp',
'^(commit\\.gpgsign|tag\\.(gpgsign|forcesignannotated))$'
],
{ cwd: tmpdir(), env, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }
)
return /\strue$/m.test(values)
} catch {
return false
}
}
/**
* Real-git fixtures must not sign with the developer's key, and `tag.gpgsign` breaks `git tag <name>`.
* The rest of the global config (e.g. safe.directory) still applies; `~` keeps HOME-isolated fixtures isolated.
*/
export function gitSigningOffEnv(env = process.env) {
if (!signsByDefault(env)) {
return {}
}
const inherited = env.GIT_CONFIG_GLOBAL
? [resolve(env.GIT_CONFIG_GLOBAL)]
: [
env.XDG_CONFIG_HOME
? join(resolve(env.XDG_CONFIG_HOME), 'git', 'config')
: '~/.config/git/config',
'~/.gitconfig'
]
const config = [
'[include]',
...inherited.map((path) => `\tpath = ${JSON.stringify(path.replaceAll('\\', '/'))}`),
'[commit]',
'\tgpgsign = false',
'[tag]',
'\tgpgsign = false',
'\tforceSignAnnotated = false',
''
].join('\n')
const hash = createHash('sha256').update(config).digest('hex').slice(0, 16)
const file = join(CACHE_DIR, `orca-vitest-unsigned-${hash}.gitconfig`)
if (!existsSync(file)) {
mkdirSync(CACHE_DIR, { recursive: true })
// Concurrent runs may share the cache; rename so no git ever reads a half-written file.
const partial = `${file}.${process.pid}`
writeFileSync(partial, config)
renameSync(partial, file)
}
return { GIT_CONFIG_GLOBAL: file }
}
@@ -0,0 +1,43 @@
import { execFileSync } from 'node:child_process'
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { dirname, join, resolve } from 'node:path'
import { afterEach, expect, it } from 'vitest'
import { gitSigningOffEnv } from './vitest-git-signing-env.mjs'
const cleanup = []
afterEach(() => {
for (const path of cleanup.splice(0)) {
rmSync(path, { recursive: true, force: true })
}
})
it('commits and tags unsigned under a signing global config, keeping its other settings', () => {
const root = mkdtempSync(join(tmpdir(), 'orca-git-signing-env-'))
cleanup.push(root)
const globalConfig = join(root, 'global.gitconfig')
// Forward slashes: a backslash starts an escape in a gitconfig value.
const missingSigner = join(root, 'missing-signer').replaceAll('\\', '/')
writeFileSync(
globalConfig,
`[commit]\n\tgpgsign = true\n[tag]\n\tgpgsign = true\n\tforceSignAnnotated = true\n[gpg]\n\tprogram = ${missingSigner}\n[user]\n\tname = Test\n\temail = test@example.invalid\n`
)
const inherited = { ...process.env, GIT_CONFIG_GLOBAL: globalConfig, GIT_CONFIG_NOSYSTEM: '1' }
const env = { ...inherited, ...gitSigningOffEnv(inherited) }
cleanup.push(env.GIT_CONFIG_GLOBAL)
expect(dirname(env.GIT_CONFIG_GLOBAL)).toBe(
resolve(import.meta.dirname, '../../../../node_modules/.cache')
)
const git = (...args) =>
execFileSync('git', args, { cwd: root, env, encoding: 'utf8', stdio: 'pipe' }).trim()
git('init', '--quiet')
git('commit', '--quiet', '--allow-empty', '-m', 'fixture')
git('tag', 'v1.0.0')
git('tag', '-m', 'release', 'v1.0.1')
expect(git('cat-file', '-t', 'v1.0.0')).toBe('commit')
expect(git('log', '-1', '--format=%an %G?')).toBe('Test N')
expect(gitSigningOffEnv({ ...inherited, GIT_CONFIG_GLOBAL: join(root, 'missing') })).toEqual({})
})
@@ -153,9 +153,6 @@ const NODE_RUNTIME_INCLUDE = [
'src/main/runtime/mobile-cloud-relay/relay-control-client.test.ts',
'src/main/ipc/filesystem/watchers/filesystem-watcher-ignore-real.test.ts',
'src/main/ipc/runtime-environments/runtime-environment-preference.test.ts',
// Real fs.watch file bindings; Bun's watcher is not the one Electron runs.
'src/main/ipc/filesystem/watcher-process/rebinding-file-watch.test.ts',
'src/main/ipc/filesystem/watcher-process/parcel-watcher-shallow-file-subscription.test.ts',
'src/renderer/src/components/emulator-pane/emulator-device-frame-visibility.test.tsx',
'src/main/claude/claude-agent-sdk-contract-pins.test.ts',
'config/scripts/desktop-distribution/runtime-verification/process-host-dev-rebuild.test.ts',
@@ -193,7 +193,7 @@ export const WINDOWS_BOUNDARY_TESTS = [
'src/main/pty/process-retirement/windows-live-tree-kill.win32.test.ts',
'src/main/wsl/execution/wsl-guest-environment.test.ts',
'src/main/wsl/execution/wsl-executable-path.win32.test.ts',
'src/main/claude-accounts/claude-profile-history-windows.test.ts',
'src/main/claude-accounts/profiles/setup/claude-profile-history-windows.test.ts',
'src/shared/source-scan/source-tree-scan.test.ts',
'src/main/cli/wsl/wsl-cli-powershell-boundary.test.ts',
'src/main/cursor/hook-service.test.ts',
@@ -12,25 +12,11 @@ it('keeps byte-compared artifacts and source LF in an autocrlf checkout', () =>
const crlf = 'first\r\nsecond\r\n'
const paths = new Map([
['resources/skills/current-manifest.json', lf],
['src/main/__snapshots__/example.test.ts.snap', lf],
['src/renderer/src/example.tsx', lf],
['src/main/example.ts', lf],
['config/scripts/example.mjs', lf],
['config/scripts/nested/deeper/example.mjs', lf],
['skill-guides/example.md', lf],
['skill-stubs/example.md', lf],
['skill-stubs/_shared/example.md', lf],
['skills/example/SKILL.md', lf],
['src/cli/bundled-skill-guides.ts', lf],
...['cmd', 'bat', 'ps1', 'nsh'].map((extension) => [`config/example.${extension}`, crlf]),
['config/example.cmd', crlf],
['resources/skills-extra/example.json', crlf],
['vendor/resources/skills/example.json', crlf],
['scripts/example.mjs', crlf],
['config/scripts-extra/example.mjs', crlf],
['vendor/config/scripts/example.mjs', crlf],
['config/scripts/example.mjsx', crlf],
['src/main/runtime/__fixtures__/example.txt', crlf],
['src/main/daemon/__fixtures__/pty-transcripts/example.txt', crlf]
['src/main/runtime/__fixtures__/example.txt', crlf]
])
const git = (args) => execFileSync('git', args, { cwd: root, stdio: 'pipe' })
+1
View File
@@ -30,6 +30,7 @@
"../src/renderer/src/components/native-chat/session/structured/delivery/structured-agent-session-pending-sends.ts",
"../src/renderer/src/components/native-chat/queue/structured-agent-session-queue-request.ts",
"../src/renderer/src/components/native-chat/native-chat-composer-primary-action.ts",
"../src/renderer/src/components/settings/accounts/codex/codex-account-auth-warning.ts",
"../src/renderer/src/components/terminal-pane/pty-transport/legacy-relay/legacy-relay-bridge-panes.ts",
"../src/preload/**/*",
"../src/shared/**/*",
+5 -3
View File
@@ -10,6 +10,7 @@ import {
} from './scripts/ci/unit-selection/dependency-graph/ci-unit-files.mjs'
import TimingSequencer from './scripts/ci/sharding/ci-unit-sequencer.mjs'
import { filesSafeToShareWorker } from './scripts/test-runtime/execution-policy/vitest-shared-worker-files.mjs'
import { gitSigningOffEnv } from './scripts/test-runtime/environment/vitest-git-signing-env.mjs'
import RuntimeSequencer from './scripts/test-runtime/execution-policy/vitest-runtime-sequencer.mjs'
import { getNodeRuntimeInclude } from './scripts/test-runtime/sqlite-admission/vitest-node-runtime-files.mjs'
import { nodeRuntimePool } from './scripts/test-runtime/node-worker/vitest-node-runtime-pool'
@@ -22,6 +23,7 @@ const nodeRuntimeInclude = process.versions.bun
? getNodeRuntimeInclude({ filters: readRunFilters() })
: []
const balancedShards = process.env.ORCA_BALANCE_UNIT_SHARDS === '1'
const gitEnv = gitSigningOffEnv()
const moduleCachePath = process.env.ORCA_UNIT_MODULE_CACHE_PATH
const phoneContractPattern = /\/mobile\/src\/.*\.(?:ts|tsx)(?:\?.*)?$/
const transforms = {
@@ -88,7 +90,7 @@ const testOptions = {
// Keyed by ci-unit-module-cache.mjs in CI and vitest-local-module-cache.mjs locally.
fsModuleCache: Boolean(moduleCachePath),
...(moduleCachePath ? { fsModuleCachePath: moduleCachePath } : {}),
env: { ORCA_VITEST_RUNTIME: 'node' },
env: { ...gitEnv, ORCA_VITEST_RUNTIME: 'node' },
server: { deps: { inline: ['zod'] } },
// Node's storage globals and V8 retention checks require the existing child flags.
execArgv: ['--no-experimental-webstorage', '--expose-gc'],
@@ -104,7 +106,7 @@ const nodeProject = {
test: {
...testOptions,
name: process.versions.bun ? 'node-runtime' : 'node',
env: { ORCA_VITEST_RUNTIME: process.versions.bun ? 'node-runtime' : 'node' },
env: { ...gitEnv, ORCA_VITEST_RUNTIME: process.versions.bun ? 'node-runtime' : 'node' },
include: process.versions.bun ? nodeRuntimeInclude : UNIT_INCLUDE,
sequence: { groupOrder: 1 },
...(process.versions.bun
@@ -118,7 +120,7 @@ const bunProject = {
test: {
...testOptions,
name: 'bun',
env: { ORCA_VITEST_RUNTIME: 'bun' },
env: { ...gitEnv, ORCA_VITEST_RUNTIME: 'bun' },
pool: 'forks',
exclude: [...testOptions.exclude, ...nodeRuntimeInclude],
sequence: { groupOrder: 1 }
-1
View File
@@ -15,7 +15,6 @@ const contracts = [
'src/main/usage/source-input/jsonl/jsonl-file-reader.test.ts',
'config/scripts/static-analysis/oxlint-contracts/app-store-performance-plugin.test.mjs',
'config/scripts/static-analysis/oxlint-contracts/quadratic-buffer-concat-plugin.test.mjs',
'src/main/claude-usage/scanner-incremental-append.test.ts',
'src/main/runtime/agent-session/structured-agent-session-chat-wait-work-state.test.ts'
]
for (const contract of contracts) {
@@ -1,68 +0,0 @@
package expo.modules.orcamobilewebshell
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Test
private const val FOREIGN = "https://example.com/artifact-link"
private const val DOCUMENT = "orca-mobile-web://sess-01JN_aZ9/"
private fun verdict(
url: String? = FOREIGN,
isForMainFrame: Boolean = true,
isDocumentUrl: Boolean = false,
hasGesture: Boolean = true
) = mobileWebShellNavigationVerdict(
url,
isForMainFrame,
false,
isDocumentUrl,
false,
hasGesture,
false
)
class MobileWebShellDroppedNavigationTest {
@Test
fun `refuses every navigation to the document that the shell did not ask for`() {
// Artifact href=/ or empty href names our document; never reload or send that URL to the opener.
assertEquals(
MobileWebShellNavigationVerdict.Cancel,
verdict(url = DOCUMENT, isDocumentUrl = true)
)
// Both engines can report no gesture for subframe top navigation; Chromium permits it for human requests too.
assertEquals(
MobileWebShellNavigationVerdict.Cancel,
verdict(url = DOCUMENT, isDocumentUrl = true, hasGesture = false)
)
}
@Test
fun `cancels a foreign navigation with no gesture and offers nothing`() {
// Meta refresh/redirects must not open a browser without a user action.
assertEquals(MobileWebShellNavigationVerdict.Cancel, verdict(hasGesture = false))
}
@Test
fun `offers nothing for a subframe, which is the sealed preview loading itself`() {
assertEquals(MobileWebShellNavigationVerdict.Cancel, verdict(isForMainFrame = false))
assertEquals(
MobileWebShellNavigationVerdict.Cancel,
verdict(isForMainFrame = false, hasGesture = false)
)
}
@Test
fun `offers nothing for an absent or empty url, and nothing past the crossing cap`() {
assertEquals(MobileWebShellNavigationVerdict.Cancel, verdict(url = null))
assertEquals(MobileWebShellNavigationVerdict.Cancel, verdict(url = ""))
val cap = MOBILE_WEB_SHELL_MAX_DROPPED_NAVIGATION_URL_CHARS
val atCap = "https://example.com/" + "a".repeat(cap - "https://example.com/".length)
assertEquals(cap, atCap.length)
assertEquals(atCap, mobileWebShellOfferableUrl(atCap))
assertNull(mobileWebShellOfferableUrl(atCap + "a"))
assertEquals(MobileWebShellNavigationVerdict.Cancel, verdict(url = atCap + "a"))
}
}
@@ -3,7 +3,6 @@ package expo.modules.orcamobilewebshell
import java.io.File
import org.json.JSONArray
import org.json.JSONObject
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNull
import org.junit.Test
@@ -30,23 +29,6 @@ private fun manifest(
private fun make(json: String) = MobileWebShellGeneration.make(json, DIRECTORY)
class MobileWebShellGenerationTest {
@Test
fun `maps the document, every declared asset and the manifest itself`() {
val generation = make(manifest())
assertNotNull(generation)
val entries = generation!!.entries
assertEquals(4, entries.size)
assertEquals(File(DIRECTORY, "index.html"), entries["/"]!!.file)
assertEquals("text/html; charset=utf-8", entries["/"]!!.contentType)
// Only / may serve document bytes with CSP; no entrypoint alias.
assertNull(entries["/index.html"])
assertEquals(File(DIRECTORY, "assets/bb.png"), entries["/assets/bb.png"]!!.file)
assertEquals("image/png", entries["/assets/bb.png"]!!.contentType)
// The manifest is written last and is not part of the content hash, so it is not in assets[].
assertEquals("application/json", entries["/manifest.json"]!!.contentType)
assertNull(entries["/assets/cc.js"])
}
@Test
fun `refuses a manifest whose shape it does not recognise`() {
assertNull(make("not json"))
@@ -35,11 +35,6 @@ private fun resolve(request: MobileWebShellRequestParts): String? =
class MobileWebShellOriginTest {
@Test
fun `binds a host the parser canonicalised`() {
assertEquals("/", resolve(parts("/", host = mobileWebShellOriginHost(SESSION)!!.uppercase())))
}
@Test
fun `refuses everything outside a plain GET on this origin`() {
assertNull(resolve(parts("/", method = "POST")))
@@ -807,166 +807,6 @@
"e5fab2f35849"
]
}
},
{
"id": "b3.blur-before-1:lifecycle-boundary",
"observation": {
"sender": ["0056f47b204a", "ea4a4f6523e7"],
"payloads": ["1eaad537f925", "7d8d46d494ff"],
"settlements": {
"mount": "eb79a9b3682a",
"lifecycle-blur": "eb79a9b3682a"
},
"state": "780aaf1d97be",
"effects": ["33614c90b6eb", "a4f1a8696a24", "264010756b38"]
}
},
{
"id": "b3.blur-before-1:issue-refused-comments-pending",
"observation": {
"sender": ["d3dc79e5717b", "ea4a4f6523e7"],
"payloads": ["1eaad537f925", "7d8d46d494ff"],
"settlements": {
"mount": "eb79a9b3682a",
"lifecycle-blur": "eb79a9b3682a"
},
"state": "780aaf1d97be",
"effects": ["33614c90b6eb", "a4f1a8696a24", "264010756b38"]
}
},
{
"id": "b3.blur-before-1:settled",
"observation": {
"sender": ["d3dc79e5717b", "1d3774209877"],
"payloads": ["1eaad537f925", "7d8d46d494ff"],
"settlements": {
"mount": "eb79a9b3682a",
"lifecycle-blur": "eb79a9b3682a"
},
"state": "42903545f0f8",
"effects": [
"33614c90b6eb",
"a4f1a8696a24",
"264010756b38",
"51ea77da7dbd",
"8ccd4fa759a5"
]
}
},
{
"id": "b3.blur-after-1:lifecycle-boundary",
"observation": {
"sender": ["d3dc79e5717b", "ea4a4f6523e7"],
"payloads": ["1eaad537f925", "7d8d46d494ff"],
"settlements": {
"mount": "eb79a9b3682a",
"lifecycle-blur": "eb79a9b3682a"
},
"state": "780aaf1d97be",
"effects": ["33614c90b6eb", "a4f1a8696a24", "264010756b38"]
}
},
{
"id": "b3.blur-after-1:issue-refused-comments-pending",
"observation": {
"sender": ["d3dc79e5717b", "ea4a4f6523e7"],
"payloads": ["1eaad537f925", "7d8d46d494ff"],
"settlements": {
"mount": "eb79a9b3682a",
"lifecycle-blur": "eb79a9b3682a"
},
"state": "780aaf1d97be",
"effects": ["33614c90b6eb", "a4f1a8696a24", "264010756b38"]
}
},
{
"id": "b3.blur-after-1:settled",
"observation": {
"sender": ["d3dc79e5717b", "1d3774209877"],
"payloads": ["1eaad537f925", "7d8d46d494ff"],
"settlements": {
"mount": "eb79a9b3682a",
"lifecycle-blur": "eb79a9b3682a"
},
"state": "42903545f0f8",
"effects": [
"33614c90b6eb",
"a4f1a8696a24",
"264010756b38",
"51ea77da7dbd",
"8ccd4fa759a5"
]
}
},
{
"id": "b3.blur-before-2:lifecycle-boundary",
"observation": {
"sender": ["d3dc79e5717b", "ea4a4f6523e7"],
"payloads": ["1eaad537f925", "7d8d46d494ff"],
"settlements": {
"mount": "eb79a9b3682a",
"lifecycle-blur": "eb79a9b3682a"
},
"state": "780aaf1d97be",
"effects": ["33614c90b6eb", "a4f1a8696a24", "264010756b38"]
}
},
{
"id": "b3.blur-before-2:settled",
"observation": {
"sender": ["d3dc79e5717b", "1d3774209877"],
"payloads": ["1eaad537f925", "7d8d46d494ff"],
"settlements": {
"mount": "eb79a9b3682a",
"lifecycle-blur": "eb79a9b3682a"
},
"state": "42903545f0f8",
"effects": [
"33614c90b6eb",
"a4f1a8696a24",
"264010756b38",
"51ea77da7dbd",
"8ccd4fa759a5"
]
}
},
{
"id": "b3.blur-after-2:lifecycle-boundary",
"observation": {
"sender": ["d3dc79e5717b", "1d3774209877"],
"payloads": ["1eaad537f925", "7d8d46d494ff"],
"settlements": {
"mount": "eb79a9b3682a",
"lifecycle-blur": "eb79a9b3682a"
},
"state": "42903545f0f8",
"effects": [
"33614c90b6eb",
"a4f1a8696a24",
"264010756b38",
"51ea77da7dbd",
"8ccd4fa759a5"
]
}
},
{
"id": "b3.blur-after-2:settled",
"observation": {
"sender": ["d3dc79e5717b", "1d3774209877"],
"payloads": ["1eaad537f925", "7d8d46d494ff"],
"settlements": {
"mount": "eb79a9b3682a",
"lifecycle-blur": "eb79a9b3682a"
},
"state": "42903545f0f8",
"effects": [
"33614c90b6eb",
"a4f1a8696a24",
"264010756b38",
"51ea77da7dbd",
"8ccd4fa759a5"
]
}
}
]
}
@@ -452,118 +452,6 @@
"state": "602e35a92eec",
"effects": []
}
},
{
"id": "inventory-lifecycle.blur-before-1:lifecycle-boundary",
"observation": {
"sender": ["bf6281c52e28"],
"payloads": ["8db0d1234c94"],
"settlements": {
"mount": "eb79a9b3682a",
"old": "eb79a9b3682a",
"lifecycle-blur": "d2ad71e601c4"
},
"state": "602e35a92eec",
"effects": []
}
},
{
"id": "inventory-lifecycle.blur-before-1:settled",
"observation": {
"sender": ["32c9018052ba", "2f1953cc0315"],
"payloads": ["8db0d1234c94", "c9b9d7a9b388"],
"settlements": {
"mount": "eb79a9b3682a",
"old": "eb79a9b3682a",
"lifecycle-blur": "d2ad71e601c4"
},
"state": "fe1aebea954c",
"effects": []
}
},
{
"id": "inventory-lifecycle.blur-after-1:lifecycle-boundary",
"observation": {
"sender": ["32c9018052ba", "ea94d4508bba"],
"payloads": ["8db0d1234c94", "c9b9d7a9b388"],
"settlements": {
"mount": "eb79a9b3682a",
"old": "eb79a9b3682a",
"lifecycle-blur": "d2ad71e601c4"
},
"state": "602e35a92eec",
"effects": []
}
},
{
"id": "inventory-lifecycle.blur-after-1:settled",
"observation": {
"sender": ["32c9018052ba", "2f1953cc0315"],
"payloads": ["8db0d1234c94", "c9b9d7a9b388"],
"settlements": {
"mount": "eb79a9b3682a",
"old": "eb79a9b3682a",
"lifecycle-blur": "d2ad71e601c4"
},
"state": "fe1aebea954c",
"effects": []
}
},
{
"id": "inventory-lifecycle.blur-before-2:lifecycle-boundary",
"observation": {
"sender": ["32c9018052ba", "ea94d4508bba"],
"payloads": ["8db0d1234c94", "c9b9d7a9b388"],
"settlements": {
"mount": "eb79a9b3682a",
"old": "eb79a9b3682a",
"lifecycle-blur": "d2ad71e601c4"
},
"state": "602e35a92eec",
"effects": []
}
},
{
"id": "inventory-lifecycle.blur-before-2:settled",
"observation": {
"sender": ["32c9018052ba", "2f1953cc0315"],
"payloads": ["8db0d1234c94", "c9b9d7a9b388"],
"settlements": {
"mount": "eb79a9b3682a",
"old": "eb79a9b3682a",
"lifecycle-blur": "d2ad71e601c4"
},
"state": "fe1aebea954c",
"effects": []
}
},
{
"id": "inventory-lifecycle.blur-after-2:lifecycle-boundary",
"observation": {
"sender": ["32c9018052ba", "2f1953cc0315"],
"payloads": ["8db0d1234c94", "c9b9d7a9b388"],
"settlements": {
"mount": "eb79a9b3682a",
"old": "eb79a9b3682a",
"lifecycle-blur": "d2ad71e601c4"
},
"state": "fe1aebea954c",
"effects": []
}
},
{
"id": "inventory-lifecycle.blur-after-2:settled",
"observation": {
"sender": ["32c9018052ba", "2f1953cc0315"],
"payloads": ["8db0d1234c94", "c9b9d7a9b388"],
"settlements": {
"mount": "eb79a9b3682a",
"old": "eb79a9b3682a",
"lifecycle-blur": "d2ad71e601c4"
},
"state": "fe1aebea954c",
"effects": []
}
}
]
}
@@ -263,58 +263,6 @@
"state": "4f53cda18c2b",
"effects": []
}
},
{
"id": "settings-bot-overrides-fulfilled.blur-before-1:lifecycle-boundary",
"observation": {
"sender": ["e3973bb12da1"],
"payloads": ["c8c77ac17e0a"],
"settlements": {
"mount": "eb79a9b3682a",
"lifecycle-blur": "eb79a9b3682a"
},
"state": "4f53cda18c2b",
"effects": []
}
},
{
"id": "settings-bot-overrides-fulfilled.blur-before-1:settled",
"observation": {
"sender": ["b0e514c7c334"],
"payloads": ["c8c77ac17e0a"],
"settlements": {
"mount": "eb79a9b3682a",
"lifecycle-blur": "eb79a9b3682a"
},
"state": "d52c8e96e222",
"effects": []
}
},
{
"id": "settings-bot-overrides-fulfilled.blur-after-1:lifecycle-boundary",
"observation": {
"sender": ["b0e514c7c334"],
"payloads": ["c8c77ac17e0a"],
"settlements": {
"mount": "eb79a9b3682a",
"lifecycle-blur": "eb79a9b3682a"
},
"state": "d52c8e96e222",
"effects": []
}
},
{
"id": "settings-bot-overrides-fulfilled.blur-after-1:settled",
"observation": {
"sender": ["b0e514c7c334"],
"payloads": ["c8c77ac17e0a"],
"settlements": {
"mount": "eb79a9b3682a",
"lifecycle-blur": "eb79a9b3682a"
},
"state": "d52c8e96e222",
"effects": []
}
}
]
}
@@ -1,785 +0,0 @@
{
"goldenFormatVersion": 6,
"operation": "agentSession.structured-launch",
"family": "agentSession.structured-create",
"namedDeltas": [],
"values": {
"001cba249e32": {
"name": "agentSession.create#2",
"ordinal": 5,
"args": [
{
"name": "method",
"value": "agentSession.create"
},
{
"name": "params",
"value": {
"agent": "claude",
"envelope": {
"clientOperationId": "1767225600000-00000000000040008000000000000002",
"expectedRuntimeFence": {
"$rpc": "null"
},
"payloadFingerprint": "ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
},
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"budgetSpansConnect": true,
"timeoutMs": 15000
}
}
],
"settlement": {
"status": "pending",
"startedAt": 0
}
},
"00c4403a6cae": {
"name": "agentSession.create#1",
"ordinal": 3,
"args": [
{
"name": "method",
"value": "agentSession.create"
},
{
"name": "params",
"value": {
"agent": "claude",
"envelope": {
"clientOperationId": "1767225600000-00000000000040008000000000000002",
"expectedRuntimeFence": {
"$rpc": "null"
},
"payloadFingerprint": "ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
},
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"budgetSpansConnect": true,
"timeoutMs": 15000
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-2",
"ok": true
}
}
},
"052339a099eb": {
"name": "agentSession.create#1",
"ordinal": 3,
"args": [
{
"name": "method",
"value": "agentSession.create"
},
{
"name": "params",
"value": {
"agent": "claude",
"envelope": {
"clientOperationId": "1767225600000-00000000000040008000000000000002",
"expectedRuntimeFence": {
"$rpc": "null"
},
"payloadFingerprint": "ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
},
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"budgetSpansConnect": true,
"timeoutMs": 15000
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-2",
"ok": true,
"result": {
"error": {
"message": "inner refused"
},
"ok": false
}
}
}
},
"05c8ed108777": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"kind": "unknown",
"message": "The Claude chat result could not be confirmed."
}
},
"122f5b326dbb": {
"launched": {
"kind": "failed",
"message": "Unknown method"
}
},
"18bdbb57da23": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"kind": "unknown",
"message": "outer refused"
}
},
"3ce787e7eb26": {
"name": "agentSession.create#1",
"ordinal": 3,
"args": [
{
"name": "method",
"value": "agentSession.create"
},
{
"name": "params",
"value": {
"agent": "claude",
"envelope": {
"clientOperationId": "1767225600000-00000000000040008000000000000002",
"expectedRuntimeFence": {
"$rpc": "null"
},
"payloadFingerprint": "ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
},
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"budgetSpansConnect": true,
"timeoutMs": 15000
}
}
],
"settlement": {
"status": "rejected",
"startedAt": 0,
"settledAt": 0,
"error": {
"category": "Error",
"message": "",
"isRpcDeliveryUnknown": true
}
}
},
"3e8a38dc3ecb": {
"name": "agentSession.create#1",
"ordinal": 3,
"args": [
{
"name": "method",
"value": "agentSession.create"
},
{
"name": "params",
"value": {
"agent": "claude",
"envelope": {
"clientOperationId": "1767225600000-00000000000040008000000000000002",
"expectedRuntimeFence": {
"$rpc": "null"
},
"payloadFingerprint": "ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
},
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"budgetSpansConnect": true,
"timeoutMs": 15000
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"error": {
"code": "method_not_found",
"message": "Unknown method"
},
"id": "frame-2",
"ok": false
}
}
},
"568aa5cfc6b5": {
"name": "agentSession.createSupport#1",
"ordinal": 2,
"json": "{\"id\":\"frame-1\",\"deviceToken\":\"recording-device\",\"method\":\"agentSession.createSupport\",\"params\":{\"worktree\":\"id:workspace-1\",\"agent\":\"claude\"}}"
},
"5d0f7c315752": {
"name": "agentSession.create#1",
"ordinal": 3,
"args": [
{
"name": "method",
"value": "agentSession.create"
},
{
"name": "params",
"value": {
"agent": "claude",
"envelope": {
"clientOperationId": "1767225600000-00000000000040008000000000000002",
"expectedRuntimeFence": {
"$rpc": "null"
},
"payloadFingerprint": "ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
},
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"budgetSpansConnect": true,
"timeoutMs": 15000
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"error": {
"code": "refused",
"message": ""
},
"id": "frame-2",
"ok": false
}
}
},
"616f0f78cd71": {
"launched": {
"kind": "unknown",
"message": "outer refused"
}
},
"6d6669cd1a85": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"kind": "created",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
}
},
"73bdf299262b": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"kind": "failed",
"message": "Unknown method"
}
},
"7903f6b6f8fd": {
"name": "agentSession.create#1",
"ordinal": 3,
"args": [
{
"name": "method",
"value": "agentSession.create"
},
{
"name": "params",
"value": {
"agent": "claude",
"envelope": {
"clientOperationId": "1767225600000-00000000000040008000000000000002",
"expectedRuntimeFence": {
"$rpc": "null"
},
"payloadFingerprint": "ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
},
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"budgetSpansConnect": true,
"timeoutMs": 15000
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"error": {
"code": "refused",
"message": "outer refused"
},
"id": "frame-2",
"ok": false
}
}
},
"907c2954b0e2": {
"name": "agentSession.create#1",
"ordinal": 3,
"args": [
{
"name": "method",
"value": "agentSession.create"
},
{
"name": "params",
"value": {
"agent": "claude",
"envelope": {
"clientOperationId": "1767225600000-00000000000040008000000000000002",
"expectedRuntimeFence": {
"$rpc": "null"
},
"payloadFingerprint": "ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
},
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"budgetSpansConnect": true,
"timeoutMs": 15000
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-2",
"ok": true,
"result": {
"error": "refused"
}
}
}
},
"91f56e5d551d": {
"name": "agentSession.create#1",
"ordinal": 4,
"json": "{\"id\":\"frame-2\",\"deviceToken\":\"recording-device\",\"method\":\"agentSession.create\",\"params\":{\"envelope\":{\"sessionId\":\"claude_00000000_0000_4000_8000_000000000001\",\"clientOperationId\":\"1767225600000-00000000000040008000000000000002\",\"expectedRuntimeFence\":null,\"payloadFingerprint\":\"ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605\"},\"worktree\":\"id:workspace-1\",\"agent\":\"claude\"}}"
},
"9270aeb7d9c6": {
"status": "pending",
"startedAt": 0
},
"95e3678a4ba5": {
"name": "agentSession.create#1",
"ordinal": 3,
"args": [
{
"name": "method",
"value": "agentSession.create"
},
{
"name": "params",
"value": {
"agent": "claude",
"envelope": {
"clientOperationId": "1767225600000-00000000000040008000000000000002",
"expectedRuntimeFence": {
"$rpc": "null"
},
"payloadFingerprint": "ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
},
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"budgetSpansConnect": true,
"timeoutMs": 15000
}
}
],
"settlement": {
"status": "rejected",
"startedAt": 0,
"settledAt": 0,
"error": {
"category": "Error",
"message": "transport failure",
"isRpcDeliveryUnknown": true
}
}
},
"9e17c54fa815": {
"name": "agentSession.create#1",
"ordinal": 3,
"args": [
{
"name": "method",
"value": "agentSession.create"
},
{
"name": "params",
"value": {
"agent": "claude",
"envelope": {
"clientOperationId": "1767225600000-00000000000040008000000000000002",
"expectedRuntimeFence": {
"$rpc": "null"
},
"payloadFingerprint": "ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
},
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"budgetSpansConnect": true,
"timeoutMs": 15000
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-2",
"ok": true,
"result": {
"$rpc": "null"
}
}
}
},
"a4273b38df83": {
"launched": "unlaunched"
},
"a75955abbbbc": {
"name": "agentSession.createSupport#1",
"ordinal": 1,
"args": [
{
"name": "method",
"value": "agentSession.createSupport"
},
{
"name": "params",
"value": {
"agent": "claude",
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-1",
"ok": true,
"result": {
"supported": true
}
}
}
},
"b5f7cf9d778d": {
"name": "agentSession.create#1",
"ordinal": 3,
"args": [
{
"name": "method",
"value": "agentSession.create"
},
{
"name": "params",
"value": {
"agent": "claude",
"envelope": {
"clientOperationId": "1767225600000-00000000000040008000000000000002",
"expectedRuntimeFence": {
"$rpc": "null"
},
"payloadFingerprint": "ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
},
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"budgetSpansConnect": true,
"timeoutMs": 15000
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-2",
"ok": true,
"result": {
"ok": true,
"value": {
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
}
}
}
}
},
"c4b8d1feb09b": {
"name": "agentSession.create#1",
"ordinal": 3,
"args": [
{
"name": "method",
"value": "agentSession.create"
},
{
"name": "params",
"value": {
"agent": "claude",
"envelope": {
"clientOperationId": "1767225600000-00000000000040008000000000000002",
"expectedRuntimeFence": {
"$rpc": "null"
},
"payloadFingerprint": "ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
},
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"budgetSpansConnect": true,
"timeoutMs": 15000
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-2",
"ok": true,
"result": {
"error": "inner refused",
"ok": false
}
}
}
},
"d00057b53c3e": {
"launched": {
"kind": "created",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
}
},
"f931c8ee446a": {
"launched": {
"kind": "unknown",
"message": "The Claude chat result could not be confirmed."
}
},
"fdff1e265b45": {
"name": "agentSession.create#2",
"ordinal": 6,
"json": "{\"id\":\"frame-3\",\"deviceToken\":\"recording-device\",\"method\":\"agentSession.create\",\"params\":{\"envelope\":{\"sessionId\":\"claude_00000000_0000_4000_8000_000000000001\",\"clientOperationId\":\"1767225600000-00000000000040008000000000000002\",\"expectedRuntimeFence\":null,\"payloadFingerprint\":\"ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605\"},\"worktree\":\"id:workspace-1\",\"agent\":\"claude\"}}"
}
},
"recording": {
"scenario": "matrix-agentsession.structured-create-agentsession.create-1",
"checkpoints": [
{
"id": "structured-agent-session-created.normal:created",
"observation": {
"sender": ["a75955abbbbc", "b5f7cf9d778d"],
"payloads": ["568aa5cfc6b5", "91f56e5d551d"],
"settlements": {
"claude": "6d6669cd1a85"
},
"state": "d00057b53c3e",
"effects": []
}
},
{
"id": "structured-agent-session-created.result-absent:created",
"observation": {
"sender": ["a75955abbbbc", "00c4403a6cae"],
"payloads": ["568aa5cfc6b5", "91f56e5d551d"],
"settlements": {
"claude": "05c8ed108777"
},
"state": "f931c8ee446a",
"effects": []
}
},
{
"id": "structured-agent-session-created.result-null:created",
"observation": {
"sender": ["a75955abbbbc", "9e17c54fa815"],
"payloads": ["568aa5cfc6b5", "91f56e5d551d"],
"settlements": {
"claude": "05c8ed108777"
},
"state": "f931c8ee446a",
"effects": []
}
},
{
"id": "structured-agent-session-created.inner-ok-missing:created",
"observation": {
"sender": ["a75955abbbbc", "907c2954b0e2"],
"payloads": ["568aa5cfc6b5", "91f56e5d551d"],
"settlements": {
"claude": "05c8ed108777"
},
"state": "f931c8ee446a",
"effects": []
}
},
{
"id": "structured-agent-session-created.inner-false-string-error:created",
"observation": {
"sender": ["a75955abbbbc", "c4b8d1feb09b"],
"payloads": ["568aa5cfc6b5", "91f56e5d551d"],
"settlements": {
"claude": "05c8ed108777"
},
"state": "f931c8ee446a",
"effects": []
}
},
{
"id": "structured-agent-session-created.inner-false-object-error:created",
"observation": {
"sender": ["a75955abbbbc", "052339a099eb"],
"payloads": ["568aa5cfc6b5", "91f56e5d551d"],
"settlements": {
"claude": "05c8ed108777"
},
"state": "f931c8ee446a",
"effects": []
}
},
{
"id": "structured-agent-session-created.outer-refused:created",
"observation": {
"sender": ["a75955abbbbc", "7903f6b6f8fd"],
"payloads": ["568aa5cfc6b5", "91f56e5d551d"],
"settlements": {
"claude": "18bdbb57da23"
},
"state": "616f0f78cd71",
"effects": []
}
},
{
"id": "structured-agent-session-created.outer-refused-no-message:created",
"observation": {
"sender": ["a75955abbbbc", "5d0f7c315752"],
"payloads": ["568aa5cfc6b5", "91f56e5d551d"],
"settlements": {
"claude": "05c8ed108777"
},
"state": "f931c8ee446a",
"effects": []
}
},
{
"id": "structured-agent-session-created.method-not-found:created",
"observation": {
"sender": ["a75955abbbbc", "3e8a38dc3ecb"],
"payloads": ["568aa5cfc6b5", "91f56e5d551d"],
"settlements": {
"claude": "73bdf299262b"
},
"state": "122f5b326dbb",
"effects": []
}
},
{
"id": "structured-agent-session-created.transport-rejection:created",
"observation": {
"sender": ["a75955abbbbc", "95e3678a4ba5", "001cba249e32"],
"payloads": ["568aa5cfc6b5", "91f56e5d551d", "fdff1e265b45"],
"settlements": {
"claude": "9270aeb7d9c6"
},
"state": "a4273b38df83",
"effects": []
}
},
{
"id": "structured-agent-session-created.transport-rejection-no-message:created",
"observation": {
"sender": ["a75955abbbbc", "3ce787e7eb26", "001cba249e32"],
"payloads": ["568aa5cfc6b5", "91f56e5d551d", "fdff1e265b45"],
"settlements": {
"claude": "9270aeb7d9c6"
},
"state": "a4273b38df83",
"effects": []
}
}
]
}
}
@@ -1,634 +0,0 @@
{
"goldenFormatVersion": 6,
"operation": "agentSession.structured-launch",
"family": "agentSession.structured-create",
"namedDeltas": [],
"values": {
"04f63acf891a": {
"launched": {
"kind": "unsupported",
"reason": {
"$rpc": "undefined"
}
}
},
"0dd78669f08d": {
"name": "agentSession.createSupport#1",
"ordinal": 1,
"args": [
{
"name": "method",
"value": "agentSession.createSupport"
},
{
"name": "params",
"value": {
"agent": "claude",
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"error": {
"code": "refused",
"message": ""
},
"id": "frame-1",
"ok": false
}
}
},
"1554c780f755": {
"name": "agentSession.createSupport#1",
"ordinal": 1,
"args": [
{
"name": "method",
"value": "agentSession.createSupport"
},
{
"name": "params",
"value": {
"agent": "claude",
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-1",
"ok": true,
"result": {
"error": "inner refused",
"ok": false
}
}
}
},
"25ff00540c46": {
"name": "agentSession.createSupport#1",
"ordinal": 1,
"args": [
{
"name": "method",
"value": "agentSession.createSupport"
},
{
"name": "params",
"value": {
"agent": "claude",
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-1",
"ok": true,
"result": {
"error": "refused"
}
}
}
},
"27cc7a2b58c9": {
"name": "agentSession.createSupport#1",
"ordinal": 1,
"args": [
{
"name": "method",
"value": "agentSession.createSupport"
},
{
"name": "params",
"value": {
"agent": "claude",
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-1",
"ok": true,
"result": {
"error": {
"message": "inner refused"
},
"ok": false
}
}
}
},
"2c227fd1941f": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"kind": "unsupported"
}
},
"553200ba8c0f": {
"name": "agentSession.createSupport#1",
"ordinal": 1,
"args": [
{
"name": "method",
"value": "agentSession.createSupport"
},
{
"name": "params",
"value": {
"agent": "claude",
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"error": {
"code": "refused",
"message": "outer refused"
},
"id": "frame-1",
"ok": false
}
}
},
"568aa5cfc6b5": {
"name": "agentSession.createSupport#1",
"ordinal": 2,
"json": "{\"id\":\"frame-1\",\"deviceToken\":\"recording-device\",\"method\":\"agentSession.createSupport\",\"params\":{\"worktree\":\"id:workspace-1\",\"agent\":\"claude\"}}"
},
"6d6669cd1a85": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"kind": "created",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
}
},
"8201501565d9": {
"name": "agentSession.createSupport#1",
"ordinal": 1,
"args": [
{
"name": "method",
"value": "agentSession.createSupport"
},
{
"name": "params",
"value": {
"agent": "claude",
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-1",
"ok": true,
"result": {
"$rpc": "null"
}
}
}
},
"91f56e5d551d": {
"name": "agentSession.create#1",
"ordinal": 4,
"json": "{\"id\":\"frame-2\",\"deviceToken\":\"recording-device\",\"method\":\"agentSession.create\",\"params\":{\"envelope\":{\"sessionId\":\"claude_00000000_0000_4000_8000_000000000001\",\"clientOperationId\":\"1767225600000-00000000000040008000000000000002\",\"expectedRuntimeFence\":null,\"payloadFingerprint\":\"ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605\"},\"worktree\":\"id:workspace-1\",\"agent\":\"claude\"}}"
},
"a4da7b5347e4": {
"name": "agentSession.createSupport#1",
"ordinal": 1,
"args": [
{
"name": "method",
"value": "agentSession.createSupport"
},
{
"name": "params",
"value": {
"agent": "claude",
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "rejected",
"startedAt": 0,
"settledAt": 0,
"error": {
"category": "Error",
"message": "",
"isRpcDeliveryUnknown": true
}
}
},
"a75955abbbbc": {
"name": "agentSession.createSupport#1",
"ordinal": 1,
"args": [
{
"name": "method",
"value": "agentSession.createSupport"
},
{
"name": "params",
"value": {
"agent": "claude",
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-1",
"ok": true,
"result": {
"supported": true
}
}
}
},
"b5f7cf9d778d": {
"name": "agentSession.create#1",
"ordinal": 3,
"args": [
{
"name": "method",
"value": "agentSession.create"
},
{
"name": "params",
"value": {
"agent": "claude",
"envelope": {
"clientOperationId": "1767225600000-00000000000040008000000000000002",
"expectedRuntimeFence": {
"$rpc": "null"
},
"payloadFingerprint": "ce04a6ad4f07079b36cb0b4e9b1bcfd95481b5cb2428fbe93b3c0cf995ef8605",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
},
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"budgetSpansConnect": true,
"timeoutMs": 15000
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-2",
"ok": true,
"result": {
"ok": true,
"value": {
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
}
}
}
}
},
"be9e3b9ce2e7": {
"name": "agentSession.createSupport#1",
"ordinal": 1,
"args": [
{
"name": "method",
"value": "agentSession.createSupport"
},
{
"name": "params",
"value": {
"agent": "claude",
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-1",
"ok": true
}
}
},
"d00057b53c3e": {
"launched": {
"kind": "created",
"sessionId": "claude_00000000_0000_4000_8000_000000000001"
}
},
"da841ebfb6b9": {
"name": "agentSession.createSupport#1",
"ordinal": 1,
"args": [
{
"name": "method",
"value": "agentSession.createSupport"
},
{
"name": "params",
"value": {
"agent": "claude",
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "rejected",
"startedAt": 0,
"settledAt": 0,
"error": {
"category": "Error",
"message": "transport failure",
"isRpcDeliveryUnknown": true
}
}
},
"efee3e1e1620": {
"name": "agentSession.createSupport#1",
"ordinal": 1,
"args": [
{
"name": "method",
"value": "agentSession.createSupport"
},
{
"name": "params",
"value": {
"agent": "claude",
"worktree": "id:workspace-1"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"error": {
"code": "method_not_found",
"message": "Unknown method"
},
"id": "frame-1",
"ok": false
}
}
},
"f0bb9de9827c": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"kind": "unsupported",
"reason": {
"$rpc": "undefined"
}
}
},
"f40adca316f9": {
"launched": {
"kind": "unsupported"
}
}
},
"recording": {
"scenario": "matrix-agentsession.structured-create-agentsession.createsupport-1",
"checkpoints": [
{
"id": "structured-agent-session-created.normal:created",
"observation": {
"sender": ["a75955abbbbc", "b5f7cf9d778d"],
"payloads": ["568aa5cfc6b5", "91f56e5d551d"],
"settlements": {
"claude": "6d6669cd1a85"
},
"state": "d00057b53c3e",
"effects": []
}
},
{
"id": "structured-agent-session-created.result-absent:created",
"observation": {
"sender": ["be9e3b9ce2e7"],
"payloads": ["568aa5cfc6b5"],
"settlements": {
"claude": "f0bb9de9827c"
},
"state": "04f63acf891a",
"effects": []
}
},
{
"id": "structured-agent-session-created.result-null:created",
"observation": {
"sender": ["8201501565d9"],
"payloads": ["568aa5cfc6b5"],
"settlements": {
"claude": "f0bb9de9827c"
},
"state": "04f63acf891a",
"effects": []
}
},
{
"id": "structured-agent-session-created.inner-ok-missing:created",
"observation": {
"sender": ["25ff00540c46"],
"payloads": ["568aa5cfc6b5"],
"settlements": {
"claude": "f0bb9de9827c"
},
"state": "04f63acf891a",
"effects": []
}
},
{
"id": "structured-agent-session-created.inner-false-string-error:created",
"observation": {
"sender": ["1554c780f755"],
"payloads": ["568aa5cfc6b5"],
"settlements": {
"claude": "f0bb9de9827c"
},
"state": "04f63acf891a",
"effects": []
}
},
{
"id": "structured-agent-session-created.inner-false-object-error:created",
"observation": {
"sender": ["27cc7a2b58c9"],
"payloads": ["568aa5cfc6b5"],
"settlements": {
"claude": "f0bb9de9827c"
},
"state": "04f63acf891a",
"effects": []
}
},
{
"id": "structured-agent-session-created.outer-refused:created",
"observation": {
"sender": ["553200ba8c0f"],
"payloads": ["568aa5cfc6b5"],
"settlements": {
"claude": "2c227fd1941f"
},
"state": "f40adca316f9",
"effects": []
}
},
{
"id": "structured-agent-session-created.outer-refused-no-message:created",
"observation": {
"sender": ["0dd78669f08d"],
"payloads": ["568aa5cfc6b5"],
"settlements": {
"claude": "2c227fd1941f"
},
"state": "f40adca316f9",
"effects": []
}
},
{
"id": "structured-agent-session-created.method-not-found:created",
"observation": {
"sender": ["efee3e1e1620"],
"payloads": ["568aa5cfc6b5"],
"settlements": {
"claude": "2c227fd1941f"
},
"state": "f40adca316f9",
"effects": []
}
},
{
"id": "structured-agent-session-created.transport-rejection:created",
"observation": {
"sender": ["da841ebfb6b9"],
"payloads": ["568aa5cfc6b5"],
"settlements": {
"claude": "2c227fd1941f"
},
"state": "f40adca316f9",
"effects": []
}
},
{
"id": "structured-agent-session-created.transport-rejection-no-message:created",
"observation": {
"sender": ["a4da7b5347e4"],
"payloads": ["568aa5cfc6b5"],
"settlements": {
"claude": "2c227fd1941f"
},
"state": "f40adca316f9",
"effects": []
}
}
]
}
}

Some files were not shown because too many files have changed in this diff Show More