Title: fix(folders): stop archived rows skewing sortOrder, hide them from admin, and cover the two untested modules by waleedlatif1 · Pull Request #6062 · simstudioai/sim · GitHub
Open Graph Title: fix(folders): stop archived rows skewing sortOrder, hide them from admin, and cover the two untested modules by waleedlatif1 · Pull Request #6062 · simstudioai/sim
X Title: fix(folders): stop archived rows skewing sortOrder, hide them from admin, and cover the two untested modules by waleedlatif1 · Pull Request #6062 · simstudioai/sim
Description: Follow-ups from the generic-folders work, on a fresh branch off origin/staging. Two correctness fixes and the first tests for the two modules that had none. Fixes nextFolderSortOrder counted soft-deleted rows. It returns min - 1 to put a new folder at the top, so including archived rows let every delete ratchet the floor further negative and never recover — an archived folder at -400 forces the next new folder to -401, forever. Both minima (folders and child resources) now see only rows a user can still see. The Files path (workspace-file-folder-manager) has always filtered this way; the generic engine never did. The admin workspace-folders endpoint listed soft-deleted folders. Both the count and the page omitted deletedAt, so an operator inspecting a workspace saw folders sitting in Recently Deleted plus an inflated total — disagreeing with every user-facing folder list. Pre-existing, not cutover fallout. Tests for naming.ts and queries.ts Both modules had zero tests and are vi.mock'd at every call site, so their bodies executed in no test anywhere. That left the two bug classes that caused real defects in the folder migration completely unasserted server-side: the suffix sequence — must start at (1), skip taken suffixes, and fill gaps. Its client twin nextUntitledFolderName is tested and pins the same shape, so the tested client was the only guard on a contract the server could silently drift from. resourceType scoping on the id-keyed lookups (findActiveFolder, wouldCreateFolderCycle). Every other query is scoped through a list filter; these accept a caller-supplied id, so a missing clause silently crosses resource trees — filing a knowledge base under a table folder where no page renders it. Also covers resolveRestoredFolderId's restoringFolderIds short-circuit, which is what stops a folder cascade dumping an entire subtree at the workspace root, and toFolderApi, the single normalizer keeping every folder route on one wire shape. Every assertion is mutation-checked Each was verified to FAIL when the behaviour it claims to guard is removed: mutation caught by suffix loop seeded at 2 3 naming tests drop resourceType from the sibling query sibling-scoping test drop deletedAt from the sibling query archived-sibling test drop resourceType from findActiveFolder scoping test drop resourceType from the cycle walk walk-scoping test drop the restoringFolderIds short-circuit short-circuit test drop either deletedAt filter in nextFolderSortOrder sortOrder test drop deletedAt from the admin route admin test Worth flagging: the first version of the sortOrder test was vacuous. For a root folder the parent condition is itself an isNull node, so a "some isNull exists" check passed with the soft-delete filter deleted. It now asserts the specific column. That is the third vacuous test caught by mutation-checking in this line of work, which is why every assertion here went through it. Overlap with realtime-rooms Checked explicitly. This branch touches 6 files; exactly one, lib/folders/lifecycle.ts", is also touched by realtime-rooms— which only addsnotifyFolderResourceChangedcalls at lines 22/227/313/393/555, while this change is confined tonextFolderSortOrderat 131–158. A test-merge ofrealtime-roomsinto this branch produces **zero conflicts in any file here**. It does conflict intable-grid.tsxandcheck-api-validation-contracts.ts, but those conflicts already exist between realtime-roomsandorigin/staging` and are unrelated to this work. Not included, deliberately Restore does not undo delete (highest remaining user impact — restoring a folder of deployed workflows reports success while schedules stay disabled). Needs a design decision: snapshot prior state at archive time (schema change + migration) versus reporting what needs redeploying. Too big to fold in silently. Workflow-surface consolidation (pinning, breadcrumbs, unified folder naming, maxLength 50 vs 100). Broad UI work needing visual verification, and it lands in files.tsx/tables.tsx — both touched by realtime-rooms, so it would create exactly the overlap this branch was asked to avoid. Testing Typecheck, check:api-validation, check:migrations, lint, and 150 tests across the affected suites pass. No migration in this PR. Type of Change Bug fix Tests Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing 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: Follow-ups from the generic-folders work, on a fresh branch off origin/staging. Two correctness fixes and the first tests for the two modules that had none. Fixes nextFolderSortOrder counted soft-d...
X Description: Follow-ups from the generic-folders work, on a fresh branch off origin/staging. Two correctness fixes and the first tests for the two modules that had none. Fixes nextFolderSortOrder counted soft-d...
Opengraph URL: https://github.com/simstudioai/sim/pull/6062
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:4fcef2d0-4b57-7ec5-c954-2af8286178d8 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E6D2:EE197:45C6D5:609F11:6AFB392D |
| html-safe-nonce | a73fdc47a5ea56d7c2fa10bb5cc33afd3ed8286d3821c04a46eebee169073bd2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkQyOkVFMTk3OjQ1QzZENTo2MDlGMTE6NkFGQjM5MkQiLCJ2aXNpdG9yX2lkIjoiODg5OTczODAzMjMyODYyMDMzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 065349cdce60c0b9df372c7cad148699cd0f0792f8aebcf99afb3f6be7e6ef0a |
| hovercard-subject-tag | pull_request:4164355788 |
| 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/6062/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 | Follow-ups from the generic-folders work, on a fresh branch off origin/staging. Two correctness fixes and the first tests for the two modules that had none. Fixes nextFolderSortOrder counted soft-d... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2169b0dfbef67ed6b128074a5ed45bb7d5d1859783b10178b09a7765ad5f3693 |
| 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 | 3b4fc8df5ef1c6757e733a23e6b81b6725021823 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width