fix: make public projects editable; gate only backend writes - #840
Conversation
Shared-surface mirror of openplc-web PR #484 (byte-identical). Removes the read-only / fork-redirect feature (read-only-project modal, workspace.isReadOnly UI-lockdown flag, forkProject/listMyFolders port methods + ProjectFolder/ForkProject* types, and all editor/menu/tree gating). Replaces it with a narrowly-scoped workspace.canEdit flag that gates only backend writes (save/commit/branch/stash/discard/restore/ README) with a graceful warning toast. In-memory editing, simulation, and compilation are always allowed. No behavioral change for the editor (desktop has no remote permission concept, so canEdit stays undefined ⇒ treated as editable). This PR exists to keep the byte-identical shared surface in sync. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (27)
💤 Files with no reviewable changes (5)
WalkthroughThis PR refactors the workspace permission model from a read-only flag with modal redirects to a ChangesPermission Model Refactoring
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Two follow-ups from the development merge (#840 — "make public projects editable; gate only backend writes"): 1. Resolve the build-save conflict in `workspace-activity-bar`. Dev added a `canEdit` capability so viewers of a public project (no write permission) can compile locally without their save getting 401'd by the backend. Our branch had already removed the lossy `editingState` gate so the build always saves. Merged pattern keeps the always-save behavior but gates it on `canEdit` instead of `!isReadOnly` — the previous `isReadOnly` flag was removed in dev with the now-deleted `ReadOnlyProjectModal`. Same gate applied to the debug-start path (mirrors the build). 2. Add `notify-no-write-permission.test.ts` to jest's `testPathIgnorePatterns`. Dev authored it as a Vitest-native test (top-level `vi.mock` with relative path, expecting the runner to hoist). Vitest does hoist `vi.mock` natively; Jest's `babel-plugin-jest-hoist` only recognises literal `jest.mock` and the test fails to load on editor. Mirror of the same asymmetric-runner pattern web already uses for 6 jest-only tests in `vitest.config.ts` (`python-lsp`, library-build- orchestrator, pipeline, generate-confs, etc.). All 4822 editor tests pass, arch + format + lint clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Shared-surface mirror of openplc-web PR #484 — keeps the byte-identical shared surface (
src/frontend/,src/middleware/shared/) in sync.What changed (shared surface)
read-only-projectmodal, theworkspace.isReadOnlyUI-lockdown flag, theforkProject/listMyFoldersport methods +ProjectFolder/ForkProject*types, and all Monaco/graphical/menu/tree gating.workspace.canEdit(persist-permission, defaultstrue) that gates only backend writes — save, commit, create/delete branch, stash, discard, restore, README save — each with a graceful warning toast (notifyNoWritePermission).Editor impact
None functionally: the desktop editor has no remote permission concept, so
canEditstaysundefined⇒ treated as editable. This PR exists purely to keep the shared surface byte-identical with web.Verification
tsc --noEmitclean on this repo.scripts/compare-surfaces.pyreportsmatch: Trueagainst the web PR branch (0 diffs).🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
Improvements
canEditpermission flag.