Skip to content

Conversation

@MasterPtato
Copy link
Contributor

No description provided.

Copy link
Contributor Author

MasterPtato commented Jan 12, 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.

@claude
Copy link

claude bot commented Jan 12, 2026

Code Review - PR #3846: chore: clean up errors

Summary

This PR cleans up the error handling structure by:

  1. Removing unused guard error artifacts (actor_destroyed and actor_not_found)
  2. Moving the Datacenter error from api-public to api-util for better code organization
  3. Updating test errors to use the test group instead of domain-specific groups
  4. Improving error handling patterns in test code

✅ Positive Changes

1. Better Code Organization

  • Moving Datacenter::NotFound from api-public/src/errors.rs to api-util/src/errors.rs improves modularity since it's used by multiple packages
  • Making errors module public in api-util allows proper access from api-public

2. Cleanup of Unused Errors

  • Removing guard.actor_destroyed.json and guard.actor_not_found.json artifacts is appropriate - these errors are handled by pegboard::errors::Actor::NotFound (line 8-9 in engine/packages/pegboard/src/errors.rs)
  • The guard proxy service still references these error codes in status code mapping (lines 2530-2531 in proxy_service.rs), but this appears to be for handling errors that might come from pegboard

3. Test Improvements

  • Renaming test error groups from domain-specific (api, namespace) to test makes it clearer these are test fixtures
  • The streaming_response.rs changes improve code clarity:
    • Using early return instead of assigning to Ok() makes control flow more explicit
    • Replacing bail!("bad path") with Err(anyhow::anyhow!("bad path")) is more explicit and follows the pattern from CLAUDE.md (avoiding glob imports from anyhow)

🔍 Observations

1. Error Artifact Files
The error artifacts in engine/artifacts/errors/ are auto-generated from the #[derive(RivetError)] macros. The test error artifacts were properly renamed:

  • api.rate_limited.jsontest.api_rate_limited.json
  • namespace.invalid_name.jsontest.namespace_invalid_name.json

2. Consistent Error Handling Pattern
The changes follow the established pattern in CLAUDE.md:

  • Using #[derive(RivetError)] with proper group/code structure
  • Returning anyhow errors from failable functions
  • Not glob-importing from anyhow

📋 Minor Suggestions

1. Consider Removing Dead Code
The proxy_service.rs still has status code mappings for the deleted errors:

("guard", "actor_not_found") => StatusCode::NOT_FOUND,
("guard", "actor_destroyed") => StatusCode::NOT_FOUND,

If these errors are truly unused, consider removing these mappings as well. However, if they're still possible from pegboard or other services, keeping them for defensive error handling is fine.

2. Error Message Clarity
In streaming_response.rs:256, the error message "bad path" could be more descriptive for debugging purposes:

Err(anyhow::anyhow!("bad path: {}", path))

✅ Code Quality Assessment

  • Best Practices: ✅ Follows Rust and project conventions
  • Potential Bugs: ✅ None identified
  • Performance: ✅ No performance impact
  • Security: ✅ No security concerns
  • Test Coverage: ✅ Tests updated appropriately

Conclusion

This is a clean refactoring PR that improves code organization and removes technical debt. The changes are low-risk and follow established patterns. The migration of Datacenter errors to api-util is a sensible consolidation.

Recommendation: ✅ Approve

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 12, 2026

More templates

@rivetkit/cloudflare-workers

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

@rivetkit/db

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

@rivetkit/framework-base

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

@rivetkit/next-js

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

@rivetkit/react

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

rivetkit

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

@rivetkit/sql-loader

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

@rivetkit/virtual-websocket

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

@rivetkit/engine-runner

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

@rivetkit/engine-runner-protocol

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

commit: 81663b7

@MasterPtato MasterPtato force-pushed the 01-12-chore_clean_up_errors branch from 66f6892 to 485634a Compare January 13, 2026 00:27
@MasterPtato MasterPtato force-pushed the 01-12-fix_pb_have_restart_policy_actors_sleep_after_pending_for_too_long branch 2 times, most recently from 363b7a5 to 3f06e1b Compare January 13, 2026 00:44
@MasterPtato MasterPtato force-pushed the 01-12-chore_clean_up_errors branch from 485634a to 964ae0f Compare January 13, 2026 00:44
@MasterPtato MasterPtato force-pushed the 01-12-fix_pb_have_restart_policy_actors_sleep_after_pending_for_too_long branch from 3f06e1b to 8cd75d7 Compare January 13, 2026 01:01
@MasterPtato MasterPtato force-pushed the 01-12-chore_clean_up_errors branch from 964ae0f to f3c17ef Compare January 13, 2026 01:02
@MasterPtato MasterPtato force-pushed the 01-12-fix_pb_have_restart_policy_actors_sleep_after_pending_for_too_long branch from 8cd75d7 to 75ce8e5 Compare January 13, 2026 01:29
@MasterPtato MasterPtato force-pushed the 01-12-chore_clean_up_errors branch from f3c17ef to b5999a3 Compare January 13, 2026 01:29
@MasterPtato MasterPtato force-pushed the 01-12-fix_pb_have_restart_policy_actors_sleep_after_pending_for_too_long branch from 75ce8e5 to 50ba096 Compare January 14, 2026 02:05
@MasterPtato MasterPtato force-pushed the 01-12-chore_clean_up_errors branch 2 times, most recently from 27fc351 to 77119ca Compare January 14, 2026 02:53
@MasterPtato MasterPtato force-pushed the 01-12-fix_pb_have_restart_policy_actors_sleep_after_pending_for_too_long branch from 50ba096 to b9a9c50 Compare January 14, 2026 03:06
@MasterPtato MasterPtato force-pushed the 01-12-chore_clean_up_errors branch from 77119ca to 1fe301c Compare January 14, 2026 03:06
@MasterPtato MasterPtato force-pushed the 01-12-fix_pb_have_restart_policy_actors_sleep_after_pending_for_too_long branch from b9a9c50 to 9a4ab5a Compare January 14, 2026 19:47
@MasterPtato MasterPtato force-pushed the 01-12-chore_clean_up_errors branch 2 times, most recently from 830c32d to dfbb13a Compare January 14, 2026 20:01
@MasterPtato MasterPtato force-pushed the 01-12-fix_pb_have_restart_policy_actors_sleep_after_pending_for_too_long branch from 9a4ab5a to 33e8961 Compare January 14, 2026 20:01
@MasterPtato MasterPtato force-pushed the 01-12-fix_pb_have_restart_policy_actors_sleep_after_pending_for_too_long branch from 33e8961 to 633544a Compare January 14, 2026 22:52
@MasterPtato MasterPtato force-pushed the 01-12-chore_clean_up_errors branch from dfbb13a to 81663b7 Compare January 14, 2026 22:52
@MasterPtato MasterPtato force-pushed the 01-12-fix_pb_have_restart_policy_actors_sleep_after_pending_for_too_long branch from 633544a to e073155 Compare January 14, 2026 23:02
@MasterPtato MasterPtato force-pushed the 01-12-chore_clean_up_errors branch from 81663b7 to 260900c Compare January 14, 2026 23:02
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.

3 participants