Skip to content

fix(traces): separate entrypoints#4119

Closed
jog1t wants to merge 1 commit into02-05-refactor_rivetkit_migrate_granularly_to_zod_v4from
02-04-fix_traces_separate_entrypoints
Closed

fix(traces): separate entrypoints#4119
jog1t wants to merge 1 commit into02-05-refactor_rivetkit_migrate_granularly_to_zod_v4from
02-04-fix_traces_separate_entrypoints

Conversation

@jog1t
Copy link
Contributor

@jog1t jog1t commented Feb 4, 2026

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)
  • 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:

  • 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 4, 2026

🚅 Deployed to the rivet-pr-4119 environment in rivet-frontend

Service Status Web Updated (UTC)
frontend-inspector ❌ Build Failed (View Logs) Web Feb 5, 2026 at 9:48 pm
frontend-cloud ❌ Build Failed (View Logs) Web Feb 5, 2026 at 9:48 pm
website ❌ Build Failed (View Logs) Web Feb 5, 2026 at 8:38 pm
mcp-hub ✅ Success (View Logs) Web Feb 4, 2026 at 10:12 pm

Copy link
Contributor Author

jog1t commented Feb 4, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@jog1t jog1t marked this pull request as ready for review February 4, 2026 22:12
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 4, 2026

More templates

@rivetkit/cloudflare-workers

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/cloudflare-workers@4119

@rivetkit/db

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/db@4119

@rivetkit/framework-base

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/framework-base@4119

@rivetkit/next-js

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/next-js@4119

@rivetkit/react

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/react@4119

rivetkit

pnpm add https://pkg.pr.new/rivet-dev/rivet/rivetkit@4119

@rivetkit/sql-loader

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sql-loader@4119

@rivetkit/traces

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/traces@4119

@rivetkit/workflow-engine

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/workflow-engine@4119

@rivetkit/virtual-websocket

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/virtual-websocket@4119

@rivetkit/engine-runner

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner@4119

@rivetkit/engine-runner-protocol

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner-protocol@4119

commit: 9c70402

@graphite-app
Copy link
Contributor

graphite-app bot commented Feb 4, 2026

Graphite Automations

"Test" took an action on this PR • (02/04/26)

1 assignee was added to this PR based on Kacper Wojciechowski's automation.

@claude
Copy link

claude bot commented Feb 4, 2026

PR Review: Refactor traces package entry points

Summary

This PR refactors the @rivetkit/traces package to improve module organization by creating dedicated entry points for encoding/decoding and OTLP functionality. The changes migrate from a single reader entry point to two more specific entry points: encoding and otlp.

✅ Positive Aspects

  1. Better Separation of Concerns: Splitting encoding/decoding functions from OTLP conversion logic is a good architectural decision that makes the package's API more intuitive.

  2. Proper Package.json Configuration: The exports field is correctly configured with both ESM and CJS support for all entry points.

  3. Comprehensive Import Updates: All imports across the codebase have been updated consistently (frontend and rivetkit packages).

  4. Build Configuration: The tsconfig path mappings and tsup external dependencies are properly configured.

🔍 Issues & Concerns

1. Missing Backward Compatibility (Breaking Change)

The old @rivetkit/traces/reader entry point has been completely removed without any deprecation path. This is a breaking change that could affect any external consumers of this package.

Impact: Any code importing from @rivetkit/traces/reader will immediately break.

Suggestion: Consider one of these approaches:

  • Add a deprecation path by keeping reader.ts that re-exports from the new entry points with a console warning
  • Document this as a breaking change in the PR description and ensure it's part of a major version bump
  • Add a migration guide in the PR description

2. Inconsistent File Naming Convention

The new entry point files have different naming patterns:

  • encoding.ts (noun/concept)
  • otlp-entry.ts (includes -entry suffix)

Suggestion: For consistency, either:

  • Rename otlp-entry.ts to otlp.ts (but this creates a naming collision with the internal module)
  • Or rename encoding.ts to encoding-entry.ts
  • Or use a exports/ directory pattern: exports/encoding.ts, exports/otlp.ts

The current naming suggests otlp-entry.ts was chosen to avoid collision with the existing otlp.ts internal module, but this creates an inconsistent pattern.

3. Potential Type Export Issues

In encoding.ts (line 7), the ReadRangeWire type is re-exported:

export type { ReadRangeWire };

However, this type is already exported from the main index.ts through types.js. While not technically wrong, this creates multiple import paths for the same type:

  • @rivetkit/traces (via types.js)
  • @rivetkit/traces/encoding

Suggestion: Document the intended usage pattern - should users import types from the main entry point or from subpaths?

4. Missing Documentation

The PR description mentions "I have made corresponding changes to the documentation" is checked, but:

  • No JSDoc comments explain when to use encoding vs otlp entry points
  • No README update explaining the new entry point structure
  • No migration guide for the breaking change

5. Index.ts Still Exports OTLP Types

The main index.ts still exports all OTLP types (lines 18-30), but these are now also available via @rivetkit/traces/otlp. This creates redundant export paths.

Question: Is the intention to:

  • Keep OTLP types in main exports for backward compatibility?
  • Eventually remove them from main exports in a future version?
  • Support both import paths indefinitely?

📋 Minor Issues

  1. Formatting Changes: The PR includes several unrelated formatting changes in actor-traces.tsx (line wrapping, import reordering). While these follow code style guidelines, they make the diff harder to review. Consider separating formatting changes into a separate commit.

  2. Build Script: The build command now includes src/index.browser.ts which wasn't mentioned in the PR description. Is this intentional or was it already being built before?

🧪 Testing

Positive: The existing test suite should catch any breaking changes since it imports from @rivetkit/traces (main entry point), which still works.

Gap: No tests verify the new entry points work correctly. Consider adding:

// Test that new entry points export expected functions
import { encodeReadRangeWire, decodeReadRangeWire } from '@rivetkit/traces/encoding';
import { readRangeWireToOtlp } from '@rivetkit/traces/otlp';

🔒 Security

No security concerns identified.

⚡ Performance

No performance impact. The refactoring is purely organizational.

📝 Recommendations

Must Fix:

  1. Document this as a breaking change and plan for version bump
  2. Fix the inconsistent naming convention (otlp-entry.ts vs encoding.ts)

Should Fix:
3. Add JSDoc comments explaining when to use each entry point
4. Clarify the intended export strategy for OTLP types
5. Add tests that import from the new entry points

Nice to Have:
6. Separate formatting changes into a dedicated commit
7. Add a migration guide for users of @rivetkit/traces/reader

Verdict

The refactoring direction is sound and improves code organization, but the breaking change needs proper handling and the naming inconsistency should be resolved before merging.

@jog1t jog1t force-pushed the 02-04-fix_traces_separate_entrypoints branch from 828baf3 to a316801 Compare February 4, 2026 22:17
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4119 February 4, 2026 22:17 Destroyed
@jog1t jog1t force-pushed the 02-04-fix_traces_separate_entrypoints branch from a316801 to 3d621b9 Compare February 4, 2026 22:57
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4119 February 4, 2026 22:57 Destroyed
@graphite-app graphite-app bot changed the base branch from 02-04-fix_rivetkit_restore_waitfornames_and_fix_queue_type_errors to graphite-base/4119 February 5, 2026 00:38
@graphite-app graphite-app bot force-pushed the graphite-base/4119 branch from 432fcd6 to 7bb6306 Compare February 5, 2026 00:39
@graphite-app graphite-app bot force-pushed the 02-04-fix_traces_separate_entrypoints branch from 3d621b9 to 940cd33 Compare February 5, 2026 00:39
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4119 February 5, 2026 00:39 Destroyed
@graphite-app graphite-app bot changed the base branch from graphite-base/4119 to main February 5, 2026 00:40
@graphite-app graphite-app bot force-pushed the 02-04-fix_traces_separate_entrypoints branch from 940cd33 to 9c70402 Compare February 5, 2026 00:40
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4119 February 5, 2026 00:40 Destroyed
Comment on lines +2 to +12
import type {
OtlpAnyValue,
OtlpExportTraceServiceRequestJson,
OtlpKeyValue,
OtlpSpan,
OtlpSpanEvent,
} from "@rivetkit/traces";
import { readRangeWireToOtlp } from "@rivetkit/traces/otlp";
import { useQuery } from "@tanstack/react-query";
import { format } from "date-fns";
import {
useMemo,
useState,
type ReactElement,
} from "react";
import { type ReactElement, useMemo, useState } from "react";
Copy link
Contributor

Choose a reason for hiding this comment

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

Import ordering violates Biome linter rules. Imports should be grouped and sorted alphabetically. Move the React imports to the top, followed by external libraries, then local imports.

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

const rangeStartMs = isLive
? now - presetMs
: customRange?.from?.getTime() ?? now - presetMs;
: (customRange?.from?.getTime() ?? now - presetMs);
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary parentheses around the conditional expression. Remove the parentheses around 'customRange?.from?.getTime() ?? now - presetMs'.

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@jog1t jog1t changed the base branch from main to graphite-base/4119 February 5, 2026 20:33
@jog1t jog1t force-pushed the 02-04-fix_traces_separate_entrypoints branch from 9c70402 to 0ad0c4d Compare February 5, 2026 20:34
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4119 February 5, 2026 20:34 Destroyed
@jog1t jog1t changed the base branch from graphite-base/4119 to 02-05-refactor_rivetkit_migrate_granularly_to_zod_v4 February 5, 2026 20:34
@jog1t jog1t mentioned this pull request Feb 5, 2026
11 tasks
@jog1t jog1t force-pushed the 02-04-fix_traces_separate_entrypoints branch from 0ad0c4d to df3efc4 Compare February 5, 2026 21:48
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4119 February 5, 2026 21:48 Destroyed
Comment on lines +99 to +101
enabled:
inspector.isInspectorAvailable &&
inspector.features.traces.supported,
Copy link
Contributor

Choose a reason for hiding this comment

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

The 'enabled' property is formatted inconsistently with line breaks. Run 'biome format --write' to ensure consistent formatting.

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

import { type ReactElement, useMemo, useState } from "react";
import type { DateRange } from "../datepicker";
import { RangeDatePicker } from "../datepicker";
import { cn } from "../lib/utils";
Copy link
Contributor

Choose a reason for hiding this comment

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

The 'cn' import was moved from its original position. Move it back to where it was (after the UI component imports) to maintain the expected import ordering.

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@graphite-app
Copy link
Contributor

graphite-app bot commented Feb 5, 2026

Merge activity

  • Feb 5, 10:06 PM UTC: jog1t added this pull request to the Graphite merge queue.
  • Feb 5, 10:06 PM UTC: CI is running for this pull request on a draft pull request (#4129) due to your merge queue CI optimization settings.
  • Feb 5, 10:07 PM UTC: Merged by the Graphite merge queue via draft PR: #4129.

graphite-app bot pushed a commit that referenced this pull request Feb 5, 2026
# 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
@graphite-app graphite-app bot closed this Feb 5, 2026
@graphite-app graphite-app bot deleted the 02-04-fix_traces_separate_entrypoints branch February 5, 2026 22:07
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