Skip to content

feat(contracts): finalized v1 DataLex contracts for the demo - #10

Merged
KKranthi6881 merged 2 commits into
mainfrom
feat/contracts-v1
May 1, 2026
Merged

feat(contracts): finalized v1 DataLex contracts for the demo#10
KKranthi6881 merged 2 commits into
mainfrom
feat/contracts-v1

Conversation

@KKranthi6881

Copy link
Copy Markdown
Collaborator

Adds the four canonical commerce-domain contracts that the DataLex+DQL walkthrough references end to end. Schema-validated against `manifest-spec/v1` (will be live at `github.com/duckcode-ai/manifest-spec` once the org repo create lands).

Two artifacts

File Purpose
`DataLex/commerce/contracts.model.yaml` Source-of-truth YAML the user authors; the DataLex compiler will eventually consume it to emit the v1 manifest.
`datalex-manifest.json` (repo root) Hand-curated v1 compiler output, schema-valid against `manifest-spec/v1`. DQL projects in the walkthrough drop this file in and resolve their `datalex_contract = "..."` references against it today. Goes away once the DataLex compiler ships the v1 emitter.

The four contracts

  • `commerce.Customer.monthly_active_customers@1` — backs the new `monthly_active_customers.dql` block in duckcode-ai/jaffle-shop-dql#6.
  • `commerce.Customer.customer_lifetime_value@1` — backs LTV cohorts and dim_customers slices.
  • `commerce.Order.monthly_revenue@1` — backs the monthly business review dashboard.
  • `commerce.Order.order_total_non_negative@1` — row-level invariant; data-quality enforcement.

Test plan

  • `jsonschema` validates `datalex-manifest.json` against `schemas/v1/datalex-manifest.schema.json`
  • After duckcode-ai/dql#28 lands, `dql compile` in jaffle-shop-dql with this manifest in scope resolves the `commerce.Customer.monthly_active_customers@1` reference cleanly
  • `datalex serve` continues to render the conceptual / logical / physical diagrams without regression

Followups

  • DataLex compiler v1 emitter (separate PR in duckcode-ai/DataLex) — once that lands, this PR's hand-crafted `datalex-manifest.json` is replaced by an auto-generated one.

🤖 Generated with Claude Code

claude added 2 commits May 1, 2026 12:29
Adds the four canonical commerce-domain contracts the joint
DataLex+DQL walkthrough references end-to-end:

  - commerce.Customer.monthly_active_customers   (backs the new MAU block)
  - commerce.Customer.customer_lifetime_value    (backs LTV blocks/cohorts)
  - commerce.Order.monthly_revenue               (backs the monthly review)
  - commerce.Order.order_total_non_negative      (data-quality invariant)

Two artifacts ship together:

1. DataLex/commerce/contracts.model.yaml — the source-of-truth YAML
   in DataLex's existing convention extended with manifest-spec v1
   contract fields (id, version, signature.inputs, signature.outputs,
   constraints). This is what users author and the DataLex compiler
   will eventually consume to emit the v1 manifest.

2. datalex-manifest.json (repo root) — the hand-curated v1
   compiler-output artifact, conforming to
   manifest-spec/schemas/v1/datalex-manifest.schema.json. DQL
   projects in the walkthrough drop this file in and resolve their
   `datalex_contract = "..."` references against it today, before
   the DataLex compiler natively emits the v1 manifest. Verified
   schema-valid.

Why both: the YAML is the human-authored source; the JSON is what
the DQL compiler/MCP consume. Until the DataLex compiler ships its
v1 emitter, the JSON is hand-curated; once the emitter lands, the
JSON gets generated from the YAML and we delete the hand-crafted
copy.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The DataLex CLI's validator accepts these top-level kinds: project,
entity, source, model, term, domain, policy, snippet, diagram,
relationship, data_type, semantic_model. Our top-level
`kind: contracts` documents the intended source-of-truth shape but
isn't yet a first-class DataLex artifact, so the .model.yaml
extension caused CI to flag it.

Renaming to .spec.yaml takes it out of the
`models: DataLex/**/*.model.yaml` glob in datalex.yaml. The file
content is unchanged and remains a human-readable reference for
the contracts surfaced in the canonical datalex-manifest.json.

When the DataLex compiler grows a first-class contracts kind we'll
revisit the extension.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@KKranthi6881
KKranthi6881 merged commit 74bf3b5 into main May 1, 2026
1 check failed
@KKranthi6881
KKranthi6881 deleted the feat/contracts-v1 branch May 1, 2026 18:25
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.

2 participants