Skip to content

Read-only per-cell projection progress query on IEventDatabase (v1.1 candidate) #435

Description

@jeremydmiller

Goal

Add a read-only query method on JasperFx.Events.IEventDatabase so monitoring tools can read the current progression-row state for a single (projectionName, tenantId?) cell without spinning up an IProjectionDaemon.

public interface IEventDatabase
{
    // … existing methods …

    /// <summary>
    /// Read the current sequence + lifecycle state for a single (projection,
    /// tenant) cell directly from the progression table, without spinning the
    /// projection daemon. Returns null when no row exists for the (projection,
    /// tenant) pair yet (e.g. projection hasn't been observed by the daemon
    /// for this tenant). Tenant id null means store-global on non-tenanted
    /// stores or the default-tenant row on tenanted stores.
    /// </summary>
    ValueTask<ProjectionProgressRow?> ReadProjectionProgressAsync(
        string projectionName,
        string? tenantId,
        CancellationToken token);
}

public record ProjectionProgressRow(
    string ProjectionName,
    string? TenantId,
    long Sequence,
    string AgentStatus,
    DateTimeOffset? LastHeartbeat);

Why

CritterWatch#309 — the long-running projection rebuild orchestration feature — wants finer-grained UI progress per cell during a rebuild. The dispatcher loop itself works without this (RestartProjectionResult covers terminal state); this is purely for the in-flight sparkline / current-sequence rendering on the Rebuilds page.

The existing IEventDatabase.AllProjectionProgress works but returns every row across every projection × tenant pair, which the BFF then has to filter. For a per-cell UI polling loop (e.g. 1Hz against a single visible batch), the targeted query is materially cheaper.

Priority

v1.1 candidate, not v1. CritterWatch#309's design explicitly notes that the existing EventProgressionPoller + RestartProjectionResult carry enough state for the dispatch loop. This query method matters only for the finer UI grain — punt if it slows other work down.

Companion PRs

  • jasperfx/marten — implement the query against mt_event_progression.
  • jasperfx/polecat — same for pc_event_progression.

Both follow once this lands and only once CritterWatch#309's v1 dispatcher demonstrates a clear need for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions