fix(test): test_kanban_core_functionality self-SIGTERM via heartbeat enforcement (broken-main, unblocks test(4) on #43/#44/#45) - #46
Conversation
…artbeat enforcement test_dispatch_once_stale_disabled_when_timeout_zero stored os.getpid() as worker_pid with a 5h-old started_at and no heartbeat, then called dispatch_once(stale_timeout_seconds=0). dispatch_once runs enforce_missing_heartbeat independently of stale_timeout_seconds, which os.kill(SIGTERM)'d the stored PID = the pytest process itself, killing pytest before it printed its summary (raw RC=143). The parallel harness then scraped 0 passed/0 failed and bucketed the file as 'no tests ran', turning test(4) red on #43/#44/#45 — broken-main from the upstream rebase. Fix: set a recent last_heartbeat_at on the run so enforce_missing_heartbeat skips the task. This test isolates STALE detection, not heartbeat enforcement. Also hardened test_enforce_max_runtime_integrates_with_dispatch (same os.getpid() footgun on its real-os.kill dispatch_once call). Test-only change. Verified: raw pytest RC=0, 166 passed 1 skipped.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughTwo test scenarios are adjusted to set ChangesTest Isolation via Heartbeat Control
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔎 Lint report:
|
|
auto-review: approved → human_review (merge-sequencing call for Sahil).
Sequencing per AC: merge #46 first (clears |
…artbeat enforcement (#46) test_dispatch_once_stale_disabled_when_timeout_zero stored os.getpid() as worker_pid with a 5h-old started_at and no heartbeat, then called dispatch_once(stale_timeout_seconds=0). dispatch_once runs enforce_missing_heartbeat independently of stale_timeout_seconds, which os.kill(SIGTERM)'d the stored PID = the pytest process itself, killing pytest before it printed its summary (raw RC=143). The parallel harness then scraped 0 passed/0 failed and bucketed the file as 'no tests ran', turning test(4) red on #43/#44/#45 — broken-main from the upstream rebase. Fix: set a recent last_heartbeat_at on the run so enforce_missing_heartbeat skips the task. This test isolates STALE detection, not heartbeat enforcement. Also hardened test_enforce_max_runtime_integrates_with_dispatch (same os.getpid() footgun on its real-os.kill dispatch_once call). Test-only change. Verified: raw pytest RC=0, 166 passed 1 skipped. Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
…artbeat enforcement (#46) test_dispatch_once_stale_disabled_when_timeout_zero stored os.getpid() as worker_pid with a 5h-old started_at and no heartbeat, then called dispatch_once(stale_timeout_seconds=0). dispatch_once runs enforce_missing_heartbeat independently of stale_timeout_seconds, which os.kill(SIGTERM)'d the stored PID = the pytest process itself, killing pytest before it printed its summary (raw RC=143). The parallel harness then scraped 0 passed/0 failed and bucketed the file as 'no tests ran', turning test(4) red on #43/#44/#45 — broken-main from the upstream rebase. Fix: set a recent last_heartbeat_at on the run so enforce_missing_heartbeat skips the task. This test isolates STALE detection, not heartbeat enforcement. Also hardened test_enforce_max_runtime_integrates_with_dispatch (same os.getpid() footgun on its real-os.kill dispatch_once call). Test-only change. Verified: raw pytest RC=0, 166 passed 1 skipped. Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
…artbeat enforcement (#46) test_dispatch_once_stale_disabled_when_timeout_zero stored os.getpid() as worker_pid with a 5h-old started_at and no heartbeat, then called dispatch_once(stale_timeout_seconds=0). dispatch_once runs enforce_missing_heartbeat independently of stale_timeout_seconds, which os.kill(SIGTERM)'d the stored PID = the pytest process itself, killing pytest before it printed its summary (raw RC=143). The parallel harness then scraped 0 passed/0 failed and bucketed the file as 'no tests ran', turning test(4) red on #43/#44/#45 — broken-main from the upstream rebase. Fix: set a recent last_heartbeat_at on the run so enforce_missing_heartbeat skips the task. This test isolates STALE detection, not heartbeat enforcement. Also hardened test_enforce_max_runtime_integrates_with_dispatch (same os.getpid() footgun on its real-os.kill dispatch_once call). Test-only change. Verified: raw pytest RC=0, 166 passed 1 skipped. Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
…artbeat enforcement (#46) test_dispatch_once_stale_disabled_when_timeout_zero stored os.getpid() as worker_pid with a 5h-old started_at and no heartbeat, then called dispatch_once(stale_timeout_seconds=0). dispatch_once runs enforce_missing_heartbeat independently of stale_timeout_seconds, which os.kill(SIGTERM)'d the stored PID = the pytest process itself, killing pytest before it printed its summary (raw RC=143). The parallel harness then scraped 0 passed/0 failed and bucketed the file as 'no tests ran', turning test(4) red on #43/#44/#45 — broken-main from the upstream rebase. Fix: set a recent last_heartbeat_at on the run so enforce_missing_heartbeat skips the task. This test isolates STALE detection, not heartbeat enforcement. Also hardened test_enforce_max_runtime_integrates_with_dispatch (same os.getpid() footgun on its real-os.kill dispatch_once call). Test-only change. Verified: raw pytest RC=0, 166 passed 1 skipped. Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
…artbeat enforcement (#46) test_dispatch_once_stale_disabled_when_timeout_zero stored os.getpid() as worker_pid with a 5h-old started_at and no heartbeat, then called dispatch_once(stale_timeout_seconds=0). dispatch_once runs enforce_missing_heartbeat independently of stale_timeout_seconds, which os.kill(SIGTERM)'d the stored PID = the pytest process itself, killing pytest before it printed its summary (raw RC=143). The parallel harness then scraped 0 passed/0 failed and bucketed the file as 'no tests ran', turning test(4) red on #43/#44/#45 — broken-main from the upstream rebase. Fix: set a recent last_heartbeat_at on the run so enforce_missing_heartbeat skips the task. This test isolates STALE detection, not heartbeat enforcement. Also hardened test_enforce_max_runtime_integrates_with_dispatch (same os.getpid() footgun on its real-os.kill dispatch_once call). Test-only change. Verified: raw pytest RC=0, 166 passed 1 skipped. Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
…artbeat enforcement (#46) test_dispatch_once_stale_disabled_when_timeout_zero stored os.getpid() as worker_pid with a 5h-old started_at and no heartbeat, then called dispatch_once(stale_timeout_seconds=0). dispatch_once runs enforce_missing_heartbeat independently of stale_timeout_seconds, which os.kill(SIGTERM)'d the stored PID = the pytest process itself, killing pytest before it printed its summary (raw RC=143). The parallel harness then scraped 0 passed/0 failed and bucketed the file as 'no tests ran', turning test(4) red on #43/#44/#45 — broken-main from the upstream rebase. Fix: set a recent last_heartbeat_at on the run so enforce_missing_heartbeat skips the task. This test isolates STALE detection, not heartbeat enforcement. Also hardened test_enforce_max_runtime_integrates_with_dispatch (same os.getpid() footgun on its real-os.kill dispatch_once call). Test-only change. Verified: raw pytest RC=0, 166 passed 1 skipped. Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
…artbeat enforcement (#46) test_dispatch_once_stale_disabled_when_timeout_zero stored os.getpid() as worker_pid with a 5h-old started_at and no heartbeat, then called dispatch_once(stale_timeout_seconds=0). dispatch_once runs enforce_missing_heartbeat independently of stale_timeout_seconds, which os.kill(SIGTERM)'d the stored PID = the pytest process itself, killing pytest before it printed its summary (raw RC=143). The parallel harness then scraped 0 passed/0 failed and bucketed the file as 'no tests ran', turning test(4) red on #43/#44/#45 — broken-main from the upstream rebase. Fix: set a recent last_heartbeat_at on the run so enforce_missing_heartbeat skips the task. This test isolates STALE detection, not heartbeat enforcement. Also hardened test_enforce_max_runtime_integrates_with_dispatch (same os.getpid() footgun on its real-os.kill dispatch_once call). Test-only change. Verified: raw pytest RC=0, 166 passed 1 skipped. Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
…artbeat enforcement (#46) test_dispatch_once_stale_disabled_when_timeout_zero stored os.getpid() as worker_pid with a 5h-old started_at and no heartbeat, then called dispatch_once(stale_timeout_seconds=0). dispatch_once runs enforce_missing_heartbeat independently of stale_timeout_seconds, which os.kill(SIGTERM)'d the stored PID = the pytest process itself, killing pytest before it printed its summary (raw RC=143). The parallel harness then scraped 0 passed/0 failed and bucketed the file as 'no tests ran', turning test(4) red on #43/#44/#45 — broken-main from the upstream rebase. Fix: set a recent last_heartbeat_at on the run so enforce_missing_heartbeat skips the task. This test isolates STALE detection, not heartbeat enforcement. Also hardened test_enforce_max_runtime_integrates_with_dispatch (same os.getpid() footgun on its real-os.kill dispatch_once call). Test-only change. Verified: raw pytest RC=0, 166 passed 1 skipped. Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
…artbeat enforcement (#46) test_dispatch_once_stale_disabled_when_timeout_zero stored os.getpid() as worker_pid with a 5h-old started_at and no heartbeat, then called dispatch_once(stale_timeout_seconds=0). dispatch_once runs enforce_missing_heartbeat independently of stale_timeout_seconds, which os.kill(SIGTERM)'d the stored PID = the pytest process itself, killing pytest before it printed its summary (raw RC=143). The parallel harness then scraped 0 passed/0 failed and bucketed the file as 'no tests ran', turning test(4) red on #43/#44/#45 — broken-main from the upstream rebase. Fix: set a recent last_heartbeat_at on the run so enforce_missing_heartbeat skips the task. This test isolates STALE detection, not heartbeat enforcement. Also hardened test_enforce_max_runtime_integrates_with_dispatch (same os.getpid() footgun on its real-os.kill dispatch_once call). Test-only change. Verified: raw pytest RC=0, 166 passed 1 skipped. Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
…artbeat enforcement (#46) test_dispatch_once_stale_disabled_when_timeout_zero stored os.getpid() as worker_pid with a 5h-old started_at and no heartbeat, then called dispatch_once(stale_timeout_seconds=0). dispatch_once runs enforce_missing_heartbeat independently of stale_timeout_seconds, which os.kill(SIGTERM)'d the stored PID = the pytest process itself, killing pytest before it printed its summary (raw RC=143). The parallel harness then scraped 0 passed/0 failed and bucketed the file as 'no tests ran', turning test(4) red on #43/#44/#45 — broken-main from the upstream rebase. Fix: set a recent last_heartbeat_at on the run so enforce_missing_heartbeat skips the task. This test isolates STALE detection, not heartbeat enforcement. Also hardened test_enforce_max_runtime_integrates_with_dispatch (same os.getpid() footgun on its real-os.kill dispatch_once call). Test-only change. Verified: raw pytest RC=0, 166 passed 1 skipped. Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
…artbeat enforcement (#46) test_dispatch_once_stale_disabled_when_timeout_zero stored os.getpid() as worker_pid with a 5h-old started_at and no heartbeat, then called dispatch_once(stale_timeout_seconds=0). dispatch_once runs enforce_missing_heartbeat independently of stale_timeout_seconds, which os.kill(SIGTERM)'d the stored PID = the pytest process itself, killing pytest before it printed its summary (raw RC=143). The parallel harness then scraped 0 passed/0 failed and bucketed the file as 'no tests ran', turning test(4) red on #43/#44/#45 — broken-main from the upstream rebase. Fix: set a recent last_heartbeat_at on the run so enforce_missing_heartbeat skips the task. This test isolates STALE detection, not heartbeat enforcement. Also hardened test_enforce_max_runtime_integrates_with_dispatch (same os.getpid() footgun on its real-os.kill dispatch_once call). Test-only change. Verified: raw pytest RC=0, 166 passed 1 skipped. Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
…artbeat enforcement (#46) test_dispatch_once_stale_disabled_when_timeout_zero stored os.getpid() as worker_pid with a 5h-old started_at and no heartbeat, then called dispatch_once(stale_timeout_seconds=0). dispatch_once runs enforce_missing_heartbeat independently of stale_timeout_seconds, which os.kill(SIGTERM)'d the stored PID = the pytest process itself, killing pytest before it printed its summary (raw RC=143). The parallel harness then scraped 0 passed/0 failed and bucketed the file as 'no tests ran', turning test(4) red on #43/#44/#45 — broken-main from the upstream rebase. Fix: set a recent last_heartbeat_at on the run so enforce_missing_heartbeat skips the task. This test isolates STALE detection, not heartbeat enforcement. Also hardened test_enforce_max_runtime_integrates_with_dispatch (same os.getpid() footgun on its real-os.kill dispatch_once call). Test-only change. Verified: raw pytest RC=0, 166 passed 1 skipped. Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
…artbeat enforcement (#46) test_dispatch_once_stale_disabled_when_timeout_zero stored os.getpid() as worker_pid with a 5h-old started_at and no heartbeat, then called dispatch_once(stale_timeout_seconds=0). dispatch_once runs enforce_missing_heartbeat independently of stale_timeout_seconds, which os.kill(SIGTERM)'d the stored PID = the pytest process itself, killing pytest before it printed its summary (raw RC=143). The parallel harness then scraped 0 passed/0 failed and bucketed the file as 'no tests ran', turning test(4) red on #43/#44/#45 — broken-main from the upstream rebase. Fix: set a recent last_heartbeat_at on the run so enforce_missing_heartbeat skips the task. This test isolates STALE detection, not heartbeat enforcement. Also hardened test_enforce_max_runtime_integrates_with_dispatch (same os.getpid() footgun on its real-os.kill dispatch_once call). Test-only change. Verified: raw pytest RC=0, 166 passed 1 skipped. Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
…artbeat enforcement (#46) test_dispatch_once_stale_disabled_when_timeout_zero stored os.getpid() as worker_pid with a 5h-old started_at and no heartbeat, then called dispatch_once(stale_timeout_seconds=0). dispatch_once runs enforce_missing_heartbeat independently of stale_timeout_seconds, which os.kill(SIGTERM)'d the stored PID = the pytest process itself, killing pytest before it printed its summary (raw RC=143). The parallel harness then scraped 0 passed/0 failed and bucketed the file as 'no tests ran', turning test(4) red on #43/#44/#45 — broken-main from the upstream rebase. Fix: set a recent last_heartbeat_at on the run so enforce_missing_heartbeat skips the task. This test isolates STALE detection, not heartbeat enforcement. Also hardened test_enforce_max_runtime_integrates_with_dispatch (same os.getpid() footgun on its real-os.kill dispatch_once call). Test-only change. Verified: raw pytest RC=0, 166 passed 1 skipped. Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
Problem
tests/hermes_cli/test_kanban_core_functionality.py::test_dispatch_once_stale_disabled_when_timeout_zerodeterministically SIGTERMs the pytest process itself (raw pytest RC=143, 5/5 runs). All tests pass, but pytest is killed before printing its summary line, so the parallel harness (scripts/run_tests_parallel.py) scrapes 0 passed/0 failed and buckets the file as "no tests ran". That is what makes thetest (4)shard red on #43, #44, AND #45 — broken-main from the 170-commit upstream rebase, not introduced by any of those three PRs (diagnosed in t_8cd01b66).Root cause
The test stores
os.getpid()as the task'sworker_pidwithstarted_at5h ago and no heartbeat, then callsdispatch_once(stale_timeout_seconds=0).dispatch_oncerunsenforce_missing_heartbeat(hermes_cli/kanban_db.py:6763) independently ofstale_timeout_seconds, whichos.kill(SIGTERM)s the stored PID = the pytest process. conftest's_guarded_killexplicitly allows self-kills, so the SIGTERM lands.enforce_missing_heartbeat-in-dispatch_oncecame from fork commit c699bb2 (#37); the test came from e286e68 — the rebase composed the two and exposed the latent self-kill.Fix
Set a recent
last_heartbeat_aton the run soenforce_missing_heartbeatskips the task (this test isolates STALE detection, not heartbeat enforcement). Also hardenedtest_enforce_max_runtime_integrates_with_dispatchagainst the sameos.getpid()-as-worker_pid footgun on its real-os.killdispatch_oncecall.Test-only change. No production code touched.
Verification
venv/bin/python -m pytest test_kanban_core_functionality.py→ RC=0, 166 passed, 1 skipped.2 passed in 0.17s).Sequencing
Merge this BEFORE #43/#44/#45 so their
test (4)shard clears.Summary by CodeRabbit
Tests