Skip to content

Stop default activities when a heartbeat refuses continued execution - #187

Merged
rmcdaniel merged 4 commits into
mainfrom
fix/186-heartbeat-authority
Oct 21, 2026
Merged

rmcdaniel merged 4 commits into
mainfrom
fix/186-heartbeat-authority

Conversation

@rmcdaniel

@rmcdaniel rmcdaniel commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Accepted product correction: stop a refused heartbeat

This is an activity-authority bug, not a documentation-only gap. The default context currently checks cancellation but ignores an explicit can_continue=false. The correction must preserve the original refusal reason, stop async and synchronous activity code at its next heartbeat, release its physical slot after exit, and send no completion or failure for the closed attempt. Cancellation remains distinct.

Tests-first 68f6ed1 adds thirteen controls for elapsed start-to-close, closed attempt and closed run on both heartbeat APIs and default worker paths, plus publication fencing when user code catches the heartbeat exception. Production is byte-identical to d2939d4e for the counterfactual: all thirteen actually FAIL in 0.77 seconds. That parent contains the independently qualified #185 maintenance-stop fix.

Functional correction a8659b70888e7780e4d2aaa04ca7b1506d1f52b8 / tree 0724221f81a5a2639fae0a09e1b611f5c9141143 preserves the original refusal in ActivityLeaseAuthorityLost.reason, separately from cancellation. The default worker returns claim_aborted and emits neither result nor failure, including after user code suppresses the refusal and returns or raises an ordinary/non-retryable error. The same original Client authority is invalidated by task/attempt/generation/owner binding; a different original is not invalidated. Two real Client/mock-HTTP controls prove transport publication is fenced before an outgoing completion request.

Final normal-install Python 3.10.22 acceptance: 3,120 tests PASS / three skips / 105 integration deselections, 164.06 seconds; 46 focused heartbeat/context/lease-worker tests PASS, overlapping the full total; Ruff passes and mypy passes all 36 source files. The earlier source component also passed 3,118 tests; a test-only lint failure was corrected explicitly. The final result includes the additional original-client authority/isolation controls. No failed original is called a pass.

Current reviewed head is 0c215c9a8ec56946930a511af1b518bffc9710c4 / tree 87eaf99724600168ad3190bf7ec8f45fa606fc95. It addresses the two actionable Sonar locations by separating ordinary exception disposition from callback dispatch and creating the selected coroutine outside the exception guard. Original storage-admission propagation, failure metadata/logging and heartbeat-authority order are preserved. Actual focused worker/storage/context/heartbeat qualification on this head passes 387 tests / two existing skips, plus Ruff and mypy on 36 source files. The 3,120-test full result belongs to functional parent a8659b70, not a whole-head claim for this cleanup. Fresh hosted supported-version/integration/Sonar gates qualify the current head independently; no threshold/profile change or analyzer-fixed claim before readback.

Before advancement, the original 3.12, corpus, package, portal/boundary and advisory cells had passed; 3.10/3.11/lint remained queued with no admitted assertions. Their original partial results remain visible. No running supported-version test was cancelled to obtain a pass.

Fresh exact-head supported Python 3.10/3.11/3.12, actual source-Server integration, lint/package/corpus/portal/boundary and final target qualification all PASS. Sonar app/workflow checks PASS; independent API readback confirms both reports CLOSED/FIXED and zero OPEN/CONFIRMED. No tuning, global suppression or package publication.

Merged normally at d6da755e80357bf2bebf460c925ff71f3433e683, October 21 at 10:28:34 UTC. Its whole tree independently equals reviewed candidate 87eaf99724600168ad3190bf7ec8f45fa606fc95. Completed remote head fix/186-heartbeat-authority is deleted and independently returns 404. Fresh-main CI 39584856529, portal 39584856514, Sonar 39584856467 and boundary 39584856460 are separate and pending. No candidate result is carried to main, and #186 remains open until published/installed acceptance and the website follow-through.

README, the SDK reference, changelog and method docs explain the refusal and its physical-stop limits. No dependency, package version, Server/native/shared/schema or wire change. The branch incorporates merged #185 via fe40c647, not a borrowed old runtime result. Fresh normal CI/Sonar, compatible publication, actual installed refusal/slot acceptance and the eight-locale website timeout explanation remain required before closing #186. Workflow #878's larger automatic-maintenance acceptance stays open independently. No provider operation or paid resource.

@rmcdaniel

rmcdaniel commented Oct 21, 2026 •

Copy link
Copy Markdown
Member Author

Sonar source follow-through

The exact a8659b70 gate passes but has two valid OPEN findings: AaFdwn1vYtctv_rdPDRW / S3776 (worker dispatch 16/15) and AaFdwn6PYtctv_rdPDRX / S5778 (the parameterized exception guard contains two possible invocations). No zero-open, false-positive or analyzer-fixed claim.

Scoped follow-through 0c215c9a8ec56946930a511af1b518bffc9710c4 / tree 87eaf99724600168ad3190bf7ec8f45fa606fc95 separates ordinary activity exception disposition from callback dispatch, preserving storage-admission propagation, exact failure metadata and logging. The heartbeat test creates its selected coroutine before the exception guard, leaving only its await inside. No authority, wire, dependency, threshold or profile change. Actual focused worker/storage-admission/heartbeat checks pass 387 tests / two existing skips, and Ruff/mypy36 pass. The earlier full 3,120-test pass remains attributed to a8659b70; final analysis/whole-head qualification is separate.

This is the current functional PR's source review before publication. Its original a8659b70 CI evidence remains visible. No separate optional full matrix is dispatched solely for a one-point maintainability finding.

Fresh exact-head app/workflow analysis on 0c215c9a now passes. Independent PR-scoped API readback confirms both findings CLOSED/FIXED and zero OPEN/CONFIRMED, with unchanged rules and thresholds. Supported-version/integration/aggregate checks remain independently pending; analyzer success does not complete #186 delivery.

@sonarqubecloud

Copy link
Copy Markdown

@rmcdaniel
rmcdaniel marked this pull request as ready for review October 21, 2026 09:34
@rmcdaniel
rmcdaniel merged commit d6da755 into main Oct 21, 2026
15 checks passed
@rmcdaniel
rmcdaniel deleted the fix/186-heartbeat-authority branch October 21, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants