feat: simplify result queries and add smart reruns#38
Merged
Conversation
Unify the results subcommands into a single `results` command and add `--rerun` support to rerun failed targets. Key changes: - CLI: replaced results subcommands with a single parser and added flags `--type`, `--target`, `--rerun`, `--dry-run`, and `--benchmark`; validate that report-only flags are not used with `--rerun`. - Rerun flow: implement `_cmd_results_rerun` to group failures by originating config file, reconstruct the original config, build narrowed targets and re-run them; write results and print follow-up guidance when failures remain. - Result records: include `config_file` and `config_file_resolved` in JSONL records; write_jsonl_records now accepts an optional config_file and _write_run_results returns a WrittenRunResults dataclass with metadata. - Filtering and semantics: add `record_type` and `target` to ResultFilters; normalize failed-status matching to treat any non-success as failure; add helpers for status matching and record filtering. - Rerun target construction: add config_file_for_failure_records and build_rerun_targets which group failures and narrow TargetDescriptor instances to only failed accounts, regions and tasks (including dependent tasks). - Utilities: add helpers to format display paths and print failure follow-ups; add tests covering new behavior and update docs/README usage examples. Tests and docs updated accordingly.
Add an optional parser parameter to _validate_results_rerun_args so it can call parser.error for friendly CLI errors (falls back to raising ValueError when no parser is provided). Invoke this validation early in main when command == "results" and --rerun. Update README to note which report-shaping flags are not supported with --rerun. Adjust tests to compare resolved Path objects for config_file_resolved instead of string endswith checks.
Apply minor formatting changes to CLI and result query function signatures for readability. Update tests to better mock run results: tests/cli/test_cli_parallel_targets.py now stubs _write_run_results to return a SimpleNamespace with summary and jsonl_path (so _run_single_config_file can proceed), and tests/cli/test_cli_smoke.py fixes a broken string/whitespace assertion and compresses a test args SimpleNamespace to a single line.
Normalize recorded config file paths to POSIX format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Checklist
ruffandpytest) were successful.