Skip to content

Fix TXID parsing for CLI arguments to use ltx.ParseTXID #673

@corylanou

Description

@corylanou

Description

All places that accept TXID as CLI arguments need to be updated to use the ltx.ParseTXID function to ensure consistent TXID format handling across all commands.

Current State

It's unclear if all CLI commands that accept TXID arguments are properly parsing them using the standard parsing function.

Required Changes

  1. Audit all CLI commands that accept TXID as input
  2. Ensure they use ltx.ParseTXID for parsing
  3. Add validation for invalid TXID formats
  4. Ensure consistent error messages for invalid TXIDs

Affected Areas

Commands that likely accept TXID arguments:

  • Restore commands with point-in-time recovery
  • Any commands that filter by transaction range
  • Debug or inspection commands

Example Implementation

// Correct parsing
txid, err := ltx.ParseTXID(txidStr)
if err \!= nil {
    return fmt.Errorf("invalid TXID format: %w", err)
}

Benefits

  • Consistent TXID format validation
  • Better error messages for users
  • Prevents issues with malformed transaction IDs

Additional Context

This was requested by Ben Johnson to ensure consistent handling of TXID formats throughout the CLI.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions