# ADR 0007: Governance and lineage

> Binding.

Source: https://openlakeforge.dev/docs/adr/0007-governance-and-lineage/

## Status

Binding.

## Context

The platform emits lineage naturally at two points — Floe writing Silver Iceberg
tables, and dbt writing Gold Iceberg tables. Surfacing that in a governed catalog
with end-to-end lineage is the goal. Getting there took two failed attempts,
and what was learned from them is worth more than the final configuration.

## Decision

### OpenMetadata is the governance target, and it is optional

OpenMetadata provides catalog discovery, domain and data-product entities, and
lineage. It is deployed only in the Full profile; Slim omits it entirely and e2e
assertions for it are skipped rather than failed.

The artifacts phase seeds domains, data products, and medallion bucket
containers over REST.

### One OpenMetadata, stage-qualified service roots

A deployment runs one OpenMetadata however many stages enable governance. Stage
is carried by service identity, never by a Domain: every governed stage gets its
own `<catalog service>.lakehouse_<stage>` database root, a `dagster_<stage>`
pipeline service, and a `superset_<stage>` dashboard service when that stage
also enables analytics. The bootstrap removes the services of a stage that
stopped being governed.

The lakehouse database service (named `polaris`, or `aws_glue` on AWS)
crawls through Trino: OpenMetadata 1.13 removed its Iceberg connector, and in
Trino every stage is one catalog, `lakehouse_<stage>`, which OpenMetadata lists
as one database. The crawl is filtered to the governed stages' catalogs, so
every governed stage is crawled into its own root, as the read-only
`openmetadata` Trino user. `olf infra openmetadata deploy-metadata` adds each stage's
domains and descriptions under that root. It sets a domain on the
`<domain>_silver` and `<product>_gold` schemas, and the tables the crawl finds
inherit it. A data product's assets are the tables under its Gold schema,
attached once the crawl has found them; its Silver inputs appear as lineage.

Every governed stage emits its own lineage. OpenMetadata 1.13+
resolves a lineage dataset by `<service>.<database>.<schema>.<table>`, so a
stage's edges land on its own `lakehouse_<stage>` tables even though schema and
table names are identical across stages; 1.12 matched on schema and table
alone, and could attach one stage's lineage to another's. Each stage emits
under its own `dagster_<stage>` namespace. An edge needs both of its tables registered before the lineage arrives:
OpenMetadata 1.13.6 fails to auto-create the tables and pipelines an event
references (an upstream bug: the entity is inserted without `updatedAt`), so
an event naming an unknown table records no edge. `olf infra openmetadata
deploy-metadata` therefore registers, at activation, each `<domain>_silver`
and `<product>_gold` schema and every table the stage's pipelines write: one
per Floe entity under the Silver schema and one per dbt model under the Gold
schema. A table is only ever created, never overwritten, and the crawl adopts
it by name and fills in its columns. The crawl never deletes schemas or
tables, so a crawl before the stage's first run cannot retire them. Edges are
recorded without a pipeline reference, and nothing may rely on pipeline
entities. The nightly asserts that each stage's
Gold lineage exists and never reaches another stage's database. The local root registers every
governed stage; the AWS and Azure roots still register one until their
adapters follow (#131).

### Lineage is emitted natively, directly to OpenMetadata

Floe and dbt-trino each emit OpenLineage events straight to OpenMetadata's
`/api/v1/openlineage/lineage` endpoint.

- The Floe environment profile the code location renders carries the endpoint;
  each domain's Floe Job receives the ingestion-bot JWT as `OPENLINEAGE_API_KEY`
  through a Kubernetes Secret reference (`secretKeyRef`), and Floe reads it from
  the environment, so the token never enters the profile or the Job spec.
- `openlineage-dbt` ships in the project-code image; Dagster sets the product job
  name around the dbt invocation so events carry stable logical identities.
- The dataset namespace matches the catalog identity: `polaris` locally and on
  Azure, `aws_glue` on AWS. dbt-trino's namespace is the Trino URI it connects
  to, so both of Trino's listeners are mapped to the catalog service: the HTTP
  port, and the HTTPS port dbt uses once workload authentication is on.
- OpenMetadata owns entity resolution and lineage persistence.

### Two rejected approaches, still rejected

**A normalising OpenLineage proxy.** An earlier design deployed a proxy that
rewrote Floe and dbt events before forwarding them. It ran successfully and
produced incomplete or wrongly-attached lineage, because the real problems were
upstream: Floe emitted non-UUID run IDs and omitted dataset context, and
dbt-duckdb resolved datasets under the local DuckDB file namespace rather than
the Iceberg catalog. The proxy converted those into a silent correctness problem
instead of a visible failure.

**A custom Dagster REST push.** Constructing lineage edges from Dagster and
pushing them directly was rejected for the same reason: it produces lineage that
looks right without the engines actually reporting what they did.

Both remain rejected. The rule they establish: **lineage is emitted by the engine
that performed the write, or it is not emitted.** Anything else is a plausible
graph that nobody has verified.

Native emission only became viable once the upstream causes were fixed — Floe
began passing its entities to its lineage observer with resolved Bronze
source URIs and Silver outputs, and Gold moved from dbt-duckdb to dbt-trino,
whose dataset namespaces resolve to the real catalog (ADR 0001).

### The Dagster connector stays deferred

OpenMetadata's Dagster pipeline service and ingestion pipeline are registered but
not triggered: the connector queries the deprecated `PipelineRuns` GraphQL type
while Dagster 1.x exposes `Runs`. Registering without triggering keeps the
service definition in place for when the connector is corrected, without
scheduling an ingestion that would fail on every run.

## Consequences

The complete Bronze→Silver→Gold graph resolves in OpenMetadata when the
governance layer is enabled.

The Floe profile stays credential-free; this ADR does not create an exception
to that rule.

Superset dashboards appear in OpenMetadata only after its dashboard ingestion
pipeline crawls the Superset API. Report import and metadata crawl are separate
operations, and Superset — not OpenMetadata — is the source of dashboard runtime
state.

## History

Merges the decisions previously recorded as ADR 0006 (OpenMetadata governance
with an OpenLineage proxy), 0009 (deferring lineage, and rejecting both the proxy
and a custom REST push), and 0023 (restoring native emission).

2026-09-23 (#131): stage-qualified service roots replace the single unqualified
`dagster` and `superset` services, and the one-governed-stage limit is lifted
on the local root.

2026-09-29 (#131): every governed stage emits lineage under its own namespace,
OpenMetadata auto-creates lineage entities, and OpenMetadata moves to 1.13.6
for database-qualified dataset resolution. 1.13 has no Iceberg connector, so
the lakehouse service crawls through Trino, which also crawls every governed
stage instead of only the canonical one.

2026-10-01 (#131, #257): table stubs survive the crawl, and lineage pipeline
entities are recorded as not created on OpenMetadata 1.13.6.

2026-10-29 (#545): domains are set on schemas, not tables, and table stubs are
no longer seeded; products attach their Gold tables only.

2026-10-31: tables are registered at activation again, named from the Floe
entities and dbt models, because OpenMetadata 1.13.6 cannot auto-create them
and dropped every Gold edge without them.

2026-10-31: Trino's HTTPS listener is mapped beside its HTTP one. dbt has
reported its datasets under the TLS port since workload authentication;
OpenMetadata 1.13.6 still resolved them by table name, but its main branch drops
a dataset whose namespace is not mapped.

2026-10-28 (#533): Floe emits lineage from one Kubernetes Job per domain, with
the endpoint in the profile the code location renders and the JWT as a Secret
reference on the Job; there is no generated manifest left to keep
credential-free.

---

<small>Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/adr/0007-governance-and-lineage.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/adr/0007-governance-and-lineage.md).</small>
