Title: fix(realtime): keep admin block locks out of write-role graph replaces by waleedlatif1 · Pull Request #10062 · simstudioai/sim · GitHub
Open Graph Title: fix(realtime): keep admin block locks out of write-role graph replaces by waleedlatif1 · Pull Request #10062 · simstudioai/sim
X Title: fix(realtime): keep admin block locks out of write-role graph replaces by waleedlatif1 · Pull Request #10062 · simstudioai/sim
Description: Summary Block lock/unlock is admin-only (batch-toggle-locked), but write-role batch-add-blocks and replace-state over the socket, plus every HTTP state replace (PUT /api/workflows/[id]/state, v2 PUT .../state, Copilot apply-operations), wrote workflow_blocks.locked straight from the payload, so a write member could clear a lock and then edit or delete the block New pure preserveProtectedWorkflowBlocks in @sim/workflow-types: during a full replace, blocks protected in the stored graph (locked or inside a locked container) are kept exactly as stored along with their incoming edges, every other block is written unlocked, and incoming blocks nested under a locked ancestor are dropped. Blocks are keyed by block.id, never the record key Applied in realtime REPLACE_STATE (which also keeps a locked container's stored loop/parallel config) and in replaceWorkflowNormalizedState, the single door all HTTP replaces go through BATCH_ADD_BLOCKS now skips blocks that are protected or nested under a protected ancestor (was: direct parent only) and never writes locked, on insert or on conflict BATCH_ADD_BLOCKS loops/parallels and SUBFLOW_OPERATIONS.UPDATE skip protected containers, so a locked loop/parallel's config can't be rewritten (the editor already refuses edits to locked blocks) When persistence keeps lock-protected state over a replace-state/batch-add-blocks payload, persistWorkflowOperation returns reconcile: true and the handler emits the existing workflow-updated to the whole room (sender included) instead of broadcasting the rejected payload, so every client reloads the stored graph saveWorkflowToNormalizedTables is unchanged on purpose: import, fork, duplicate and the admin-only revert legitimately carry lock state into the graphs they write, and none of them is a write-role overwrite of an existing workflow Type of Change Bug fix Testing apps/realtime/src/database/block-lock.integration.ts (5) and apps/sim/lib/workflows/persistence/block-lock.integration.ts (1) against real Postgres: all 4 fail on the pre-fix code and pass with the fix; reverting the ancestor-parent guard, the nested-block drop, and the stored-subflow merge one at a time each turns its own test red; same for the loop-config filter, the subflow-update guard and the reconcile signal (an ordinary add asserts reconcile: false) apps/realtime database/operations.test.ts + handlers/operations.test.ts, apps/sim replace-normalized-state.test.ts, type-check for apps/realtime and packages/workflow-types, biome, check:boundaries, check:file-names, check:comment-hygiene, check:test-patterns, check:utils, check:explicit-any (baseline shrunk by 2) Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing (new tests pass the test-audit authoring gate) No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)
Open Graph Description: Summary Block lock/unlock is admin-only (batch-toggle-locked), but write-role batch-add-blocks and replace-state over the socket, plus every HTTP state replace (PUT /api/workflows/[id]/state, v2 P...
X Description: Summary Block lock/unlock is admin-only (batch-toggle-locked), but write-role batch-add-blocks and replace-state over the socket, plus every HTTP state replace (PUT /api/workflows/[id]/state, v2 P...
Opengraph URL: https://github.com/simstudioai/sim/pull/10062
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:11abd495-e81e-ef1b-a61f-ad335594b0f7 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DD2C:72699:6AD1C9:962EF1:6AFB6485 |
| html-safe-nonce | fedd2c335da3eb48267d0f6dd61ba93505cabbde1d2233217379519b64bf4e1c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDJDOjcyNjk5OjZBRDFDOTo5NjJFRjE6NkFGQjY0ODUiLCJ2aXNpdG9yX2lkIjoiNjQyODgwMDU1MTg4NTY5NDA4NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0325feefcd964609ef40ca1dc38f34987e1d0f217cc78f4f1d72620ce915a9b3 |
| hovercard-subject-tag | pull_request:5316793683 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/10062/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | Summary Block lock/unlock is admin-only (batch-toggle-locked), but write-role batch-add-blocks and replace-state over the socket, plus every HTTP state replace (PUT /api/workflows/[id]/state, v2 P... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 59ef97164c52cf59bd10558ddec9c4f482763988 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width