Skip to content

Conversation

@NathanFlurry
Copy link
Member

No description provided.

Copy link
Member Author

NathanFlurry commented Jan 14, 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.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 14, 2026

More templates

@rivetkit/cloudflare-workers

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

@rivetkit/db

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

@rivetkit/framework-base

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

@rivetkit/next-js

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

@rivetkit/react

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

rivetkit

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

@rivetkit/sql-loader

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

@rivetkit/virtual-websocket

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

@rivetkit/engine-runner

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

@rivetkit/engine-runner-protocol

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

commit: 8c5aaf8

@claude
Copy link

claude bot commented Jan 14, 2026

Pull Request Review: Auto-generate docs for engine config and registry config

This PR introduces automated JSON schema generation for engine configuration and RivetKit configuration, significantly improving documentation maintainability. Overall, the implementation is well-structured and follows good practices.

✅ Strengths

  1. Strong type safety: Uses Rust's schemars and TypeScript's Zod to generate schemas from actual type definitions
  2. Build-time generation: Schemas are generated during the build process, ensuring they stay in sync with code
  3. Good separation of concerns: Separates runtime schemas from documentation schemas (e.g., ActorConfigSchema vs DocActorConfigSchema)
  4. Consistent patterns: Uses similar approaches for both Rust and TypeScript schema generation
  5. Comprehensive documentation: New MDX files provide good coverage of configuration options

🔍 Code Quality Issues

Critical Issues

1. Error handling in config-schema-gen/build.rs (Lines 7-18, 24-25)
Multiple .unwrap() calls that could panic at build time:

let workspace_root = std::env::var("CARGO_MANIFEST_DIR")
    .map(|dir| {
        Path::new(&dir)
            .parent()
            .unwrap()  // Could panic
            .parent()
            .unwrap()  // Could panic
            .parent()
            .unwrap()  // Could panic
            .to_path_buf()
    })
    .unwrap();  // Could panic

Recommendation: Use proper error handling with expect() and descriptive messages:

let workspace_root = std::env::var("CARGO_MANIFEST_DIR")
    .expect("CARGO_MANIFEST_DIR must be set")
    .map(|dir| {
        Path::new(&dir)
            .parent()
            .expect("Failed to get parent of packages")
            .parent()
            .expect("Failed to get parent of engine")
            .parent()
            .expect("Failed to get workspace root")
            .to_path_buf()
    });

Medium Priority Issues

2. Typo in actor config description (rivetkit-typescript/packages/rivetkit/src/actor/config.ts:101)
Line 101 has .prefault(() => ({})) - should this be .default(() => ({}))? The method name "prefault" appears to be a typo.

3. Missing file in workspace members
The new package rivet-config-schema-gen is created but not added to the workspace members list in the root Cargo.toml. This might cause build issues or prevent the schema from being regenerated.

Recommendation: Add to Cargo.toml:

members = [
  # ... existing members ...
  "engine/packages/config-schema-gen",
]

4. Hardcoded path traversal (config-schema-gen/build.rs)
The build script uses hardcoded .parent().parent().parent() which is fragile and assumes a specific directory structure. If the package is moved, this will break.

Recommendation: Consider using a more robust approach, perhaps by setting an environment variable or using a workspace-level configuration.

Low Priority Issues

5. Inconsistent naming convention

  • Package renamed from rivet-dump-openapi to rivet-api-public-openapi-gen
  • New package named rivet-config-schema-gen
  • Consider consistency: either use -gen suffix for all generation packages or use a different pattern

6. Empty lib.rs file (config-schema-gen/src/lib.rs)
The file only contains a comment explaining it exists to trigger build.rs. Consider adding a more descriptive module-level doc comment:

//\! JSON schema generation for Rivet engine configuration.
//\!
//\! This crate generates a JSON Schema file at build time from the
//\! engine's configuration types defined in rivet-config.
//\! The generated schema is written to `engine/artifacts/config-schema.json`.

7. TypeScript any types (schema-utils.ts:9, actor/config.ts:193)

  • Line 9: export function toJsonSchema(schema: z.ZodType): any
  • Line 193: createVars: (c: CreateVarsContext<TState, TInput, TDatabase>, driverCtx: any) => ...

These could use more specific types or at least document why any is necessary.

🔒 Security Considerations

No security issues identified. The schema generation happens at build time and doesn't involve user input or runtime execution.

⚡ Performance Considerations

Build-time overhead: Schema generation adds build time, but this is acceptable since:

  • Schemas only regenerate when source files change (Turbo.build caching)
  • Trade-off for better documentation is worthwhile

Runtime impact: None - schemas are static files loaded at build/startup time.

🧪 Test Coverage

Missing test coverage for:

  1. Schema generation scripts (both Rust and TypeScript)
  2. Generated schemas validation
  3. Documentation components rendering the schemas

Recommendation: Add tests to verify:

  • Generated schemas match expected structure
  • All required configuration fields are documented
  • Schema generation doesn't fail with missing dependencies

📝 Documentation Quality

Excellent improvements:

  • New environment variables documentation is comprehensive
  • Actor and registry configuration schemas are auto-generated
  • Good use of existing JsonSchemaPreview component

Minor suggestions:

  1. Add a comment in generated JSON files indicating they are auto-generated and shouldn't be edited manually
  2. Consider adding examples to the environment variables documentation
  3. The RIVET_ENGINE variable is listed as "Alternative to RIVET_ENDPOINT" but could clarify when to use which

🎯 Summary

This is a well-designed PR that adds valuable auto-documentation infrastructure. The main concerns are:

  1. Critical: Fix error handling in build.rs to prevent potential build failures
  2. Important: Add config-schema-gen to workspace members
  3. Minor: Fix the .prefault() typo
  4. Enhancement: Improve type safety in TypeScript code

Once the critical and important issues are addressed, this PR will be ready to merge.

Estimated Risk: Low-Medium (mostly build configuration changes)
Recommendation: Request changes for items 1-3, then approve.

@NathanFlurry NathanFlurry force-pushed the 01-14-doc_auto-generate_docs_for_engine_config_and_registry_config branch from c8807c1 to 8c5aaf8 Compare January 15, 2026 03:22
@NathanFlurry NathanFlurry force-pushed the 01-14-doc_document_version_upgrades branch from 9800079 to 82ade5d Compare January 15, 2026 03:22
@NathanFlurry NathanFlurry force-pushed the 01-14-doc_auto-generate_docs_for_engine_config_and_registry_config branch from 8c5aaf8 to fe63ee7 Compare January 15, 2026 05:08
@NathanFlurry NathanFlurry marked this pull request as ready for review January 15, 2026 05:08
@graphite-app
Copy link
Contributor

graphite-app bot commented Jan 15, 2026

Merge activity

  • Jan 15, 5:08 AM UTC: NathanFlurry added this pull request to the Graphite merge queue.
  • Jan 15, 5:08 AM UTC: CI is running for this pull request on a draft pull request (#3915) due to your merge queue CI optimization settings.
  • Jan 15, 5:09 AM UTC: Merged by the Graphite merge queue via draft PR: #3915.

@graphite-app graphite-app bot closed this Jan 15, 2026
@graphite-app graphite-app bot deleted the 01-14-doc_auto-generate_docs_for_engine_config_and_registry_config branch January 15, 2026 05:09
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.

2 participants