Skip to content

fix(ups): formalize subjects#4334

Draft
MasterPtato wants to merge 1 commit into02-27-chore_bump_rivetkit_protocol_versionfrom
fix-ups-formalize-subjects
Draft

fix(ups): formalize subjects#4334
MasterPtato wants to merge 1 commit into02-27-chore_bump_rivetkit_protocol_versionfrom
fix-ups-formalize-subjects

Conversation

@MasterPtato
Copy link
Contributor

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

@MasterPtato
Copy link
Contributor Author

MasterPtato commented Mar 2, 2026

@railway-app
Copy link

railway-app bot commented Mar 2, 2026

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

Service Status Web Updated (UTC)
website 😴 Sleeping (View Logs) Web Mar 2, 2026 at 8:52 pm
frontend-inspector 😴 Sleeping (View Logs) Web Mar 2, 2026 at 8:51 pm
frontend-cloud ❌ Build Failed (View Logs) Web Mar 2, 2026 at 8:42 pm
mcp-hub ✅ Success (View Logs) Web Mar 2, 2026 at 8:39 pm
ladle ❌ Build Failed (View Logs) Web Mar 2, 2026 at 8:38 pm

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 2, 2026

More templates

@rivetkit/cloudflare-workers

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

@rivetkit/framework-base

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

@rivetkit/next-js

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

@rivetkit/react

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

rivetkit

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

@rivetkit/sql-loader

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

@rivetkit/sqlite-vfs

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sqlite-vfs@4334

@rivetkit/traces

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

@rivetkit/workflow-engine

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

@rivetkit/virtual-websocket

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

@rivetkit/engine-runner

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

@rivetkit/engine-runner-protocol

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

commit: f076166

@claude
Copy link

claude bot commented Mar 2, 2026

PR Review: fix(ups): formalize subjects

Overall this is a clean, well-scoped refactor. The Subject trait is a natural improvement over passing raw &strs everywhere, and the MsgSubject struct is a nice way to defer string formatting while keeping type safety.


Issues

1. root() is unused dead code

subject.rs:5

The comment says "Used for metrics" but nothing calls it anywhere in the codebase. As an associated function (not &self), it also cannot be used with trait objects (dyn Subject). Either wire it up to the metrics code or remove it until it is actually needed.

2. subject_cow is computed unconditionally but only used in the local path

pubsub.rs:165

For MsgSubject on the non-local path, this means two separate String allocations per publish: one from subject_cow (unused in that branch) and one inside publish_with_backoff. The subject_cow computation could be deferred into the if use_local branch, or publish_with_backoff could accept a Cow<str> directly to share it.

3. Missing impl Subject for String

There are implementations for &str and &String but not for owned String. Callers with owned subjects must borrow at the call site (&my_string), which may not be obvious. This matters since M::subject() returns String, not &str. If Subject is intended as a general-purpose API, String should be covered too.

4. subscribe_opt still uses a manual format string

message.rs:201

The publish path uses the new typed MsgSubject, but subscribe still constructs a raw string via format!. Functionally equivalent, but the inconsistency is confusing. If MsgSubject is the canonical way to express this subject, subscribe should use it too (or at minimum share a helper).

5. Unrelated file in PR

.claude/skills/git-spice-merge-my-stack/SKILL.md has nothing to do with UPS subject formalization and should be in a separate commit.


Minor Notes

  • The error handling improvement in message() -- propagating spawn failures as WorkflowError::PublishMessage instead of silently logging -- is a genuine improvement, though spawn only fails on runtime shutdown so the practical impact is minimal.
  • MsgSubject::root() calls M::subject() which allocates a String each time. If this is ever wired to metrics on a hot path, the allocation will add up.
  • Copy could be derived for MsgSubject since it contains only &str and PhantomData, avoiding the need for explicit Clone in the publish loop.

@MasterPtato MasterPtato force-pushed the 02-27-chore_bump_rivetkit_protocol_version branch from d6bbde2 to cedca7a Compare March 3, 2026 00:06
@MasterPtato MasterPtato force-pushed the fix-ups-formalize-subjects branch from 9501411 to c8e5674 Compare March 3, 2026 00:06
@MasterPtato MasterPtato requested a review from NathanFlurry March 3, 2026 00:06
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