Commit 374f2ba
committed
feat(folders): generalize folders and pinning across workflows, files, knowledge bases, and tables
Introduces a shared `folder`/`pinned_item` schema replacing the per-resource
folder tables, and generalizes resource-level locking (item lock + folder
cascade) across all four resource types with full parity to the existing
workflow implementation.
- Generic `folder` table (resourceType discriminator) + `pinned_item` table,
shared API contracts/routes/hooks/UI across workflows, files, knowledge
bases, and tables.
- Generic resource-lock engine (`@sim/platform-authz/resource-lock`):
item-level `locked` column + folder-cascade enforcement, wired into every
structural mutation entry point (create, rename, move, delete, restore)
for all four resource types, including destination-folder and TOCTOU
checks a prior implementation missed.
- Migration collapses cleanly with expand/contract discipline: FK adds
deferred to a follow-up contract migration (blue/green deploy safety),
concurrent index builds, NOT VALID + VALIDATE for new-column FKs, and a
dedup-safe backfill for production's pre-existing duplicate folder names.
- Extensive review-loop hardening: cycle-detection gaps, archived-row
mutability gaps, silent-partial-success batch operations, and lock-check
TOCTOU races closed across every restore/move/create entry point, with
regression tests for each.
# Conflicts:
# packages/db/migrations/meta/0259_snapshot.json
# packages/db/migrations/meta/_journal.json1 parent 8525ba5 commit 374f2ba
158 files changed
Lines changed: 25184 additions & 1914 deletions
File tree
- apps/sim
- app
- api
- folders
- [id]
- duplicate
- restore
- reorder
- knowledge
- [id]
- restore
- pinned-items
- [resourceType]/[resourceId]
- table
- [tableId]
- restore
- v1/admin
- folders/[id]/export
- workspaces/[id]
- export
- folders
- import
- workspaces/[id]/files
- [fileId]
- restore
- bulk-archive
- download
- folders
- [folderId]
- restore
- move
- register
- f/[token]
- workspace/[workspaceId]
- components/resource
- files
- components
- file-viewer/rich-markdown-editor/mention
- home
- components
- mothership-view/components
- add-resource-dropdown
- resource-content
- resource-registry
- user-input/components/prompt-editor
- knowledge
- components
- create-base-modal
- delete-knowledge-base-modal
- lib
- settings/components/recently-deleted
- tables
- components
- w
- [workflowId]/components
- panel
- components/editor
- search-replace
- components/sidebar/components
- file-list
- workflow-list
- components
- folder-item
- workflow-item
- hooks
- background
- components/folders
- ee/workspace-forking/lib
- copy
- mapping
- hooks
- queries
- kb
- utils
- selectors/providers/sim
- lib
- api/contracts
- knowledge
- cleanup
- copilot
- chat
- tools/handlers
- vfs
- folders
- knowledge
- orchestration
- logs
- resources/orchestration
- table
- __tests__
- orchestration
- uploads/contexts/workspace
- workflows
- orchestration
- persistence
- workspace-files/orchestration
- workspaces
- stores/folders
- packages
- db
- migrations
- meta
- platform-authz
- src
- testing/src/mocks
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
0 commit comments