Mokum Solutions logoMokum Solutions, LLC

Data contracts: startup guide

How to add a data contract to FiduLock and how to configure it, from first draft to ACTIVE.

Startup guide · Platform v1.0.0 · For the Data Steward and ODCS Author roles · Full detail in Volume 3, chapter 9

1. What a contract is

A data contract is the written terms a data product is delivered under, in the Open Data Contract Standard (ODCS, version 3.2). It holds the schema, the quality rules, the service levels (SLAs), the Statement of Intent (SoI) it serves, and regulatory tags. It has three layers of definition:

  • Plain-language description (purpose, usage, limitations). This is the only layer an Agent reads. It is scored for clarity.
  • Technical contract: schema, quality rules, SLAs.
  • Regulatory annex: the legal wording, never shown to an Agent.

A contract starts as a DRAFT. It serves nothing until it is ACTIVE. A live contract that changes in a breaking way never overwrites itself; it forks a new DRAFT.

2. Before you start

  1. A role. To create or activate a contract you need DATA_STEWARD, GOVERNANCE_LEAD, ODCS-Author or SUPER_ADMINISTRATOR. Only the first, second and last may add a SQL quality rule.
  2. A registered data product. You need its ID. Register it in the Data Catalog first and describe its fields.
  3. A named Business Owner on the product, by user ID. With CONTRACT_OWNER_CHECK at enforce, activation is refused without one.
  4. A Statement of Intent for the purpose the contract serves. It must be ACTIVE and signed by the Business Owner before the entry gate passes.
  5. Know your sensitivity. If any field is CONFIDENTIAL or RESTRICTED you must declare how it is masked (section 6).

3. Add a contract in the UI

The Contracts list
The Contracts list. New Contract is at the top right. Filter by status or search by name, producer or consumer.
  1. Open Contracts and choose New Contract. A live ODCS JSON preview on the right updates as you type.
  2. Basic information. Contract name (lowercase, hyphen-separated), version (semantic, start at 1.0.0), producer team, consumer team (they cannot be the same team), and the Data Product ID.
  3. Schema fields. Pick the data product and choose Populate Data Elements to copy its fields, or add them one by one with a type and whether each is required.
  4. Quality rules. Add the checks to run on the real data (see section 5).
  5. Service level agreements. Add the promises and what happens on breach.
  6. Statement of Intent. Link the purpose the contract serves.
  7. Compliance and regulatory tags. For example GDPR or EU_AI_ACT.
  8. Choose Create Contract. You get a DRAFT.
The New Data Contract form
New Data Contract. The six sections are on the left; the ODCS JSON preview on the right updates as you type. Preview JSON shows it full size and Create Contract saves a DRAFT.
Drafts and rulesA DRAFT may be saved without runnable rules. It cannot be activated without them.

4. Add a contract through the API

The UI calls the same endpoint. Send POST /contracts to contract-engine (port 8005; through the API gateway on port 8000 in a full stack) with your identity headers or token.

{
  "data_product_id": "<product uuid>",
  "contract_name": "northwind-orders",
  "version": "1.0.0",
  "producer": "sales-engineering",
  "consumer": "finance-analytics",
  "schema_name": "orders",
  "schema_definition": {
    "type": "object",
    "properties": {
      "order_id":    { "type": "string" },
      "customer_id": { "type": "string" },
      "amount":      { "type": "number" }
    },
    "required": ["order_id"]
  },
  "quality_rules": [
    { "field": "order_id", "rule_type": "completeness", "min_population_pct": 99 },
    { "field": "amount",   "rule_type": "range", "min_threshold": 0 }
  ],
  "slas": [
    { "metric": "freshness_hours", "threshold": 24, "breach_action": "alert" }
  ],
  "regulatory_tags": ["GDPR"],
  "description": {
    "purpose": "Shows every customer order so finance can report monthly revenue."
  }
}

The response is the DRAFT, with its id. Keep it for the next steps.

5. Import an ODCS file

If you already have an ODCS v3.2 YAML or JSON file:

  1. POST /contracts/odcs/validate checks it against the official schema and reports problems without saving.
  2. POST /contracts/odcs/import creates a DRAFT from it. A draft may be imported without runnable rules.
Computed values are ignoredThe import ignores tdk, trustBadge, blastRadius and passportHash with a warning. The platform computes these itself; do not try to set them in the file.

Library checks such as missingValues and invalidValues that must be 0 import as runnable rules.

6. Configure the contract

Quality rules

Rule typeUse it toKey settings
completenessRequire a field to be filled in.min_population_pct (your own line, 0 to 100); when makes it conditional ({field, op: equals|in|not_null, value}).
rangeBound a number.min_threshold, threshold (maximum).
regexMatch a pattern.pattern.
in_listAllow only listed values.allowed_values.
no_placeholderReject test data such as 999-99-9999, test@email.com, n/a.denied_values adds your own.
toleranceKeep a value within a percentage of another column.reference_field, tolerance_pct.
sqlOne read-only SELECT returning one number.operator, expected, severity (warn or error), business_impact. Checked when written: single SELECT, no writes, at most 2000 characters. Runs read-only with a 5 second timeout. Steward, Governance Lead or Super Administrator only.

Mark a column that matters most with criticalDataElement. The platform then watches its mean and raises a drift alert or an anomaly when it moves.

Service levels (SLAs)

Every ACTIVE contract's SLAs are checked every 15 minutes. Each SLA has a metric, a threshold and a breach_action of alert, revoke or quarantine.

MetricThreshold means
freshness_hoursThe oldest the data may be.
completeness_pct, accuracy_pctThe lowest acceptable pass rate.
validity_pctThe data-quality floor: the weakest checkable rule.
volume_variance_pctLargest allowed % gap to a source table named in element (same PostgreSQL database).
volume_history_pctLargest allowed % gap from the median of the last 30 snapshots.
arrival_minutesThe most minutes between deliveries. Producers must call POST /monitor/{id}/heartbeat on data-product-monitor.
availability_pctShare of governed reads over 30 days that the platform answered.
Choose breach actions with carerevoke and quarantine SUSPEND the contract, and every child contract with it, until the SLAs hold again. Start with alert and tighten later.

GET /contracts/{id}/sla-coverage lists the freshness, volume and validity promises your contract is missing.

Masking for sensitive fields

Any property classified confidential or restricted must declare an obfuscationMethod, or activation is refused with 422 obfuscation-method-missing.

obfuscationMethodResult
one_way_hashHASH
partial_redactPARTIAL
dynamic_maskingFULL, unless maskingByIntent loosens it for a stated purpose, e.g. { "FRAUD_REVIEW": "PARTIAL" }. Only PARTIAL, HASH and FULL are allowed, never the raw value.

A contract can only add masking. It can never loosen what the data catalog already masks.

Governance settings

FieldWhat it does
hitl_floorOptional trust-score line (above 0, up to 100). It can only raise the platform floor. Below it, an Agent's request goes to a human.
data_classREGULATED, OPERATIONAL or EXPLORATORY.
step_floorsTrust needed per action step (recommend, draft, approve, execute, transfer). Never falls as the step gets riskier.
environmentIncluding NON_PRODUCTION, which serves no unmasked confidential data when NON_PROD_MASKING is enforced.
lineage_upstreamUpstream products and the logic that feeds this one. Written once when the contract goes live.
row_filters, join_keys, write_scopeWhat rows may be read, how products join, and what an Agent may write.
descriptionPlain-language purpose, usage, limitations. Keep sentences short and say only what is true of the contract.

7. Policy blocks

Blocks live in odcs_extras (or as an ODCS custom property of the same name). CONTRACT_BLOCKS_CHECK is shadow by default: a faulty block is logged and the contract still activates. At enforce, activation is refused with 422 contract-blocks-invalid.

"odcs_extras": {
  "columnMasking": [
    { "column": "email", "mode": "PARTIAL", "exceptionRoles": ["DATA_STEWARD"] }
  ],
  "maxRecordAge": { "field": "created_at", "hours": 720 },
  "serviceTier": "GOLD",
  "schemaEvolution": { "allowed": "MINOR" },
  "consentFilter": { "column": "ai_consent", "permittedValues": ["YES"] }
}

Check the exact shape of each block in GET /contracts/{id}/declarations after saving. The full list (columnMasking, maxRecordAge, serviceTier, utilityThreshold, thresholdOverrides, schemaEvolution, entityIdMapping, failurePosture, relaxedGates, consentFilter, destinationZone) is in the user manual, Volume 3 chapter 9.

Declarations checked before activation

SettingChecksRefusal at enforce
CONTRACT_GLOSSARY_CHECKREGULATED contracts: every field maps to an approved glossary term.422 contract-glossary-unmapped
CONTRACT_STANDARD_TYPESDate, time, currency and country fields declare a standard type or format.422 contract-standard-type-missing
CONTRACT_SCHEMA_CONFORMANCESchema matches the approved schema of the same name.409 schema-differs-from-approved
CONTRACT_TEXT_GATEThe contract's own descriptions pass the plain-language check (Impact Class C or D by default).422 contract-text-unclear

Each is shadow (log only) by default, enforce to refuse, off to skip. Start in shadow, read the logs, then enforce.

8. Activate

  1. Check what is missing. GET /contracts/{id}/declarations and GET /contracts/{id}/sla-coverage. GET /contracts/{id}/text-check previews the clarity score.
  2. Activate: POST /contracts/{id}/activate (or the Activate button). Roles: Data Steward, Governance Lead, ODCS Author, Super Administrator.
  3. If this replaces an earlier version, the old one is superseded and starts a 30 to 90 day countdown set by the product's strictest Impact Class.
Two further conditions can applyTwo further conditions can apply: an EU_AI_ACT contract needs a competent person's oversight sign-off (POST /contracts/{id}/oversight-signoff) when CONTRACT_OVERSIGHT_CHECK is enforced, and a contract with the tag must carry a complete regulatory_compliance block.

9. After activation

A contract's summary card and clarity
Summary card and clarity. The description scored 77.66 out of 100 (readability 88.75 times consistency 87.5) and passed. Below it, the one-page card: risk, purpose, consumers, trust floor and SLAs, and who signed.
  • Run the entry gate on the product (Gate tab, Run Gate Check). It runs about fourteen checks and names every failing step in one run.
  • Build and score the product, so it earns a trust badge.
  • Read the summary card: GET /contracts/{id}/summary-card shows purpose, owners, risk, trust floor, SLAs and consumers on one page.
  • Export: GET /contracts/{id}/odcs returns the contract as ODCS.
  • Change it safely. Use POST /contracts/{id}/change-preview first. A PATCH (an adjustment) applies in place; a MINOR (an addition) bumps the version and reaches child contracts; a MAJOR (dropped or renamed column, changed type) forks a DRAFT 2.0.0 and waits for every affected Business Owner to acknowledge it.
  • Children. Another team can create a child contract (POST /contracts/{id}/children) that inherits yours and may only tighten SLAs and floors.
  • Pausing SLAs for planned work needs a Governance Lead, Ops administrator or Super Administrator: POST /contracts/{id}/sla-suspensions, at most 24 hours with a written reason.
A PATCH change preview
Preview a change: PATCH. Tightening an SLA is a PATCH: version 1.1.1, human impact NONE.
A MAJOR change preview
Preview a change: MAJOR. Dropping columns is a MAJOR change: version 2.0.0, human impact HIGH. The live version keeps serving and a new DRAFT is forked.
A suspended contract
A suspended contract. The SUSPENDED badge, the written reason and the Resume control, shown to the roles allowed to resume.

10. Troubleshooting

You seeWhyDo this
403 on create or activateYour role is not allowed.Ask for a Data Steward, Governance Lead or ODCS Author role.
422 obfuscation-method-missingA confidential or restricted field has no masking method.Add obfuscationMethod to that property.
422 contract-owner-missingThe product has no Business Owner by user ID.Set the owners on the product, then activate again.
422 contract-text-unclearThe description fails the clarity check.Shorten sentences, define acronyms, name only real columns. Check with text-check.
422 contract-blocks-invalidA policy block is malformed (enforce only).Read the list in /declarations.
409 change-not-acknowledgedA breaking version waits for owners.Ask each affected Business Owner to acknowledge it.
409 schema-differs-from-approvedYour schema differs from the approved one of that name.Propose a new schema version in the glossary and have a second person approve it.
Reads refused with CONTRACT_SUSPENDEDAn SLA breach (revoke or quarantine) or a person suspended it.Fix the cause. The 15-minute sweep resumes platform-suspended contracts; or resume it with POST /contracts/{id}/resume.
Gate fails on freshnessThe contract promises freshness but nothing measures it.Run the content monitor on the product.

Source: FiduLock user manual, Volume 3 (Data Steward), chapters 9 to 11. Settings named here default to shadow unless stated; confirm your deployment's values before relying on a refusal.