mirror of
https://github.com/stablyai/orca.git
synced 2026-11-13 17:37:40 +00:00
* Keep review note changes on their captured workspace owner * Keep review note actions on the copy whose notes are shown Review notes now read their owner and their notes together, so an action always changes the copy the user is looking at: - A paired SSH copy saves through its server even when its row does not name the server, instead of saving on this computer. - The Markdown preview shows and edits the selected copy's notes, not the first copy listed with the same workspace id. - While the selected copy is not listed yet, no other copy's notes are shown; a note started then saves to that copy once it lists. - A listing that stamps the same copy's host no longer looks like a new copy: a pending Send stays held and unsaved note edits are kept. - Clear all / Clear file confirmations stay on the copy they opened on when the selected host changes. - A copy removed since the user acted reports the existing save or clear failure once instead of failing silently. - Mounted note views skip ownership work on store updates that cannot change it, and do not re-render for another copy's changes. * Keep review notes on the exact workspace copy each surface shows Notes, their owner and every note action now come from one copy identity. Previews and editors of a server's copy read and save that copy, paired SSH copies keep working through their server, an SSH draft never lands on a local row, and controls stay disabled instead of claiming "All notes sent" while a copy's notes are unknown. Open Clear confirmations share the cached read, so unrelated store writes do no row work. * Resolve review-note copies through the shared workspace ownership rules Every listed row now gets its copy from the same rules the app routes writes with, including server provenance from detected listings and the SSH place behind a paired server for older rows without host stamps. Previews, editors and diffs read notes from their own tab's provenance instead of the selected copy, folders honor their source's host, and a note composer's shortcut captures the copy its surface shows when it opens. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Keep folder review notes on the folder copy their source names A folder's notes now come from the same source rules as worktree notes, so a file from this app never shows or saves to a server's folder with the same id. Queued folder saves and rollbacks check the captured folder copy the same way reads do, and resolving copies no longer rescans the project list for every row. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Read review-note copies through the shared id indexes Folder and worktree note views now read only their own workspace's catalog entries from the shared indexes, and readers of one folder share its qualification, so listing updates cost work proportional to what is shown rather than catalog size times readers. Also fixes the type errors and the end-to-end note seeds, which now pass the owner of the worktree they seed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Share review-note copy resolution across rows and readers Rows of one workspace on the same host now share a single ownership answer per catalog snapshot, so duplicate listings of an SSH worktree no longer make every note view rescan its peers. Folders that are not listed return one shared answer instead of leaving cache entries behind. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Name the catalog snapshots review-note ownership results are shared under Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Save renamed-file drafts under the new path and encode restored SSH targets A diff note draft opened before its file was renamed in place now saves under the file's current path, still on the copy it was opened on. A restored SSH file whose target id needs encoding now shows and saves its own copy's notes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Update the diff note path ref after render instead of during it Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
118 lines
4.0 KiB
TypeScript
118 lines
4.0 KiB
TypeScript
// Real clicks must reach React note controls inside Monaco view zones; propagation or overlay regressions escape store-only tests.
|
||
|
||
import { test, expect } from './helpers/orca-app'
|
||
import { waitForSessionReady, waitForActiveWorktree } from './helpers/store'
|
||
|
||
test.describe('Diff note delete', () => {
|
||
test.beforeEach(async ({ orcaPage }) => {
|
||
await waitForSessionReady(orcaPage)
|
||
await waitForActiveWorktree(orcaPage)
|
||
})
|
||
|
||
test('clicking the trash button removes the saved note', async ({ orcaPage }) => {
|
||
const worktreeId = await waitForActiveWorktree(orcaPage)
|
||
|
||
// Modify a tracked fixture so Monaco renders a real diff instead of an empty state.
|
||
const { relativePath } = await orcaPage.evaluate(async (wId) => {
|
||
const store = window.__store
|
||
if (!store) {
|
||
throw new Error('window.__store is not available — is the app in dev mode?')
|
||
}
|
||
const state = store.getState()
|
||
const worktree = Object.values(state.worktreesByRepo)
|
||
.flat()
|
||
.find((entry) => entry.id === wId)
|
||
if (!worktree) {
|
||
throw new Error('active worktree not found')
|
||
}
|
||
const separator = worktree.path.includes('\\') ? '\\' : '/'
|
||
const rel = `src${separator}index.ts`
|
||
const absolutePath = `${worktree.path}${separator}${rel}`
|
||
await window.api.fs.writeFile({
|
||
filePath: absolutePath,
|
||
content: 'export const hello = "note-test"\n'
|
||
})
|
||
return { relativePath: rel }
|
||
}, worktreeId)
|
||
|
||
// Seed the note directly to isolate delete from the separate gutter-hover interaction.
|
||
const addResult = await orcaPage.evaluate(
|
||
async ({ wId, rel }) => {
|
||
const store = window.__store
|
||
if (!store) {
|
||
throw new Error('window.__store is not available')
|
||
}
|
||
// The seeded worktree is this app's own (local) copy.
|
||
const comment = await store.getState().addDiffComment(
|
||
{
|
||
kind: 'worktree',
|
||
worktreeId: wId,
|
||
authority: { endpoint: { kind: 'self' }, at: 'local' }
|
||
},
|
||
{
|
||
worktreeId: wId,
|
||
filePath: rel,
|
||
source: 'diff',
|
||
lineNumber: 1,
|
||
body: 'delete-me note',
|
||
side: 'modified'
|
||
}
|
||
)
|
||
return comment
|
||
},
|
||
{ wId: worktreeId, rel: relativePath }
|
||
)
|
||
expect(addResult, 'addDiffComment returned null').not.toBeNull()
|
||
const commentId = addResult!.id
|
||
|
||
await orcaPage.evaluate(
|
||
({ wId, rel }) => {
|
||
const store = window.__store
|
||
if (!store) {
|
||
throw new Error('window.__store is not available')
|
||
}
|
||
const state = store.getState()
|
||
const worktree = Object.values(state.worktreesByRepo)
|
||
.flat()
|
||
.find((entry) => entry.id === wId)
|
||
if (!worktree) {
|
||
throw new Error('active worktree not found')
|
||
}
|
||
const separator = worktree.path.includes('\\') ? '\\' : '/'
|
||
state.openDiff(wId, `${worktree.path}${separator}${rel}`, rel, 'typescript', false)
|
||
},
|
||
{ wId: worktreeId, rel: relativePath }
|
||
)
|
||
|
||
// Wait for the trash button itself to prove the React root inside Monaco’s zone mounted.
|
||
const deleteButton = orcaPage.getByTitle('Delete note').first()
|
||
await expect(deleteButton).toBeVisible({ timeout: 15_000 })
|
||
|
||
await deleteButton.click()
|
||
|
||
await expect
|
||
.poll(
|
||
async () =>
|
||
orcaPage.evaluate((id: string) => {
|
||
const store = window.__store
|
||
if (!store) {
|
||
return null
|
||
}
|
||
const all = Object.values(store.getState().worktreesByRepo)
|
||
.flat()
|
||
.flatMap((w) => w.diffComments ?? [])
|
||
return all.some((c) => c.id === id)
|
||
}, commentId),
|
||
{
|
||
timeout: 5_000,
|
||
message: 'deleteDiffComment did not remove the comment from the store'
|
||
}
|
||
)
|
||
.toBe(false)
|
||
|
||
await expect(orcaPage.getByTitle('Delete note')).toHaveCount(0, {
|
||
timeout: 5_000
|
||
})
|
||
})
|
||
})
|