mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 10:58:10 +00:00
* fix(sidebar): land flip-a's switch-on fixes on main, still dark (no flip) The fixes found while the sidebar ran from main's feed, without turning that on: ORCA_SIDEBAR_INPUTS_IS_MAIN stays false, and none of flip-a's stop-gaps come along. - Main stops counting a closed tab's terminal once it was asked to stop and no pane shows it; a failed or refused stop takes the request back, and a host out of contact stays unverifiable. - Main fetches a paired server's rows with the transport's normal bound, so a server slower than 5 s still lists. - A deferred unread raise flips the folder row it was decided for, and a read while the owner check is out cancels it. - Phone: no worktree.ps flash before the feed; a host's last installed feed stands in while a fresh read is out; it highlights its own last-opened workspace and a fold never scrolls; projects file under their project group with the desktop's indent; the collapse spinner shows only after 500 ms; "Reopen to update" keeps the rows on screen. - e2e helpers and journeys for the switch-on suite. * fix(sidebar): keep an owed relay stop marked, clear a thrown stop, and prune pending unread raises - A stop-and-wait that throws takes its stop request back, like one that fails. - A final stop the legacy relay still owes stays marked, since the relay retries it. - Pending unread raises are tracked only while one waits, so the map no longer grows. - The paired-server fallback poll test gives its third fetch a reply and asserts live. * fix(sidebar): key activity, review, retention and repo lookups by host, not bare id The feed published activity and PR facts by bare workspace id, so a same-id workspace on two hosts (a paired server and this desktop, or two servers) shared one host's facts. Activity and review are now keyed by row identity, retention sweeps per listed row, and the builder resolves each row's repo by its own host's registration. Bumps the feed semantics version to 3. Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103 * test(e2e): read a review fact by its row key Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103 * test(mobile): key fixture rows by row identity Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103 * fix(sidebar): count and label rows by their own repo registration; keep activity keyed through a failed listing Host header counts and mixed-host labels read the row's own registration, as the host filter and row now do, so one render cannot file a row under one host and count it under another. A failed listing keys activity by the last rows. Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103 * fix(sidebar): a slower older listing never overwrites a newer one's rows Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103 * test(sidebar): read the quiet-desktop PR fact by its row key Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103 * refactor(repos): the renderer re-exports the shared getRepoHostIdentity Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103
72 lines
2.9 KiB
TypeScript
72 lines
2.9 KiB
TypeScript
import type { Page } from '@stablyai/playwright-test'
|
|
import { test, expect } from './helpers/orca-app'
|
|
import { SIDEBAR_INPUTS_BUILD } from './helpers/sidebar-inputs-build'
|
|
import { waitForActiveWorktree, waitForSessionReady } from './helpers/store'
|
|
import { WorkspaceReviewFactsSnapshotSchema } from '../../src/shared/sidebar-list/workspace-review-facts'
|
|
import { getWorktreeIdFromHostIdentity } from '../../src/shared/worktree/host-qualified-identity'
|
|
|
|
test.skip(
|
|
!SIDEBAR_INPUTS_BUILD,
|
|
'main publishes sidebar inputs only in an ORCA_SIDEBAR_INPUTS=main build'
|
|
)
|
|
|
|
/** Writes a PR into the window's cache the way a fetch result lands; returns the row's id. */
|
|
async function setWindowPRState(page: Page, state: 'open' | 'merged' | null): Promise<string> {
|
|
return page.evaluate((state) => {
|
|
const store = window.__store
|
|
if (!store) {
|
|
throw new Error('window.__store is not available')
|
|
}
|
|
const current = store.getState()
|
|
const worktree = Object.values(current.worktreesByRepo)
|
|
.flat()
|
|
.find((entry) => entry.branch.replace(/^refs\/heads\//, '') === 'e2e-secondary')
|
|
if (!worktree) {
|
|
throw new Error('seeded e2e-secondary worktree not found')
|
|
}
|
|
const key = `${worktree.repoId}::e2e-secondary`
|
|
const pr = state && {
|
|
number: 81,
|
|
title: 'Review facts from E2E',
|
|
state,
|
|
url: 'https://github.com/acme/orca/pull/81',
|
|
checksStatus: 'pending' as const,
|
|
updatedAt: '2026-10-17T00:00:00.000Z',
|
|
mergeable: 'UNKNOWN' as const
|
|
}
|
|
store.setState({ prCache: { ...current.prCache, [key]: { data: pr, fetchedAt: Date.now() } } })
|
|
return worktree.id
|
|
}, state)
|
|
}
|
|
|
|
async function readMainReviewFact(page: Page, worktreeId: string): Promise<unknown> {
|
|
const response = await page.evaluate(() =>
|
|
window.api.runtime.call({ method: 'sidebarInputs.reviewFacts' })
|
|
)
|
|
if (!response.ok) {
|
|
throw new Error('sidebarInputs.reviewFacts failed')
|
|
}
|
|
// Keyed by row identity; the seeded workspace is listed on this host only.
|
|
const facts = Object.entries(WorkspaceReviewFactsSnapshotSchema.parse(response.result).facts)
|
|
return facts.find(([key]) => getWorktreeIdFromHostIdentity(key) === worktreeId)?.[1] ?? null
|
|
}
|
|
|
|
test('main follows the window PR cache for each workspace', async ({ orcaPage }) => {
|
|
await waitForSessionReady(orcaPage)
|
|
await waitForActiveWorktree(orcaPage)
|
|
|
|
const worktreeId = await setWindowPRState(orcaPage, 'open')
|
|
// The window mirrors its cache to main within a second of a change.
|
|
await expect
|
|
.poll(() => readMainReviewFact(orcaPage, worktreeId), { timeout: 5_000 })
|
|
.toEqual({ provider: 'github', reviewState: 'open' })
|
|
|
|
await setWindowPRState(orcaPage, 'merged')
|
|
await expect
|
|
.poll(() => readMainReviewFact(orcaPage, worktreeId), { timeout: 5_000 })
|
|
.toEqual({ provider: 'github', reviewState: 'merged' })
|
|
|
|
await setWindowPRState(orcaPage, null)
|
|
await expect.poll(() => readMainReviewFact(orcaPage, worktreeId), { timeout: 5_000 }).toBeNull()
|
|
})
|