[AAP-103750] perf: optimize CCSPv2 fact/set merges and skip discarded node-usage columns #658
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 424 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.362
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #658"
general
weight: 0.35
redhat-chai-bot
Description
Follow-up to #654 optimizing the remaining pure-Python hot paths in CCSP/CCSPv2 report aggregation and sheet building:
metrics_utility/automation_controller_billing/helpers.py,dataframe_engine/base.py):- In
merge_json_sets()andcombine_json_values(): skip callingmake_hashable()on elements already inside a Pythonset(copying on first insert so caller sets are never mutated), fast-path exact primitive scalars (str,int,float,bool) pastmake_hashable(), replacesetdefault(key, set())withif key in merged:to avoid allocating throwaway sets on existing keys, and short-circuit empty/non-dict pairs incombine_json_values().- In
combine_set(): fast-path two plainsets (set1 | set2).canonical_factsonce (dataframe_engine/dataframe_inventory_scope.py): Parsebilling_data['canonical_facts']once withparse_json()beforeserial_from_facts()andself.group(), halvingjson.loads()calls onmain_host.canonical_facts.report/base.py): In_build_data_section_usage_by_node(), computeinclude_orgs,include_facts, andinclude_indirectupfront and only aggregate / JSON-convertorganizations,managed_node_types_set,events,canonical_facts, andfactswhen those columns are rendered in the output sheet (previously all 5 were computed for every per-organization sheet and non-dedup direct sheet, then dropped by.reindex(columns=columns)).Testing
Steps to Test
1. Run focused unit tests:
2. Run paired alternating-order benchmarks (3 pairs in separate processes) of full 31-day / 124-archive synthetic CCSPv2 XLSX reports (all optional sheets,
ccsp-experimental) on a containerized AAPcont_bController (automation-controller-task, Python 3.12.16, pandas 3.0.3).Expected Results
canonical_facts: median full-report time dropped from 29.153 s to 27.100 s (−7.04%), peak RSS flat (279.05 → 279.25 MiB), all 6 workbook digests matched.279.01 → 278.78 MiB), all 6 workbook digests matched (scales linearly with organization count in multi-org reports).(Synthetic source-checkout measurements in a disposable Controller container; not a guarantee for every customer workload.)
Self-Review Checklist
Code Quality
- If updates are required in the handbook, create a separate PR for the handbook repo.