Skip to content

Conversation

@GEFNENEN
Copy link

Description of Changes

  • Corrected UUID v4/v7 reducer documentation examples to use valid reducer signatures returning ()/Result<(), E>

API and ABI breaking changes

  • None

Expected complexity level and risk

  • 1 (doc example corrections only)

Testing

  • Not run (docs-only change)
  • Please review documentation formatting and correctness

Copilot AI review requested due to automatic review settings January 12, 2026 07:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates the UUID reducer documentation examples to align with the valid reducer signatures (() or Result<(), E>). The changes ensure the example function signatures match the allowed return types for reducers.

Changes:

  • Updated UUID v4 reducer example to return () instead of Uuid
  • Updated UUID v7 reducer example to return Result<(), Box<dyn std::error::Error>> instead of Result<Uuid, ...>
  • Added Ok(()) return statement to complete the UUID v7 example

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

/// #[reducer]
/// fn generate_uuid_v4(ctx: &ReducerContext) -> Uuid {
/// fn generate_uuid_v4(ctx: &ReducerContext) {
/// let uuid = ctx.new_uuid_v4();
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function new_uuid_v4() returns anyhow::Result<Uuid>, but the Result is not being handled here. Since the reducer signature returns (), you need to either:

  1. Handle the error explicitly (e.g., using .unwrap(), .expect(), or a match statement), or
  2. Change the reducer signature to return Result<(), impl std::fmt::Display> and use the ? operator to propagate the error, similar to the generate_uuid_v7 example below.
Suggested change
/// let uuid = ctx.new_uuid_v4();
/// let uuid = ctx.new_uuid_v4().expect("failed to generate UUID v4");

Copilot uses AI. Check for mistakes.
@CLAassistant
Copy link

CLAassistant commented Jan 12, 2026

CLA assistant check
All committers have signed the CLA.

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