Skip to content

feat: read-only workspaces (fixes #187) - #193

Merged
MathiasVDA merged 1 commit into
mainfrom
claude/project-thread-1mbgj6
Oct 6, 2026
Merged

MathiasVDA merged 1 commit into
mainfrom
claude/project-thread-1mbgj6

Conversation

@MathiasVDA

Copy link
Copy Markdown
Collaborator

Requested by Mathias · project thread

Fixes #187

Before: every workspace is writable. A query opened from a shared workspace such as the demo queries can be saved back over the original with Ctrl+S, and the workspace is offered as a target for new queries, renames, moves and deletes.

After: a workspace can be marked Read-only (checkbox in the workspace settings, or readOnly: true when registered from code). Its queries can still be browsed and opened, but it never appears as a save target and is labelled "(read-only)" in the Query Browser. Saving a query opened from it opens Save as, so edits can only go to another workspace as a copy. Rename, move and delete are hidden in the Query Browser, and renaming the tab only changes the tab label. If every workspace is read-only, the save button is hidden.

How: WorkspaceConfigBase gets an optional readOnly flag. getWorkspaceBackend wraps the backend of a read-only workspace in a new ReadOnlyWorkspaceBackend, which passes reads through, leaves the optional write methods undefined (so the existing if (backend.renameQuery) checks hide those actions) and rejects writeQuery with FORBIDDEN. On top of that, Tab and SaveManagedQueryModal skip read-only workspaces when choosing where to save. Save as also no longer sends the source query's version tag when saving into a different workspace.

Tests: new query-management-read-only-workspace-test.ts. The full unit suite passes (1679) and npm run build succeeds. I have not clicked through it in a browser.

Follow-up: the demo workspace in matgui-matdata gets readOnly: true in a separate PR there. Older MatGUI versions ignore the flag.

🤖 Generated with Claude Code

https://claude.ai/code/session_01StQ5dk15ErNgjFnErZ7ce4


Generated by Claude Code

A workspace can be marked readOnly. Its queries can be browsed and
opened, but it is never offered as a save target, and its queries
cannot be updated, renamed, moved or deleted. Saving a query opened
from it falls through to Save as, so changes go to another workspace.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01StQ5dk15ErNgjFnErZ7ce4
@MathiasVDA MathiasVDA self-assigned this Oct 6, 2026
@MathiasVDA
MathiasVDA merged commit fca101f into main Oct 6, 2026
2 checks passed
MathiasVDA added a commit that referenced this pull request Oct 11, 2026
A workspace can be marked readOnly. Its queries can be browsed and
opened, but it is never offered as a save target, and its queries
cannot be updated, renamed, moved or deleted. Saving a query opened
from it falls through to Save as, so changes go to another workspace.
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.

Add option for read only workspaces

2 participants