Skip to content

docs(plan): Mecatl Studio bootstrap acceptance plan and ADR 0351 - #1753

Merged
samuv merged 1 commit into
mainfrom
plan/studio-bootstrap
Sep 23, 2026
Merged

samuv merged 1 commit into
mainfrom
plan/studio-bootstrap

Conversation

@samuv

@samuv samuv commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds docs/acceptance/studio-bootstrap.md (Architectural) and docs/adr/0351-mecatl-studio-in-repo-web-ui.md: the durable decisions for bringing the Studio browser UI into the repository — a self-contained apps/ pnpm workspace over the published @stacklok-oss/mecatl-sdk, the browser → BFF → mecatl boundary, stateless sealed-cookie sessions, the MECATL_* / STUDIO_* configuration split, a one-origin multi-stage image published as ghcr.io/stacklok/mecatl/studio, and Bounded per-feature follow-ups.

Review focus

  • The interface contract rows (CLI/config, Events/persistence, Security/authority): the operator-facing surface.
  • Human decisions taken during design: STUDIO_ALLOW_UNAUTHENTICATED=1 opt-in for static-token / no-auth runtimes inside the image; optional MECATL_RESOURCE_URL with fail-closed discovery; full security hardening in the bootstrap; the user-docs/ page as the top layer of the stack.

Checker: check-acceptance-plan.sh passes; task docs passes. Stacked delivery: nothing in this series merges until the whole stack is reviewed; the plan's approval-by-merge event is deferred to the end, as its Delivery line records.

Contract amendments

  • Host allowlist. Every request except /api/health must carry the host of STUDIO_PUBLIC_URL, or a loopback host when it is unset; anything else is 421 host_not_allowed (AC3.16). This closes DNS rebinding, which the same-origin check alone could not.
  • Origin rule. A present Origin must equal the configured origin, Sec-Fetch-Site: same-origin is required only when Origin is absent, and any other Sec-Fetch-Site value is refused (AC3.12).
  • Listen address. New STUDIO_HOST: 127.0.0.1 by default, 0.0.0.0 inside the image (AC2.10).
  • Auth. The rate limit skips the GET /api/v1/auth/session poll and now covers the /oauth/callback alias (AC3.13). A forged callback no longer clears an existing session (AC3.6). return_to gets its own AC (AC3.17).
  • Errors. Request-validation failures are 400 invalid_request problem details. A daemon code Studio does not name maps by its Connect class instead of falling to 500 (AC2.7).
  • Wording. The image label is org.stacklok.mecatl.studio.stability=early-access in every document (the plan, ADR 0351, AGENTS.md, and the architecture doc). The compose decision now says the compose file runs the image with STUDIO_ALLOW_UNAUTHENTICATED=1.
  • Readiness. Every /api/v1 route except the auth routes and /runtime waits up to 10 seconds for compatibility negotiation, then answers 503 runtime_unavailable. A feature route never reports a capability as unsupported from an empty snapshot (AC2.11).
  • Refresh. A completed refresh keeps answering requests that still carry the replaced token for 60 seconds per replica. A request already in flight when the tokens rotated no longer ends the session (AC3.9).
  • Account data. GET /api/v1/auth/session gains an opaque account key. The browser clears every studio.-prefixed key on sign-out and when a different account signs in (AC4.6).
  • Release. publish-studio publishes nothing, with a notice, for a tag without apps/Dockerfile, or when the checked-out tag differs from the run's own commit and its provenance would name the wrong source (AC5.4).

Development stage

  • Plan / Interface
  • Implementation
  • Combined
  • Spike / Routine / Cleanup

Contract linkage

  • Work classification: Architectural
  • Classification rationale: a new system boundary (a browser-facing BFF holding user credentials in front of a mecatl deployment), a new released deployment artifact, and a durable dependency decision (Studio consumes only the published SDK)
  • Decision record: ADR 0351
  • Human waiver of spine: Yes — the directing human chose stacked (gh stack) delivery for the whole Studio series: nothing merges until every layer is reviewed, so the plan's approval-by-merge event is deferred to the end (recorded in each plan's Delivery line), and each implementation layer records the exact plan commit it built against.
  • Acceptance plan: docs/acceptance/studio-bootstrap.md
  • Human decisions resolved and recorded: Yes
  • Plan / Interface PR: this PR
  • Approved commit baseline: absent until the stack root merges (stacking exception above)
  • Combined/exemption rationale: N/A

Interface conformance

  • Interface contract under review: Environment surface (MECATL_* target settings, STUDIO_* Studio settings incl. STUDIO_PUBLIC_URL, STUDIO_SESSION_SECRET, STUDIO_IMAGE, STUDIO_ALLOW_UNAUTHENTICATED, STUDIO_TRUSTED_PROXY_HOPS), the four studio_* cookies and their sealing, the security boundary (PKCE login, 401 gating, CSP, same-origin + double-submit CSRF, rate limiting, audit records), the one-origin image, the studio:* tasks, the studio CI category, and the publish-studio release job. No gRPC, Go, or tool-schema change.

Issue relationship

Relates to #1746 (parent #1736; stack #1766). Non-closing: the step completes when both of its layers merge.

Type of change

  • Behavioral/interface plan
  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation/process

Test plan

Baseline checks

  • Acceptance-plan checker
  • Linting (task lint)
  • Offline test suite (task test)
  • Offline demo (go run ./cmd/mecademo)
  • Markdown changed: docs generation/link checks (task docs)

Plan layer: the acceptance-plan checker and task docs pass. The Studio gates (task studio:check, task ac-trace) run on the implementation layer above, since this layer adds no apps/ code.

User-facing change

None — a plan document and, for the bootstrap, ADR 0351.

Special notes for reviewers

Part of a fourteen-layer stack; review bottom-up. Nothing merges until the whole series is reviewed.

@samuv
samuv added this pull request to stack #1766 September 22, 2026 08:01
@samuv samuv changed the title plan/studio bootstrap docs(plan): Mecatl Studio bootstrap acceptance plan and ADR 0350 Sep 22, 2026
@samuv samuv self-assigned this Sep 22, 2026
@samuv
samuv force-pushed the plan/studio-bootstrap branch 2 times, most recently from 4bbdd53 to ad10c7e Compare September 23, 2026 10:46
@samuv samuv changed the title docs(plan): Mecatl Studio bootstrap acceptance plan and ADR 0350 docs(plan): Mecatl Studio bootstrap acceptance plan and ADR 0351 Sep 23, 2026
@samuv
samuv force-pushed the plan/studio-bootstrap branch from ad10c7e to e344835 Compare September 23, 2026 11:54
Plan / Interface layer for bringing the Studio web UI into this repository
as a self-contained
apps/ pnpm workspace over the published @stacklok-oss/mecatl-sdk, with
a hardened OIDC BFF, a one-origin multi-stage image published as
ghcr.io/stacklok/mecatl/studio, a CI job, and a publish-studio release
job mirroring the Slack bot's. Feature ports follow as Bounded plans in
the same gh stack; the user-docs page is the top layer.

Records the 17 human decisions from the 2026-09-21 design interview and
folds one advisory devils-advocate pass (unauthenticated /api/v1 gating,
exact session sealing and refresh semantics, MECATL_RESOURCE_URL for
discovery, STUDIO_ALLOW_UNAUTHENTICATED for the image, trusted proxy
hops, CSRF/origin exactness, cookie-size failure, ac-trace resolver
widening).

Tracking: #1736

Signed-off-by: Samuele Verzi <[email protected]>
@samuv
samuv force-pushed the plan/studio-bootstrap branch from e344835 to 09bc02e Compare September 23, 2026 12:54
@samuv
samuv merged commit f5649b8 into main Sep 23, 2026
30 checks passed
@samuv
samuv deleted the plan/studio-bootstrap branch September 23, 2026 13:15
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.

3 participants