Repository navigation
FIX: Combine scenario group counts for unmatched attempts (#3699) - #3780
Open
Hrushikesh Ramilla (Hrushikesh-ramilla) wants to merge 1 commit into
Conversation
Roman Lutz (romanlutz)
self-requested a review
November 2, 2026 08:05
This branch has not been deployed
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
Fixes #3699.
When querying scenario history aggregates (
get_scenario_history_aggregates_asyncinpyrit/memory/memory_interface.py), per-group attempt counts fromgroup_rowsare grouped by(scenario_result_id, unit_group_id)in SQL.For unmatched attempts,
raw_gidis formatted asname\x1feval_hash, which lines 7336-7338 convert to the canonical configuration hashcanonical_gid = config_hash({"atomic_attack_name": name, "technique_eval_hash": eval_hash}).Previously,
run_groups[canonical_gid] = countsunconditionally assigned the row counts. If an unplanned attempt shared the same atomic attack name and technique configuration as a planned group, its row overwrote the existing canonical group's counts instead of combining the disjoint attempt populations. As a result, the group's planned completed/successful counts were overwritten, while overall run counts remained correct.Fix
MemoryInterface.get_scenario_history_aggregates_async:canonical_gidalready exists inrun_groups, combine the counts usingcombine_execution_counts([run_groups[canonical_gid], counts]).canonical_gid != raw_gid, combine intorun_groups[raw_gid]if already present.Tests
test_scenario_history_aggregates_combine_unplanned_attempt_counts_with_canonical_groupintests/unit/memory/memory_interface/test_interface_scenario_history.pyusing canonical configuration hashes and both planned and unplanned attempt records.pytest tests/unit/memory/memory_interface/test_interface_scenario_history.py: 25 passed.pytest tests/unit/analytics/test_scenario_statistics_parity.py: 37 passed.ruff check pyrit/memory/memory_interface.py tests/unit/memory/memory_interface/test_interface_scenario_history.py: 0 errors.ruff format --check pyrit/memory/memory_interface.py tests/unit/memory/memory_interface/test_interface_scenario_history.py: Clean.