Skip to content

Derive Dagster code locations from the provider contract, not two hardcoded copies #185

Closed

Description

@malon64

Context

#115 moved Dagster user-code ownership from Terraform to olf project deploy.
The two sides now decide the code-location set independently, and nothing keeps
them in agreement.

Terraform renders the webserver's workspace.yaml from every configured
location: variables.tf:65
declares code_locations as a list of {name, definitions_module}, all three
environment roots pass it from local.orchestration_contract.code_locations
(e.g. aws-poc/main.tf:679),
and release.tf:59
renders one workspace server per entry.

Activation renders exactly one, hardcoded:

# tools/olf/olf/deployment/activation.py:225
"name": "openlakeforge-dagster",
"dagsterApiGrpcArgs": ["--module-name", "lakehouse_code.definitions"],

Both currently agree only because they happen to repeat the module variable's
default, which is the single merged location ADR 0006 documents.

Impact

Configure code_locations as anything other than that default and the stage
breaks, silently at apply time:

  • Renamed location — the workspace points at a Service name activation never
    creates, so the sole code server is unreachable and no domain loads.
  • Split locations (one per domain) — the workspace names N servers,
    activation creates one; every location but the first has no matching Service.
  • A renamed definitions_module is not expressible by activation at all.

dagster-user-deployments names each Service after its deployment, so the
contract's code-location name is also its in-cluster host — which is exactly why
the two sides have to derive it from one source.

Latent rather than broken today: only the default is shipped, and the AWS
acceptance run passed on it. But the module variable is a supported knob whose
own description offers the split-location trade-off, so nothing warns a user off.

Why this needs a contract change

Activation cannot read what Terraform used. The v3 stage contract exposes
orchestration only as refs:

"orchestration": {
  "service_ref": "stage/dev/orchestration",
  "endpoint_ref": "stage/dev/endpoints/orchestration"
}

and neither contracts.py nor provider_contracts.py mentions code_locations
anywhere — no env var carries the name or definitions_module to the CLI. Under
AGENTS.md rule 1 ("contracts before providers"), the code-location set belongs in
the provider contract, with both Terraform and activation reading it from there.

Acceptance criteria

  • The provider contract carries the stage's code locations (name and
    definitions_module), with the schema and fixtures updated.
  • olf project deploy renders one user deployment per contracted location
    instead of a hardcoded pair.
  • The Terraform-rendered workspace and the activation-rendered Services agree
    by construction for a renamed location and for split locations, with a test
    covering both — a test asserting only the default would not have caught this.
  • manage_user_deployments = true (the deprecated olf deploy path,
    ADR 0006) keeps its current behaviour.
  • ADR 0006 records where the code-location set is owned.

Notes

Found during review of #184 and deliberately not fixed there: it needs a
contract schema change, which is wider than that PR's scope. Its review thread
carries the same analysis.

Activity

  1. added
    roadmap
    priority: P2
    on Sep 4, 2026
  2. malon64 commented on Sep 10, 2026

    @malon64
    CollaboratorAuthor

    Delivered by #194 (contract) and #195 (consumer), both merged.

    stages.<name>.orchestration.code_locations now carries the set, emitted by all three roots from the same local.orchestration_contract.code_locations Terraform already passes to the Dagster module, and activation.py renders one user deployment per contracted entry. One source, two readers — the hardcoded literal at what was activation.py:225 (line 272 by the time it was fixed) is gone.

    Two things worth carrying forward from review:

    • The field is optional, not required. Requiring it broke ADR 0002's lifecycle boundary: a platform applied before this change has a 3.0.0 contract without the field, so olf project deploy would have failed until someone ran Terraform. It defaults to the single merged location such a platform is actually running.
    • Names are validated as RFC 1035, not DNS-1123 — a code-location name becomes a Kubernetes Service name and must start with a letter — and matched with fullmatch, since $ also matches before a trailing newline.

    Review also surfaced two defects in the surrounding activation code that are fixed in #195: release_runs_activation accepted a release when any deployment matched (equivalent to all only while one location was possible), and the rollback path could pair an image with modules it never shipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: P2roadmap

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions