Skip to content

fix: sync workspace properties via op log + read-only gate#199

Open
careck wants to merge 3 commits into
developmentfrom
fix/workspace-props-sync
Open

fix: sync workspace properties via op log + read-only gate#199
careck wants to merge 3 commits into
developmentfrom
fix/workspace-props-sync

Conversation

@careck
Copy link
Copy Markdown
Member

@careck careck commented May 13, 2026

Summary

  • Workspace metadata changes now sync to peersset_workspace_metadata creates a signed UpdateWorkspaceMetadata operation in the op log, so changes propagate via delta bundles
  • Non-owners see a read-only viewWorkspacePropertiesDialog fetches is_workspace_owner and disables all inputs with a yellow hint banner when not owner; only a Close button is shown (no Save)
  • Snapshots include workspace metadataWorkspaceSnapshot now carries workspace_metadata so peers joining later also receive it

What changed

Rust core (krillnotes-core)

  • Operation::UpdateWorkspaceMetadata variant added with all match arms (operation_id, timestamp, device_id, metadata_json, modified_by, signature)
  • set_workspace_metadata() now wraps the write in a transaction, creates + signs the operation, and logs it
  • apply_incoming_operation() handles the new variant (owner-gated, same pattern as script ops)
  • WorkspaceSnapshot includes optional workspace_metadata field
  • to_snapshot_json() / import_snapshot_json() serialize/deserialize workspace metadata

Frontend (krillnotes-desktop)

  • WorkspacePropertiesDialog fetches ownership state and renders read-only for non-owners
  • i18n key workspace.propertiesReadOnly added to all 7 locales

Test plan

  • cargo test -p krillnotes-core — 674 tests pass
  • cargo clippy -p krillnotes-core -- -D warnings — clean
  • cargo fmt --check — clean
  • npx tsc --noEmit — clean
  • Manual: open workspace as owner → edit properties → save → verify op appears in operations log
  • Manual: open shared workspace as non-owner → verify read-only dialog with yellow hint
  • Manual: sync workspace to peer → verify metadata arrives via delta

careck added 3 commits May 13, 2026 10:05
…owners

Workspace metadata changes (author, license, description, etc.) were
written directly to workspace_meta without creating an Operation, so
they never propagated to peers. Non-owners could also edit the form
(only to get an error on save).

- Add UpdateWorkspaceMetadata operation variant with signed op logging
- Apply incoming metadata ops in apply_incoming_operation (owner-gated)
- Include workspace_metadata in WorkspaceSnapshot for initial peer sync
- Gate WorkspacePropertiesDialog as read-only for non-owners with hint
… gate

- cargo fmt on menu.rs after merge with development
- Add UpdateWorkspaceMetadata to rbac gate resolve_scope (workspace-level, no note scope)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant