Skip to content

EPIC: Extract a LIF control-plane service (identity + developer keys + admin/monitoring) from MDR #1041

Open
3 of 11 issues completed

Description

@bjagg

Why

A core LIF goal is that components/microservices stay independent enough that deployers can pick what they run alongside their existing data infrastructure. MDR's unique value is the metadata/schema registry. The LDE self-service API-key work (#1000) initially put key issuance + the Cognito identity in MDR (#1033/#1035), which would make MDR a fleet-wide auth dependency — a deployer wanting only LDE + their own warehouse would have to stand up full MDR just for keys. That conflates two domains and cuts against the independence goal.

Decision (see ADR 0002)

The key/identity control plane — identity (Cognito), developer-key issuance/management, and cross-cutting admin dashboards/monitoring — belongs in a dedicated LIF control-plane service, not MDR. MDR returns to being just the metadata registry and consumes the control plane like any other service. Runtime coupling is avoided by signed-token offline validation (API services verify keys with a shared secret; no per-request call to the issuer).

Near-term (already in flight)

Ship LDE keys hosted in MDR as self-contained Polylith bricks (developer_keys store/issuance + cognito_auth verify), with no imports into MDR-domain services, so MDR is the interim host, not the owner. Because validation is offline/signed and the logic is bricked, extraction later is a re-deploy, not a rewrite.

Extraction workstreams (this epic)

Refs: #1000, ADR 0002 (control plane vs MDR host), ADR 0001 (auth), docs/design/cross-cutting/self-serve-tenant-auth.md.

Sub-issues

Sub-issues

3 of 11 Issues completed
Loading 11 sub-issues

Activity

  1. bjagg commented on Jul 13, 2026

    @bjagg
    ContributorAuthor

    Decision recorded in ADR 0002 → PR #1042.

  2. bjagg commented on Jul 16, 2026

    @bjagg
    ContributorAuthor

    Candidate control-plane monitoring feature: a cache-introspection ("what's currently cached") endpoint.

    Came up while designing how the LDE test/export playground (#1036) surfaces test users. A "get learners" endpoint can only mean "what's in the Query Planner cache right now" — which is non-deterministic (cache warms/evicts), privacy-sensitive (it's a learner enumeration), and circular for the demo (test users aren't cached until queried). So it's the wrong source for the demo picker (that uses a curated list instead — see the persona-source issue).

    But as an ops/monitoring view it's legitimate and fits this epic's admin/monitoring scope: a permissioned, tenant-scoped "what's cached / cache health" endpoint — explicitly labeled as cache state, not an authoritative learner directory (LIF is federated; there isn't one). Capturing here as a low-priority control-plane monitoring candidate rather than an LDE/demo dependency.

  3. 3 remaining items

  4. bjagg commented on Aug 31, 2026

    @bjagg
    ContributorAuthor

    Broken down into 11 sub-issues (2026-08-31)

    Sequenced. The dependency order matters more than the list — starting in the wrong place is how this epic stalls.

    Phase A — make ADR 0002's premise true (blocks everything else)

    Phase B — stand it up

    Phase C — cut over

    Phase D — admin & monitoring

    Phase E — the deferred question


    ⚠️ Correction to this epic's premise

    This epic and ADR 0002 both state that extraction will be "a re-deploy, not a rewrite", because phase 1 was to host the keys in MDR as self-contained bricks with no imports into MDR-domain services.

    That is not what shipped. components/lif/developer_keys does not exist. The key logic lives in components/lif/mdr_dto/developer_api_key_dto.py, components/lif/mdr_services/developer_api_key_service.py, components/lif/datatypes/mdr_sql_model.py, and bases/lif/mdr_restapi/developer_api_key_endpoints.py — all MDR-domain.

    So a control-plane project built today would have to package mdr_dto + mdr_services + datatypes, inheriting the entire MDR domain — precisely what ADR 0002 exists to prevent. cognito_auth did land correctly as its own brick, so only the key half is affected.

    Consequence for estimation: the <40h figure in the sprint plan assumes the re-deploy premise. With #1180 in front of it, and phases D–E included, this epic is materially larger. #1180 alone is a refactor across three shared bricks. Worth re-estimating before committing it to a sprint.

  5. self-assigned this
    on Sep 11, 2026
  6. added a commit that references this issue on Sep 20, 2026
  7. bjagg commented on Sep 21, 2026

    @bjagg
    ContributorAuthor

    Cross-linking #1290 (EPIC: a deployable MDR for outside implementers — no AWS dependency, no demo functionality), because it overlaps this epic's seam directly rather than tangentially.

    Measured while scoping it: ~85% of MDR's Cognito/boto coupling sits in four files — mdr_restapi/tenant_endpoints.py (50 refs), mdr_auth/core.py (39), mdr_auth/cognito_admin.py (20), mdr_services/workspace_service.py (18). That is the identity/tenant surface this epic proposes to extract. MDR's domain logic is already clean — mdr_services is 11,113 lines with ~2 references.

    So the two epics are working the same seam from opposite ends. Whichever moves first should probably absorb the auth half, leaving the other the packaging, demo-strip and deployment concerns. Flagged as a sequencing decision for #1290's spike rather than assumed either way.

  8. dereck-symmetry commented on Oct 1, 2026

    @dereck-symmetry
    Contributor

    @bjagg thanks for handing this epic over. I'm taking it on as my top priority, and I plan to start at #1180, extracting the developer-key logic into a portable developer_keys brick. Your 08-31 breakdown marks it as the blocker for everything else, and it's pure code. Two things I'd like your view on first:

    1. Should this epic own the auth seam that #1290 also covers? Both epics plan to rework the same code: the Cognito/tenant surface in mdr_auth/core.py, mdr_auth/cognito_admin.py, mdr_restapi/tenant_endpoints.py and mdr_services/workspace_service.py. #1290's option B puts Cognito behind an auth port, and #1190 here asks whether Cognito identity should move out of MDR entirely. On 09-21 you said whichever epic moves first should probably absorb the auth half, and #1290 lists "the relationship to #1041 is resolved" as an acceptance criterion. Since this one is now moving, my proposal is that #1041 owns the auth seam, through #1190, and #1290 keeps the packaging, demo-strip and deployment concerns, with a dependency on this epic for its auth part. One more data point: #1323 added a second login path in the MDR base (bases/lif/mdr_restapi/local_users.py). It's additive and doesn't touch mdr_auth, but the extraction will have to account for it. Does that split work for you? If so, I'll note it on #1290 so its spike starts from it.

    2. The AWS-bound steps. I don't think that I have AWS credentials currently. Phase A (#1180, and the #1181 spike/ADR) and the code side of #1182 I can do. Standing up the deploy pipeline (#1182), migrating the store on dev and demo (#1183), and distributing the secrets (#1184) would need you or someone with access. I'd hand those off the same way I did on #1320, if that still works for you.

  9. dereck-symmetry commented on Oct 4, 2026

    @dereck-symmetry
    Contributor

    @bjagg a follow-up on my 10-01 comment above, with a review request and where this epic stands.

    Please review #1353. It's the output of the #1181 spike: ADR 0006 (Proposed), which extends ADR 0002. The proposal is that the control plane owns its key store as its own logical Postgres database, with its own login and Flyway set. In dev and demo it may sit on the MDR Aurora cluster. Keys go in one table with an explicit workspace column, and existing keys are copied out of MDR's per-tenant tables rather than moved. The spike also found that two of ADR 0002's premises weren't implemented as written. The shipped keys are opaque (lifk_ + token_urlsafe(32), plain SHA-256), not the signed lifk_<payload>.<hmac> from #1033. And nothing validates them yet: LDE's developer-key strategy is still a stub that returns None. The details are cited in the ADR's Context.

    Sub-issues that might need re-scoping, depending on how #1353 lands. I'm holding the detailed comments until you've had a chance to weigh in:

    Status of #1180. It's waiting on groybal's draft #1345, which moves datatypes/mdr_sql_model.py (home of DeveloperApiKey) into a new brick. I've asked groybal about timing there.

    The two questions from 10-01 are still open:

    1. Auth-seam split with EPIC: a deployable MDR for outside implementers — no AWS dependency, no demo functionality #1290. My proposal is that EPIC: Extract a LIF control-plane service (identity + developer keys + admin/monitoring) from MDR #1041 owns the Cognito/tenant seam through Control plane: spike — should Cognito identity ownership move out of MDR? (ADR extending 0002) #1190, and EPIC: a deployable MDR for outside implementers — no AWS dependency, no demo functionality #1290 keeps packaging, demo-strip and deployment, depending on this epic for its auth part. I'd like your OK before I note it on EPIC: a deployable MDR for outside implementers — no AWS dependency, no demo functionality #1290. I've also noted your 09-26 requirement on Control plane: spike — should Cognito identity ownership move out of MDR? (ADR extending 0002) #1190 that the configured local-login path from Test-drive LIF on a non-AWS cloud, stage 1: MDR, single schema, locally configured logins #1316/Issue #1316: test-drive MDR without AWS — configured logins, restore ordering, guide #1323 has to survive any move of sign-in.
    2. AWS-bound steps. Control plane: create the control-plane service (base + project + deploy pipeline) #1182's provisioning and pipeline, Control plane: migrate the developer-key store to control-plane-owned storage (dev + demo, non-destructive) #1183's dev/demo migration and Control plane: formalize signed-token verification — secret distribution, rotation, and revocation freshness #1184's secrets need AWS access, which I don't think I currently have. Would it still work for you if I prepare the code side and hand those steps to you, as on Dagster on ECS: measure whether gRPC's c-ares resolver stalls code-location calls, and apply GRPC_DNS_RESOLVER=native if so #1320?
  10. added a commit that references this issue on Oct 5, 2026
  11. added a commit that references this issue on Oct 9, 2026
  12. added a commit that references this issue on Oct 9, 2026
  13. added a commit that references this issue on Oct 20, 2026
  14. added a commit that references this issue on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions