mirror of
https://github.com/block/buzz.git
synced 2026-10-27 12:40:30 +00:00
🤖 Adds append-only channel canvas history, restore, and relay-authoritative optimistic concurrency so stale edits cannot silently replace a newer canvas. ## What this adds - **Desktop history and restore** — browse revisions with author, timestamp, preview, and diff; restore an older revision as a new signed head after explicit confirmation. Persisted empty canvases remain reachable, mutation outcomes are announced accessibly, and focus moves to a stable destination after save or restore. - **CLI history and restore** — `buzz canvas history --channel …`, `buzz canvas get --channel … --revision <id>`, and `buzz canvas restore --channel … --revision <id>` use keyset pagination over the retained revision stream. - **SDK canvas builders** — optional `expected-revision` tags, bounded ancestry classification, and shared timestamp discipline keep first-party writes ahead of the head they read without propagating poisoned future timestamps. ## Authoritative concurrency contract Tagged canvas writes use compare-and-swap semantics in the relay and database: - `expected-revision=none` succeeds only when no live canvas exists. - An event ID succeeds only when it names the canonical live head. - A byte-identical replay succeeds only when that event is already the canonical live head. - A successful candidate must sort strictly ahead of the current head under `created_at DESC, id ASC`. - Malformed preconditions and stale or non-advancing writes are rejected before event rows, mentions, or fan-out are committed. The database serializes tagged writes, unconditional kind `40100` writes, and canvas soft deletion on the same `(community, kind, channel)` advisory key. Untagged `buzz canvas set` remains an unconditional write, but participates in that serialization boundary so it cannot race a tagged save or deletion. Deletion classification is derived inside the datastore transaction; unrelated event kinds do not take the canvas lock. ## Read and timestamp consistency Precondition and post-write ancestry reads request strong consistency from `/query`, pinning them to the writer when replica routing is enabled. Display-only history remains replica-eligible. First-party canvas writers stamp `created_at = max(now, head + 1)` with a conservative client skew limit. The relay applies a canvas-specific future-timestamp ceiling before persistence, preventing an accepted boundary head from making subsequent first-party writes invalid while preserving the broader ingest limit for other event kinds. ## Durable outcomes and recovery After an accepted publish, a failed verification read is reported as durable success with `verified: false` rather than a failed save. Desktop and CLI preserve the new event ID and direct users to History when verification is unavailable. A successful read walks the bounded, cycle-guarded `expected-revision` ancestry chain so transitive descendants are not misclassified as supersession. Canvas caches invalidate for every settled mutation outcome, including a retained but superseded revision. The 409 reconciliation path in `cmd_restore_canvas` now separately establishes persistence evidence from ancestry classification. `canvas_write_survived` checks reachability only; a secondary writer-pinned IDs lookup distinguishes "A absent" from "A present but superseded by a legacy write." The four-way outcome (survived / persisted-but-superseded / genuinely-absent / read-fail) is now correct for all lost-response shapes including unconditional legacy writes. --------- Signed-off-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz> Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz> Co-authored-by: Hayt <9e1c23a3fd83f61da34420e4e88ff1b16e45cafcc0cd9019eb07d4ecfa8ca9b0@buzz.block.builderlab.xyz>
112 lines
4.0 KiB
JSON
112 lines
4.0 KiB
JSON
{
|
|
"name": "buzz",
|
|
"private": true,
|
|
"version": "0.5.24",
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "vite",
|
|
"build": "tsc && node ./scripts/build-protected-feature-artifacts.mjs",
|
|
"build:e2e": "tsc && vite build --mode e2e",
|
|
"typecheck": "tsc --noEmit",
|
|
"check:file-sizes": "node ./scripts/check-file-sizes.mjs",
|
|
"check:px-text": "node ./scripts/check-px-text.mjs",
|
|
"check:pubkey-truncation": "node ./scripts/check-pubkey-truncation.mjs",
|
|
"lint": "biome lint .",
|
|
"check": "biome check . && pnpm check:px-text && pnpm check:pubkey-truncation",
|
|
"format": "biome format --write .",
|
|
"test": "node --import ./test-loader.mjs --experimental-strip-types --test \"src/**/*.test.mjs\" \"scripts/*.test.mjs\"",
|
|
"preview": "vite preview",
|
|
"tauri": "node ./scripts/tauri-command.mjs",
|
|
"test:e2e": "pnpm build:e2e && playwright test",
|
|
"test:e2e:smoke": "pnpm build:e2e && playwright test --project=smoke",
|
|
"test:e2e:integration": "pnpm build:e2e && playwright test --project=integration",
|
|
"test:e2e:release-smoke": "pnpm build:e2e && playwright test --config=playwright.release-smoke.config.ts",
|
|
"test:e2e:report": "playwright show-report",
|
|
"tauri:build": "node ./scripts/tauri-command.mjs build"
|
|
},
|
|
"dependencies": {
|
|
"@dnd-kit/core": "^6.3.1",
|
|
"@dnd-kit/sortable": "^10.0.0",
|
|
"@dnd-kit/utilities": "^3.2.2",
|
|
"@emoji-mart/data": "^1.2.1",
|
|
"@emoji-mart/react": "^1.1.1",
|
|
"@fontsource-variable/inter": "^5.2.8",
|
|
"@fontsource/jetbrains-mono": "^5.3.0",
|
|
"@mediapipe/tasks-vision": "^0.10.35",
|
|
"@radix-ui/react-alert-dialog": "^1.1.15",
|
|
"@radix-ui/react-avatar": "^1.1.11",
|
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
"@radix-ui/react-context-menu": "^2.2.16",
|
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
"@radix-ui/react-focus-scope": "^1.1.8",
|
|
"@radix-ui/react-popover": "^1.1.15",
|
|
"@radix-ui/react-separator": "^1.1.8",
|
|
"@radix-ui/react-slot": "^1.2.4",
|
|
"@radix-ui/react-switch": "^1.2.6",
|
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
"@radix-ui/react-toggle": "^1.1.10",
|
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
"@tanstack/react-query": "^5.90.21",
|
|
"@tanstack/react-router": "^1.168.10",
|
|
"@tanstack/react-virtual": "^3.14.2",
|
|
"@tauri-apps/api": "~2.11",
|
|
"@tauri-apps/plugin-notification": "^2.3.3",
|
|
"@tauri-apps/plugin-opener": "~2.5",
|
|
"@tauri-apps/plugin-process": "^2.3.1",
|
|
"@tauri-apps/plugin-updater": "^2.10.0",
|
|
"@tiptap/core": "^3.22.3",
|
|
"@tiptap/extension-link": "^3.22.3",
|
|
"@tiptap/extension-placeholder": "^3.22.3",
|
|
"@tiptap/pm": "^3.22.3",
|
|
"@tiptap/react": "^3.22.3",
|
|
"@tiptap/starter-kit": "^3.22.3",
|
|
"class-variance-authority": "^0.7.1",
|
|
"clsx": "^2.1.1",
|
|
"diff": "^8.0.4",
|
|
"embla-carousel-react": "^8.6.0",
|
|
"emoji-mart": "^5.6.0",
|
|
"jdenticon": "^3.3.0",
|
|
"linkifyjs": "^4.3.2",
|
|
"lucide-react": "^1.0.0",
|
|
"mdast-util-from-markdown": "^2.0.3",
|
|
"motion": "^12.38.0",
|
|
"qrcode": "^1.5.4",
|
|
"qrcode.react": "^4.2.0",
|
|
"react": "^19.1.0",
|
|
"react-day-picker": "^10.0.1",
|
|
"react-diff-view": "^3.3.2",
|
|
"react-dom": "^19.1.0",
|
|
"react-markdown": "^10.1.0",
|
|
"remark-breaks": "^4.0.0",
|
|
"remark-gfm": "^4.0.1",
|
|
"shiki": "^4.0.2",
|
|
"sonner": "^2.0.7",
|
|
"tailwind-merge": "^3.5.0",
|
|
"tiptap-markdown": "^0.9.0",
|
|
"upng-js": "^2.1.0",
|
|
"virtua": "0.49.3",
|
|
"yaml": "^2.8.3",
|
|
"zod": "^4.4.3"
|
|
},
|
|
"devDependencies": {
|
|
"@noble/hashes": "^2.0.1",
|
|
"@playwright/test": "^1.58.2",
|
|
"@tailwindcss/postcss": "^4.3.0",
|
|
"@tanstack/router-plugin": "^1.167.12",
|
|
"@tanstack/virtual-file-routes": "^1.161.7",
|
|
"@tauri-apps/cli": "~2.11.4",
|
|
"@testing-library/react": "^16.3.2",
|
|
"@types/react": "^19.1.8",
|
|
"@types/react-dom": "^19.1.6",
|
|
"@vitejs/plugin-react": "^6.0.0",
|
|
"jsdom": "^27.4.0",
|
|
"nostr-tools": "^2.23.3",
|
|
"postcss": "^8.5.8",
|
|
"tailwindcss": "^4.3.0",
|
|
"tw-animate-css": "^1.4.0",
|
|
"typescript": "~6.0.0",
|
|
"vite": "^8.0.0"
|
|
}
|
|
}
|