Skip to content

feat: export deterministic OpenMetadata service roots per stage - #221

Merged
malon64 merged 3 commits into
mainfrom
feat/131-openmetadata-stage-qualified-service-roots
Sep 16, 2026
Merged

malon64 merged 3 commits into
mainfrom
feat/131-openmetadata-stage-qualified-service-roots

Conversation

@malon64

@malon64 malon64 commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #131.

What this slice does

OpenMetadata is deployed once for the whole platform, but its live
Iceberg/Dagster/Superset connections still collapse to a single stage:
main.tf's governance_dagster_stage/governance_superset_stage pick
"the selected stage if it qualifies, else the first one sorted" out of
governed_stages, even though governed_stages already holds every
stage that enabled governance. Nothing exported by the provider
contract let a future bootstrap represent more than one governed
stage at all.

This PR adds the missing piece to the contract, per the issue's target
service-root naming (lakehouse_<stage> / dagster_<stage> /
superset_<stage>):

  • stages.<name>.orchestration.pipeline_service_name = dagster_<stage>,
    on every enabled stage's orchestration binding (not gated on
    governance - it's a stage property, independent of who reads it).
  • stages.<name>.reporting.dashboard_service_name = superset_<stage>,
    on every analytics stage's reporting binding.
  • Both are sourced in contracts.tf from the same stage_databases
    locals main.tf already derives dagster_<stage>/superset_<stage>
    from, so the names cannot drift from what Postgres actually
    provisions.
  • catalog.catalog_name (lakehouse_<stage>) already existed per
    stage, so with these two additions ProviderContracts.stages
    already carries everything a future bootstrap needs, keyed by stage.
    Added two properties: ProviderContracts.governed_stages (stages
    whose governance capability is on - the database/pipeline roots) and
    ProviderContracts.analytics_stages (stages whose analytics
    capability is on - the dashboard roots). They're separate because
    the two capabilities are independent per stage (ADR 0011): a stage
    can have analytics without governance or vice versa, so a consumer
    that only loops governed_stages would silently miss a
    superset_<stage> root that exists on an ungoverned analytics
    stage.
  • Extended docs/schema/provider-contracts.schema.json and
    tools/olf/olf/provider_contracts.py's parser (new optional fields,
    each validated against its own stage's canonical name) plus their
    tests. Both new fields are optional, matching the existing
    backward-compat pattern for orchestration.code_locations: a v3
    contract persisted before this change still parses.

AWS and Azure do not emit these fields yet, on purpose

infra/terraform/environments/aws-poc/contracts.tf and
azure-poc/contracts.tf are untouched by this PR and do not set
pipeline_service_name or dashboard_service_name - only
infra/terraform/environments/local/contracts.tf does. That is
deliberate: this slice is the contract plus its tests, with no adapter
consuming it, and AWS/Azure adapters are their own slice by design (see
"Explicitly out of scope" below).

Because of that, tools/olf/tests/fixtures/aws-provider-contracts-v3.json
and azure-provider-contracts-v3.json - captures standing in for
terraform output -json provider_contracts from those roots, which
test_provider_conformance.py treats as ground truth for what each
provider actually emits - are not touched by this PR either. An
earlier revision of this branch had added the two new fields to those
captures to get a two-governed-stage test fixture cheaply; Codex
correctly flagged that as asserting behaviour no real cloud deployment
produces, which would have hidden the exact adapter gap this slice
defers. The two tests that need a multi-governed-stage input now build
one directly (_synthetic_multi_capability_contract in
test_provider_contracts.py), assembled from local-provider- contracts-v3.json - the one fixture that is honest about these fields

  • rather than read from a cloud capture.

Explicitly out of scope (left for #131's remaining slices)

  • Looping the OpenMetadata module's bootstrap over governed_stages to
    actually register per-stage services in OpenMetadata. module "openmetadata" is untouched (count = governance_enabled ? 1 : 0),
    and the Terraform check limiting governed stages to one for that
    same reason is untouched. This needs a live cluster to verify
    (local-e2e), which this environment does not have.
  • AWS and Azure adapters - including making aws-poc/azure-poc's
    contracts.tf emit pipeline_service_name/dashboard_service_name,
    see above.
  • The OpenLakeForgeStage classification/tag.
  • The OpenLineage stage-safety review (defaultPipelineService,
    namespaceToServiceMapping).
  • superset_<stage> dashboard services in OpenMetadata itself
    (depends on Add stage-aware Superset authoring and report promotion #130, only partly landed) - this PR only exports the
    deterministic name, it does not register anything.
  • ws_<user>_* exclusion - vacuous until Run personal DEV workspaces locally with DuckDB over Iceberg catalog adapters #117 lands.

Falsification

ProviderContracts.governed_stages, collapsed to simulate the bug this
change fixes:

governed = {name: stage for name, stage in self.stages.items() if stage.governance is not None}
first = sorted(governed)[:1]
return MappingProxyType({name: governed[name] for name in first})
$ uv run --project tools/olf pytest tools/olf/tests/test_provider_contracts.py -q -k "test_two_governed_stages_each_expose_their_own_deterministic_service_roots"
F
>       assert {stage.value for stage in parsed.governed_stages} == {"dev", "uat"}
E       AssertionError: assert {'dev'} == {'dev', 'uat'}
E         Extra items in the right set:
E         'uat'
1 failed, 104 deselected in 0.09s

Restored; full file green again (105 passed).

ProviderContracts.analytics_stages, aliased to the governance filter
to simulate the bug the second test guards against (a consumer that
loops the governed set for dashboard roots too):

return MappingProxyType({name: stage for name, stage in self.stages.items() if stage.governance is not None})
$ uv run --project tools/olf pytest tools/olf/tests/test_provider_contracts.py -q -k "test_analytics_stages_are_tracked_separately_from_governed_stages"
F
>       assert analytics_only, (
E       AssertionError: the fixture no longer has an analytics stage without governance, so this test cannot show the two sets differ...
E       assert set()
1 failed, 104 deselected in 0.09s

Restored (diffed clean against backup); full file green again (105
passed).

The two canonical-name checks were falsified the same way earlier
(commented out pipeline_service_name's check) and also confirmed to
fail without the guard; that guard is unchanged by this update.

Gates

uv run --project tools/olf olf check all                       # PASS (incl. terraform validate on all 3 roots)
uv run --project tools/olf ruff check tools/olf                # All checks passed!
uv run --project tools/olf mypy --config-file tools/olf/pyproject.toml tools/olf/olf   # Success: no issues found in 150 source files
uv run --project tools/olf pytest tools/olf/tests --cov --cov-config=tools/olf/pyproject.toml   # 1559 passed, 81.95% branch coverage (floor 81%)

🤖 Generated with Claude Code

https://claude.ai/code/session_01Tq7cZuHZp5U2DQ5NsuxZE2

#131's first slice: OpenMetadata is one shared instance, but its live
Iceberg/Dagster/Superset connections still collapse to a single stage
(main.tf's governance_dagster_stage/governance_superset_stage), even
though governed_stages already carries every stage that asked for
governance. Nothing exported by the provider contract let a future
bootstrap represent more than one.

Add pipeline_service_name (dagster_<stage>) to every stage's
orchestration binding and dashboard_service_name (superset_<stage>) to
every analytics stage's reporting binding, sourced from the same
stage_databases locals main.tf already derives them from, so they
cannot drift. Combined with the existing catalog.catalog_name
(lakehouse_<stage>) and each stage's own optional governance block,
ProviderContracts.stages already amounts to a per-stage map; add a
governed_stages property that filters it to the governed subset so an
adapter has one place to loop over instead of re-deriving the filter.

This is the contract only: the OpenMetadata module's bootstrap still
registers one stage's connections (module "openmetadata" stays
count = governance_enabled ? 1 : 0, and the Terraform check limiting
governed stages to one for that reason is untouched) - looping it over
governed_stages needs a live cluster to verify and is the next slice.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f742b511ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/olf/olf/provider_contracts.py Resolved
`governed_stages` cannot be the single loop for all three service roots.
Analytics and governance are independent per-stage capabilities (ADR
0011), so with governance on DEV and analytics on PROD, iterating the
governed set registers DEV's services and silently skips superset_prod --
the only Superset root that exists. Terraform already draws this
distinction: main.tf selects the Superset connection from
analytics_stages, not the governed set.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@malon64

malon64 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee4ac3b4a5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…utput

Codex (PR #221, comment 4024581239): aws-provider-contracts-v3.json and
azure-provider-contracts-v3.json are captures standing in for
`terraform output -json provider_contracts` from aws-poc/azure-poc's
contracts.tf, and test_provider_conformance.py treats them as such.
Neither root emits pipeline_service_name or dashboard_service_name yet
- that adapter work is deliberately still open in #131 - so adding the
fields to those fixtures made the suite pass against a shape no real
cloud deployment produces, masking exactly the gap this slice leaves
for later.

Revert both fixtures to their origin/main state and rebuild the two
tests that needed a multi-governed-stage input from a hand-assembled
contract instead, built off local-provider-contracts-v3.json (the one
root that genuinely emits both fields) with governance/reporting
grafted on. The helper's docstring says why it exists rather than
reading a fixture, so a reader can't mistake it for a capture.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@malon64

malon64 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 1c08130bfa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@malon64
malon64 merged commit cccadac into main Sep 16, 2026
8 checks passed
@malon64
malon64 deleted the feat/131-openmetadata-stage-qualified-service-roots branch September 16, 2026 12:16
malon64 added a commit that referenced this pull request Sep 23, 2026
…fied roots

OpenMetadata collapsed governance to one stage: the bootstrap created a
single `<service>.lakehouse_<stage>` database and registered unqualified
`dagster` and `superset` services pointed at whichever stage two root
locals picked, and a Terraform check warned against a second governed
stage. A DEV+PROD profile governs both, so PROD's activation seeded
schemas under a `polaris.lakehouse_prod` database that never existed.

The module now takes a `stages` map and a `canonical_stage`. For every
governed stage the bootstrap upserts the stage's database root, a
`dagster_<stage>` pipeline service, and a `superset_<stage>` dashboard
service when the stage also runs analytics; it removes the services of a
stage that is no longer governed and the legacy unqualified pair. The one
Iceberg connection still crawls a single catalog, the canonical stage's,
whose pipeline service now receives OpenLineage pipelines.

The local root passes every governed stage, with names taken from the same
stage_databases the provider contract exports (#221), and drops the
one-governed-stage check. AWS and Azure pass the one stage they already
registered and keep their check until their own adapter changes.

Refs #131.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
malon64 added a commit that referenced this pull request Sep 28, 2026
…fied roots

OpenMetadata collapsed governance to one stage: the bootstrap created a
single `<service>.lakehouse_<stage>` database and registered unqualified
`dagster` and `superset` services pointed at whichever stage two root
locals picked, and a Terraform check warned against a second governed
stage. A DEV+PROD profile governs both, so PROD's activation seeded
schemas under a `polaris.lakehouse_prod` database that never existed.

The module now takes a `stages` map and a `canonical_stage`. For every
governed stage the bootstrap upserts the stage's database root, a
`dagster_<stage>` pipeline service, and a `superset_<stage>` dashboard
service when the stage also runs analytics; it removes the services of a
stage that is no longer governed and the legacy unqualified pair. The one
Iceberg connection still crawls a single catalog, the canonical stage's,
whose pipeline service now receives OpenLineage pipelines.

The local root passes every governed stage, with names taken from the same
stage_databases the provider contract exports (#221), and drops the
one-governed-stage check. AWS and Azure pass the one stage they already
registered and keep their check until their own adapter changes.

Refs #131.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
malon64 added a commit that referenced this pull request Sep 28, 2026
…fied roots (#237)

* feat: register every governed stage in OpenMetadata under stage-qualified roots

OpenMetadata collapsed governance to one stage: the bootstrap created a
single `<service>.lakehouse_<stage>` database and registered unqualified
`dagster` and `superset` services pointed at whichever stage two root
locals picked, and a Terraform check warned against a second governed
stage. A DEV+PROD profile governs both, so PROD's activation seeded
schemas under a `polaris.lakehouse_prod` database that never existed.

The module now takes a `stages` map and a `canonical_stage`. For every
governed stage the bootstrap upserts the stage's database root, a
`dagster_<stage>` pipeline service, and a `superset_<stage>` dashboard
service when the stage also runs analytics; it removes the services of a
stage that is no longer governed and the legacy unqualified pair. The one
Iceberg connection still crawls a single catalog, the canonical stage's,
whose pipeline service now receives OpenLineage pipelines.

The local root passes every governed stage, with names taken from the same
stage_databases the provider contract exports (#221), and drops the
one-governed-stage check. AWS and Azure pass the one stage they already
registered and keep their check until their own adapter changes.

Refs #131.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: pin the canonical crawl to its own database and never delete roots

Every governed stage's database now sits under the one catalog service, so
the canonical stage's crawl must not be able to retire another stage's root.
OpenMetadata 1.12.10 already defaults markDeletedDatabases and
markDeletedSchemas to false and scopes markDeletedTables to the schema being
ingested; state both explicitly and pin databaseFilterPattern to the
canonical database so an upgrade that changes those defaults cannot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: upsert the canonical crawler so a stage switch refreshes its filter

The bootstrap reused an existing Iceberg ingestion pipeline as-is and only
wrote databaseFilterPattern when creating one. After the canonical stage
changes on a live deployment (DEV governance turned off, PROD kept), the
database service connection moved to PROD but the kept pipeline still
filtered for ^lakehouse_dev$, matching nothing and silently ending the
catalog refresh. PUT the pipeline on every apply instead, which also brings
a pipeline created before #131 up to the pinned filter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
chouaibmouidis-py pushed a commit to chouaibmouidis-py/openlakeforge that referenced this pull request Nov 4, 2026
…LakeForge#221)

* feat: export deterministic OpenMetadata service roots per stage

OpenLakeForge#131's first slice: OpenMetadata is one shared instance, but its live
Iceberg/Dagster/Superset connections still collapse to a single stage
(main.tf's governance_dagster_stage/governance_superset_stage), even
though governed_stages already carries every stage that asked for
governance. Nothing exported by the provider contract let a future
bootstrap represent more than one.

Add pipeline_service_name (dagster_<stage>) to every stage's
orchestration binding and dashboard_service_name (superset_<stage>) to
every analytics stage's reporting binding, sourced from the same
stage_databases locals main.tf already derives them from, so they
cannot drift. Combined with the existing catalog.catalog_name
(lakehouse_<stage>) and each stage's own optional governance block,
ProviderContracts.stages already amounts to a per-stage map; add a
governed_stages property that filters it to the governed subset so an
adapter has one place to loop over instead of re-deriving the filter.

This is the contract only: the OpenMetadata module's bootstrap still
registers one stage's connections (module "openmetadata" stays
count = governance_enabled ? 1 : 0, and the Terraform check limiting
governed stages to one for that reason is untouched) - looping it over
governed_stages needs a live cluster to verify and is the next slice.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat: track analytics stages separately from governed stages

`governed_stages` cannot be the single loop for all three service roots.
Analytics and governance are independent per-stage capabilities (ADR
0011), so with governance on DEV and analytics on PROD, iterating the
governed set registers DEV's services and silently skips superset_prod --
the only Superset root that exists. Terraform already draws this
distinction: main.tf selects the Superset connection from
analytics_stages, not the governed set.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix: stop asserting stage service roots against uncaptured provider output

Codex (PR OpenLakeForge#221, comment 4024581239): aws-provider-contracts-v3.json and
azure-provider-contracts-v3.json are captures standing in for
`terraform output -json provider_contracts` from aws-poc/azure-poc's
contracts.tf, and test_provider_conformance.py treats them as such.
Neither root emits pipeline_service_name or dashboard_service_name yet
- that adapter work is deliberately still open in OpenLakeForge#131 - so adding the
fields to those fixtures made the suite pass against a shape no real
cloud deployment produces, masking exactly the gap this slice leaves
for later.

Revert both fixtures to their origin/main state and rebuild the two
tests that needed a multi-governed-stage input from a hand-assembled
contract instead, built off local-provider-contracts-v3.json (the one
root that genuinely emits both fields) with governance/reporting
grafted on. The helper's docstring says why it exists rather than
reading a fixture, so a reader can't mistake it for a capture.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
chouaibmouidis-py pushed a commit to chouaibmouidis-py/openlakeforge that referenced this pull request Nov 4, 2026
…fied roots (OpenLakeForge#237)

* feat: register every governed stage in OpenMetadata under stage-qualified roots

OpenMetadata collapsed governance to one stage: the bootstrap created a
single `<service>.lakehouse_<stage>` database and registered unqualified
`dagster` and `superset` services pointed at whichever stage two root
locals picked, and a Terraform check warned against a second governed
stage. A DEV+PROD profile governs both, so PROD's activation seeded
schemas under a `polaris.lakehouse_prod` database that never existed.

The module now takes a `stages` map and a `canonical_stage`. For every
governed stage the bootstrap upserts the stage's database root, a
`dagster_<stage>` pipeline service, and a `superset_<stage>` dashboard
service when the stage also runs analytics; it removes the services of a
stage that is no longer governed and the legacy unqualified pair. The one
Iceberg connection still crawls a single catalog, the canonical stage's,
whose pipeline service now receives OpenLineage pipelines.

The local root passes every governed stage, with names taken from the same
stage_databases the provider contract exports (OpenLakeForge#221), and drops the
one-governed-stage check. AWS and Azure pass the one stage they already
registered and keep their check until their own adapter changes.

Refs OpenLakeForge#131.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: pin the canonical crawl to its own database and never delete roots

Every governed stage's database now sits under the one catalog service, so
the canonical stage's crawl must not be able to retire another stage's root.
OpenMetadata 1.12.10 already defaults markDeletedDatabases and
markDeletedSchemas to false and scopes markDeletedTables to the schema being
ingested; state both explicitly and pin databaseFilterPattern to the
canonical database so an upgrade that changes those defaults cannot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: upsert the canonical crawler so a stage switch refreshes its filter

The bootstrap reused an existing Iceberg ingestion pipeline as-is and only
wrote databaseFilterPattern when creating one. After the canonical stage
changes on a live deployment (DEV governance turned off, PROD kept), the
database service connection moved to PROD but the kept pipeline still
filtered for ^lakehouse_dev$, matching nothing and silently ending the
catalog refresh. PUT the pipeline on every apply instead, which also brings
a pipeline created before OpenLakeForge#131 up to the pinned filter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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