Skip to content

refactor(den-api): group settings, move tuning out, prove parity - #7734

Open
benjaminshafii wants to merge 8 commits into
feat/deployment-capability-catalogfrom
refactor/den-env-surface
Open

benjaminshafii wants to merge 8 commits into
feat/deployment-capability-catalogfrom
refactor/den-env-surface

Conversation

@benjaminshafii

Copy link
Copy Markdown
Member

What is this about?

den-api's settings: one flat list of 210 variables becomes 12 core settings plus three named groups, and 39 internal timings leave the installation surface. Den Web no longer needs DEN_API_BASE.

What problem does it solve?

A self-hosted operator could not tell which variables matter. Nothing guarded how OpenWork Cloud or an existing install reads its environment when that code changes.

What was the situation before?

Before After
den-api schema 210 variables, flat 171 in four groups: 12 core, 93 optional, 49 Cloud only, 17 legacy or internal
Timings, batch sizes, timeouts 39 in the schema tuning.ts: same defaults, each variable still honored
.env.example starts with PORT and CORS_ORIGINS starts with the 12 core settings
Den Web without DEN_API_BASE 503 DEN_API_PUBLIC_URL, else api.<host>
What existing installs read unguarded five recorded environments, compared field for field

How is this implemented?

  • env-schema.ts holds the same validators, regrouped. env.ts keeps every derivation and env keeps every field, so no caller changes.
  • No address derivation changed. den-api already works out sign-in, cookies, CORS, the API (api.<host>) and MCP from DEN_BASE_URL, and an explicit value still wins. /api/den is a redirect for old desktops, so it is not a fallback.
  • test/env-prod-parity.test.ts parses OpenWork Cloud, managed AWS (gateway, legacy), Helm chart 0.2.0 and a minimal self-hosted install, each in a new process.
  • Den Web: readDenApiBase().

What else changed?

  • pnpm check and the quick check's Den job run the parity test.
  • smoke:env-boot boots the built server on a new database.
  • Rebasing over refactor(features): remove five unused experiments #7721: delete the documents group and documentsOffice, then env:parity:write. A trial rebase gave output byte-identical to untouched dev for all five.

Release note

Self-hosted installs set one address, DEN_BASE_URL: Den Web no longer needs DEN_API_BASE.

Evidence

ee/apps/den-api/test/env-prod-parity.test.ts — before: recorded from the untouched env.ts; after: identical. smoke:env-boot: the built server starts with the Cloud and the minimal environment, four routes answer 200, no secret in a response. No E2E: no screen changed.

…ery installer

Workbot, the Slack assistant, Automations, the AI Gateway and cloud computers
are controlled in several places with different defaults per installer. The
catalog records, for managed AWS, managed Google Cloud, the Helm chart and the
AWS ECS and Cloud Run modules, whether each capability is supported and which
Terraform variables, Helm values and Den switches implement it.

A drift test reads the Terraform roots and modules, the chart and Den, and
fails when a control is missing or its default differs from the catalog.
Today's inconsistencies are recorded as gaps and pinned. A capability may not
depend on a rollout flag in the customer's deployment unless it is a recorded
gap. The configuration change planner now reads its fixed and editable rules
from the catalog. The test runs in pnpm check and the required quick check.

The Helm README example used retired feature keys and said cloud-only
features have no key; both are corrected and the example is now tested.
…tructure or unsupported

GET /v1/org adds deploymentCapabilities.capabilities, derived from settings
Den already has (configured services, its Automations and Slack switches, the
organization's features). No network call is made, and the aiGateway boolean
is unchanged.

GET /v1/managed-deployments/{deploymentId}/capabilities reports the same for a
managed deployment from its recorded target: runtime profile, assistant
settings and computer provider on AWS, unsupported on Google Cloud.
…tuning out

env.ts read 210 variables from one flat list. They are now four named groups
in env-schema.ts: 12 core settings a self-hosted install sets, optional
capabilities, OpenWork Cloud only, and legacy or internal names. Validators
and the cross-field rules are unchanged.

39 timings, batch sizes and timeouts of background work move to tuning.ts
with the same defaults. Each still reads its variable, so a value set on a
running service keeps working; they are no longer listed in .env.example,
which now opens with the core settings.

The env object den-api code reads keeps every field.
Five whole environments are parsed by a new den-api process each and
compared field for field with what was recorded before the settings were
regrouped: OpenWork Cloud (separate API origin, hosted database, variables
Render adds, tuning set by hand, variables left behind by removed code), the
managed AWS gateway and legacy profiles as their Terraform passes them, the
Helm chart 0.2.0 ConfigMap and Secret as helm template renders them, and a
self-hosted install that sets only its address, database, secrets and first
administrator.

The recorded files were produced by the env.ts this branch started from. The
same run on origin/dev differs only by documentsOffice, which dev has since
removed.

Runs in pnpm check and with the Den API tests in the quick check.
Den Web's server needed DEN_API_BASE to proxy requests, read the workspace
icon and check single sign-on. When it is unset the public API address is
now used: DEN_API_PUBLIC_URL, else api.<host> from DEN_BASE_URL. A
DEN_API_BASE that is set is used exactly as before.
…llation environments

pnpm --filter @openwork-ee/den-api smoke:env-boot starts dist/main.js twice
on a new local MySQL database, migrated the way a deployment migrates it:
once with the OpenWork Cloud environment and once with a self-hosted install
that sets its address, database, two secrets, first administrator and setup
code. It signs the first administrator in, reads /health, /ready, /v1/org and
/v1/org/diagnostics, and fails if any secret value appears in a response.

The Cloud environment keeps its shape but points at hosts that never resolve,
and the keys of services that would be called are left out.
@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openwork-app Ready Ready Preview Nov 25, 2026 7:20am UTC
openwork-den Ready Ready Preview Nov 25, 2026 7:20am UTC
openwork-landing Ready Ready Preview, v0 Nov 25, 2026 7:20am UTC

Request Review

This branch was successfully deployed

3 active deployments
Preview – openwork-app — 940b4e53 Deployed Nov 25, 2026 by vercel[bot]
Preview – openwork-den — 940b4e53 Deployed Nov 25, 2026 by vercel[bot]
Preview – openwork-landing — 940b4e53 Deployed Nov 25, 2026 by vercel[bot]
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