René's URL Explorer Experiment


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

direct link

Domain: github.com

react-profiling0
react-import-mapreact,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-controllerpull_requests
route-actionfiles
fetch-noncev2:4fcef2d0-4b57-7ec5-c954-2af8286178d8
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE6D2:EE197:45C6D5:609F11:6AFB392D
html-safe-noncea73fdc47a5ea56d7c2fa10bb5cc33afd3ed8286d3821c04a46eebee169073bd2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkQyOkVFMTk3OjQ1QzZENTo2MDlGMTE6NkFGQjM5MkQiLCJ2aXNpdG9yX2lkIjoiODg5OTczODAzMjMyODYyMDMzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac065349cdce60c0b9df372c7cad148699cd0f0792f8aebcf99afb3f6be7e6ef0a
hovercard-subject-tagpull_request:4164355788
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6062/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altFollow-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_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None2169b0dfbef67ed6b128074a5ed45bb7d5d1859783b10178b09a7765ad5f3693
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3b4fc8df5ef1c6757e733a23e6b81b6725021823
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/6062/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6062%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6062%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/6062/files
Reloadhttps://github.com/simstudioai/sim/pull/6062/files
Reloadhttps://github.com/simstudioai/sim/pull/6062/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests199 (199)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
feat/folder-followupshttps://github.com/simstudioai/sim/tree/feat/folder-followups
Conversation 5 https://github.com/simstudioai/sim/pull/6062
Commits 2 https://github.com/simstudioai/sim/pull/6062/commits
Checks 26 https://github.com/simstudioai/sim/pull/6062/checks
Files changed https://github.com/simstudioai/sim/pull/6062/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6062/files
fix(folders): stop archived rows skewing sortOrder, hide them from admin, and cover the two untested modules https://github.com/simstudioai/sim/pull/6062/files#top
Show all changes 2 commits https://github.com/simstudioai/sim/pull/6062/files
a910b36 fix(folders): stop archived rows skewing sortOrder, hide them from ad… waleedlatif1 Jul 29, 2026 https://github.com/simstudioai/sim/pull/6062/commits/a910b3665648b49e4197b7cd809ef9d0d0c7ea17
c029210 refactor(testing): share the drizzle condition-tree helpers waleedlatif1 Jul 29, 2026 https://github.com/simstudioai/sim/pull/6062/commits/c029210882a50517cf6e34c04f3394955f7de32d
Clear filters https://github.com/simstudioai/sim/pull/6062/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6062/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6062/files
route.test.ts https://github.com/simstudioai/sim/pull/6062/files#diff-ac70c41477e3642a78a1876d9ce65bb5c64ad69ec9d02412e08dca3233a41118
route.ts https://github.com/simstudioai/sim/pull/6062/files#diff-d0a542f9126d529917e6fabcbf06ea33e920ce0894b241fdbe17f7a0203acfc8
cascade.test.ts https://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
lifecycle.test.ts https://github.com/simstudioai/sim/pull/6062/files#diff-a8f1c3f618fff6b4625c421c4caf8d379702418c6861611522540397576ef154
lifecycle.ts https://github.com/simstudioai/sim/pull/6062/files#diff-5549871eaa1033ce9ab06110a45243e09b010842207b25b9bffeaefb843e53ba
naming.test.ts https://github.com/simstudioai/sim/pull/6062/files#diff-94f7c81f9d07b56bd1ed6d0f34268c741c9b4cdd9a5d1d5e7717369b1b82b630
queries.test.ts https://github.com/simstudioai/sim/pull/6062/files#diff-76c466bd8dd934f65570b800c2e539a2e034da449727b0a9c354c0e259c8dea2
database.mock.ts https://github.com/simstudioai/sim/pull/6062/files#diff-859f381ad1b6a93489bef08c44a1044a2c3cc6f9b98b8d973bb5b0ef893ba42b
index.ts https://github.com/simstudioai/sim/pull/6062/files#diff-38963b775b9a08da9c40dbdf25380b1bd038aa3f9f93e9c657ef549fb39f512c
apps/sim/app/api/v1/admin/workspaces/[id]/folders/route.test.tshttps://github.com/simstudioai/sim/pull/6062/files#diff-ac70c41477e3642a78a1876d9ce65bb5c64ad69ec9d02412e08dca3233a41118
View file https://github.com/simstudioai/sim/blob/c029210882a50517cf6e34c04f3394955f7de32d/apps/sim/app/api/v1/admin/workspaces/%5Bid%5D/folders/route.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6062/{{ revealButtonHref }}
apps/sim/app/api/v1/admin/workspaces/[id]/folders/route.tshttps://github.com/simstudioai/sim/pull/6062/files#diff-d0a542f9126d529917e6fabcbf06ea33e920ce0894b241fdbe17f7a0203acfc8
View file https://github.com/simstudioai/sim/blob/c029210882a50517cf6e34c04f3394955f7de32d/apps/sim/app/api/v1/admin/workspaces/%5Bid%5D/folders/route.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6062/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6062/files#diff-d0a542f9126d529917e6fabcbf06ea33e920ce0894b241fdbe17f7a0203acfc8
https://github.com/simstudioai/sim/pull/6062/files#diff-d0a542f9126d529917e6fabcbf06ea33e920ce0894b241fdbe17f7a0203acfc8
https://github.com/simstudioai/sim/pull/6062/files#diff-d0a542f9126d529917e6fabcbf06ea33e920ce0894b241fdbe17f7a0203acfc8
https://github.com/simstudioai/sim/pull/6062/files#diff-d0a542f9126d529917e6fabcbf06ea33e920ce0894b241fdbe17f7a0203acfc8
apps/sim/lib/folders/cascade.test.tshttps://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
View file https://github.com/simstudioai/sim/blob/c029210882a50517cf6e34c04f3394955f7de32d/apps/sim/lib/folders/cascade.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6062/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
https://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
https://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
https://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
https://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
https://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
https://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
https://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
https://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
https://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
https://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
https://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
https://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
https://github.com/simstudioai/sim/pull/6062/files#diff-85f0247de40fbad12361aee59e01dbd9d2db3c15935ffc96a9b0d62e3e4e2392
apps/sim/lib/folders/lifecycle.test.tshttps://github.com/simstudioai/sim/pull/6062/files#diff-a8f1c3f618fff6b4625c421c4caf8d379702418c6861611522540397576ef154
View file https://github.com/simstudioai/sim/blob/c029210882a50517cf6e34c04f3394955f7de32d/apps/sim/lib/folders/lifecycle.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6062/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6062/files#diff-a8f1c3f618fff6b4625c421c4caf8d379702418c6861611522540397576ef154
https://github.com/simstudioai/sim/pull/6062/files#diff-a8f1c3f618fff6b4625c421c4caf8d379702418c6861611522540397576ef154
https://github.com/simstudioai/sim/pull/6062/files#diff-a8f1c3f618fff6b4625c421c4caf8d379702418c6861611522540397576ef154
https://github.com/simstudioai/sim/pull/6062/files#diff-a8f1c3f618fff6b4625c421c4caf8d379702418c6861611522540397576ef154
apps/sim/lib/folders/lifecycle.tshttps://github.com/simstudioai/sim/pull/6062/files#diff-5549871eaa1033ce9ab06110a45243e09b010842207b25b9bffeaefb843e53ba
View file https://github.com/simstudioai/sim/blob/c029210882a50517cf6e34c04f3394955f7de32d/apps/sim/lib/folders/lifecycle.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6062/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6062/files#diff-5549871eaa1033ce9ab06110a45243e09b010842207b25b9bffeaefb843e53ba
https://github.com/simstudioai/sim/pull/6062/files#diff-5549871eaa1033ce9ab06110a45243e09b010842207b25b9bffeaefb843e53ba
https://github.com/simstudioai/sim/pull/6062/files#diff-5549871eaa1033ce9ab06110a45243e09b010842207b25b9bffeaefb843e53ba
Please reload this pagehttps://github.com/simstudioai/sim/pull/6062/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6062/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.