From 9906dd7b09f958366a3ca06e18f3384aa101b33d Mon Sep 17 00:00:00 2001 From: Jonathan Kaiser Date: Mon, 31 Aug 2026 21:55:13 +0200 Subject: [PATCH] fix: correct test setup bugs found by actually running the suite Set up a working Docker-based Rails environment (this session's shell had no compatible Ruby/Bundler) and ran the full suite against PR #3298. Two real bugs surfaced that static checks couldn't have caught: - WorkerAiHealth::Snapshot.new(**{...}.merge(overrides)) needs the double-splat -- a bare Hash isn't auto-converted to keyword arguments. Both test snapshot builders passed a positional Hash instead, which raised "missing keywords" for every field on every call. - assert_enqueued_with/assert_no_enqueued_jobs need `include ActiveJob::TestHelper` explicitly in a plain ActiveSupport::TestCase -- every other model test in this codebase that uses them does the same; I'd wrongly assumed it was available process-wide. With both fixed: 7510 runs, 29877 assertions, 0 failures, 0 errors, 30 skips for the full suite; rubocop, erb_lint, and brakeman all clean. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01A9494Pxh4LZKnNLTGfFXPw --- test/controllers/admin/system_health_controller_test.rb | 2 +- test/models/worker_ai_health_test.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/controllers/admin/system_health_controller_test.rb b/test/controllers/admin/system_health_controller_test.rb index 5b11e68ef..1cd4a8288 100644 --- a/test/controllers/admin/system_health_controller_test.rb +++ b/test/controllers/admin/system_health_controller_test.rb @@ -481,7 +481,7 @@ class Admin::SystemHealthControllerTest < ActionDispatch::IntegrationTest def worker_snapshot(overrides = {}) WorkerAiHealth::Snapshot.new( - { + **{ process_identity: "worker:1", hostname: "worker", pid: 1, diff --git a/test/models/worker_ai_health_test.rb b/test/models/worker_ai_health_test.rb index 360348afb..219fe4445 100644 --- a/test/models/worker_ai_health_test.rb +++ b/test/models/worker_ai_health_test.rb @@ -1,6 +1,8 @@ require "test_helper" class WorkerAiHealthTest < ActiveSupport::TestCase + include ActiveJob::TestHelper + setup do @cache = ActiveSupport::Cache::MemoryStore.new end @@ -149,7 +151,7 @@ class WorkerAiHealthTest < ActiveSupport::TestCase private def passing_snapshot(overrides = {}) WorkerAiHealth::Snapshot.new( - { + **{ process_identity: "host:1", hostname: "host", pid: 1,