Skip to content

improvement(api): scope folders to resource paths - #6284

Merged
TheodoreSpeaks merged 3 commits into
improvement/v2-endpointsfrom
refactor/resource-scoped-folders
Aug 5, 2026
Merged

improvement(api): scope folders to resource paths#6284
TheodoreSpeaks merged 3 commits into
improvement/v2-endpointsfrom
refactor/resource-scoped-folders

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • move folder CRUD under workflows, files, knowledge, and tables using canonical path identifiers
  • add exact folderPath filtering and serialize path resolution with resource mutations
  • remove the standalone v2 folders API and public archive/restore operations
  • update shared contracts, OpenAPI specs, audits, and tests

Type of Change

  • Improvement

Testing

  • 530 v2 API tests passing
  • 174 folder and orchestration tests passing
  • TypeScript compilation passing
  • Lint, OpenAPI validation, API boundary validation, and all CI audit checks passing

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)

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 5, 2026 5:58am

Request Review

@cursor

cursor Bot commented Aug 5, 2026

Copy link
Copy Markdown

PR Summary

Cursor Bugbot is generating a summary for commit 3df2837. Configure here.

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile-apps

Comment thread apps/sim/app/api/v2/files/route.ts Outdated
Comment thread apps/sim/lib/folders/orchestration.ts
@greptile-apps

greptile-apps Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR replaces the standalone v2 folder API with resource-scoped, canonical-path folder operations and serializes folder resolution with related resource mutations.

  • Adds /folders operations beneath workflows, files, knowledge, and tables.
  • Replaces public folder identifiers with canonical folderPath values across contracts, routes, and OpenAPI specifications.
  • Adds advisory locking around folder-tree mutations and path resolution.
  • Removes public archive/restore operations and updates audits, orchestration, tests, and client integrations.

Confidence Score: 5/5

The PR appears safe to merge based on the eligible follow-up-review scope.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/lib/folders/paths.ts Defines canonical folder-path parsing, encoding, validation, indexing, and public path projections.
apps/sim/lib/folders/orchestration.ts Adds path-addressed folder creation, relocation, and deletion while integrating tree-level mutation serialization.
apps/sim/lib/folders/locks.ts Introduces transaction-scoped advisory locking keyed by workspace and folder resource type.
apps/sim/app/api/v2/lib/folders.ts Centralizes path resolution, folder response projection, and mutation-error mapping for resource-scoped routes.
apps/sim/lib/workspace-files/orchestration/file-folder-lifecycle.ts Coordinates file mutations with canonical folder resolution under the shared folder-tree lock.
apps/sim/app/api/v2/files/folders/route.ts Exposes resource-scoped file-folder listing and path-based create, relocate, and delete operations.
apps/sim/app/api/v2/workflows/folders/route.ts Adds path-based workflow-folder CRUD beneath the workflows API.
apps/sim/app/api/v2/knowledge/folders/route.ts Adds path-based knowledge-folder CRUD beneath the knowledge API.
apps/sim/app/api/v2/tables/folders/route.ts Adds path-based table-folder CRUD beneath the tables API.
apps/sim/lib/api/contracts/v2/shared.ts Defines shared canonical-path folder request schemas and public response contracts.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Client[API client] --> ResourceAPI[Resource-scoped v2 endpoint]
  ResourceAPI --> Auth[Workspace access check]
  Auth --> Lock[Acquire workspace and resource-type folder lock]
  Lock --> Resolve[Resolve canonical folder path]
  Resolve --> Mutation[Apply folder or resource mutation]
  Mutation --> DB[(Postgres)]
  Mutation --> Audit[Record path-based audit event]
  Mutation --> Notify[Invalidate resource views]
Loading

Reviews (3): Last reviewed commit: "fix(files): release folder lock before u..." | Re-trigger Greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile-apps

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/app/api/v2/files/uploads/route.ts Outdated
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile-apps

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 6d30efa. Configure here.

@TheodoreSpeaks
TheodoreSpeaks merged commit 2a27f9e into improvement/v2-endpoints Aug 5, 2026
5 checks passed
@TheodoreSpeaks
TheodoreSpeaks deleted the refactor/resource-scoped-folders branch August 5, 2026 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant