Skip to content

[Graphite MQ] Draft PR GROUP:spec_65f6d2 (PRs 4120, 4121, 4119, 4126)#4129

Closed
graphite-app[bot] wants to merge 4 commits intomainfrom
gtmq_spec_65f6d2_1770329208520-effabed7-5375-4a26-a547-f7657b47ce11
Closed

[Graphite MQ] Draft PR GROUP:spec_65f6d2 (PRs 4120, 4121, 4119, 4126)#4129
graphite-app[bot] wants to merge 4 commits intomainfrom
gtmq_spec_65f6d2_1770329208520-effabed7-5375-4a26-a547-f7657b47ce11

Conversation

@graphite-app
Copy link
Contributor

@graphite-app graphite-app bot commented Feb 5, 2026

This draft PR was created by the Graphite merge queue.
Trunk will be fast forwarded to the HEAD of this PR when CI passes, and the original PRs will be closed.

The following PRs are included in this draft PR:

jog1t added 4 commits February 5, 2026 22:06
# Description

Added browser-specific exports for the `@rivetkit/traces` package to ensure proper bundling in browser environments. This change:

1. Created a browser-specific entry point (`index.browser.ts`) that provides a stub implementation of `createTraces()` which throws an appropriate error when called in browser contexts
2. Updated the package.json to include browser-specific export conditions for all entry points
3. Reorganized imports in frontend components to use the correct paths and avoid importing server-only code in the browser
4. Consolidated type imports to come from their appropriate modules

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

## How Has This Been Tested?

Verified that the frontend components can properly import the trace-related types and functions without pulling in server-only code.

## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
# Description

Updated all imports of `zod` to use the more specific `zod/v4` path across the RivetKit TypeScript codebase. This change ensures consistent versioning of the Zod library throughout the project.

Also downgraded the CodeMirror commands package from version 6.9.0 to 6.8.1 and TypeScript from 5.9.3 to 5.9.2 in the dependencies.

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

## How Has This Been Tested?

The existing test suite has been run to verify that the import path changes don't affect functionality.

## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
# Description

Refactored the traces package to improve module organization by:

1. Creating dedicated entry points for specific functionality:
   - Added `encoding.ts` for ReadRangeWire encoding/decoding functions
   - Added `otlp-entry.ts` for OTLP-related functionality

2. Updated imports across the codebase to use these new entry points:
   - Changed imports from `@rivetkit/traces/reader` to `@rivetkit/traces/encoding`
   - Added path mappings in tsconfig.json for the new entry points
   - Updated package.json exports to expose the new entry points

3. Updated the build script to include the new entry points in the build process

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

## How Has This Been Tested?

Verified that all imports resolve correctly and the application builds successfully.

## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
# Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
@railway-app
Copy link

railway-app bot commented Feb 5, 2026

This PR was not deployed automatically as @graphite-app[bot] does not have access to the Railway project.

In order to get automatic PR deploys, please add @graphite-app[bot] to your workspace on Railway.

@claude
Copy link

claude bot commented Feb 5, 2026

Pull Request Review

This PR combines 4 separate PRs (#4120, #4121, #4119, #4126) addressing various improvements across the codebase. Here's my feedback:


Overall Assessment

The changes are well-structured and address specific issues. The code follows the repository's conventions and patterns. However, there are a few areas that need attention.


🔍 Detailed Feedback by Component

1. Frontend: Archive/Delete Functionality (#4126)

Good:

  • Proper confirmation dialogs with user input validation
  • Consistent UI patterns with existing codebase
  • PostHog analytics tracking for deletions
  • Query invalidation after mutations

Issues:

  • Duplicate CSS classes in settings.tsx: Line 62 has pb-4 pb-8 (duplicate padding-bottom)
    • Should be: pb-8 px-6 max-w-5xl mx-auto my-8 border-t @6xl:border @6xl:rounded-lg
  • Minor: Navigation after deletion could handle edge cases better (what if navigation fails?)

Suggestions:

  • Consider adding optimistic updates to improve UX
  • Add error boundaries around the delete operations
  • The danger zone description could be more specific about what "stability" means

2. RivetKit: Traces Package Refactoring (#4119, #4120)

Good:

  • Clean separation of concerns with dedicated entry points
  • Browser-safe exports that prevent server-only code in client bundles
  • Proper error messages for browser-incompatible functions
  • Updated imports across the codebase consistently

Issues:

  • Package.json exports: The new entry points (./encoding, ./otlp) look correct, but the build script in package.json line 54 should be verified:
    "build": "pnpm run compile:bare && tsup src/index.ts src/index.browser.ts src/encoding.ts src/otlp-entry.ts"
    • Ensure this generates all necessary output files correctly

Suggestions:

  • Consider adding JSDoc comments to the browser stub explaining why it throws
  • The index.browser.ts stub could export types to make it more useful for type checking

3. RivetKit: Zod v4 Migration (#4121)

Good:

  • Consistent migration pattern across all files
  • All imports changed from zod to zod/v4

Issues:

  • Inconsistent import style: Some files use import { z } from "zod/v4", others use import z from "zod/v4"
    • Examples: client/config.ts (line 1) uses default import, while actor/config.ts uses named export
    • This could cause issues - verify which is the correct pattern for zod v4

Critical:

  • Downgraded packages without explanation: The PR description mentions downgrading @codemirror/commands and TypeScript. These changes aren't shown in the diff but mentioned in the description. If these are in pnpm-lock.yaml:
    • Why were they downgraded?
    • Are there breaking changes in the newer versions?
    • This needs documentation or a separate commit explaining the rationale

4. Frontend: Type Updates & Refactoring

Good:

  • actor-builds-list.tsx: Nice refactoring to extract getActorIcon function - improves readability
  • Removed unnecessary useMemo wrapper which wasn't providing value
  • Type updates for MetricName are consistent across all files

Minor:

  • The extracted getActorIcon function is not memoized anymore. Given it's called in a map, this might cause unnecessary re-renders if the component re-renders frequently. Consider wrapping the function with useCallback or making it a module-level function (outside the component).

5. Examples & Documentation

Good:

  • Added queue-sandbox and workflow-sandbox examples to the registry
  • README updates use consistent formatting
  • Added dom.iterable to tsconfig for better type support

Issues:

  • READMEs changed from pnpm to npm: Lines in queue-sandbox/README.md and queue-sandbox-vercel/README.md now show npm install instead of pnpm install
    • This contradicts CLAUDE.md which states "Use pnpm for all npm-related commands"
    • Should be: pnpm install and pnpm dev

🔒 Security Considerations

  • Archive operations look secure with proper confirmation
  • No SQL injection risks (using parameterized queries through the API client)
  • PostHog tracking doesn't expose sensitive data
  • ✅ No major security concerns

Performance Considerations

  • Query invalidation after mutations might be broad (queryClient.invalidateQueries() without filters) - could cause unnecessary refetches
  • Consider using more specific query key invalidation:
    queryClient.invalidateQueries({ queryKey: ['projects', organization] })

🧪 Testing

Missing:

  • No tests added for the new archive functionality
  • No tests for the traces package refactoring
  • Should add:
    • Unit tests for confirmation dialog validation
    • Integration tests for archive mutations
    • Tests for browser/server entry point resolution

📝 Action Items

Must Fix:

  1. Fix duplicate pb-4 pb-8 CSS classes in projects./settings.tsx:62
  2. Fix README files to use pnpm instead of npm (per CLAUDE.md)
  3. Clarify and document the Zod import pattern (default vs named export)
  4. Document why CodeMirror and TypeScript were downgraded

Should Fix:

  1. Make query invalidation more specific (use query keys)
  2. Add tests for new archive functionality
  3. Consider memoization for getActorIcon or move to module scope

Nice to Have:

  1. Add JSDoc to browser stubs
  2. Add error boundaries around delete operations
  3. Export types from index.browser.ts

📊 Summary

Category Status
Code Quality ⚠️ Good with minor issues
Security ✅ No concerns
Performance ⚠️ Query invalidation could be optimized
Testing ❌ Missing tests
Documentation ⚠️ Needs clarification on downgrades

Recommendation: Fix the critical issues (CSS duplication, README npm→pnpm, Zod imports) before merging. Consider adding tests in a follow-up PR if time is constrained.

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