feat(analytics): ADR-0037 P3 — draft data preview (seed-overlay dataset queries)#1726
Merged
Merged
Conversation
…et queries) queryDataset gains options.previewDrafts: when set AND the dataset's base object has a PENDING seed draft, the selection is evaluated over the seed's rows in memory — a query-evaluating proxy feeds the unchanged DatasetExecutor, so measure filters / compareTo / derived measures behave identically. The Live Canvas charts real numbers from drafted sample data BEFORE publish, and since publish materializes the same seed, the numbers are continuous across the gate. - preview-evaluator.ts: AnalyticsQuery over rows — Mongo-style where subset, timeDimension dateRange + granularity bucketing (day/week/month/quarter/ year), count/countDistinct/sum/avg/min/max, order/limit/offset. - AnalyticsServiceConfig.draftRowsResolver — injected hook; analytics plugin wires it to the kernel protocol (state:'draft' seed reads ONLY: a published seed's rows are already in the table and must not overlay). No pending seed → falls through to live data, so published objects keep charting real data inside a preview. - REST /analytics/dataset/query: body.previewDrafts / ?preview=draft thread through to the lookup (draft-overlaid dataset definitions) and execution. - spec: IAnalyticsService.queryDataset optional options param (additive). Reads only; same ExecutionContext principal; never touches physical tables. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Implements ADR-0037 Phase 3 (option B-min) — the only genuinely new mechanism of the Live Canvas: draft data preview.
What
queryDataset(dataset, selection, context, { previewDrafts }): when the flag is set and the dataset's base object has a pendingseeddraft, the selection is evaluated over the seed's resolved rows in memory — a query-evaluating proxy feeds the unchangedDatasetExecutor, so measure-scoped filters,compareToand derived measures all behave identically to the engine path.preview-evaluator.ts—AnalyticsQueryover rows: Mongo-stylewheresubset ($eq/$ne/$gt/$gte/$lt/$lte/$in/$nin/$contains/$and/$or/$not),timeDimensionsdateRange filtering + granularity bucketing (day/week/month/quarter/year), count/countDistinct/sum/avg/min/max, order/limit/offset.draftRowsResolverconfig hook; the analytics plugin wires it to the kernel protocol withstate:'draft'reads only — a published seed's rows are already in the real table and must not overlay. No pending seed → clean fall-through to live data (published objects keep charting real data inside a preview; numbers are continuous across Publish because publish materializes the same seed)./analytics/dataset/query:body.previewDrafts/?preview=draftthread through to both the saved-dataset lookup (draft-overlaid definitions) and execution.optionsparam onIAnalyticsService.queryDataset.Security
Reads only, same
ExecutionContextprincipal as any other read; the flag changes the source, never the principal (ADR-0037 §Phase 3). Physical tables untouched.Tests
9 new cases: seed-overlay aggregation (group/sum/count), month bucketing, fall-through proof (no pending seed → engine path), flag ignored without resolver, evaluator units (filters, dateRange, order/limit, zero-row count, helpers). Suites green: service-analytics 118/118, rest 100/100.
Follow-up (objectui, next PR)
DatasetWidget/list reads pass the flag underPreviewModeContextso the canvas iframe actually sends it;/data/:objectlist-read overlay per ADR remains open.🤖 Generated with Claude Code