Skip to content

fix(api): restore migrated endpoint and SDK compatibility - #6564

Merged
TheodoreSpeaks merged 11 commits into
stagingfrom
fix/api-route-error-projection
Aug 12, 2026
Merged

fix(api): restore migrated endpoint and SDK compatibility#6564
TheodoreSpeaks merged 11 commits into
stagingfrom
fix/api-route-error-projection

Conversation

@TheodoreSpeaks

@TheodoreSpeaks TheodoreSpeaks commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • restore migrated route error semantics so classified domain and typed HTTP failures keep their intended 4xx status instead of collapsing to generic 500 responses
  • preserve legacy API compatibility for table conflicts, file-storage quota failures, knowledge document failures, and related response envelopes while retaining canonical v2 error bodies
  • repair normal File block and workspace-file behavior: nested write/move paths, archive folders and rollback, encoded folder paths and filters, stale-ID downloads, and fail-fast folder path limits
  • restore unbounded-by-default table filter updates/deletes through bounded keyset batches, revalidate mutation pages under row locks so concurrent changes cannot produce partial-failure responses, preserve saved group output coordinates, return missing rows as 404, and report the effective workspace-plan row limit
  • fix numeric deployment reverts, paused execution projections, paused MCP workflow results, and Knowledge-backed hallucination validation
  • restore legacy owner access across child resources of legacy personal knowledge bases without weakening workspace-scoped v2 authorization, and project their mutations through the shared semantic audit path
  • prevent session credential creation from returning encrypted service-account material
  • restore TypeScript SDK sync failure throwing and executionId / timing compatibility, and bump the SDK to 0.1.3

Error model

Application and domain code now throws classified errors at the source. Shared route builders project those errors into each API surface's declared envelope, including typed HttpError failures. Unknown errors still fail closed as generic 500 responses without leaking implementation details.

Security and authorization notes

  • the latest staging base sanitizes deployed workflow-version snapshots before v2 projection; this merge preserves that behavior and its secret-redaction regression test
  • workspace API keys intentionally list metadata for all shared OAuth and service-account connections because they are workspace principals, not their creator; encrypted keys, tokens, environment secrets, and credential values are never selected or returned
  • personal API keys continue to use human credential visibility and membership rules
  • the latest staging base also withholds stored MCP authentication header values from read-only session callers

Validation

  • post-sync table concurrency pass: 3 focused suites, 46 tests
  • review-feedback pass: 7 focused Knowledge/auth/MCP suites, 46 tests
  • latest staging-conflict pass: 10 focused suites, 76 tests
  • earlier branch regression pass: 33 focused Sim suites, 323 tests
  • Sim TypeScript type-check
  • repository-wide lint and all 25 repository audits on the final staging-synced branch
  • TypeScript SDK: 35 tests, type-check, lint, and build
  • generated OpenAPI verification and block registry validation

Notes

  • targets staging and includes staging through merge commit 1858bad382 (origin/staging at cb2809001e)
  • Agiloft changes present in the merge are owned by the staging base, not this PR
  • unrelated local investigation artifacts are excluded
  • do not merge automatically

@TheodoreSpeaks
TheodoreSpeaks requested a review from a team as a code owner August 11, 2026 22:50
@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 12, 2026 12:27am

Request Review

@cursor

cursor Bot commented Aug 11, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Touches cross-cutting API error projection, Knowledge authorization for legacy personal bases, credential response shaping, and bulk table mutation semantics—security- and data-sensitive compatibility paths.

Overview
Restores migrated API compatibility so classified domain and typed HttpError failures keep their intended 4xx statuses through internal and v2 route envelopes instead of collapsing to generic 500s.

Knowledge restores owner-only access to legacy personal knowledge bases (and their child resources) without weakening workspace-scoped auth, including usage admission, search billing, and shared audit projection. Tables again support unbounded filter updates/deletes via bounded keyset batches with concurrent-change revalidation, return missing rows as 404, preserve saved group output coordinates, and expose plan-derived maxRows.

Files switch nested write/move paths to canonical folder helpers with fail-fast segment limits and map folder/move conflicts to 409. Also restores legacy status codes for table name conflicts (400) and storage quota (402), strips encrypted service-account material from credential create responses, treats MCP paused HITL runs as successful tool results, allows nullable pause contextId, coerces numeric deployment version params, and fails Knowledge-backed hallucination validation when delegated KB queries are rejected.

Reviewed by Cursor Bugbot for commit e0a5c39. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR restores API and SDK compatibility across error projection, file operations, table mutations, workflow execution, Knowledge authorization, and response serialization.

  • Preserves legacy and v2 error envelopes while retaining classified HTTP statuses.
  • Adds bounded keyset processing and locked revalidation for unbounded table mutations.
  • Repairs workspace-file path handling, archive behavior, and stale-reference downloads.
  • Restores workflow execution projections and TypeScript SDK compatibility.
  • Prevents encrypted service-account material from appearing in credential-creation responses.

Confidence Score: 5/5

The PR appears safe to merge because the previously reported issues are fixed and no blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/lib/table/rows/service.ts Restores no-limit filter mutations using bounded keyset pages, per-page transactions, locked revalidation, and bounded side-effect dispatch.
packages/ts-sdk/src/index.ts Restores synchronous execution failure throwing and compatibility fields for execution identifiers and timing metadata.
packages/ts-sdk/src/index.test.ts Adds compiler-checked coverage for synchronous workflow failures and restored execution metadata.
apps/sim/app/api/credentials/route.ts Validates credential-creation responses through the public contract so encrypted service-account material is omitted.
apps/sim/lib/workspace-files/application/workspace-file-folders.ts Coordinates canonical nested-folder creation and rollback behavior for workspace-file operations.
apps/sim/lib/knowledge/application/authorization.ts Restores legacy personal-knowledge owner access while preserving workspace-scoped authorization behavior.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Caller[API or SDK caller] --> Contract[Shared request/response contract]
  Contract --> UseCase[Authorized application use case]
  UseCase --> Domain[Files, Tables, Knowledge, or Workflows]
  Domain --> Policy[Surface-specific error policy]
  Policy --> Response[Legacy or v2 response envelope]
Loading

Reviews (8): Last reviewed commit: "fix(auth): project legacy knowledge audi..." | Re-trigger Greptile

Comment thread apps/sim/lib/table/rows/service.ts Outdated
Comment thread packages/ts-sdk/src/index.test.ts Outdated
Comment thread apps/sim/app/api/v2/files/folders/route.ts
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/lib/uploads/contexts/workspace/workspace-file-folder-manager.ts Outdated
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@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 9d7c60f. Configure here.

…r-projection

# Conflicts:
#	apps/sim/app/api/mcp/servers/route.test.ts
#	apps/sim/app/api/mcp/servers/route.ts
#	apps/sim/app/api/table/utils.test.ts
#	apps/sim/app/api/v1/tables/route.test.ts
#	apps/sim/app/api/v2/files/folders/route.test.ts
#	apps/sim/app/api/v2/lib/response.ts
#	apps/sim/app/api/v2/tables/[tableId]/rows/[rowId]/route.test.ts
#	apps/sim/lib/api/contracts/workflows.ts
#	apps/sim/lib/uploads/archive.test.ts
#	apps/sim/lib/uploads/archive.ts
#	apps/sim/lib/uploads/contexts/workspace/workspace-file-folder-manager.test.ts
#	apps/sim/lib/uploads/contexts/workspace/workspace-file-folder-manager.ts
#	apps/sim/lib/workspace-files/application/workspace-file-folders.ts
@TheodoreSpeaks TheodoreSpeaks changed the title fix(api): restore migrated endpoint compatibility fix(api): restore migrated endpoint and SDK compatibility Aug 11, 2026
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

Comment thread apps/sim/lib/knowledge/application/authorized-knowledge-use-case.ts
Comment thread apps/sim/lib/knowledge/application/authorized-knowledge-use-case.ts
Comment thread apps/sim/lib/table/rows/service.ts
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/lib/table/rows/service.ts Outdated

@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 6976393. Configure here.

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

…r-projection

# Conflicts:
#	apps/sim/app/api/tools/file/manage/route.test.ts
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

Comment thread apps/sim/lib/knowledge/application/authorized-knowledge-use-case.ts
Comment thread apps/sim/lib/mcp/middleware.ts Outdated
@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!

2 issues from previous reviews remain unresolved.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit 1858bad. Configure here.

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@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 e0a5c39. Configure here.

@TheodoreSpeaks
TheodoreSpeaks merged commit 092311e into staging Aug 12, 2026
31 checks passed
@TheodoreSpeaks
TheodoreSpeaks deleted the fix/api-route-error-projection branch August 12, 2026 00:36
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