Skip to content

fix(modeler): dedup a multi-active satellite's CDK from its attributes#13

Merged
mischa76 merged 1 commit into
mainfrom
fix-masat-cdk-dedup
Jul 16, 2026
Merged

fix(modeler): dedup a multi-active satellite's CDK from its attributes#13
mischa76 merged 1 commit into
mainfrom
fix-masat-cdk-dedup

Conversation

@mischa76

Copy link
Copy Markdown
Owner

Summary

Re-running the health_insurance demo to refresh the walkthrough figures exposed that it failed validation 4/4: every run tripped E_SAT_DUP_ATTR on sat_insured_person_address. The modeler listed the multi-active satellite's child dependent key (address_type) also among its attributes; attributes + child_dependent_key share one column namespace (src_payload + src_cdk), so the generated satellite would emit that column twice and cannot build. The re-model loop couldn't recover within MAX_MODELING_ATTEMPTS.

Fix

Both, since LLM steering alone failed 4/4 even with the error fed back through the retry loop:

  • A [GUIDE] line in DV_MODELING_RULES: a multi-active CDK is a key column, not payload — never also list it among the attributes.
  • Deterministic rules.attributes_without_cdk(attributes, child_dependent_key), applied by dv2_modeler._validate_model — drops payload attributes normalising to a CDK label (order-preserving; the CDK column still ships via src_cdk). Meaning-preserving — genuine attribute-vs-attribute duplicates are left for E_SAT_DUP_ATTR to flag.

Verification

  • Health demo now PASSES 3/3 (0 issues, was 0/4). A representative run: 4 hubs / 3 links / 8 satellites → 15 raw-vault + 8 staging models, matching the walkthrough.
  • 333 tests green (+2: attributes_without_cdk unit + modeler-dedup integration), ruff clean, uv run mypy clean (32 files).
  • Refreshed docs/demos/health-insurance-walkthrough.md (staging count in the figures).

Note

A separate, sporadic gate (E_SAT_ATTR_OVERLAP on hub_policy) appeared once pre-fix and not in the post-fix runs — a different, lower-frequency modeler-quality issue, not addressed here.

🤖 Generated with Claude Code

Re-running the health_insurance demo to refresh the walkthrough figures exposed that it
FAILED validation 4/4: every run tripped E_SAT_DUP_ATTR on the multi-active
sat_insured_person_address, because the modeler listed the child_dependent_key
(address_type) ALSO among the satellite's attributes. Attributes and child_dependent_key
share one column namespace (src_payload + src_cdk), so the generated satellite would emit
that column twice and cannot build. The re-model loop couldn't recover within
MAX_MODELING_ATTEMPTS.

Fix (both, since LLM steering alone failed 4/4 even with the error fed back through the
retry loop):
- A [GUIDE] line in DV_MODELING_RULES: a multi-active CDK is a key column, not payload —
  never also list it among the satellite's attributes.
- Deterministic rules.attributes_without_cdk(attributes, child_dependent_key), applied by
  dv2_modeler in _validate_model: drops payload attributes normalising to a CDK label
  (order-preserving; the CDK column still ships via src_cdk). Meaning-preserving — genuine
  attribute-vs-attribute duplicates are left for E_SAT_DUP_ATTR to flag.

After the fix the health_insurance demo PASSES 3/3 (0 issues, was 0/4); a representative run
is 4 hubs / 3 links / 8 satellites -> 15 raw-vault + 8 staging models, matching the
walkthrough. Refreshed the walkthrough's dbt-model figure (now incl. the staging count).

333 tests green (+2: attributes_without_cdk unit + modeler-dedup integration), ruff clean,
mypy strict clean (32 files).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mischa76 mischa76 merged commit 3cfd844 into main Jul 16, 2026
4 checks passed
@mischa76 mischa76 deleted the fix-masat-cdk-dedup branch July 16, 2026 06:35
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