Skip to content

feat(smart-gen): bound baked meta, Cube-native descriptions, idempotent reconciles#64

Merged
acmeguy merged 1 commit into
mainfrom
chore/smart-gen-meta-trim
Jul 8, 2026
Merged

feat(smart-gen): bound baked meta, Cube-native descriptions, idempotent reconciles#64
acmeguy merged 1 commit into
mainfrom
chore/smart-gen-meta-trim

Conversation

@acmeguy

@acmeguy acmeguy commented Jul 8, 2026

Copy link
Copy Markdown

What

Generated models were ~⅔ per-field meta by volume — redundant type/provenance echoes plus volatile value snapshots (ranges, 60-value enum lists, exact cardinalities) that rot as data arrives, bake identifier values (PII) into schema files, and defeat the reconciler's no-change guard so nearly every reconcile minted a no-op version.

Principle: the model carries shape + semantics; the data plane answers value questions (live queries, /meta/dynamic).

Changes (all in utils/smart-generation/)

  • Dropped (verified write-only across synmetrix + cxs2): range, raw_type, max_array_length, known_keys (superseded by 014 /meta/dynamic), cube-level refresh_cadence
  • unique_values: exact ≤ 12, else rounded to 2 significant figures — consumers only threshold (7 pie / 12 facet / 50 searchable / 500 list / 2000 lazy), exact large counts were pure churn
  • lc_values / known_values: baked only as a complete (≤ 12 distinct) set that is not identifier-shaped (UUID/email/opaque-token guard — fixes user UUIDs baked into user_id.meta.lc_values)
  • Descriptions are Cube-native description properties now (member + cube; meta.description gone) — surfaces in standard Cube tooling; expanded map keys no longer repeat the parent column's description dozens of times
  • Titles baked only where the acronym-aware form differs from Cube's derived default (Entity GID kept, Store Format dropped)
  • merger + templateMerger shed legacy generator keys (refresh_cadence, cube meta.description) instead of preserving them forever as presumed user keys

Full key-by-key consumer map + dispositions: docs/plans/2026-07-07-smart-gen-meta-trim-scope.md (in this PR).

Verification (live dev stack, real ClickHouse)

Check Result
Unit suite 620/622 — the 2 failures (partition.test.js) pre-exist on main (verified in a clean worktree)
Fresh smart-generate apply (doc-anchor datasource, event='Sales Report Submitted') per-field meta 9.0 → 3.8 lines; zero forbidden keys; UUID guard live-verified (account_id); store_format keeps its complete 8-value enum; 158,604 → unique_values: 160000
Applied model queryable store_format × count matches doc anchors exactly (Discount Supermarket = 82,180)
Reconcile idempotency (/internal/reconcile-team ×3, somi team) run 1 converges trim (updated), run 2 all skipped_no_change
cxs2 079 e2e vs this backend US1 smart-generation 5/5, US2 dynamic explore 6/6

cxs2 needs no code change (all meta reads are null-guarded with thresholds preserved); its editor meta-conventions + the semantic-layer skill docs were synced separately.

Known follow-up (pre-existing, out of scope)

Probe key inventory can flap on rare map keys (profiler deep-pass sampling — holiday_name appeared in one reconcile probe, not the next). With meta now byte-stable, this is the only remaining reconcile churn source. Candidate fix: occurrence-thresholded or unsampled key discovery.

🤖 Generated with Claude Code

…nt reconciles

Generated models were ~2/3 per-field meta: volatile value snapshots
(ranges, 60-value enum lists, exact cardinalities) that rot as data
arrives, leak identifier values (PII) into schema files, and defeat the
reconciler's no-change guard so every reconcile minted a version.

The model carries shape + semantics; the data plane answers value
questions (live queries, /meta/dynamic). Changes:

- drop write-only keys: range, raw_type, max_array_length, known_keys
  (superseded by /meta/dynamic), cube refresh_cadence
- unique_values: exact <= 12, else 2 significant figures (consumers
  only threshold at 7/12/50/500/2000)
- lc_values / known_values: baked only as a COMPLETE (<= 12) set that
  is not identifier-shaped (UUID/email/opaque-token guard)
- descriptions move to the Cube-native description property (member +
  cube); expanded map keys no longer repeat the parent column's text
- titles baked only where the acronym-aware form differs from Cube's
  derived default (Entity GID vs Entity Gid)
- merger/templateMerger shed legacy generator keys instead of
  preserving them forever as presumed user keys

Verified live (dev stack, doc-anchor datasource): per-field meta 9.0 ->
3.8 lines; applied model queryable (store_format counts match doc
anchors); reconcile-team run 2 = all skipped_no_change; cxs2 079 e2e
US1 5/5 + US2 6/6 against this backend. Unit suite 620/622 (2 failures
pre-exist on main, partition.test.js). Known follow-up: probe key
inventory can flap on rare map keys (profiler sampling) - now the only
churn source.

Scope + consumer map: docs/plans/2026-07-07-smart-gen-meta-trim-scope.md

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@acmeguy acmeguy merged commit 17d111e into main Jul 8, 2026
3 checks passed
@acmeguy acmeguy deleted the chore/smart-gen-meta-trim branch July 8, 2026 05:13
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