Skip to content

feat(rivetkit): add database stress testing methods to driver test suite#4279

Merged
NathanFlurry merged 1 commit intomainfrom
feat_rivetkit_add_database_stress_testing_methods_to_driver_test_suite
Feb 24, 2026
Merged

feat(rivetkit): add database stress testing methods to driver test suite#4279
NathanFlurry merged 1 commit intomainfrom
feat_rivetkit_add_database_stress_testing_methods_to_driver_test_suite

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

@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4279 February 24, 2026 05:22 Destroyed
@railway-app
Copy link

railway-app bot commented Feb 24, 2026

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

Service Status Web Updated (UTC)
ladle ❌ Build Failed (View Logs) Web Feb 24, 2026 at 5:49 am
frontend-inspector 🕒 Building (View Logs) Web Feb 24, 2026 at 5:49 am
frontend-cloud 🕒 Building (View Logs) Web Feb 24, 2026 at 5:49 am
website 🕒 Building (View Logs) Web Feb 24, 2026 at 5:49 am
mcp-hub ✅ Success (View Logs) Web Feb 24, 2026 at 5:23 am

Copy link
Member Author


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 Feb 24, 2026

PR Review: feat(rivetkit): add database stress testing methods to driver test suite

This PR adds useful database stress testing fixtures and tests to the driver test suite, covering shrink/regrow workloads, hot row updates, and integrity checks after mixed workloads. The cleanup of redundant Vercel examples is also welcome. A few issues worth addressing:


Medium: Code Duplication Between Fixture Files

The four helper functions (firstRowValue, toSafeInteger, normalizeRowIds, makePayload) and all six new actor methods (insertPayloadRows, roundRobinUpdateValues, getPageCount, vacuum, integrityCheck, runMixedWorkload) are duplicated verbatim between actor-db-drizzle.ts and actor-db-raw.ts. These are identical across both files. Shared helpers should live in a shared module (e.g., fixtures/driver-test-suite/db-stress-helpers.ts) and be imported by both fixture files. Maintaining duplicate logic is a maintenance hazard.


Minor: Weak Assertion in Shrink-Regrow Test

The assertion expect(grownPages).toBeGreaterThanOrEqual(baselinePages) allows grownPages === baselinePages, meaning the test could pass even if no pages were actually allocated. If inserting SHRINK_GROW_INITIAL_ROWS rows with a 4096-byte payload does not trigger page growth, the rest of the test becomes trivially true. Consider using toBeGreaterThan to confirm actual growth, or add a comment explaining why equal counts are valid.


Minor: insertPayloadRows Does Not Use Transactions

The existing insertMany action uses a single bulk INSERT INTO ... VALUES (v1), (v2), ... for efficiency. insertPayloadRows inserts rows one-by-one in a loop with separate awaited calls, resulting in one write transaction per row. For a stress testing fixture this is fine if the goal is to test sequential write overhead, but wrapping the loop in a single BEGIN/COMMIT transaction would be more realistic for bulk-insert scenarios (especially the 16-row seed in the shrink-regrow test).


Minor: integrityCheck Only Returns First Row

PRAGMA integrity_check returns one row per error if the database is corrupt. The current implementation returns only firstRowValue(rows[0]). For the test use case (expect(...).toBe("ok")), this is sufficient, but if the check fails callers only see the first error. Consider returning all rows joined as a string, or documenting the limitation.


Minor: Committed Compiled JS Files

examples/sqlite-raw/src/registry.js and examples/sqlite-raw/src/server.js appear to be compiled JavaScript files added to the repo. Committing build artifacts for a TypeScript project is unusual and can cause drift from source. Are these intentional (e.g., for an environment that cannot run TypeScript directly)?


Minor: Hot-Row Test Only Validates Format, Not Final State

The assertion expect(row.value).toMatch(/^v-\d+$/) verifies the format of updated values but not the expected final value for each row. With HOT_ROW_UPDATES round-robin updates across HOT_ROW_COUNT rows, the last update for each row is deterministic. Testing the concrete final value would give stronger correctness guarantees. That said, this is acceptable as a smoke test.


Positive Notes

  • Input normalization (normalizeRowIds, toSafeInteger, etc.) is thorough and defensive.
  • Test isolation via crypto.randomUUID() actor names prevents cross-test interference.
  • CHUNK_BOUNDARY_SIZES constant is a clean improvement over the previous hardcoded [CHUNK_SIZE - 1, CHUNK_SIZE, CHUNK_SIZE + 1], extending coverage up to 4x chunk size.
  • The new tests exercise meaningful real-world scenarios: storage reclamation after vacuum, write-heavy hot rows, and integrity after sleep/wake cycles.

@NathanFlurry NathanFlurry force-pushed the feat_rivetkit_add_database_stress_testing_methods_to_driver_test_suite branch from bb52f68 to 211539c Compare February 24, 2026 05:48
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4279 February 24, 2026 05:48 Destroyed
@NathanFlurry NathanFlurry merged commit 37c2207 into main Feb 24, 2026
8 of 23 checks passed
@NathanFlurry NathanFlurry deleted the feat_rivetkit_add_database_stress_testing_methods_to_driver_test_suite branch February 24, 2026 05:49
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