Skip to content

Comments

fix(rivetkit): repair setupDatabase merge after restack#4243

Closed
NathanFlurry wants to merge 1 commit intographite-base/4243from
02-19-fix_rivetkit_repair_setupdatabase_merge_after_restack
Closed

fix(rivetkit): repair setupDatabase merge after restack#4243
NathanFlurry wants to merge 1 commit intographite-base/4243from
02-19-fix_rivetkit_repair_setupdatabase_merge_after_restack

Conversation

@NathanFlurry
Copy link
Member

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

@NathanFlurry NathanFlurry mentioned this pull request Feb 19, 2026
11 tasks
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4243 February 19, 2026 23:05 Destroyed
@railway-app
Copy link

railway-app bot commented Feb 19, 2026

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

Service Status Web Updated (UTC)
website 😴 Sleeping (View Logs) Web Feb 19, 2026 at 11:16 pm
mcp-hub ✅ Success (View Logs) Web Feb 19, 2026 at 11:06 pm
frontend-cloud ❌ Build Failed (View Logs) Web Feb 19, 2026 at 11:06 pm
frontend-inspector ❌ Build Failed (View Logs) Web Feb 19, 2026 at 11:06 pm
ladle ❌ Build Failed (View Logs) Web Feb 19, 2026 at 11:06 pm

Copy link
Member Author

NathanFlurry commented Feb 19, 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.

@NathanFlurry NathanFlurry changed the base branch from 02-12-chore_skill_evals_cookbooks to graphite-base/4243 February 19, 2026 23:06
@NathanFlurry NathanFlurry force-pushed the 02-19-fix_rivetkit_repair_setupdatabase_merge_after_restack branch from a6c938a to b0dcd83 Compare February 19, 2026 23:06
@claude
Copy link

claude bot commented Feb 19, 2026

PR Review: fix(rivetkit): repair setupDatabase merge after restack

This PR fixes a malformed #setupDatabase method in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts that resulted from a bad restack/merge.

What was broken in the original

The original code had several structural defects from the merge conflict:

  1. Misplaced assignment: this.#db = client; had inconsistent indentation, making it unclear whether it was inside the try block or outside it.
  2. Broken catch block: The const wrappedError = new Error(...) line appeared outside the catch block's scope, which would cause a runtime ReferenceError for error if a non-Error exception was thrown (since error is only in scope inside the catch block).
  3. Mismatched closing braces: The overall nesting of try/catch inside if was structurally invalid.

The fix

The new code is correct and clean:

  • Early return guard clause is a readable pattern and reduces nesting. No functional difference from the original intent.
  • this.#db = client; is correctly placed after migration completes inside the try block.
  • Both error branches (Error instance and non-Error) are correctly scoped inside the catch block with proper logging and re-throwing.

Minor observation

The if (error instanceof Error) { ... throw error; } branch does not fall through to the wrappedError path, which is correct. The const wrappedError block is only reached for non-Error thrown values. This logic is sound.

Verdict

This is a straightforward correctness fix for a merge artifact. The refactored code is functionally equivalent to the intended pre-restack logic and is more readable. No concerns.

@claude
Copy link

claude bot commented Feb 19, 2026

PR Review: fix(rivetkit): repair setupDatabase merge after restack

Summary: This PR fixes broken indentation and structure in #setupDatabase resulting from a bad restack/merge. The change is a refactor only — the logic is semantically identical to the intended behavior.


Code Quality

The refactor is clean and correct:

Early return pattern — replacing the outer if ("db" in this.#config && this.#config.db) wrapper with an early return is a good improvement. It reduces nesting and makes the happy path easier to follow.

De Morgan's law check — the guard inversion is correct:

  • Before: if ("db" in this.#config && this.#config.db)
  • After: if (\!("db" in this.#config) || \!this.#config.db) return;

These are logically equivalent. ✓

Catch block logic — the two-path error handler (rethrow Error instances directly, wrap non-Error objects) is preserved correctly and now has consistent indentation.


Minor Observations

  1. this.#db assignment placement — In the original broken code, this.#db = client had inconsistent indentation that made it ambiguous whether it was inside the try block. The new code makes this explicit and unambiguous. Worth confirming this was the intended placement (it appears correct given the if (\!this.#db) guard at the call site).

  2. Error path duplication — The non-Error branch creates wrappedError before calling this.#rLog.error, which is fine. One stylistic nit: the instanceof Error branch logs before rethrowing, while the non-Error branch logs after wrapping but before throwing — this ordering asymmetry is harmless but slightly inconsistent. Not worth changing for this fix.

  3. No test coverage — The PR doesn't include tests for the error paths in #setupDatabase. This isn't a blocker for a formatting fix, but coverage for the non-Error catch path would be useful if it doesn't already exist.


Verdict

The fix correctly repairs the malformed structure from the merge. No logical changes, no new issues introduced. LGTM once out of draft.

@NathanFlurry NathanFlurry marked this pull request as ready for review February 19, 2026 23:17
@graphite-app
Copy link
Contributor

graphite-app bot commented Feb 19, 2026

Merge activity

  • Feb 19, 11:17 PM UTC: NathanFlurry added this pull request to the Graphite merge queue.
  • Feb 19, 11:18 PM UTC: CI is running for this pull request on a draft pull request (#4244) due to your merge queue CI optimization settings.
  • Feb 19, 11:19 PM UTC: Merged by the Graphite merge queue via draft PR: #4244.

graphite-app bot pushed a commit that referenced this pull request Feb 19, 2026
# 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
@graphite-app graphite-app bot closed this Feb 19, 2026
@graphite-app graphite-app bot deleted the 02-19-fix_rivetkit_repair_setupdatabase_merge_after_restack branch February 19, 2026 23:19
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