Skip to content

feat(080): row-type discovery probe + template-seeded generation (cxs2 spec 080)#65

Open
acmeguy wants to merge 4 commits into
mainfrom
080-row-type-generation
Open

feat(080): row-type discovery probe + template-seeded generation (cxs2 spec 080)#65
acmeguy wants to merge 4 commits into
mainfrom
080-row-type-generation

Conversation

@acmeguy

@acmeguy acmeguy commented Jul 8, 2026

Copy link
Copy Markdown

Companion to smartdataHQ/cxs2#807 (internal SL row-type models). All changes additive.

New endpoints

  • POST /v1/discover-row-types — exact two-pass row-type discovery: novelty is a FULL snapshot every run (presence never rides on cursor semantics); stats ride per-table cursors (semantic_events (timestamp,event_gid) tuple-compare, data_points (timestamp,signature), entities _version + uniqExact(gid) current-state counts). Returns monotone map-key/JSON-path inventories (capped) and the next cursor from scan bounds. Series head-label enrichment via headSchema (non-fatal).
  • GET /v1/published-template?name= — the published global template (seed for the FR-020 maturation context package).

smart-generate (backward compatible)

  • template_name: seed via buildCubesFromTemplate + probe-prune against the request filters (published-template fetch replicated in cubejs — templateResolver.js, same GraphQL surface the reconciler's feed reads).
  • cube_meta: caller provenance (marker family Fix: resolve datasource access issues by simplifying user query logic #2, managed_by: row-type-pipeline) stamped INSTEAD of the 013 default_model/template_checksum pair.
  • Template path: forces skip_llm; disables deep-profile sampling (registry pruning must not flap on sampled key inventories — the pre-existing partition.test.js failures document the adjacent gap); forces the target table into internalTables so the generated cube bakes partition scoping even when team settings don't enumerate the table; regenerations merge via mergeTemplateModel (ai_generated/team content survives; auto_generated refreshes; template converges).

Auth/JIT

FraiOS JIT provisioning: tokens with provider: row-type-pipeline provision as team admin (dataschemas select/update permissions are owner/admin-only — a plain member reads an EMPTY dataschemas list, silently), with an upgrade path for already-provisioned identities.

Verification

  • cubejs npm test: 620/622 — the 2 failures are pre-existing on clean main (verified via stash).
  • Live from cxs2 e2e (somi.is: 13.9M semantic_events + 2.4M data_points, real ClickHouse): discovery idempotency incl. cursor stability, template-seeded generation with partition-scoped SQL and exact count match, group IN-models, no-change guard, entities skeleton mode, series-scoped models. cxs2 suites: US2 6/6, US3 10/10, US5 2/2.

🤖 Generated with Claude Code

acmeguy and others added 4 commits July 8, 2026 13:40
…2 spec 080)

- NEW POST /v1/discover-row-types: exact two-pass row-type discovery
  (novelty = full snapshot every run; stats via per-table cursors:
  semantic_events (timestamp,event_gid), data_points (timestamp,signature),
  entities _version + uniqExact(gid) snapshot counts); monotone map-key/
  JSON-path inventories; series head-label enrichment (headSchema).
- NEW GET /v1/published-template: the published global template by name
  (the FR-020 maturation package's seed).
- smart-generate: optional template_name (seed via buildCubesFromTemplate,
  probe-pruned by the request filters) + cube_meta (family-#2 provenance,
  replaces the 013 default_model/template_checksum stamp); template path
  forces skip_llm, disables deep-profile sampling (registry pruning must
  not flap), forces the target table into internalTables (partition
  scoping), and merges regenerations via mergeTemplateModel so
  ai_generated/team content survives.
- buildCubesFromTemplate: additive filters/cubeName/cubeMeta options.
- FraiOS JIT provisioning: the row-type-pipeline provider provisions as
  team ADMIN (dataschemas select/update perms are owner/admin-only) with
  an upgrade path for already-provisioned identities.

Verified live from cxs2 e2e (somi.is, 13.9M-row semantic_events + 2.4M-row
data_points): cxs2 suites US2 6/6, US3 10/10, US5 2/2. cubejs npm test:
620/622 (2 pre-existing partition.test.js failures on clean main).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ies head labels

- discover-row-types (semantic_events): identity = event value, but rows
  with an empty event register under synthetic 'type:<type>' keys (owner
  amendment — page/screen/identify/log/custom carry no event name).
- discover-row-types (data_points): optional headSchema — series display
  labels resolved from <headSchema>.timeseries (non-fatal when absent).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner refinement: an event type spans multiple sources across rows
(source.label/type are scalar Nullable(String) per row). Add a
sourceEvidence config on semantic_events and groupUniqArray(64) over
`source.label` in both the novelty + stats passes, surfaced as
observedSources alongside observedTypes. groupUniqArray drops NULLs, so
sourceless platform events fall out cleanly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner: count() + max(timestamp) are the PRIMARY active-indicator and were
missing/zero for most types because they came from the cursor-bounded delta.

- Novelty (full-partition) pass now computes total_count + min/max per key —
  always correct, independent of the delta cursor. count/min/max are cheap
  columnar aggregates.
- The delta pass carries ONLY the expensive union-mergeable evidence (distinct
  Segment types, source labels, map keys, JSON paths).
- Cursor bound is derived from the delta slice (its max IS the global max),
  removing a second full-partition scan.
- Truncation: raise caps (types 100, sources 256) + uniqExact totals +
  evidenceTruncated flag so capped arrays are no longer silently lossy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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