Skip to content

Guarantee deterministic risk sorting - #6

Merged
rdzehtsiar merged 2 commits into
masterfrom
codex/linear-mention-rdg-38-review-sorting
Jun 10, 2026
Merged

Guarantee deterministic risk sorting#6
rdzehtsiar merged 2 commits into
masterfrom
codex/linear-mention-rdg-38-review-sorting

Conversation

@rdzehtsiar

Copy link
Copy Markdown
Owner

Motivation

  • Ensure deterministic ordering for all exposed lists and UI rows so risk outputs are repeatable and tie-broken predictably, following RDG-38 requirements to sort risk rows by score descending then path ascending.
  • Avoid depending on ephemeral rank insertion order or unstable iteration when materializing package and file lists.

Description

  • Sort source package enumeration and materialized file facts by path by adding ORDER BY relative_path ASC and ORDER BY file_analysis.relative_path ASC to the SQL used in finalize_source_dependencies and materialize_file_facts in src/pipeline/store_reducer.rs.
  • Load TUI risk rows deterministically by replacing ORDER BY score.rank ASC with ORDER BY score.score DESC, score.relative_path ASC in src/tui.rs so the UI presents rows by score descending then path ascending.
  • Add regression tests: materialized_package_and_file_lists_are_path_sorted and materialized_risk_rows_break_score_ties_by_path in src/pipeline/store_reducer.rs, and loads_risk_rows_by_score_descending_then_path_ascending in src/tui.rs to cover deterministic ordering and tie-breaking.
  • Minor test helper text_rows added and code formatted; commit message is Guarantee deterministic risk sorting.

Testing

  • Ran cargo fmt --check and formatting passed.
  • Ran cargo test and the full test suite passed (98 unit tests in-library plus integration CLI tests and store reducer tests all succeeded).
  • Ran cargo clippy --all-targets --all-features -- -D warnings and the linter completed without warnings.

Codex Task

@codecov-commenter

codecov-commenter commented Jun 10, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown

Qodana for Rust

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

@sonarqubecloud

Copy link
Copy Markdown

@rdzehtsiar
rdzehtsiar marked this pull request as ready for review June 10, 2026 16:05
@rdzehtsiar
rdzehtsiar merged commit cd2c5be into master Jun 10, 2026
8 checks passed
@rdzehtsiar
rdzehtsiar deleted the codex/linear-mention-rdg-38-review-sorting branch June 10, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants