ReadProjectionProgressAsync reports the persisted heartbeat and agent status (#5172) - #5180
Merged
Merged
Conversation
… status (#5172) Both overloads hardcoded `LastHeartbeat` and `AgentStatus` to null and never selected the columns, on the rationale that Marten modelled them but no daemon path wrote them (#519). That stopped being true at #537 — `ExtendedProgressionWriter` populates both on every flush, and `AllProjectionProgress` reads them back correctly. So the targeted per-cell read that #435 added *specifically* as the monitoring alternative to scanning every row returned NULL for exactly the two fields a monitor calls it for, with nothing to distinguish a placeholder from a fact — while the expensive path it was meant to replace returned the truth. Both queries now select `agent_status` and `heartbeat` when `EnableExtendedProgressionTracking` is on and hydrate them into the record. With extended tracking off the columns are not on the table, so the narrow column list is kept and both fields stay null. In the version-collapsing overload the telemetry follows the winning row rather than whichever candidate was read first. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017CTtw2kVRSZKp1p5RTxgAy
This was referenced Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5172.
The bug
Both
ReadProjectionProgressAsyncoverloads hardcodedAgentStatusandLastHeartbeattonulland never selected the columns. The XML docs justified it:That was true when it was written. Since #537 the daemon does write them —
ExtendedProgressionWriter→WriteExtendedProgressionAsyncpopulatesheartbeatandagent_statuson every flush, andAllProjectionProgressreads them back correctly throughProjectionProgressStatement+ShardStateSelector. Only these read paths were never updated.The sting: #435 added the targeted per-cell read specifically so a monitor polling one visible cell wouldn't have to pull every projection × tenant row on each tick. A caller taking that supported path to ask "is this shard's agent alive" got NULL, with no way to tell a placeholder from a fact — while the row-scan path they were told to avoid returned the real value.
The fix
Both queries select
agent_status, heartbeatwhenEnableExtendedProgressionTrackingis on, and hydrate them intoProjectionProgressRow. With extended tracking off the columns don't exist onmt_event_progression, so the narrow column list is kept and both fields stay null — that's a fact ("this store doesn't track it"), not a placeholder.In the version-collapsing overload the telemetry is captured from the row that wins the newest-version/highest-sequence contest, not from whichever candidate happened to be read first.
Kept minimal per the issue:
ProjectionProgressRowhas no fields forpause_reason,running_on_nodeor thefailure_*columns, and monitors wanting those still haveAllProjectionProgress.Not in this PR
ProjectionProgressRow's own doc comment in JasperFx (src/JasperFx.Events/ProjectionProgressRow.cs:21-25) carries the same stale claim ("Neither Marten nor Polecat writes it today"). That's a JasperFx change and is left as a hand-off.Tests
DaemonTests/Bugs/Bug_5172_read_progress_extended_columns.cs— 5 cases:ShardNameoverload does too, on a tenant-bearing identityStopped/heartbeat must not leak through)All 5 pass, along with the existing 8
read_projection_progresstests (net10.0).🤖 Generated with Claude Code
https://claude.ai/code/session_017CTtw2kVRSZKp1p5RTxgAy