Skip to content

Add -n/--numthr to dd_table_for_deal - #384

Merged
tameware merged 2 commits into
dds-bridge:developfrom
tameware:dd_table_for_deal
Sep 15, 2026
Merged

tameware merged 2 commits into
dds-bridge:developfrom
tameware:dd_table_for_deal

Conversation

@tameware

Copy link
Copy Markdown
Collaborator

Summary

  • Add -n/--numthr to the C++ and Python dd_table_for_deal utilities so callers can control worker threads per table solve.
  • Match dtest semantics: 0 = auto (default), 1 = sequential; C++ uses CalcDDtablePBNN, Python passes max_threads through to calc_all_tables_pbn.
  • Cover parsing, usage text, and thread-count plumbing with unit tests.

Test plan

  • Run C++ dd_table_for_deal tests (ParseNumthr cases)
  • Run Python test_dd_table_for_deal_par (CLI + max_threads main test)
  • Smoke: dd_table_for_deal -n 1 hands/example.pbn and Python equivalent
  • Confirm -n 0 / omitted flag still behave as auto

Made with Cursor

Match dtest: 0 = auto, 1 = sequential; C++ uses CalcDDtablePBNN.

Co-authored-by: Cursor <cursoragent@cursor.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Two moderate issues remain, along with two documentation nits.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds -n/--numthr worker-thread controls to the C++ and Python dd_table_for_deal utilities.

Changes:

  • Adds option parsing with automatic mode at 0.
  • Forwards thread limits to the solver APIs.
  • Adds parsing and propagation tests.
File summaries
File Summary
utilities/tests/dd_table_for_deal_test.cpp Adds C++ parser tests; executable-level forwarding coverage is still requested.
utilities/src/dd_table_for_deal/dd_table_for_deal.hpp Declares the thread-count parser.
utilities/src/dd_table_for_deal/dd_table_for_deal.cpp Adds C++ option handling and solver forwarding; usage grammar needs correction (nit, 1 vote).
utilities/src/dd_table_for_deal/dd_table_for_deal_lib.cpp Implements C++ thread-count parsing.
python/utilities/tests/test_dd_table_for_deal_par.py Tests Python CLI parsing and thread propagation.
python/utilities/src/dd_table_for_deal.py Adds Python option handling and forwarding; usage grammar needs correction (nit, 1 vote) and values above INT_MAX should be rejected (moderate, 3 votes).
Review details

Suppressed comments (3)

python/utilities/src/dd_table_for_deal.py:201

  • This usage grammar makes -n look like a flag without an argument ([-n|--numthr N]), but the parser requires a value after either spelling. Users following the documented short form get a misleading error; spell out the value for both alternatives, such as [-n N|--numthr N].
        f"[-n|--numthr N] <pbn_deal_or_file>\n"

utilities/src/dd_table_for_deal/dd_table_for_deal.cpp:244

  • This usage grammar makes -n look like a flag without an argument ([-n|--numthr N]), but the parser requires a value after either spelling. Users following the documented short form get a misleading error; spell out the value for both alternatives, such as [-n N|--numthr N].
          "[-n|--numthr N] <pbn_deal_or_file>\n"

utilities/src/dd_table_for_deal/dd_table_for_deal.cpp:215

  • The C++ CLI's new thread-count plumbing is not covered: utilities/tests/dd_table_for_deal_test.cpp only exercises parse_numthr, so a regression that drops or changes this CalcDDtablePBNN argument would leave the tests green. Add an executable-level test (or an extracted testable processing function) that verifies -n 1 and the omitted/0 cases reach the solver with the intended cap.
  const int res = CalcDDtablePBNN(tableDealPBN, &table, num_threads);
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread python/utilities/src/dd_table_for_deal.py
Document [-n N|--numthr N] and cover num_threads reaching CalcDDtablePBNN via an injectable helper.

Co-authored-by: Cursor <cursoragent@cursor.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The reviewed changes and tests cover thread-count parsing and forwarding without unresolved blocking issues.

Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@tameware tameware self-assigned this Sep 15, 2026
@tameware tameware added the Clean Copilot review Copilot reviewed and had neither new comments nor new suppressed comments. label Sep 15, 2026
@tameware
tameware requested a review from zzcgumn September 15, 2026 08:57

@zzcgumn zzcgumn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Makes sense

@tameware
tameware merged commit 80b6aa4 into dds-bridge:develop Sep 15, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Clean Copilot review Copilot reviewed and had neither new comments nor new suppressed comments.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants