perf(row-types): stateless full-snapshot discovery — drop the delta cursor#66
Merged
Conversation
…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>
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.
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 keythe 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 keepscursor: nullfor 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 (mapKeysfor Map cols,JSONAllPathsfor JSON cols, classified dynamically per schema).node --checkpasses.Companion: cxs2
080-stateless-discovery(snapshot reconciliation). Spec 080.🤖 Generated with Claude Code