-
Notifications
You must be signed in to change notification settings - Fork 3
Manual QA: test the pred CLI tool #86
Copy link
Copy link
Closed
Description
Objective
Manually test the pred CLI tool end-to-end. This covers all subcommands, error handling, piping, and JSON output modes.
Setup
# Build the CLI in release mode
make cli
# Verify installation
./target/release/pred --version
./target/release/pred --helpOr use cargo run with dev profile:
alias pred='cargo run --manifest-path problemreductions-cli/Cargo.toml --'Testing Checklist
1. Discovery commands
-
pred list— lists all registered problems with aliases -
pred list --json— outputs valid JSON to stdout -
pred show MIS— shows variants, size fields, and reductions for MIS -
pred show MIS --json— JSON output -
pred show MIS/UnitDiskGraph— shows a specific graph variant⚠️ Bug: ignores variant, shows same aspred show MIS -
pred from MIS— shows 1-hop outgoing neighbors -
pred from MIS --hops 2— shows 2-hop outgoing neighbors -
pred to QUBO— shows 1-hop incoming neighbors -
pred to QUBO --hops 2— shows 2-hop incoming neighbors
2. Path finding
-
pred path MIS QUBO— finds cheapest path (minimize steps) -
pred path MIS QUBO --all— lists all available paths -
pred path MIS QUBO --cost minimize:num_variables— custom cost function -
pred path MIS QUBO -o path.json— saves path for use withpred reduce --via -
pred path MIS MIS— same source and target (edge case) -
pred path SAT QUBO— multi-step reduction path
3. Problem creation
- Graph problems:
-
pred create MIS --graph 0-1,1-2,2-3 -o problem.json -
pred create MIS --graph 0-1,1-2 --weights 2,1,3 -
pred create MVC --graph 0-1,1-2,2-0 -
pred create MaxCut --graph 0-1,1-2,2-3
-
- SAT problems:
-
pred create SAT --num-vars 3 --clauses "1,2;-1,3" -
pred create 3SAT --num-vars 4 --clauses "1,2,3;-1,-2,4"
-
- QUBO:
-
pred create QUBO --matrix "1,0.5;0.5,2"
-
- KColoring:
-
pred create KColoring --graph 0-1,1-2,2-0 --k 3
-
- Factoring:
-
pred create Factoring --target 15 --m 4 --n 4
-
- Random generation:
-
pred create MIS --random --num-vertices 10 --edge-prob 0.3 -
pred create MIS --random --num-vertices 10 --seed 42— reproducible (run twice, compare)
-
- Geometry variants:
-
pred create MIS/KingsSubgraph/i32 --positions "0,0;1,0;1,1;0,1" -
pred create MIS/UnitDiskGraph/i32 --positions "0.0,0.0;1.0,0.0;0.5,0.8" --radius 1.5
-
4. Evaluate
-
pred evaluate problem.json --config 1,0,1,0— evaluates a config -
pred create MIS --graph 0-1,1-2 | pred evaluate - --config 1,0,1— piping from stdin - Test invalid config length (should error gracefully)
5. Reduce
-
pred reduce problem.json --to QUBO -o reduced.json— direct reduction -
pred reduce problem.json --via path.json -o reduced.json— via saved path -
pred create MIS --graph 0-1,1-2 | pred reduce - --to QUBO --json— piping (requires--json) -
pred inspect reduced.json— inspect the reduction bundle
6. Solve
-
pred solve problem.json— ILP solver (default) -
pred solve problem.json --solver brute-force— brute-force solver -
pred solve reduced.json— solve a reduction bundle (solution mapped back) -
pred create MIS --graph 0-1,1-2 | pred solve -— piping -
pred solve problem.json --timeout 10— timeout option - Compare ILP and brute-force results on the same instance — should agree
7. Full closed-loop workflow
Test the complete pipeline end-to-end:
# Create → Solve → Verify
pred create MIS --graph 0-1,1-2,2-3,3-0 -o problem.json
pred solve problem.json -o result.json
# Check that the solution config is valid:
pred evaluate problem.json --config <solution_from_result>
# Create → Reduce → Solve → Verify
pred create MIS --graph 0-1,1-2,2-3 -o problem.json
pred path MIS QUBO -o path.json
pred reduce problem.json --via path.json -o reduced.json
pred solve reduced.json -o result.json
# Solution should be mapped back to MIS space
# Full pipe chain (requires --json on reduce)
pred create MIS --graph 0-1,1-2,2-3 | pred reduce - --to QUBO --json | pred solve -8. JSON output and piping
- Every command with
--jsonproduces valid JSON (pipe throughjq .to verify) - Every command with
-o file.jsonwrites valid JSON to the file - Stdin reading with
-works for:evaluate,reduce,solve,inspect -
--quietsuppresses stderr info messages while still producing stdout output -
⚠️ Bug:reduce/solve/evaluatedon't auto-detect pipe —createoutputs JSON when stdout is not a TTY, but other commands always output human-readable text unless--jsonis specified
9. Error handling
- Unknown problem name → clear error message with suggestions
- Missing required args (e.g.,
pred create MISwithout--graph) → helpful per-problem help - Invalid edge format → clear error
- Non-existent reduction path → informative message
- Invalid JSON input file → graceful error
- Mismatched config length in
pred evaluate→ clear error -
⚠️ Bug: variant ambiguity —pred from MIS/UnitDiskGraphfails because bothi32andOneweights match. Should prefer default weight.
10. Shell completions
-
⚠️ Bug:eval "$(pred completions)"fails on macOS zsh withcompdef:153: _comps: assignment to invalid subscript range - Tab completion works for subcommands and problem names
11. Known display issues
-
⚠️ Bug: header infrom/todoesn't show variant —pred from MIS/UnitDiskGraph/i32shows "MaximumIndependentSet" instead of "MaximumIndependentSet/UnitDiskGraph" -
⚠️ Bug: "N reachable problems" counts unique names, not variant nodes — tree shows 4 nodes but says "3 reachable problems" because MIS variants are collapsed -
⚠️ Bug: SpinGlass couplings/fields can't be floats —pred create SpinGlass/f64 --couplings 1.0,-0.5fails with "invalid digit found in string" -
⚠️ Bug:--hopsdefault listed twice in help:[default: 1] [default: 1]
Reporting
For each failed item, please note:
- The exact command run
- The actual output / error
- The expected behavior
File findings as comments on this issue or as separate bug issues referencing this one.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done