Skip to content

Latest commit

Β 

History

History
573 lines (423 loc) Β· 18.6 KB

File metadata and controls

573 lines (423 loc) Β· 18.6 KB

Command-Line Switch Requirements for dealer3

Implementation Status

Current Version: 0.2.0 (unreleased) Last Updated: 2026-01-01

Quick Status Summary

βœ… Phase 0 (Breaking Changes): COMPLETE βœ… Phase 1 (Essential Compatibility): COMPLETE ⏳ Phase 2 (DealerV2_4 Enhancements): Next ⏳ Phase 3 (Advanced Features): Future

Implemented Switches (12 core + 5 deprecated):

  • βœ… -p/--produce N - Produce N matching deals
  • βœ… -g/--generate N - Generate N total deals
  • βœ… -s/--seed SEED - Random seed
  • βœ… -f/--format FORMAT - Output format
  • βœ… -d/--dealer POS - Dealer position
  • βœ… --vulnerable VULN - Vulnerability (long form only)
  • βœ… -v/--verbose - Verbose output (matches dealer.exe)
  • βœ… -V/--version - Version info (matches dealer.exe)
  • βœ… -q/--quiet - Quiet mode (matches dealer.exe)
  • βœ… -m/--progress - Progress meter (matches dealer.exe)
  • βœ… -C/--CSV FILE - CSV export file (DealerV2_4 feature)
  • βœ… -T/--title TEXT - Title metadata for PBN output (DealerV2_4 feature)
  • βœ… --license - Display license information
  • βœ… --credits - Display credits
  • βœ… -2, -3, -e, -u, -l - Deprecated switches (helpful errors)

Key Achievement: dealer3 is now fully compatible with essential dealer.exe command-line behavior!


Overview

This document defines the requirements and strategy for command-line switch implementation in dealer3, ensuring maximum compatibility with both the original dealer.exe and DealerV2_4 while avoiding conflicts and maintaining clear documentation.


Core Principles

1. Avoid Remapping dealer.exe Switches

Requirement: Do NOT change the meaning of any switch from the original dealer.exe.

Rationale:

  • Users migrating from dealer.exe expect consistent behavior
  • BridgeBase Online (BBO) uses the original dealer.exe library
  • Breaking compatibility creates confusion and migration barriers

Implementation:

  • All dealer.exe switches retain their original meaning
  • If we cannot implement a switch exactly, we do not implement it at all
  • Document any switches we choose not to implement

2. Avoid Remapping DealerV2_4 Switches

Requirement: Do NOT change the meaning of any switch from DealerV2_4 where possible.

Rationale:

  • DealerV2_4 is the de facto modern standard
  • Many users have migrated to DealerV2_4
  • Consistency across implementations benefits the bridge community

Implementation:

  • DealerV2_4 switches retain their meaning when we implement them
  • Exception: The -l switch conflict (dealer.exe vs V2_4) - we will not implement either version to avoid confusion
  • Document which V2_4 features we support

3. Parse and Error on Deprecated Switches

Requirement: Recognize deprecated switches and provide clear error messages.

Rationale:

  • Helps users understand why their scripts don't work
  • Provides migration guidance
  • Better than silent failures or cryptic errors

Implementation: βœ… COMPLETED

Error message format:

Error: Switch '-2' (2-way swapping) is not supported in dealer3.

Reason: Swapping modes are incompatible with predeal functionality,
        which is a core feature of dealer3.

Suggestion: Remove the '-2' switch from your command.
            If you need swapping, use the original dealer.exe.

Deprecated Switches: βœ… ALL IMPLEMENTED

  • βœ… -2 (2-way swapping) - Incompatible with predeal
  • βœ… -3 (3-way swapping) - Incompatible with predeal
  • βœ… -e (exhaust mode) - Never completed, experimental
  • βœ… -u (upper/lowercase toggle) - Cosmetic feature, low priority
  • βœ… -l (library mode) - Conflicting meanings in dealer.exe vs V2_4

4. Maintain Comparison Documentation

Requirement: Keep up-to-date documentation comparing all three implementations.

Files:

  • docs/command_line_comparison.md - Comprehensive three-way comparison
  • docs/dealer_vs_dealer2_switches.md - Categorized comparison (same/different/conflict)
  • docs/command_line_switch_requirements.md - This document

Update Triggers:

  • When implementing a new switch
  • When discovering incompatibilities
  • When receiving user feedback
  • On each major release

5. Maintain Implementation Roadmap

Requirement: Track planned switch implementations in priority order.

File: docs/implementation_roadmap.md

Update Triggers:

  • When starting work on a new switch
  • When completing a switch implementation
  • When re-prioritizing based on user feedback
  • Quarterly review cycles

Breaking Change: Vulnerability Switch Removal

Current Situation (dealer3 0.x)

Problem: We currently use -v for vulnerability, which conflicts with dealer.exe's -v (verbose).

# Current dealer3 (WRONG)
dealer -v none    # Sets vulnerability (conflicts with dealer.exe)

Required Change (dealer3 1.0)

Solution: Remove -v short form for vulnerability, implement standard switches.

# dealer3 1.0 (CORRECT - matches dealer.exe)
dealer -v         # Verbose mode (toggle statistics)
dealer -V         # Version info
dealer --vulnerable none  # Vulnerability (long form only)

Migration Path:

  1. Add deprecation warning in 0.x versions:

    Warning: Switch '-v' for vulnerability is deprecated and will be removed in 1.0.
    Please use '--vulnerable' instead.
    The '-v' switch will mean 'verbose' in 1.0 to match dealer.exe.
    
  2. In version 1.0:

    • -v = verbose (matches dealer.exe)
    • -V = version (matches dealer.exe)
    • --vulnerable = vulnerability (long form only, no conflict)
    • Remove -v short form for vulnerability

Justification:

  • Compatibility with dealer.exe is more important than backward compatibility with our own 0.x versions
  • BBO uses dealer.exe - scripts written for BBO should work with dealer3
  • Long form --vulnerable is clearer and self-documenting
  • This is a pre-1.0 breaking change, acceptable in early development

Implementation Roadmap

Phase 0: Breaking Changes (Version 0.2.0 - Pre-1.0) βœ… COMPLETED

Goal: Fix incompatibilities before 1.0 release

Switch Action Priority Effort Status
-v Change to verbose πŸ”΄ Critical Low βœ… COMPLETED
--vulnerable Add long form only πŸ”΄ Critical Low βœ… COMPLETED
-V Implement version πŸ”΄ Critical Low βœ… COMPLETED
-q Implement quiet mode 🟑 High Low βœ… COMPLETED
-m Progress meter 🟑 High Medium βœ… COMPLETED

Timeline: βœ… Completed 2026-01-01

Deliverables:

  • Add deprecation warnings for -v vulnerability in current version (Breaking change implemented directly)
  • Implement -V version switch
  • Implement -v verbose switch (toggle statistics)
  • Add --vulnerable long form
  • Implement -q quiet mode
  • Implement -m progress meter
  • Implement deprecated switch detection (-2, -3, -e, -u, -l)
  • Update all documentation
  • Update README with migration guide
  • Add CHANGELOG entry documenting breaking changes

Phase 1: Essential dealer.exe Compatibility (Version 1.0) βœ… COMPLETED

Goal: Support all essential dealer.exe switches

Switch Description Priority Effort Status
-p N Produce N hands DONE - βœ… Implemented
-g N Generate N hands DONE - βœ… Implemented
-s N Random seed DONE - βœ… Implemented
-h Help DONE - βœ… Implemented (clap)
-0 No swapping DONE - βœ… Default behavior
-v Verbose DONE - βœ… Implemented (Phase 0)
-V Version DONE - βœ… Implemented (Phase 0)
-q Quiet DONE - βœ… Implemented (Phase 0)
-m Progress meter DONE - βœ… Implemented (Phase 0)

Deprecated (Error on Use): βœ… ALL IMPLEMENTED

  • βœ… -2, -3 (Swapping modes) - Incompatible with predeal
  • βœ… -e (Exhaust mode) - Experimental, never completed
  • βœ… -u (Upper/lowercase) - Cosmetic, low value
  • βœ… -l (Library mode) - Conflicting meanings

Timeline: βœ… Completed 2026-01-01 (ahead of schedule)

Success Criteria: βœ… ALL MET

  • βœ… All essential dealer.exe scripts work unchanged (except deprecated features)
  • βœ… Clear error messages for deprecated switches
  • βœ… 100% test coverage for all switches
  • βœ… Documentation complete

Phase 2: DealerV2_4 Enhancements (Version 1.1+)

Goal: Add high-value DealerV2_4 features

Switch Description Priority Effort Notes
-N/E/S/W CARDS Command-line predeal 🟑 High Medium Convenience feature
-C FILE CSV export 🟒 Medium Medium Analytics support
-T "text" Title metadata 🟒 Medium Low PBN enhancement
-x MODE Exchange mode (swapping) πŸ”΅ Low Medium Conflicts with predeal

Timeline: Post-1.0, based on user demand

Phase 3: Advanced Features (Version 2.0+)

Goal: Advanced analysis and performance features

Switch Description Priority Effort Notes
-M MODE DDS mode πŸ”΅ Low Very High Requires DDS library
-R N Multi-threading πŸ”΅ Low High Performance feature
-Z FILE RP zrd export πŸ”΅ Low Medium Niche format
-L PATH Library source πŸ”΅ Low High Advanced feature
-O POS OPC evaluation πŸ”΅ Low High Advanced analysis
-P N Par vulnerability πŸ”΅ Low High Requires DDS

Timeline: Long-term, 2.0+ release


Special Feature: BBO Compatibility Mode

Requirement: -bbo or --bbo-strict Switch

Purpose: Flag errors if input file contains syntax not supported by the original dealer.exe (as used by BridgeBase Online).

Use Case:

# Test if script will work on BBO before uploading
dealer --bbo-strict myscript.dl

# If incompatibilities found:
Error: BBO compatibility mode detected incompatible features:
  Line 5: 'predeal' keyword not in original dealer.exe (use command-line predeal instead)
  Line 12: 'frequency' action not supported by dealer.exe

Suggestion: Remove these features or use dealer3 without --bbo-strict flag.

Implementation Details:

#[arg(long = "bbo-strict")]
bbo_strict: bool,

Checks Performed:

  • βœ… No predeal keyword (BBO dealer.exe supports predeal)
  • ❌ No DealerV2_4-only functions (tricks, par, opc)
  • ❌ No dealer3-only features (frequency, average)
  • βœ… Only original dealer.exe functions (hcp, shape, controls, etc.)
  • βœ… No DealerV2_4-specific syntax

BBO-Compatible Feature Set:

  • βœ… Basic constraints (hcp, shape, controls, etc.)
  • βœ… Predeal (input file keyword)
  • βœ… Produce/generate modes
  • βœ… All print formats (printall, printew, printpbn, etc.)
  • βœ… Variable assignments
  • ❌ Average/frequency actions (dealer3 extension)
  • ❌ DDS functions (tricks, par) - DealerV2_4 only
  • ❌ OPC evaluation - DealerV2_4 only

Error Message Format:

BBO Strict Mode Violation:
  File: myscript.dl
  Line: 12
  Feature: 'frequency' action
  Reason: Not supported by dealer.exe (BBO's library)

This script will NOT work on BridgeBase Online.

To fix:
  - Remove the 'frequency' action, or
  - Run without --bbo-strict flag for local use only

Priority: 🟒 Medium (Version 1.1)

Effort: Medium (3-4 hours)

Benefit: Helps users validate scripts before uploading to BBO


Documentation Requirements

Per-Switch Documentation

For each implemented switch, maintain:

  1. Help text (auto-generated by clap)

    /// Verbose output, prints statistics at the end of the run
    #[arg(short = 'v', long = "verbose")]
    verbose: bool,
  2. Long-form documentation in README.md

    • What it does
    • Example usage
    • Compatibility notes
  3. Comparison notes

    • How it compares to dealer.exe
    • How it compares to DealerV2_4
    • Any differences in behavior
  4. Migration guidance (if breaking change)

    • What changed
    • Why it changed
    • How to update scripts

Comparison Matrix Updates

Keep docs/dealer_vs_dealer2_switches.md updated with:

  • Same in Both: Switches that work identically
  • dealer.exe Only: Features we won't implement
  • DealerV2_4 Only: Features we may implement
  • Both But Different: Conflicts to avoid

Roadmap Updates

Keep docs/implementation_roadmap.md updated with:

  • Current implementation status
  • Priority ordering
  • Effort estimates
  • Timeline targets
  • Dependencies between features

Testing Requirements

For Each New Switch

  1. Unit tests for argument parsing

    #[test]
    fn test_verbose_flag() {
        let args = Args::parse_from(&["dealer", "-v"]);
        assert!(args.verbose);
    }
  2. Integration tests for functionality

    # Test that -v shows statistics
    echo "hcp(north) >= 15" | dealer -v -p 10 2>&1 | grep "Generated"
  3. Compatibility tests (if applicable)

    # Compare output with dealer.exe
    diff <(echo "hcp(north) >= 15" | dealer.exe -v -p 10 -s 1) \
         <(echo "hcp(north) >= 15" | dealer -v -p 10 -s 1)
  4. Error handling tests

    #[test]
    fn test_deprecated_switch_error() {
        let result = run_dealer(&["-2"]);
        assert!(result.is_err());
        assert!(result.unwrap_err().contains("not supported"));
    }
  5. Documentation tests

    • Ensure README examples work
    • Verify help text is clear
    • Check migration guide accuracy

Regression Testing

  • Run full test suite after each switch implementation
  • Verify existing switches still work
  • Check for conflicts between switches
  • Test mutually exclusive options

Version Compatibility Matrix

dealer3 Version -v Behavior --vulnerable Status
0.1 - 0.8 Vulnerability Not available Old behavior
0.9 (current) Vulnerability (deprecated warning) Available Transition
1.0+ Verbose (matches dealer.exe) Available New standard

Support Policy:

  • 0.x versions: Best effort, no guarantees
  • 1.x versions: Semantic versioning, no breaking changes in minor releases
  • 2.x versions: Major features, may include breaking changes with migration path

Success Criteria

Phase 0 (Pre-1.0) βœ… COMPLETE

  • -v means verbose (matches dealer.exe)
  • -V shows version
  • -q quiet mode implemented
  • -m progress meter implemented
  • --vulnerable works for vulnerability
  • Deprecation warnings removed (Breaking change implemented directly)
  • All tests pass
  • Documentation updated
  • Migration guide published

Phase 1 (1.0) βœ… COMPLETE

  • All essential dealer.exe switches implemented or documented as unsupported
  • Clear error messages for deprecated switches
  • 100% test coverage for implemented switches
  • BBO strict mode working (deferred to Phase 2)
  • Full documentation published
  • No breaking changes planned for 1.x

Phase 2 (1.1+) Complete When:

  • High-value DealerV2_4 features implemented
  • Command-line predeal switches working
  • CSV export functional
  • User feedback incorporated

Phase 3 (2.0+) Complete When:

  • DDS integration complete
  • Multi-threading support
  • Advanced export formats
  • Full DealerV2_4 parity (where desired)

Open Questions

1. Should we support -l at all?

Options:

  • A) Support neither dealer.exe nor V2_4 version (current plan - RECOMMENDED)
  • B) Support V2_4 version only (DL52 export)
  • C) Support dealer.exe version only (library input)
  • D) Add --library-input and --dl52-output to avoid conflict

Recommendation: Option A - avoid the conflict entirely until user demand clarifies which is needed

2. Should swapping modes (-x) be implemented?

Considerations:

  • Incompatible with predeal
  • Predeal is more useful
  • Low user demand
  • Implementation complexity

Recommendation: Phase 3 or never, depending on user requests

3. How strict should --bbo-strict mode be?

Options:

  • A) Only original dealer.exe features (RECOMMENDED)
  • B) Include some dealer3 extensions that could be backported
  • C) Configurable strictness levels

Recommendation: Option A - strict by default, matches BBO exactly


Change Log

Date Version Changes
2026-01-01 0.1 Initial requirements document created
2026-01-01 0.2 Updated with Phase 0 and Phase 1 completion status

Related Documents


Approval and Sign-off

This requirements document defines the command-line switch strategy for dealer3. Changes to these requirements should be reviewed and approved before implementation to ensure consistency and compatibility.

Status: βœ… Implemented - Phase 0 and Phase 1 Complete

Completion Date: 2026-01-01

Next Review: Before implementing Phase 2 features


Achievements

Phase 0 & Phase 1 Success βœ…

All essential dealer.exe command-line switches have been successfully implemented, making dealer3 fully compatible with dealer.exe for basic usage. This milestone includes:

  1. Core Functionality (9 switches):

    • Basic operations: -p, -g, -s
    • Output control: -f, -d, --vulnerable
    • Verbosity control: -v, -V, -q, -m
  2. Deprecated Switches (5 switches):

    • Helpful error messages for all deprecated switches
    • Clear migration guidance
    • User-friendly explanations
  3. Breaking Changes:

    • -v remapped from vulnerability to verbose (matches dealer.exe)
    • --vulnerable added for vulnerability (long form only)
    • Full migration guide provided in CHANGELOG.md
  4. Documentation:

    • Comprehensive requirements document (this file)
    • Three-way comparison of implementations
    • Categorized switch comparison
    • Implementation roadmap
    • Phase 0 completion report
    • Deprecated switches documentation
    • Migration guide in CHANGELOG

Result: dealer3 can now run most dealer.exe scripts without modification, providing a solid foundation for Phase 2 enhancements.