fix(validation): process all dashboards in a run, not just the first one

Root cause of stuck 'running' runs: the plugin's execute() method
only processed dashboard_ids[0] and returned. The remaining N-1
dashboards were never processed, and _update_run_status was called
after each single dashboard without checking dashboard_count.

Fixes:
- execute() now loops over ALL dashboard_ids and processes each
  via _execute_path_a or _execute_path_b
- _update_run_status is called once AFTER the loop finishes
- _update_run_status now checks that len(records) >= dashboard_count
  before marking the run as finished (prevents premature completion)
- Per-dashboard _update_run_status calls removed from _execute_path_a
  and _execute_path_b (the parent loop owns it now)
- Test updated for new batch return format {dashboards: [...], total: N}
This commit is contained in:
2026-05-31 23:03:46 +03:00
parent c8e81747fc
commit ab90755fa1
2 changed files with 79 additions and 66 deletions

View File

@@ -218,7 +218,9 @@ async def test_dashboard_validation_plugin_persists_task_and_environment_ids(
context=context,
)
assert result["environment_id"] == "env-42"
# Plugin now returns a batch result with all dashboards
assert result["total"] == 1
assert result["dashboards"][0]["environment_id"] == "env-42"
assert fake_db.committed is True
assert fake_db.closed is True
assert fake_db.added is not None