Skip to content

perf(row-types): stateless full-snapshot discovery — drop the delta cursor#66

Merged
acmeguy merged 1 commit into
mainfrom
080-stateless-discovery
Jul 9, 2026
Merged

perf(row-types): stateless full-snapshot discovery — drop the delta cursor#66
acmeguy merged 1 commit into
mainfrom
080-stateless-discovery

Conversation

@acmeguy

@acmeguy acmeguy commented Jul 9, 2026

Copy link
Copy Markdown

Why

The discovery stats-pass rode a delta cursor on the event timestamp, which is a business attribute, not an ingestion watermark. Forecast rows carry FUTURE timestamps (poison the cursor, stall the delta indefinitely); backfills carry PAST timestamps (sit below the cursor, never scanned). received_at (the only ingestion axis) is ~68% null, so it can't replace it.

What

Fold the inventory/evidence aggregation into the single full-partition GROUP BY key the counts already used, and remove the cursor + delta entirely. Discovery is now one stateless, idempotent snapshot per run — immune to forecasts, backfills, late data and clock skew. Cost: one bounded aggregation per (manual) run; the map-key/JSON-path caps bound memory. Response keeps cursor: null for cxs2-client back-compat.

Verified

Ran the exact combined query against live cst.semantic_events — returns count + first/last-seen + observed_types/observed_sources + inventory (mapKeys for Map cols, JSONAllPaths for JSON cols, classified dynamically per schema). node --check passes.

Companion: cxs2 080-stateless-discovery (snapshot reconciliation). Spec 080.

🤖 Generated with Claude Code

…ursor

The stats-pass delta cursor rode the event `timestamp`, a business attribute
not an ingestion watermark: forecast rows carry FUTURE timestamps (poison the
cursor, stall the delta forever) and backfills carry PAST ones (never scanned).
`received_at` is ~68% null so it can't replace the axis.

Fold the inventory/evidence aggregation into the single full-partition GROUP BY
that the counts already used, and remove the cursor. Discovery is now one
stateless, idempotent snapshot per run — immune to forecasts, backfills, late
data and clock skew. Cost: one bounded aggregation per (manual) run; the
map-key/json-path caps bound memory. Response keeps `cursor: null` for client
back-compat (spec 080).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@acmeguy acmeguy merged commit 1fc4e1d into main Jul 9, 2026
3 checks passed
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.

1 participant