Skip to content

Conversation

@ymc9
Copy link
Member

@ymc9 ymc9 commented Oct 30, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Added TanStack Start server adapter enabling seamless integration with route handlers, supporting CRUD operations, RPC and REST API patterns, and policy-based access control.
  • Chores

    • Updated build configuration to include new adapter exports.

Copilot AI review requested due to automatic review settings October 30, 2025 02:08
@coderabbitai
Copy link

coderabbitai bot commented Oct 30, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This PR introduces a new TanStack Start server adapter for the ZenStack framework, complete with handler implementation and comprehensive test coverage. Additionally, it applies widespread formatting updates across test and schema files, including quote style normalization, trailing commas, and multi-line restructuring of imports and literals. Package exports and build configuration are updated to support the new adapter.

Changes

Cohort / File(s) Summary
TanStack Start Adapter (New)
packages/server/src/adapter/tanstack-start/handler.ts, packages/server/src/adapter/tanstack-start/index.ts
New adapter implementation: exports factory function that creates request handlers, initializes ZenStack client from request context, validates path parameters, parses query and JSON body, delegates to apiHandler, and returns JSON responses with error handling. Introduces TanStackStartOptions<Schema> interface with getClient callback and TanStackStartHandler function.
Package Configuration
packages/server/package.json, packages/server/tsup.config.ts
Added "./tanstack-start" export entry in package.json with dual import/require targets (types and default dist files). Added corresponding "tanstack-start" entry to tsup build configuration.
Server Adapter Formatting
packages/server/src/adapter/common.ts, packages/server/src/adapter/fastify/index.ts, packages/server/src/adapter/fastify/plugin.ts, packages/server/src/adapter/nuxt/handler.ts
Formatting updates: quote style normalization, multi-line function parameter restructuring (e.g., getClient in FastifyPluginOptions), removal of trailing whitespace.
Test Suite Formatting
packages/server/test/adapter/elysia.test.ts, packages/server/test/adapter/fastify.test.ts, packages/server/test/adapter/hono.test.ts, packages/server/test/adapter/sveltekit.test.ts
Formatting-only changes: added trailing commas, expanded multi-line formatting in object literals and function calls without altering test logic.
TanStack Start Test Suite (New)
packages/server/test/adapter/tanstack-start.test.ts
Comprehensive new test file with two describe blocks: RPC handler tests covering CRUD operations, policies, and error handling; REST handler tests for create/get/filter/update/delete flows. Includes helper utilities makeRequest, unmarshal, makeTestClient.
CLI Formatting
packages/cli/src/actions/migrate.ts
Added trailing comma to reset command array construction in runReset function.
Schema & Model Formatting
tests/e2e/orm/schemas/basic/input.ts, tests/e2e/orm/schemas/basic/models.ts, tests/e2e/orm/schemas/basic/schema.ts, tests/e2e/orm/schemas/delegate/input.ts, tests/e2e/orm/schemas/delegate/models.ts, tests/e2e/orm/schemas/delegate/schema.ts, tests/e2e/orm/schemas/name-mapping/input.ts, tests/e2e/orm/schemas/name-mapping/models.ts, tests/e2e/orm/schemas/name-mapping/schema.ts, tests/e2e/orm/schemas/petstore/input.ts, tests/e2e/orm/schemas/petstore/models.ts, tests/e2e/orm/schemas/petstore/schema.ts, tests/e2e/orm/schemas/todo/input.ts, tests/e2e/orm/schemas/todo/models.ts, tests/e2e/orm/schemas/todo/schema.ts, tests/e2e/orm/schemas/typing/input.ts, tests/e2e/orm/schemas/typing/models.ts, tests/e2e/orm/schemas/typing/schema.ts
Systematic formatting updates across all schema directories: converted double quotes to single quotes in imports, string literals, and generic type parameters; restructured imports into multi-line blocks; reformatted object/array literals with trailing commas. No semantic or logic changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~35–45 minutes

  • packages/server/src/adapter/tanstack-start/handler.ts — Review error handling, client initialization flow, and request/response serialization logic.
  • packages/server/src/adapter/tanstack-start/index.ts — Verify interface definitions and delegation to handler; check type parameter constraints.
  • packages/server/test/adapter/tanstack-start.test.ts — Validate comprehensiveness of CRUD and policy-driven access test coverage; ensure helper utilities are robust.
  • tests/e2e/orm/schemas/delegate/schema.ts and tests/e2e/orm/schemas/typing/schema.ts — Large-scale formatting changes (High complexity per original summaries); verify no unintended semantic drift due to quote/formatting adjustments.

Possibly related PRs

Poem

🐰 Hop through the code, new paths appear,
TanStack Start adapter's here, crystal clear!
Trailing commas, quotes so fine,
Schema formatting in a line,
Tests and handlers, all align—
A well-formatted design! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "feat(server): migrate tanstack-start adapter" directly reflects the primary objective of the changeset. The raw_summary shows that the main work involves adding a new TanStack Start adapter, including new handler and index files in packages/server/src/adapter/tanstack-start/, new package.json exports, build configuration updates in tsup.config.ts, and a comprehensive test suite. While the PR also includes numerous formatting changes across test and schema files, these are secondary to the core feature. The title is concise, uses appropriate conventional commit syntax (feat/server), and clearly communicates the main change to reviewers.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/tanstack-start

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@claude
Copy link

claude bot commented Oct 30, 2025

Claude finished @ymc9's task —— View job


Code Review for TanStack Start Adapter

Reviewed the new TanStack Start adapter implementation. Here's my comprehensive feedback:

🏗️ Code Quality & Architecture

Excellent consistency with existing patterns: The implementation follows the established adapter architecture perfectly, matching the structure and conventions of other adapters (SvelteKit, Hono, etc.).

Well-structured exports (packages/server/src/adapter/tanstack-start/index.ts:20-24): Clean interface definition and export pattern consistent with other adapters.

🐛 Potential Issues

HTTP Status Code Inconsistency (packages/server/src/adapter/tanstack-start/handler.ts:17-22):

  • Returns 500 for missing client, but SvelteKit adapter uses 400 for the same condition
  • Consider using 400 for consistency since this indicates a client request issue

Incomplete Error Handling (packages/server/src/adapter/tanstack-start/handler.ts:42-46):

  • JSON parsing silently fails with // noop comment
  • Other adapters handle this similarly, but consider logging parse failures for debugging

🔒 Security Considerations

Good security practices:

  • ✅ Proper error sanitization in catch blocks (handler.ts:65)
  • ✅ Safe JSON parsing with try-catch
  • ✅ Path validation for missing _splat parameter

Missing request validation:

  • Consider adding request size limits
  • No explicit validation of request method in request.method! (handler.ts:51) - the non-null assertion assumes method exists

🚀 Performance Considerations

Efficient implementation:

  • ✅ Minimal overhead in request handling
  • ✅ Proper async/await usage
  • ✅ Direct Response object creation instead of framework abstractions

Minor optimization opportunity:

  • URL parsing on every request (handler.ts:25) - consider caching if request.url is static

🧪 Test Coverage Assessment

Comprehensive test suite (packages/server/test/adapter/tanstack-start.test.ts):

  • ✅ Covers all CRUD operations (75 test cases for RPC handler)
  • ✅ Tests both RPC and REST API handlers
  • ✅ Includes access policy validation scenarios
  • ✅ Proper error condition testing (403, 404 responses)
  • ✅ Complex query testing (aggregations, groupBy, filters)

Test quality is excellent - follows established patterns and covers edge cases thoroughly.

📦 Configuration & Build

Proper package.json integration:

  • ✅ Added "tanstack-start" to keywords (package.json:20)
  • ✅ Correct export paths added (package.json:112-121)
  • ✅ Build configuration updated in tsup (tsup.config.ts:13)

Missing peerDependency: Consider adding TanStack Start as an optional peer dependency for better dependency management.

🔄 Consistency with Framework Patterns

TanStack Start specific implementation:

  • ✅ Correctly uses _splat parameter for catch-all routing (handler.ts:29)
  • ✅ Proper Request/Response object handling
  • ✅ Compatible with TanStack Start's server function signature

📝 Recommendations

  1. Fix status code consistency: Change line 18 from status: 500 to status: 400
  2. Add optional peer dependency for @tanstack/start in package.json
  3. Consider request size limits for production safety
  4. Add error logging for JSON parse failures (optional)

Overall Assessment

Excellent implementation that maintains high code quality standards. The adapter follows established patterns perfectly and includes comprehensive test coverage. Only minor consistency issues identified.

Ready to merge with the status code fix recommended above.


Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for TanStack Start as a new server adapter for ZenStack. The implementation follows the established pattern used by existing adapters like Hono and SvelteKit.

  • Adds a new TanStack Start adapter that handles CRUD operations via catch-all routes using the _splat parameter
  • Implements both RPC and REST API handler support
  • Adds comprehensive test coverage for the new adapter

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/server/tsup.config.ts Adds build configuration entry for the tanstack-start adapter
packages/server/package.json Adds export paths for the tanstack-start adapter module
packages/server/src/adapter/tanstack-start/index.ts Defines the public API and type definitions for the TanStack Start adapter
packages/server/src/adapter/tanstack-start/handler.ts Implements the core request handling logic for TanStack Start routes
packages/server/test/adapter/tanstack-start.test.ts Provides comprehensive test coverage for RPC and REST API handlers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@claude
Copy link

claude bot commented Oct 30, 2025

Claude finished @ymc9's task —— View job


Code Review for TanStack Start Adapter

Reviewed the new TanStack Start adapter implementation. Here's my comprehensive feedback:

Progress Checklist:

  • Examine the new adapter implementation files
  • Review handler.ts for code quality and potential issues
  • Check index.ts for proper API design
  • Analyze test coverage and quality
  • Compare with existing adapters for consistency
  • Review build configuration and package updates
  • Check for security considerations
  • Assess performance implications
  • Provide comprehensive feedback

🏗️ Code Quality & Architecture

Excellent consistency with existing patterns: The implementation follows the established adapter architecture perfectly, matching the structure and conventions of other adapters (SvelteKit, Hono, etc.).

Well-structured exports (packages/server/src/adapter/tanstack-start/index.ts:20-24): Clean interface definition and export pattern consistent with other adapters.

🐛 Potential Issues

HTTP Status Code Inconsistency (packages/server/src/adapter/tanstack-start/handler.ts:17-22):

  • Returns 500 for missing client, but SvelteKit adapter uses 400 for the same condition
  • Consider using 400 for consistency since this indicates a client request issue

Incomplete Error Handling (packages/server/src/adapter/tanstack-start/handler.ts:42-46):

  • JSON parsing silently fails with // noop comment
  • Other adapters handle this similarly, but consider logging parse failures for debugging

🔒 Security Considerations

Good security practices:

  • ✅ Proper error sanitization in catch blocks (handler.ts:65)
  • ✅ Safe JSON parsing with try-catch
  • ✅ Path validation for missing _splat parameter

Missing request validation:

  • Consider adding request size limits
  • No explicit validation of request method in request.method! (handler.ts:51) - the non-null assertion assumes method exists

🚀 Performance Considerations

Efficient implementation:

  • ✅ Minimal overhead in request handling
  • ✅ Proper async/await usage
  • ✅ Direct Response object creation instead of framework abstractions

Minor optimization opportunity:

  • URL parsing on every request (handler.ts:25) - consider caching if request.url is static

🧪 Test Coverage Assessment

Comprehensive test suite (packages/server/test/adapter/tanstack-start.test.ts):

  • ✅ Covers all CRUD operations (75 test cases for RPC handler)
  • ✅ Tests both RPC and REST API handlers
  • ✅ Includes access policy validation scenarios
  • ✅ Proper error condition testing (403, 404 responses)
  • ✅ Complex query testing (aggregations, groupBy, filters)

Test quality is excellent - follows established patterns and covers edge cases thoroughly.

📦 Configuration & Build

Proper package.json integration:

  • ✅ Added "tanstack-start" to keywords (package.json:20)
  • ✅ Correct export paths added (package.json:112-121)
  • ✅ Build configuration updated in tsup (tsup.config.ts:13)

Missing peerDependency: Consider adding TanStack Start as an optional peer dependency for better dependency management.

🔄 Consistency with Framework Patterns

TanStack Start specific implementation:

  • ✅ Correctly uses _splat parameter for catch-all routing (handler.ts:29)
  • ✅ Proper Request/Response object handling
  • ✅ Compatible with TanStack Start's server function signature

📝 Recommendations

  1. Fix status code consistency: Change line 18 from status: 500 to status: 400
  2. Add optional peer dependency for @tanstack/start in package.json
  3. Consider request size limits for production safety
  4. Add error logging for JSON parse failures (optional)

Overall Assessment

Excellent implementation that maintains high code quality standards. The adapter follows established patterns perfectly and includes comprehensive test coverage. Only minor consistency issues identified.

Ready to merge with the status code fix recommended above.


Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/server/src/adapter/tanstack-start/handler.ts (2)

40-47: Consider improving the comment for clarity.

The empty catch block is intentional and reasonable (failed parsing leaves requestBody undefined for the API handler to deal with), but the comment could be more descriptive to make this clear to future maintainers.

Apply this diff for a clearer comment:

         } catch {
-            // noop
+            // If body parsing fails, requestBody remains undefined and the API handler will validate as needed
         }

49-62: Minor: Non-null assertion is unnecessary.

The Request.method property is always defined according to the Web Fetch API specification, making the non-null assertion on line 51 technically redundant (though harmless).

Apply this diff if you prefer to remove the redundant assertion:

-            const r = await options.apiHandler.handleRequest({
-                method: request.method!,
+            const r = await options.apiHandler.handleRequest({
+                method: request.method,
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe5f61d and 69d9132.

📒 Files selected for processing (5)
  • packages/server/package.json (1 hunks)
  • packages/server/src/adapter/tanstack-start/handler.ts (1 hunks)
  • packages/server/src/adapter/tanstack-start/index.ts (1 hunks)
  • packages/server/test/adapter/tanstack-start.test.ts (1 hunks)
  • packages/server/tsup.config.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
{packages,samples,tests}/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place packages only under packages/, samples/, or tests/

Files:

  • packages/server/src/adapter/tanstack-start/index.ts
  • packages/server/src/adapter/tanstack-start/handler.ts
  • packages/server/tsup.config.ts
  • packages/server/package.json
  • packages/server/test/adapter/tanstack-start.test.ts
🧬 Code graph analysis (3)
packages/server/src/adapter/tanstack-start/index.ts (3)
packages/sdk/src/schema/schema.ts (1)
  • SchemaDef (10-18)
packages/server/src/adapter/common.ts (1)
  • CommonAdapterOptions (8-13)
packages/orm/src/client/contract.ts (1)
  • ClientContract (50-170)
packages/server/src/adapter/tanstack-start/handler.ts (4)
packages/sdk/src/schema/schema.ts (1)
  • SchemaDef (10-18)
packages/server/src/adapter/tanstack-start/index.ts (1)
  • TanStackStartOptions (9-14)
packages/server/src/types.ts (1)
  • Response (52-62)
packages/server/src/adapter/common.ts (1)
  • logInternalError (15-17)
packages/server/test/adapter/tanstack-start.test.ts (3)
packages/server/src/adapter/tanstack-start/index.ts (1)
  • TanStackStartOptions (9-14)
packages/sdk/src/schema/schema.ts (1)
  • SchemaDef (10-18)
packages/testtools/src/client.ts (2)
  • createTestClient (52-169)
  • createPolicyTestClient (179-190)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build-test (20.x, postgresql)
  • GitHub Check: build-test (20.x, sqlite)
🔇 Additional comments (14)
packages/server/tsup.config.ts (1)

13-13: LGTM!

The build entry for the TanStack Start adapter follows the same pattern as other adapters and correctly points to the index file.

packages/server/package.json (2)

20-20: LGTM!

Good addition to keywords for package discoverability.


111-121: LGTM!

The export entry for the TanStack Start adapter is correctly configured with both ESM and CJS support, matching the pattern of other adapters.

packages/server/src/adapter/tanstack-start/index.ts (3)

1-4: LGTM!

Imports are clean and appropriate for the adapter implementation.


9-14: LGTM!

The interface design is clean and provides the necessary flexibility for client resolution with both synchronous and asynchronous support.


20-24: LGTM!

The wrapper function provides a clean, typed public API while delegating the implementation details to the handler factory.

packages/server/test/adapter/tanstack-start.test.ts (4)

7-15: LGTM!

The helper functions are well-focused and provide clean abstractions for request creation and response parsing.


17-73: LGTM!

The test client helper is well-designed and accurately simulates the TanStack Start request/response flow, including proper handling of query parameters, request bodies, and the catch-all route pattern.


75-196: LGTM!

Excellent test coverage for RPC operations, including comprehensive CRUD operations and access policy scenarios. The tests verify both successful operations and proper handling of forbidden requests.


198-235: LGTM!

The REST API tests provide solid coverage of core operations and properly validate JSON:API format compliance, including filtering and resource identification.

packages/server/src/adapter/tanstack-start/handler.ts (4)

11-13: LGTM!

The factory function signature is clean and properly typed for TanStack Start's handler pattern.


15-23: LGTM!

Client resolution with appropriate error handling when the client is unavailable.


25-38: LGTM!

URL parsing and path extraction correctly implements TanStack Start's catch-all route pattern using the _splat parameter.


63-71: LGTM!

Proper error handling with internal error logging while returning a secure, generic error message to clients.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/server/test/adapter/tanstack-start.test.ts (1)

7-10: Consider adding Content-Type header for requests with body.

The makeRequest helper doesn't set a Content-Type: application/json header when a body is present. While the TanStack Start handler may handle this gracefully, it's best practice to include the header for requests with JSON payloads.

Apply this diff:

 function makeRequest(method: string, url: string, body?: any): Request {
     const payload = body ? JSON.stringify(body) : undefined;
-    return new Request(url, { method, body: payload });
+    const headers = payload ? { 'Content-Type': 'application/json' } : undefined;
+    return new Request(url, { method, body: payload, headers });
 }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe5f61d and e1b48f4.

📒 Files selected for processing (32)
  • packages/cli/src/actions/migrate.ts (1 hunks)
  • packages/server/package.json (1 hunks)
  • packages/server/src/adapter/common.ts (2 hunks)
  • packages/server/src/adapter/fastify/index.ts (0 hunks)
  • packages/server/src/adapter/fastify/plugin.ts (1 hunks)
  • packages/server/src/adapter/nuxt/handler.ts (1 hunks)
  • packages/server/src/adapter/tanstack-start/handler.ts (1 hunks)
  • packages/server/src/adapter/tanstack-start/index.ts (1 hunks)
  • packages/server/test/adapter/elysia.test.ts (7 hunks)
  • packages/server/test/adapter/fastify.test.ts (3 hunks)
  • packages/server/test/adapter/hono.test.ts (7 hunks)
  • packages/server/test/adapter/sveltekit.test.ts (6 hunks)
  • packages/server/test/adapter/tanstack-start.test.ts (1 hunks)
  • packages/server/tsup.config.ts (1 hunks)
  • tests/e2e/orm/schemas/basic/input.ts (1 hunks)
  • tests/e2e/orm/schemas/basic/models.ts (1 hunks)
  • tests/e2e/orm/schemas/basic/schema.ts (1 hunks)
  • tests/e2e/orm/schemas/delegate/input.ts (1 hunks)
  • tests/e2e/orm/schemas/delegate/models.ts (1 hunks)
  • tests/e2e/orm/schemas/delegate/schema.ts (1 hunks)
  • tests/e2e/orm/schemas/name-mapping/input.ts (1 hunks)
  • tests/e2e/orm/schemas/name-mapping/models.ts (1 hunks)
  • tests/e2e/orm/schemas/name-mapping/schema.ts (1 hunks)
  • tests/e2e/orm/schemas/petstore/input.ts (1 hunks)
  • tests/e2e/orm/schemas/petstore/models.ts (1 hunks)
  • tests/e2e/orm/schemas/petstore/schema.ts (1 hunks)
  • tests/e2e/orm/schemas/todo/input.ts (1 hunks)
  • tests/e2e/orm/schemas/todo/models.ts (1 hunks)
  • tests/e2e/orm/schemas/todo/schema.ts (1 hunks)
  • tests/e2e/orm/schemas/typing/input.ts (1 hunks)
  • tests/e2e/orm/schemas/typing/models.ts (1 hunks)
  • tests/e2e/orm/schemas/typing/schema.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/server/src/adapter/fastify/index.ts
🧰 Additional context used
📓 Path-based instructions (3)
{packages,samples,tests}/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place packages only under packages/, samples/, or tests/

Files:

  • packages/server/src/adapter/nuxt/handler.ts
  • packages/server/test/adapter/hono.test.ts
  • packages/server/src/adapter/tanstack-start/handler.ts
  • packages/server/tsup.config.ts
  • tests/e2e/orm/schemas/petstore/schema.ts
  • packages/server/test/adapter/tanstack-start.test.ts
  • tests/e2e/orm/schemas/delegate/input.ts
  • packages/server/src/adapter/fastify/plugin.ts
  • tests/e2e/orm/schemas/delegate/schema.ts
  • packages/server/package.json
  • packages/server/src/adapter/tanstack-start/index.ts
  • packages/cli/src/actions/migrate.ts
  • tests/e2e/orm/schemas/typing/schema.ts
  • tests/e2e/orm/schemas/petstore/models.ts
  • tests/e2e/orm/schemas/basic/schema.ts
  • packages/server/test/adapter/sveltekit.test.ts
  • tests/e2e/orm/schemas/petstore/input.ts
  • tests/e2e/orm/schemas/todo/schema.ts
  • tests/e2e/orm/schemas/name-mapping/models.ts
  • tests/e2e/orm/schemas/name-mapping/input.ts
  • tests/e2e/orm/schemas/name-mapping/schema.ts
  • tests/e2e/orm/schemas/basic/input.ts
  • tests/e2e/orm/schemas/todo/models.ts
  • packages/server/src/adapter/common.ts
  • tests/e2e/orm/schemas/typing/input.ts
  • tests/e2e/orm/schemas/todo/input.ts
  • packages/server/test/adapter/fastify.test.ts
  • packages/server/test/adapter/elysia.test.ts
  • tests/e2e/orm/schemas/basic/models.ts
  • tests/e2e/orm/schemas/delegate/models.ts
  • tests/e2e/orm/schemas/typing/models.ts
tests/e2e/**

📄 CodeRabbit inference engine (CLAUDE.md)

End-to-end tests must live under tests/e2e/

Files:

  • tests/e2e/orm/schemas/petstore/schema.ts
  • tests/e2e/orm/schemas/delegate/input.ts
  • tests/e2e/orm/schemas/delegate/schema.ts
  • tests/e2e/orm/schemas/typing/schema.ts
  • tests/e2e/orm/schemas/petstore/models.ts
  • tests/e2e/orm/schemas/basic/schema.ts
  • tests/e2e/orm/schemas/petstore/input.ts
  • tests/e2e/orm/schemas/todo/schema.ts
  • tests/e2e/orm/schemas/name-mapping/models.ts
  • tests/e2e/orm/schemas/name-mapping/input.ts
  • tests/e2e/orm/schemas/name-mapping/schema.ts
  • tests/e2e/orm/schemas/basic/input.ts
  • tests/e2e/orm/schemas/todo/models.ts
  • tests/e2e/orm/schemas/typing/input.ts
  • tests/e2e/orm/schemas/todo/input.ts
  • tests/e2e/orm/schemas/basic/models.ts
  • tests/e2e/orm/schemas/delegate/models.ts
  • tests/e2e/orm/schemas/typing/models.ts
**/schema.ts

📄 CodeRabbit inference engine (CLAUDE.md)

The generated TypeScript schema should be named schema.ts

Files:

  • tests/e2e/orm/schemas/petstore/schema.ts
  • tests/e2e/orm/schemas/delegate/schema.ts
  • tests/e2e/orm/schemas/typing/schema.ts
  • tests/e2e/orm/schemas/basic/schema.ts
  • tests/e2e/orm/schemas/todo/schema.ts
  • tests/e2e/orm/schemas/name-mapping/schema.ts
🧠 Learnings (4)
📚 Learning: 2025-09-04T12:38:14.150Z
Learnt from: CR
PR: zenstackhq/zenstack-v3#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-04T12:38:14.150Z
Learning: Applies to **/schema.ts : The generated TypeScript schema should be named `schema.ts`

Applied to files:

  • tests/e2e/orm/schemas/petstore/schema.ts
  • tests/e2e/orm/schemas/delegate/schema.ts
  • tests/e2e/orm/schemas/typing/schema.ts
  • tests/e2e/orm/schemas/petstore/models.ts
  • tests/e2e/orm/schemas/basic/schema.ts
  • tests/e2e/orm/schemas/todo/schema.ts
  • tests/e2e/orm/schemas/name-mapping/models.ts
  • tests/e2e/orm/schemas/name-mapping/input.ts
  • tests/e2e/orm/schemas/name-mapping/schema.ts
  • tests/e2e/orm/schemas/basic/input.ts
  • tests/e2e/orm/schemas/todo/models.ts
  • tests/e2e/orm/schemas/typing/input.ts
  • tests/e2e/orm/schemas/todo/input.ts
  • tests/e2e/orm/schemas/basic/models.ts
  • tests/e2e/orm/schemas/delegate/models.ts
📚 Learning: 2025-10-21T16:09:31.218Z
Learnt from: ymc9
PR: zenstackhq/zenstack-v3#319
File: packages/runtime/src/client/executor/zenstack-query-executor.ts:63-72
Timestamp: 2025-10-21T16:09:31.218Z
Learning: In ZenStack, TypeDefs can be inherited by models. When a TypeDef contains fields with `map` attributes, those mapped field names need to be processed by the QueryNameMapper since they become part of the inheriting model's schema. Therefore, when checking if a schema has mapped names (e.g., in `schemaHasMappedNames`), both `schema.models` and `schema.typeDefs` must be inspected for `@map` and `map` attributes.

Applied to files:

  • tests/e2e/orm/schemas/petstore/schema.ts
  • tests/e2e/orm/schemas/delegate/schema.ts
  • tests/e2e/orm/schemas/typing/schema.ts
  • tests/e2e/orm/schemas/basic/schema.ts
  • tests/e2e/orm/schemas/todo/schema.ts
  • tests/e2e/orm/schemas/name-mapping/models.ts
  • tests/e2e/orm/schemas/name-mapping/input.ts
  • tests/e2e/orm/schemas/name-mapping/schema.ts
  • tests/e2e/orm/schemas/typing/input.ts
  • tests/e2e/orm/schemas/basic/models.ts
  • tests/e2e/orm/schemas/typing/models.ts
📚 Learning: 2025-09-04T12:38:14.150Z
Learnt from: CR
PR: zenstackhq/zenstack-v3#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-04T12:38:14.150Z
Learning: Applies to **/schema.zmodel : Name ZModel schema files `schema.zmodel`

Applied to files:

  • tests/e2e/orm/schemas/petstore/schema.ts
📚 Learning: 2025-09-04T12:38:14.150Z
Learnt from: CR
PR: zenstackhq/zenstack-v3#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-04T12:38:14.150Z
Learning: Database migrations use Prisma CLI under the hood

Applied to files:

  • packages/cli/src/actions/migrate.ts
🧬 Code graph analysis (18)
packages/server/test/adapter/hono.test.ts (2)
packages/server/src/adapter/hono/handler.ts (1)
  • createHonoHandler (17-55)
packages/server/test/utils.ts (1)
  • makeUrl (31-33)
packages/server/src/adapter/tanstack-start/handler.ts (4)
packages/sdk/src/schema/schema.ts (1)
  • SchemaDef (10-18)
packages/server/src/adapter/tanstack-start/index.ts (1)
  • TanStackStartOptions (9-17)
packages/server/src/types.ts (1)
  • Response (52-62)
packages/server/src/adapter/common.ts (1)
  • logInternalError (15-21)
tests/e2e/orm/schemas/petstore/schema.ts (2)
tests/e2e/orm/schemas/basic/schema.ts (1)
  • schema (9-395)
packages/orm/src/schema/expression.ts (1)
  • ExpressionUtils (16-120)
packages/server/test/adapter/tanstack-start.test.ts (1)
packages/server/src/adapter/tanstack-start/index.ts (2)
  • TanStackStartOptions (9-17)
  • TanStackStartHandler (23-27)
packages/server/src/adapter/fastify/plugin.ts (1)
packages/orm/src/client/contract.ts (1)
  • ClientContract (50-170)
tests/e2e/orm/schemas/delegate/schema.ts (1)
packages/orm/src/schema/expression.ts (1)
  • ExpressionUtils (16-120)
packages/server/src/adapter/tanstack-start/index.ts (3)
packages/sdk/src/schema/schema.ts (1)
  • SchemaDef (10-18)
packages/server/src/adapter/common.ts (1)
  • CommonAdapterOptions (8-13)
packages/orm/src/client/contract.ts (1)
  • ClientContract (50-170)
tests/e2e/orm/schemas/typing/schema.ts (1)
packages/orm/src/schema/expression.ts (1)
  • ExpressionUtils (16-120)
tests/e2e/orm/schemas/petstore/models.ts (5)
tests/e2e/orm/schemas/basic/models.ts (1)
  • User (10-10)
tests/e2e/orm/schemas/delegate/models.ts (1)
  • User (10-10)
tests/e2e/orm/schemas/name-mapping/models.ts (1)
  • User (10-10)
tests/e2e/orm/schemas/todo/models.ts (1)
  • User (12-12)
tests/e2e/orm/schemas/typing/models.ts (1)
  • User (10-10)
tests/e2e/orm/schemas/basic/schema.ts (1)
packages/orm/src/schema/expression.ts (1)
  • ExpressionUtils (16-120)
packages/server/test/adapter/sveltekit.test.ts (1)
packages/server/test/utils.ts (1)
  • makeUrl (31-33)
tests/e2e/orm/schemas/todo/schema.ts (1)
packages/orm/src/schema/expression.ts (1)
  • ExpressionUtils (16-120)
tests/e2e/orm/schemas/name-mapping/models.ts (5)
tests/e2e/orm/schemas/basic/models.ts (2)
  • User (10-10)
  • Post (11-11)
tests/e2e/orm/schemas/delegate/models.ts (1)
  • User (10-10)
tests/e2e/orm/schemas/petstore/models.ts (1)
  • User (10-10)
tests/e2e/orm/schemas/todo/models.ts (1)
  • User (12-12)
tests/e2e/orm/schemas/typing/models.ts (2)
  • User (10-10)
  • Post (11-11)
tests/e2e/orm/schemas/name-mapping/schema.ts (1)
packages/orm/src/schema/expression.ts (1)
  • ExpressionUtils (16-120)
tests/e2e/orm/schemas/basic/input.ts (2)
tests/e2e/orm/schemas/delegate/input.ts (1)
  • UserGetPayload (53-57)
tests/e2e/orm/schemas/name-mapping/input.ts (2)
  • UserGetPayload (53-57)
  • PostGetPayload (77-81)
tests/e2e/orm/schemas/todo/input.ts (1)
tests/e2e/orm/schemas/basic/input.ts (1)
  • UserGetPayload (53-57)
packages/server/test/adapter/elysia.test.ts (2)
packages/server/src/adapter/elysia/handler.ts (1)
  • createElysiaHandler (25-77)
packages/server/test/utils.ts (1)
  • makeUrl (31-33)
tests/e2e/orm/schemas/delegate/models.ts (5)
tests/e2e/orm/schemas/basic/models.ts (2)
  • User (10-10)
  • Comment (12-12)
tests/e2e/orm/schemas/name-mapping/models.ts (1)
  • User (10-10)
tests/e2e/orm/schemas/petstore/models.ts (1)
  • User (10-10)
tests/e2e/orm/schemas/todo/models.ts (1)
  • User (12-12)
tests/e2e/orm/schemas/typing/models.ts (1)
  • User (10-10)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build-test (20.x, sqlite)
  • GitHub Check: build-test (20.x, postgresql)
🔇 Additional comments (36)
packages/server/src/adapter/nuxt/handler.ts (1)

3-3: LGTM!

Import formatting change only—no functional impact.

packages/cli/src/actions/migrate.ts (1)

89-89: LGTM!

Trailing comma addition—formatting-only change with no impact on command construction.

packages/server/test/adapter/fastify.test.ts (1)

16-16: LGTM!

Formatting-only updates (trailing commas)—no changes to test logic or assertions.

Also applies to: 52-52, 100-100

packages/server/test/adapter/hono.test.ts (1)

13-15: LGTM!

Formatting-only updates (multiline formatting and trailing commas)—no changes to test behavior.

Also applies to: 34-34, 54-54, 68-69, 75-75, 92-92, 104-104, 131-131

packages/server/package.json (1)

111-121: LGTM! New TanStack Start adapter export added correctly.

The export structure follows the established pattern for other adapters, with proper dual-package support (ESM/CJS) and type definitions.

packages/server/test/adapter/elysia.test.ts (1)

14-18: LGTM!

Formatting-only updates (multiline formatting and trailing commas)—no changes to test behavior.

Also applies to: 38-38, 58-58, 72-72, 79-79, 96-97, 109-109, 136-136

packages/server/test/adapter/sveltekit.test.ts (1)

12-16: LGTM!

Formatting-only updates (multiline formatting and trailing commas)—no changes to test behavior.

Also applies to: 35-35, 55-55, 69-69, 76-76, 104-104, 131-131

tests/e2e/orm/schemas/basic/schema.ts (1)

8-395: LGTM! Auto-generated schema with systematic formatting updates.

This file is auto-generated (as noted in the header), and the changes reflect consistent quote normalization (double to single quotes) and trailing comma additions. No manual review concerns for generated code.

packages/server/src/adapter/common.ts (1)

1-21: LGTM! Formatting improvements.

The changes normalize quote style and improve readability of the function call with multi-line formatting. No semantic changes to the exported API.

tests/e2e/orm/schemas/delegate/schema.ts (1)

1-543: LGTM! Consistent formatting in auto-generated schema.

The changes apply project-wide formatting standards (single quotes, trailing commas, multi-line formatting) without altering the schema structure, model definitions, relationships, or discriminators.

tests/e2e/orm/schemas/delegate/input.ts (1)

8-201: LGTM! Improved import structure and consistent formatting.

The imports are reorganized into logical groups with multi-line formatting, and all type exports use consistent single quotes. No changes to type signatures or semantics.

packages/server/src/adapter/fastify/plugin.ts (1)

19-22: LGTM! Improved readability with multi-line formatting.

The getClient property is reformatted to multi-line structure, improving readability while preserving the exact same type signature.

tests/e2e/orm/schemas/delegate/models.ts (1)

8-16: LGTM! Consistent quote style normalization.

All imports and type exports updated to use single quotes, maintaining consistency with the project's formatting standards. No changes to type definitions or behavior.

packages/server/tsup.config.ts (1)

13-13: LGTM! Build configuration for the new adapter is correct.

The new TanStack Start entry follows the established pattern for other adapters and correctly points to the adapter's entry point.

tests/e2e/orm/schemas/name-mapping/input.ts (1)

1-81: Auto-generated file with formatting updates applied consistently.

This file is automatically generated by the ZenStack CLI (as noted in the header). The changes apply consistent formatting (single quotes, multi-line imports) without altering any type definitions or exports.

tests/e2e/orm/schemas/todo/input.ts (1)

1-153: Auto-generated file with formatting updates applied consistently.

This file is automatically generated by the ZenStack CLI. The changes apply consistent formatting (single quotes, multi-line structure) without any semantic modifications.

tests/e2e/orm/schemas/petstore/input.ts (1)

1-105: Auto-generated file with formatting updates applied consistently.

This file is automatically generated by the ZenStack CLI. The changes maintain consistency with other schema files in the codebase through standardized formatting.

tests/e2e/orm/schemas/name-mapping/schema.ts (1)

1-103: Auto-generated schema with consistent formatting applied.

This schema definition file is automatically generated by the ZenStack CLI. The formatting changes (single quotes, multi-line structure) are applied uniformly without modifying the schema structure or semantics.

tests/e2e/orm/schemas/petstore/models.ts (1)

1-12: Auto-generated models with consistent quote style applied.

This file is automatically generated by the ZenStack CLI. The changes standardize quote usage without altering the exported type definitions.

tests/e2e/orm/schemas/todo/models.ts (1)

1-14: Auto-generated models with consistent quote style applied.

This file is automatically generated by the ZenStack CLI. The formatting changes maintain consistency with the codebase without affecting the type definitions.

tests/e2e/orm/schemas/petstore/schema.ts (1)

1-258: Auto-generated schema with consistent formatting applied.

This schema definition file is automatically generated by the ZenStack CLI. The formatting changes (single quotes, multi-line structure for fields and attributes) maintain consistency without altering schema semantics or policy logic.

tests/e2e/orm/schemas/name-mapping/models.ts (1)

8-11: Formatting consistency looks good.

Switching these generated exports to single quotes keeps them aligned with the other schema fixtures—no functional changes observed.

tests/e2e/orm/schemas/basic/input.ts (1)

8-105: Reflowed imports/readability improvement acknowledged.

The multi-line import grouping and literal quote normalization keep this generator output in sync with the rest of the suite without altering types.

tests/e2e/orm/schemas/todo/schema.ts (1)

8-834: Schema diff is formatting-only.

Confirmed the generated schema preserves all model metadata and policy expressions; only literal quoting and array formatting changed.

packages/server/src/adapter/tanstack-start/handler.ts (1)

11-72: Handler flow reads solid.

Client resolution, _splat path guarding, query extraction, and error handling align with the adapter pattern used elsewhere—no issues spotted.

tests/e2e/orm/schemas/typing/input.ts (1)

8-177: Import/style normalization verified.

Everything here is a formatting refresh; exported typings remain identical.

tests/e2e/orm/schemas/typing/schema.ts (1)

8-407: No semantic deltas detected.

The generated schema keeps the same models, enums, and policies; changes are purely quote/style adjustments.

tests/e2e/orm/schemas/basic/models.ts (1)

8-14: LGTM! Formatting standardization in generated file.

The quote style changes (double → single quotes) are consistent with the broader formatting standardization across the PR. Since this is a generated file, these changes reflect updates to the code generator itself.

packages/server/test/adapter/tanstack-start.test.ts (4)

12-15: LGTM! Simple and effective helper for tests.

The unmarshal function is appropriate for test scenarios where JSON parsing errors should surface as test failures.


24-78: LGTM! Well-designed test client utility.

The makeTestClient function properly handles:

  • TanStack Start's _splat routing parameter
  • Query parameter encoding for GET/DELETE requests
  • Consistent request/response handling across HTTP methods

The implementation aligns with TanStack Start's handler contract and provides a clean testing interface.


80-221: LGTM! Comprehensive RPC handler test coverage.

The test suite thoroughly validates:

  • Complete CRUD lifecycle (create, read, update, delete operations)
  • Advanced operations (upsert, count, aggregate, groupBy)
  • Policy enforcement with appropriate status codes (403 for forbidden, 404 for not found)
  • Final state verification

The tests follow established patterns from other adapter test suites and provide excellent coverage.


223-267: LGTM! Solid REST handler test coverage.

The REST API tests properly validate:

  • JSON:API format compliance (data.type, data.attributes structure)
  • Resource-level operations (GET, PUT, DELETE on specific IDs)
  • Collection filtering with query parameters
  • Data integrity across operations

The test suite complements the RPC tests and ensures the adapter works with both API styles.

packages/server/src/adapter/tanstack-start/index.ts (3)

1-17: LGTM! Well-designed adapter interface.

The TanStackStartOptions interface properly:

  • Extends CommonAdapterOptions for consistency with other adapters
  • Provides a flexible getClient callback for per-request client instantiation
  • Supports both synchronous and asynchronous client creation
  • Includes clear documentation

The design aligns with established patterns from other server adapters in the codebase.


19-27: LGTM! Clean factory function implementation.

The TanStackStartHandler function follows the adapter pattern used across the codebase:

  • Thin wrapper that delegates to the core Handler implementation
  • Proper type inference with ReturnType<typeof Handler>
  • Comprehensive JSDoc with documentation link
  • Type-safe generic constraints

The implementation is clean and maintainable.


29-29: LGTM! Flexible export pattern.

Providing both named (line 23) and default exports gives users flexibility in how they import the adapter, which is a good developer experience practice.

tests/e2e/orm/schemas/typing/models.ts (1)

8-17: LGTM! Consistent formatting in generated file.

The changes standardize quote style (double → single quotes) and add explicit type-only imports, consistent with the formatting updates across other generated schema files in this PR.

@ymc9 ymc9 merged commit f9cbedc into dev Oct 30, 2025
7 checks passed
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.

2 participants