fix(rules): count blocked rule transactions (#1782)

* Add blocked count to rule run summary

* test(rules): cover rule run blocked counts

* fix(rules): derive blocked count from modified rows

Blocked rule transactions are the processed rows that were not modified. This keeps the displayed queued / processed / modified / blocked summary aligned when a run has already processed all matching rows but some were skipped by enrichment locks.

* fix(rules): count processed rows for rule jobs

Synchronous rule actions return the number of rows they modified, but rule-run processed counts should represent the number of matched transactions the job attempted to process. Using queued matches for processed preserves the distinction between processed and modified rows, which lets locked manual edits appear as blocked instead of making processed collapse to modified.

This changes RuleJob counter semantics, so it was committed separately from the derived blocked-count display change.
This commit is contained in:
Himank Dave
2026-05-14 15:56:49 -04:00
committed by GitHub
parent 0ad1e59165
commit 04549d80bf
7 changed files with 119 additions and 2 deletions

View File

@@ -210,6 +210,26 @@ class RulesControllerTest < ActionDispatch::IntegrationTest
end
end
test "index shows blocked count in recent runs summary" do
rule = rules(:one)
RuleRun.create!(
rule: rule,
execution_type: "manual",
status: "success",
transactions_queued: 10,
transactions_processed: 7,
transactions_modified: 4,
pending_jobs_count: 0,
executed_at: Time.current
)
get rules_url
assert_response :success
assert_select "th", text: /Queued\s+Processed\s+Modified\s+Blocked/
assert_select "td", text: "10 / 7 / 4 / 3"
end
test "should get confirm_all" do
get confirm_all_rules_url
assert_response :success