You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(folders): address the review round and the full-PR audit
Reverts the workflow restore hook — it was the wrong fix
- Greptile flagged that restoring a folder leaves schedules disabled and webhooks/chats
inactive. The hook added last round routed workflows through `restoreWorkflow` to address
it, but `restoreDependents` ALREADY clears exactly those columns, in bulk, inside the
restore transaction and matched on the archive timestamp. The hook bought nothing and cost
a per-workflow read/transaction/read OUTSIDE that transaction — roughly 1600 round trips
for a folder of 200 workflows — plus a window where the workflows were active and the
folder was not, and it made `restoreDependents` dead code
- What no restore path can undo is the state archive OVERWRITES: `status: 'disabled'` with
`nextRunAt` cleared, `isActive: false`. Archive does not record what those were, so
restoring them to a constant would re-enable a schedule the user had disabled and re-run a
completed one. Left explicit — redeploy re-activates a schedule — matching deployment state,
which restore also deliberately leaves off. Documented on the config rather than guessed
- Kept the genuine bug the review surfaced underneath it: `restoreWorkflow` un-archived every
dependent by `workflowId` alone, resurrecting a webhook or chat the user had archived days
earlier. Now matched on the workflow's own `archivedAt`, which is the semantics this feature
documents
Bugbot: orphaned knowledge bases vanished from every view
- Knowledge filtered on a raw `folderId === currentFolderId` and never re-rooted a base whose
folder is missing or archived, so a base restored on its own — or left behind by a partial
cascade — was invisible everywhere. Tables already fell those back to the root
A dead `?folderId=` is now healed instead of being a dead end
- A bookmark to a deleted folder rendered the root title over an empty grid, hid everything
actually at the root, and — worse — left every create/upload action targeting the dead id,
filing new resources somewhere nothing could reach. `useFolderNavigation` clears it once the
folder list resolves, which fixes Files, Knowledge, and Tables at once
Parity gaps found by auditing against Files
- Tables sorted folders newest-first on a clean URL while Files and Knowledge sorted A→Z: its
sort params are defaulted, so the raw column was never null. Reads `activeSort` now
- On Tables you could not delete the folder you were standing in — its own row is not in the
list, and the crumb menu offered only Rename, which also made the step-out branch
unreachable dead code
- A failed knowledge-base move was logged and never surfaced, so a rejected move — from the
submenu or from a drag — looked like nothing happened
- A drag begun in another mount of the page could never be dropped: `onDragOver` bailed before
`preventDefault`, so no drop event ever fired and the `dataTransfer` fallback in `onDrop`
was unreachable. External/foreign drags are still ignored, so an OS file dropped on the list
cannot navigate the tab away
Files: a folder cycle crashed the page
- The folder-size roll-up recursed with no `visited` guard, so a parent/child cycle in the
cached tree — reachable through the optimistic folder-move write — recursed until the stack
blew and the page went blank. Also indexes children once instead of re-scanning per node
Migration 0274 is now atomic
- 0272 ends with an embedded COMMIT for its CONCURRENTLY index builds, so this file is not
guaranteed to run inside drizzle's batch transaction. Wrapped in a DO block so the parking
pass cannot commit without the reconcile, which would leave every mirrored folder holding a
placeholder name
- Verified against production, where 0272 has NOT yet run, so the two apply back to back and
this is a no-op reconcile: 1,493 legacy file folders, 0 active name duplicates, 0 orphaned
or cross-workspace parents, and 0 id collisions with `workflow_folder` — so the insert
cannot trip the unique index, the FKs, or the resource-type trigger
Smaller corrections
- Knowledge indexed its members for the owner comparator instead of two linear scans per
comparison, and logs a load failure from an effect rather than the render body
- Files uses the shared root sentinel instead of a bare `'__root__'` in two places
- `restore_resource` documents that its two new folder types are unreachable until the enum in
the copilot service's tool catalog — a different repository — widens
- Corrected a forking comment that still described file folders as a separate table
0 commit comments