buzz icon indicating copy to clipboard operation
buzz copied to clipboard

feat(desktop): expose canvas revision history [issue:#3086]

Open tcballard opened this issue 4 months ago • 4 comments

Summary

Implements #3086, as part of the work needed for #3863.

Adds:

  • current Canvas revision author and localized timestamp;
  • a bounded history of signed Canvas revisions;
  • read-only viewing of earlier revisions with a return-to-current control;
  • a concise first-open empty state when the Canvas has no signed revisions yet;
  • focused Desktop E2E coverage and screenshot evidence.

Scope

Included

  • Query the existing signed Canvas event kind 40100 for up to 50 channel revisions.
  • Show the newest revision as current and list earlier revisions by resolved profile name and timestamp.
  • Open an earlier revision read-only and return to the current revision.
  • Invalidate history after a Canvas save.
  • Explain the empty first-open state before the first Canvas save.

Excluded

  • No diff or restore action.
  • No new Nostr event kind or HTTP API.
  • No command-palette/autocomplete work.
  • No OEXL-specific code, matching, payments, settlement, ledger, or marketplace semantics.
  • Workflow history (#2980), mention resolution (#3204), and reply placement (#3825/#3836) remain separate follow-up contributions.

Product / Architecture Decisions

  • Reuses the existing signed Canvas event path and kind 40100; history is a read-only relay query.
  • Keeps the response bounded to 50 revisions for predictable Desktop rendering.
  • Earlier revisions are explicitly read-only; editing remains available only for the current revision.
  • Human and agent authors use the existing profile batch lookup and identity-label resolver.
  • An empty history is an expected first-open state, not an error: the panel tells the user to save the Canvas to begin tracking changes.

User-Facing Contract

Desktop

The Canvas panel shows:

  • Updated by <profile> · <timestamp> for the current revision;
  • a Revision history list with current and earlier revisions;
  • Viewing an earlier revision (read-only). plus Return to current when historical content is selected;
  • No revision history yet — save the canvas to start tracking changes. before the first save.

No restore or diff semantics are introduced.

Verification

Ran

  • pnpm typecheck
  • pnpm test — 3,870 tests passed
  • pnpm build:e2e
  • pnpm exec playwright test tests/e2e/channels.spec.ts --project=smoke --grep 'canvas shows signed revision history' --reporter=line — 1 passed before this follow-up
  • focused Biome check on the changed Canvas component and E2E spec
  • git diff --check
  • cargo check --manifest-path desktop/src-tauri/Cargo.toml

The new empty-history E2E assertion is committed and ready for CI. A follow-up browser run was not possible in this clone because the dependency install is unavailable; the existing focused history test and full build evidence are recorded above.

cargo clippy --manifest-path desktop/src-tauri/Cargo.toml --all-targets -- -D warnings was attempted but could not start because the environment lacks cmake while compiling audiopus_sys. The full just ci gate was not run in this environment.

Covered

The regression coverage seeds signed current and earlier revisions from two identities, verifies current metadata and history, opens the earlier revision read-only, verifies editing is unavailable, and returns to current.

The new regression seeds an empty revision list and verifies the first-open message plus the Create canvas action.

Desktop before/after evidence is posted in a separate screenshot comment. No private keys or relay credentials are included.

Review Path

Suggested review order: Canvas relay command and API types, Canvas panel behavior and first-open empty state, then the focused E2E fixture and test.

Notes For Reviewer

This is intentionally the smallest history slice for #3086. The command-palette/UI autocomplete work remains deferred to its existing issues.

tcballard avatar Jul 31 '26 10:07 tcballard

Canvas revision history screenshots

Current revision: author and timestamp metadata plus the bounded revision list.

canvas-revision-history-current

Earlier revision: read-only notice, previous content, and return-to-current control.

canvas-revision-history-earlier

These are immutable commit-SHA-based images from the fork’s screenshot branch; no desktop UI beyond the Canvas panel changed.

tcballard avatar Jul 31 '26 10:07 tcballard

canvas revision history looks useful. worth a one-line empty state when a canvas has never been edited so the panel doesnt look broken on first open.

chessing234 avatar Jul 31 '26 12:07 chessing234

Canvas first-open empty state

When a Canvas has never been saved, the panel explains that revision history will begin after saving.

canvas-revision-history-empty

tcballard avatar Jul 31 '26 12:07 tcballard

canvas revision history looks useful. worth a one-line empty state when a canvas has never been edited so the panel doesnt look broken on first open.

Good feedback, incorporated as well

tcballard avatar Jul 31 '26 12:07 tcballard