Skip to content

Commit e56f9ec

Browse files
committed
Fix(release): the Cloud conflict write test keeps POSIX modes out of Windows
The symlink-and-mode test for replaceConflictFile asserted a 0600 mode on the rewritten note, which Windows cannot report (it has no POSIX mode bits; chmod there only toggles read-only, and stat answers 0666). It was hidden behind the Harper failure in the earlier Windows runs because turbo stops the desktop suite once app-core fails. The test now follows the shape the atomic-write tests already use: the symlink case skips where links need privileges, and the permissions case returns early on win32. Claude-Session: https://claude.ai/code/session_015HNdWonTE8g6dPY2SkdsRS
1 parent 804deeb commit e56f9ec

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

apps/desktop/src/main/cloud-sync-filesystem.test.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -542,29 +542,43 @@ describe('DesktopCloudSyncRepository: decisions and writes', () => {
542542
expect(await readFile(path.join(root, 'Deck.pdf'), 'utf8')).toBe('agreed')
543543
})
544544

545-
it('writes through a symlinked note and keeps the file mode', async () => {
545+
it('writes through a symlinked note instead of replacing the link', async () => {
546546
const root = await temporaryRoot()
547547
const elsewhere = await temporaryRoot()
548548
const target = path.join(elsewhere, 'linked.md')
549549
await writeFile(target, 'agreed')
550-
await symlink(target, path.join(root, 'linked.md'))
551-
await writeFile(path.join(root, 'private.md'), 'agreed')
552-
await chmod(path.join(root, 'private.md'), 0o600)
550+
try {
551+
await symlink(target, path.join(root, 'linked.md'))
552+
} catch {
553+
// Creating symlinks can require privileges (e.g. Windows); skip there.
554+
return
555+
}
553556
const repository = new DesktopCloudSyncRepository(root)
554557

555558
await repository.replaceConflictFile({
556559
path: 'linked.md',
557560
expectedSha256: hash('agreed'),
558561
content: upsert('linked.md', 'from cloud').content!
559562
})
563+
564+
expect((await lstat(path.join(root, 'linked.md'))).isSymbolicLink()).toBe(true)
565+
expect(await readFile(target, 'utf8')).toBe('from cloud')
566+
})
567+
568+
it('leaves an existing note its own permissions', async () => {
569+
// Windows has no POSIX mode bits to keep.
570+
if (process.platform === 'win32') return
571+
const root = await temporaryRoot()
572+
await writeFile(path.join(root, 'private.md'), 'agreed')
573+
await chmod(path.join(root, 'private.md'), 0o600)
574+
const repository = new DesktopCloudSyncRepository(root)
575+
560576
await repository.replaceConflictFile({
561577
path: 'private.md',
562578
expectedSha256: hash('agreed'),
563579
content: upsert('private.md', 'from cloud').content!
564580
})
565581

566-
expect((await lstat(path.join(root, 'linked.md'))).isSymbolicLink()).toBe(true)
567-
expect(await readFile(target, 'utf8')).toBe('from cloud')
568582
expect((await stat(path.join(root, 'private.md'))).mode & 0o777).toBe(0o600)
569583
})
570584
})

0 commit comments

Comments
 (0)