Skip to content

refactor(config): make Settings the single configuration surface - #270

Merged
artempartos merged 7 commits into
developfrom
artempartos/chore-env-vars-audit
Sep 17, 2026
Merged

artempartos merged 7 commits into
developfrom
artempartos/chore-env-vars-audit

Conversation

@artempartos

@artempartos artempartos commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Why

I inventoried the whole environment-variable surface. The findings, in numbers:

  • 125 variables reached the app through config/settings.yml — good, that is the convention.
  • 3 application files read ENV directly, and 16 settings keys were read by nothing.
  • 4 keys were read by code that no settings file defined — knobs that looked tunable and silently fell back forever.
  • 3 documents described the surface and disagreed: 35 variables had no row anywhere (including OAUTH_SECRET_KEY, which production refuses to boot without), 5 rows stated the wrong default, and the copy the /docs portal serves had drifted from the file in docs/ it was hand-copied from.
  • 1 real defect fell out of it (below).

This is the whole cleanup in one pass, because the pieces only make sense together: the deletions are what make the reference honest, and the reference is what the new test holds the settings files to.

The defect

config/settings.yml sized the Active Record pool as (RAILS_MAX_THREADS || 5) + 3 while config/puma.rb fell back to 10. A deployment that never sets the variable therefore ran 10 request threads against an 8-connection pool, and paid for it with ConnectionTimeoutError under load. Compose and the cluster both set RAILS_MAX_THREADS=10, which is exactly why this survived: the only exposed deployment is a fresh self-host.

Both fallbacks are now 10, and test/config/thread_budget_test.rb fails if the two files ever disagree again, or if the pool stops leaving headroom above the thread budget.

What changed

Deliberately NOT changed: the Temporal worker's thread budget. It shared RAILS_MAX_THREADS and would have gone from 5 to 10 — doubling activity concurrency on worker pods that set neither variable (I checked: worker-ruby does not). That is a capacity decision, not part of fixing pool arithmetic, so the worker keeps its own fallback of 5 behind a new, documented TEMPORAL_WORKER_MAX_THREADS.

Derived instead of repeated. domain, the thread budget, the internal base URL, the OTLP endpoint and the Traefik base are bound once as ERB locals; mailer.domain, mcp.server_url, cloud.credentials_url and traefik.ws_base are built from them, each keeping its own override. Agent runtime images are derived from AGENT_IMAGE_PREFIX + the runtime name + AGENT_IMAGE_TAG, with the seven AGENT_IMAGE_* variables kept as per-runtime overrides — that removes 21 lines across three settings files and makes a new runtime a zero-line change. Verified resolved images are byte-identical:

development claude_code -> aixle/claude-code:latest        (was aixle/claude-code:latest)
production  claude_code -> ghcr.io/aixle/aixle-app-claude-code  (was the same)

Removed — read by nobody. Each was grepped against the app, the tests, and the infra repo first:

Variable Why it was dead
AUTHOR_NAME, AUTHOR_EMAIL Fed app.last_commiter, which nothing read. Also plumbed through the Dockerfile, both compose files and all three workflows — all removed. The docs claimed these were agent commit identity; they were not.
RAILS_PORT A second name for PORT that nothing read.
TEMPORAL_UI_URL, REDIS_UI_URL, TRAEFIK_DASHBOARD_URL No admin link ever consumed them (infra sets real hostnames for two of them — see follow-ups).
TRAEFIK_CORS_ORIGINS CORS is not configured from a setting.
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, ..._LOGS_ENDPOINT Nothing read the logs one; the single reader of the metrics one stripped /v1/<signal> back off to recover the base. No OpenTelemetry SDK runs in this app, so one base endpoint is the whole requirement.
CODER_DEFAULT_TEMPLATE, CODER_MACHINE_PREFIX Both are per-integration columns read straight off the integration row, with no settings fallback.
MAX_FILE_SIZE Read by nothing.
ENVIRONMENT A stray CI-only variable.
container_execution.timeouts.* (10 keys), limits.tool_execution.max_timeout Temporal owns activity timeouts; a tool's own timeout comes from its definition.
authorization.otp_enabled, mcp.name, integrations.github.private_pem Unread. The last one also ran OpenSSL::PKey::RSA.new(2048) on every settings load in test.

Also gone: the git rev-parse / git log backticks that ran on every settings load — including in images that ship without a .git directory, where they silently produced "".

Phantom keys resolved. tool_results.retention_days, context.token_budget and github.private_key_path are now real, documented keys (the GitHub one makes the GITHUB_APP_PRIVATE_KEY_PATH branch in Github::TokenService reachable for the first time — it asked for a setting nothing defined). Settings.agents.oauth.base_client_id is folded into the constant it always fell back to: Anthropic publishes one public client id, so there was nothing per-deployment to configure.

K8S_TRAEFIK_VERIFY_TLS stated positively. It was traefik_skip_tls_verify: ENV[...] != 'true' — a double negative over the same variable, which made "verification is off unless explicitly enabled" hard to see. Same effective default (that listener serves a self-signed certificate, so flipping it would break those deployments), now readable.

SESSION_* moved into Settings. The three session-queue inputs were the only application code reading ENV. They keep every property the design doc specifies — the two scope defaults are still re-read at each boot, a bad value is still logged and ignored rather than raised, session_admission:sync is still the strict validator — and the tests now replace the settings block instead of mutating the process environment.

Added after review of the first pass

Azure DevOps variables documented. The reference test caught its own first drift on the rebase: the Azure integration (#251) had landed 15 settings variables with no row anywhere. Documented with real defaults, and azure_devops.git_credentials_url now derives from the same internal base as the MCP and Bedrock endpoints — which surfaced a live production defect, fixed separately in aixle-infra#38: that URL was falling back to http://web:4002/..., and in the cluster port 4002 belongs to the mcp service while web serves 4000, so the in-container git credential helper had no reachable endpoint. Measured from a prod pod: the mcp address answers 401, web:4002 times out.

PORT and MCP_PORT now move the whole stack. Both were already read from the environment by the Puma configs, but everything derived from them was a literal: domain, asset_host and container_asset_host hardcoded 4000, the internal base hardcoded 4002, and Compose published, health-checked and routed the ports by hand. PORT=4010 MCP_PORT=4012 docker compose up now moves the listeners and every derived value, which is what running a second stack beside the first needs.

A blank ASSET_HOST no longer counts as configured. The image declares it as an ENV, so a build without the arg carries "" — truthy in Ruby, so || default never fired. The default is removed rather than fixed (nothing in development or test read Settings.asset_host), and production.rb now guards on the setting it is about to assign instead of on the raw variable.

The qa environment is gone. Nothing deploys it: the infra repo has no match for "qa" at all, helmfile declares prod and staging, terraform's live stacks are bootstrap/global/iam/mgmt/prod/staging, and the only RAILS_ENV values set anywhere are staging, production and development. In this repo it was still a full environment — config/environments/qa.rb (93 lines, longer than production.rb), config/settings/qa.yml, and a qa: key in four config files. Removed in one go, because config/queue.yml documents why a partial removal is worse than none: Solid Queue falls back to its own gem defaults silently when the key for an environment is missing. uat: in database.yml went too — there is no uat.rb, so that environment could never boot, and the line was the only occurrence of the word in the repository.

RecurringTasksTest failed on that last one in CI, which is exactly what it is for: it hardcodes the deployed environments and asserts the queue watchdog is scheduled in each, and the watchdog is the one entry that must never quietly stop being scheduled. Its list follows the removal.

Guardrails

  • test/config/configuration_reference_test.rb — fails when a settings variable has no row in the reference, when a row names a variable nothing reads, or when the portal copy diverges from it. bin/rails docs:sync_config_reference regenerates the copy.
  • Configuration/NoEnvInApp (.rubocop/cops/configuration/no_env_in_app.rb) — bans ENV in app/**, with no exclusions needed. Boot files, bin/, rake tasks, seeds and tests stay exempt.
  • test/config/thread_budget_test.rb — the thread/pool invariants above.

Verification

Run against an isolated Postgres (this is an orca worktree, outside the compose mount):

  • bundle exec rubocop — 1631 files, no offenses. Cop verified to fire on ENV["X"], ENV.fetch, and bare ENV.

  • bundle exec brakeman — 0 warnings.

  • bin/rails test — 5512 runs, 0 failures, 0 errors (against an isolated Postgres).

  • Settings load checked in development and production (all derived values printed and compared against the previous defaults).

  • Frontend, run locally too (the main checkout's node_modules mounted read-only, with tmpfs over Vite's temp dirs): vitest run 108 files / 1359 tests all passing, tsc --noEmit clean, steiger (FSD) clean, eslint --ext .ts,.tsx app/frontend 0 errors.

  • Settings rendered under the real production and staging ConfigMaps, old code versus new, key by key — see the equivalence comment below.

Follow-ups (not in this PR)

  • aixle-infra: TEMPORAL_UI_URL, TRAEFIK_DASHBOARD_URL, TRAEFIK_CORS_ORIGINS, RAILS_PORT, OTEL_EXPORTER_OTLP_{METRICS,LOGS}_ENDPOINT are now inert in kube/helmfile/values/aixle-app/{prod,staging}.yaml and can be dropped. The seven AGENT_IMAGE_* entries can collapse to one AGENT_IMAGE_PREFIX.
  • If an admin link to the Temporal / Redis / Traefik UIs is actually wanted, that is a feature, not a variable — the hostnames were configured for a link that was never built.

🤖 Generated with Claude Code

artempartos and others added 2 commits September 17, 2026 16:59
An inventory of the environment surface found 125 variables reaching the app
through config/settings.yml, 16 settings keys nothing read, 4 keys read by code
that no settings file defined, and three documents describing all of it that
disagreed with each other and with the code. This lands the whole cleanup.

The one real defect: the Active Record pool fell back to RAILS_MAX_THREADS || 5
while config/puma.rb fell back to 10, so a deployment that never set the
variable ran 10 request threads against an 8-connection pool. Compose and the
cluster both set it, which is why nothing caught it.

Derived values are now bound once as ERB locals (domain, thread budget, internal
base URL, OTLP endpoint, Traefik base) instead of re-reading the same variable
in two places, and agent runtime images are derived from a registry prefix
rather than enumerated seven times in three files. Every resolved image is
byte-identical in development, staging and production.

Deletions are all "read by nobody", verified against the infra repo before
removal: the variables stay inert in existing ConfigMaps rather than breaking
anything. The four phantom keys are either defined now (tool-result retention,
context token budget, GitHub private-key path) or folded into the constant they
always fell back to (the Claude base OAuth client id).

Documentation drift is now mechanically prevented: docs/reference/configuration.md
is the single source, the docs portal serves a generated copy of it, a test
fails when a variable gains no row or a row names a variable nothing reads, and
a rubocop cop keeps app code from reading ENV behind that file's back.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
The new reference test caught its first drift on the rebase: the Azure
DevOps integration (#251) landed 15 settings variables with no row in
docs/reference/configuration.md, which is exactly the gap the test exists
to close. Documented with real defaults, including the two that are easy to
get wrong — the OAuth resource that only looks like a legacy ADAL value, and
the webhook base URL whose blank default means "use the deployment's domain".

Also folds azure_devops.git_credentials_url into the same `internal_base`
local the MCP and cloud-credential URLs now derive from. The resolved value
is unchanged (http://web:4002/azure/git/credentials), but it is no longer a
third hardcoded copy of the internal host — and that host is wrong in the
cluster, where port 4002 belongs to the mcp service and not to web, so the
one variable now fixes all three.

CONTAINER_RUNTIME's row said "docker or kubernetes"; the deployed ConfigMaps
set `k8s`, which ContainerRuntime.build accepts as well.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
@artempartos
artempartos force-pushed the artempartos/chore-env-vars-audit branch from fe52bca to fff80be Compare September 17, 2026 13:06
@artempartos

Copy link
Copy Markdown
Contributor Author

Equivalence check against the real deployment configuration

To answer "does this still agree with the infra", I rendered the settings twice — once from origin/develop, once from this branch — under the actual environment each deployed workload gets, and diffed every resolved key. The environments were extracted from aixle-infra (kube/helmfile/values/aixle-app/{prod,staging}.yaml configMap.data plus the per-workload env: from common.yaml), from docker-compose.yml and from docker-compose.ci.yml:

Profile Rails env Vars fed in
production-web production 77
production-worker production 74
staging-web staging 69
staging-worker staging 66
development-compose development 13
test-ci test 12

Every difference in all six profiles falls into one of three buckets, and nothing else changed:

  1. Removals — the dead keys this PR deletes. Notably kubernetes.traefik_skip_tls_verify = true becomes kubernetes.traefik_verify_tls = false in every profile, i.e. the TLS behaviour is provably identical.
  2. Additions — the new keys, each resolving to the value the old code fell back to anyway: tool_results.retention_days = 30, context.token_budget = 6000, github.private_key_path = nil, session_admission.* = nil (no deployment sets those variables), agents.image_prefix / image_tag.
  3. Two changed values, both expected:
    • app.version: nil -> "unknown" — only when APP_VERSION is unset. The published images set it (images.yml passes APP_VERSION=${{ github.sha }}), so deployed pods are unaffected; previously an unset value shelled out to git rev-parse in a .git-less image and produced "".
    • database.pool: 8 -> 13 on the profiles that set no RAILS_MAX_THREADS. No deployed workload's effective pool changes: web and mcp set RAILS_MAX_THREADS=10 (pool 13 before and after), jobs sets DB_POOL=10 outright, and worker-ruby has its pool re-established by bin/temporal_worker from the worker budget (5 × 2, clamped → 10). The fix lands exactly where the bug was: a deployment that sets nothing.

End-to-end values under the production ConfigMap

worker_max_threads=5          activity_slots=4      effective worker pool=10   (all unchanged)
runtime=ContainerRuntime::KubernetesRuntime         (CONTAINER_RUNTIME=k8s is accepted)
image claude_code -> 541894707537.dkr.ecr.us-east-1.amazonaws.com/aixle-app-claude-code
image kiro_cli    -> 541894707537.dkr.ecr.us-east-1.amazonaws.com/aixle-app-kiro-cli
mcp=http://mcp.aixle-prod.svc.cluster.local:4002/action_mcp
cloud=http://mcp.aixle-prod.svc.cluster.local:4002/cloud/aws/credentials
otel=http://otlp-ingest.aixle-prod.svc.cluster.local:4318
http=https://flow.aixle.com   ws=wss://flow.aixle.com                k8s_verify_tls=false

The per-runtime AGENT_IMAGE_* overrides still win over the derived prefix — production keeps pulling from ECR. And ws_base, which is now derived, resolves to exactly the value the ConfigMap sets explicitly.

Findings for the infra repo (no app change needed)

production-web sets 77 variables, of which 21 are not read by this app:

  • Removable after this merge (this PR's list): RAILS_PORT, TEMPORAL_UI_URL, TRAEFIK_DASHBOARD_URL, TRAEFIK_CORS_ORIGINS, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, OTEL_EXPORTER_OTLP_LOGS_ENDPOINT.
  • Consumed by other containers, keep: every TEMPORAL_DB_* / TEMPORAL_SQL_* / TEMPORAL_POSTGRES_* / TEMPORAL_VISIBILITY_DB_NAME (the Temporal server), MALLOC_ARENA_MAX (glibc), AWS_REGION (the AWS SDK reads it directly).
  • Pre-existing leftovers worth a look: BITBUCKET_OAUTH_KEY (its value is literally get_from_1password), GITHUB_APP_URL, GITLAB_APP_ID, TEMPORAL_DEBUG — nothing in the app or, as far as I can tell, in the Temporal Ruby SDK reads them. Also ACTION_CABLE_URL, which is set in production but only read by config/environments/development.rb.

One real bug the line-up exposed (pre-existing, not from this PR)

azure_devops.git_credentials_url resolves to http://web:4002/azure/git/credentials in production, because no ConfigMap sets AZURE_DEVOPS_GIT_CREDENTIALS_URL. The web service only serves port 4000 — port 4002 is the separate mcp service, which is exactly why MCP_SERVER_URL and CLOUD_CREDENTIALS_URL are set explicitly to mcp.<ns>.svc.cluster.local:4002. So the in-container git credential helper for Azure DevOps has no reachable endpoint in the cluster today.

This PR does not change that value (the default was the same hardcoded string before), but it does make the fix a single variable: INTERNAL_BASE_URL=http://mcp.<ns>.svc.cluster.local:4002 in the ConfigMap now sets the Azure URL — and would have set the other two had they not been configured already.

@artempartos

Copy link
Copy Markdown
Contributor Author

CI is green; the two failures on the first run were flakes, not this change

Both jobs failed once and passed on a rerun with no code change in between. develop was green at the same time, so neither is a regression here — but both are worth their own issue, since they will block unrelated PRs too:

  • AssetUploadTest#test_uploads_a_json_file_whose_contents_are_not_valid_json (system test). [OK] for rails-test, rubocop, brakeman, vite-build and worker-boot; only the system test failed, on assert asset, "asset persisted". The race is in the test: Uppy renders the file name from the local file selection, so assert_text passes before the upload has completed and the row exists. Nothing in this PR touches the presign/PUT path, and MAX_FILE_SIZE — the one asset-adjacent variable it removes — has no Ruby reader at all.
  • useBoardTaskPages.test.ts > re-queries every column server-side once a filter is on (Vitest). A debounce-timing test, unrelated to configuration.

Frontend checks now verified locally too

The earlier note in the description ("frontend checks did not run locally") no longer applies — I mounted the main checkout's node_modules read-only into the check container, with tmpfs over node_modules/.vite-temp and node_modules/.vite so Vite can write its temp files:

  • vitest run — 108 files, 1359 tests, all passed, including the test that failed on CI.
  • tsc --noEmit — clean.
  • steiger ./app/frontend (FSD) — clean.
  • eslint --ext .ts,.tsx app/frontend (what yarn lint runs) — 0 errors, 22 pre-existing warnings, same as CI.

Backend, for completeness: bin/rails test 5512 runs / 0 failures locally against an isolated Postgres, plus rubocop (1729 files, no offenses) and brakeman (0 warnings).

artempartos and others added 5 commits September 17, 2026 17:40
`container_env` fell back to a literal "http://web:4002/azure/git/credentials"
behind the setting, which made four copies of the internal host in the tree and
one of them wrong: that address is only correct under compose, where a single
`web` container runs both pumas and publishes 4002. In the cluster port 4002
belongs to the separate `mcp` service, `web` serves only 4000, and the runtime
NetworkPolicy admits exactly those two pairs — so a fallback to `web:4002`
cannot connect even in principle.

The setting always has a value (config/settings.yml derives it from
INTERNAL_BASE_URL alongside mcp.server_url and cloud.credentials_url), so the
fallback was unreachable code that only served to duplicate a bad default.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
The two ports were already read from the environment by config/puma.rb and
config/puma_mcp.rb, but everything derived from them was a literal: `domain`,
`asset_host` and `container_asset_host` hardcoded 4000, the internal base URL
hardcoded 4002, and Compose published, health-checked and routed 4000/4001/4002
by hand. Overriding PORT therefore moved the listener and left every derived
host pointing at the old number — so a second stack on one machine (a worktree
under review, for instance) could not be brought up cleanly.

The settings file now binds both ports as ERB locals and derives those four
values from them, and Compose takes `${PORT}`, `${MCP_PORT}` and
`${VITE_RUBY_PORT}` for the published ports, the Traefik service label, the
health check and the container env.

  PORT=4010 MCP_PORT=4012 docker compose up
  -> domain=localhost:4010  container_asset=web:4010
     mcp=http://web:4012/action_mcp  cloud=http://web:4012/cloud/aws/credentials

Deployed environments are unaffected: they set the derived values explicitly
(DOMAIN, CONTAINER_ASSET_HOST, and in the cluster the internal base), so the
defaults these ports feed are never reached there.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
The image declares ASSET_HOST as an ENV, so an image built without that build
arg carries it as "" — present to the process, blank to anyone who means it.
`ENV['ASSET_HOST'] || "localhost:4000"` therefore never reached its default:
an empty string is truthy in Ruby, so the setting resolved to "" rather than to
anything usable.

The default is gone rather than fixed, because nothing in development or test
ever read `Settings.asset_host` — `localhost:4000` was a value with no consumer.
Blank now means what it says: Rails serves the assets itself.

config/environments/production.rb keyed its guard off the raw variable
(`if ENV["ASSET_HOST"].present?`), which is what hid this; it now reads the
setting it is about to assign. Production sets a real value, so nothing changes
there.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
…e it

Nothing deploys `qa`. The infra repo has no match for it at all: helmfile
declares prod and staging, terraform's live stacks are bootstrap/global/iam/
mgmt/prod/staging, the kubeconfig knows `aixle-staging` and `palad-prod`, and
the only RAILS_ENV values set anywhere are staging, production and development.
The deploy repo's branches are develop, main, main-images and staging.

In this repo it was a full environment all the same: config/environments/qa.rb
(93 lines — longer than production.rb, and three times staging.rb, which is just
`require_relative "production"` plus one override), config/settings/qa.yml, and a
`qa:` key in database.yml, cable.yml, queue.yml and recurring.yml. No code reads
`Rails.env.qa?`; the "qa" occurrences that remain in app code are the job
position in onboarding (`POSITIONS = %w[qa pm_po_ba dev ...]`). It arrived in
4179ec1, the same scaffold commit that brought the unread `ui_url` keys.

Removed in one go rather than piecemeal: the comment above the `qa:` key in
queue.yml records why. Solid Queue looks that file up by Rails.env and falls
back to its own gem defaults SILENTLY when the key is missing — staging once ran
three threads polling ten times a second that way. Leaving qa.rb while dropping
its queue key would have rebuilt exactly that trap.

`uat:` in database.yml went with it: there is no config/environments/uat.rb, so
RAILS_ENV=uat cannot boot at all, and that line was the only occurrence of the
word in the repository.

Verified staging still resolves its own config after the removal:
`RAILS_ENV=staging bin/rails runner` boots and reads the staging key out of
queue.yml (dispatchers present, not the gem fallback).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
RecurringTasksTest asserted the queue watchdog is scheduled in
`%w[production staging qa]`; with the qa environment gone, `config_for` returns
nil for it and the test dies on the nil rather than on a missing schedule.

The list is the test's definition of "every deployed environment", so it follows
the removal. That this test is what broke is the point of it existing: the
watchdog is exactly the entry that must never silently stop being scheduled.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
@artempartos
artempartos merged commit 44c1666 into develop Sep 17, 2026
7 checks passed
artempartos added a commit that referenced this pull request Sep 17, 2026
Resolves against #270, which moved the queue's deployment inputs from raw
ENV reads onto Settings. Takes develop's mechanism and drops the user
scope from it, since this branch removes that scope entirely:

* SCOPE_DEFAULTS keeps develop's `setting:` key, Project only.
* `with_scope_defaults` becomes develop's Settings stub without `user:`,
  and the ENV bookkeeping it replaced — including `restore_scope_defaults`
  — is gone.
* config/settings.yml loses `user_default`, and its comment loses the pool
  mode that no longer exists.
* The configuration reference tables describe a ceiling and a reservation
  rather than a choice of pool.

This conflict is also why CI had stopped running on the pull request:
GitHub cannot build the merge ref of a conflicting branch, so three
successive events produced no run at all.

Signed-off-by: Artem Petrov <[email protected]>
artempartos added a commit that referenced this pull request Sep 17, 2026
The Settings refactor that landed on develop (#270) brought a guard: every
environment variable a settings file reads must have a row in
docs/reference/configuration.md, and the docs portal must serve that file
rather than a hand-copy. Rebasing onto it surfaced four undocumented
variables from this branch.

AUTH_ENABLED_KINDS is worth reading twice: availability is derived from which
credentials are actually present, so the allowlist can only ever offer less
than that — an installation with no Microsoft credentials never offers
Microsoft however it is set.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
artempartos added a commit that referenced this pull request Sep 25, 2026
The Settings refactor that landed on develop (#270) brought a guard: every
environment variable a settings file reads must have a row in
docs/reference/configuration.md, and the docs portal must serve that file
rather than a hand-copy. Rebasing onto it surfaced four undocumented
variables from this branch.

AUTH_ENABLED_KINDS is worth reading twice: availability is derived from which
credentials are actually present, so the allowlist can only ever offer less
than that — an installation with no Microsoft credentials never offers
Microsoft however it is set.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
artempartos added a commit that referenced this pull request Sep 25, 2026
The Settings refactor that landed on develop (#270) brought a guard: every
environment variable a settings file reads must have a row in
docs/reference/configuration.md, and the docs portal must serve that file
rather than a hand-copy. Rebasing onto it surfaced four undocumented
variables from this branch.

AUTH_ENABLED_KINDS is worth reading twice: availability is derived from which
credentials are actually present, so the allowlist can only ever offer less
than that — an installation with no Microsoft credentials never offers
Microsoft however it is set.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
artempartos added a commit that referenced this pull request Sep 25, 2026
The Settings refactor that landed on develop (#270) brought a guard: every
environment variable a settings file reads must have a row in
docs/reference/configuration.md, and the docs portal must serve that file
rather than a hand-copy. Rebasing onto it surfaced four undocumented
variables from this branch.

AUTH_ENABLED_KINDS is worth reading twice: availability is derived from which
credentials are actually present, so the allowlist can only ever offer less
than that — an installation with no Microsoft credentials never offers
Microsoft however it is set.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
artempartos added a commit that referenced this pull request Sep 28, 2026
* docs(auth): add federated identity research, architecture and spec

Market research for broad login coverage, the architecture spine it produced,
the companion RFC, and the BMAD spec kernel.

The research answers why this is built rather than bought: three constraints —
enterprise SSO must work for self-hosted installs, there is no deadline, and no
paid dependency may sit in the login path — eliminate the commercial CIAM market
and the AGPL or self-hosted-paywalled identity providers before any feature
comparison. Keycloak is evaluated on its merits and declined on fit with an app
that already owns its user and organization model.

The spine carries 26 invariants (AD-1..AD-26) with Binds/Prevents/Rule, four
reviewer-gate reports, and an append-only memlog of every decision. Two
questions are left open rather than answered: the sidecar's OSS tenancy, and
IdP-initiated SSO.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* feat(auth): add federated identity, company auth policy and SSO

Six capabilities on one seam: a port with an adapter per authentication method,
so adding a method is an adapter plus a provider row and never a change to the
entry gate.

Foundation. Identity is (provider, subject), never email — the previous
resolution joined on address alone and never read email_verified, which is an
account-takeover path the moment a second provider exists. Sessions become
server-side rows whose proofs append, so revocation works, "sign out everywhere"
is possible, and a user in two companies with disjoint policies is not bounced
between step-ups forever.

Company auth policy. Providers and policy are two tables, because a
deployment-wide Google client and a per-customer SAML connection are not the
same shape. Enforcement is at company entry, re-evaluated every request beside
the membership check, and a mismatch redirects to step-up rather than signing
anyone out. A policy edit that would strand any active member is refused and
names them; deletion is evaluated exactly as disabling.

Methods. Microsoft (Entra), per-company OIDC with PKCE and a server-side nonce,
passkeys, single-use emailed links, and TOTP as a step-up that can never start a
session. Every assertion is bound to the row it claims to satisfy — iss, aud,
nonce, tid, bridge tenant — with no email fallback when binding fails.

SAML never enters this process. A connection row holds the bridge's keys, not
IdP metadata, and an invariant test fails if ruby-saml or omniauth-saml ever
appear in Gemfile.lock: five Critical authentication-bypass advisories in
fifteen months is not a dependency to carry in the web process.

SCIM is a first-party endpoint scoped by its bearer token alone, writing
memberships through the same state machine the UI uses and never writing
identities.

Two adversarial reviews caught four defects a green suite did not: an
impersonation marker that outlived its session and granted admin to whoever
signed in next, password credentials that never reached the identity resolver
and so broke the stranding guard for everyone, a SCIM rename that could repoint
a membership at an unrelated account, and a Microsoft assertion that could adopt
an existing account because Entra proves no domain ownership. All four are fixed
and covered.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* feat(auth)!: drop SAML; enterprise SSO is per-company OIDC

Removes the SAML adapter, the bridge client, the compose profile and their
tests. A spike had verified the bridge first — the OSS build took three
per-company connections with no licence gate, the adapter's client_id shape
worked against the live authorize endpoint, and along the way it showed that the
published compose image name did not resolve at all, that one entityID may serve
only one tenant, and that the bridge phones analytics home unless told not to.

None of that was the deciding factor. Carrying a second service is not worth
what SAML buys, because enterprise SSO does not require it: per-company OIDC is
already implemented and tested, and Entra ID, Okta, Ping, OneLogin, JumpCloud and
Google Workspace all speak it. What is given up is customers whose IT mandates
SAML specifically, or who run ADFS or Shibboleth.

The in-process alternative stays rejected for the reason it always was: ruby-saml
is the only Ruby service provider, and it has had five Critical
authentication-bypass advisories in fifteen months — December 2025's published as
an incomplete fix of March's. A test now bars it and its wrappers from
Gemfile.lock, so adding SAML later is a deliberate decision taken with that
history in view rather than a quiet bundle add.

BREAKING CHANGE: the `sso` compose profile and the SSO_BRIDGE_* settings are
removed. No deployment used them.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* fix(auth): six defects a green suite could not see

Found by running the feature in a browser against a real database. Each belongs
to a class the suite is structurally blind to.

Inertia camelizes prop keys, so every snake_case prop the new pages read came
back undefined: the login screen offered Google on an installation with no
Google credentials and hid passkeys and magic links entirely. Component tests
passed because the test supplied the props, which made them a record of the
author's guess rather than of the contract.

SCIM writes were rejected with "Can't verify CSRF token authenticity". The test
environment disables forgery protection, so request tests were green while a
real directory — which sends a bearer token and no CSRF token — could not
provision anyone. The regression test turns protection back on for that case.

The emailed sign-in link pointed at the wrong port: url_for splits a `host` that
carries one and falls back to the environment default. Invisible in production,
where the domain has no port. Built as a string now, like the OIDC callback.

The SCIM token was passed through a redirect's query string, putting a
credential in browser history, access logs and any Referer. It travels in the
flash.

The step-up code form always failed: setData followed by post sends the previous
state, so a TOTP attempt submitted as a password attempt with an empty password.
The payload is built explicitly and the test now asserts what was posted.

Magic link and passkey sign-ins replaced the live session instead of appending
their proof, unlike the OIDC path — which would have defeated step-up through
either. One shared `sign_in_or_prove` now governs all of them.

Also: deployment providers no longer freeze a humanised label into every
installation's data ("Totp"), the SCIM endpoint is shown before a token exists,
and schema.rb keeps its committed check-constraint rendering.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* fix(auth): offer every accepted method on the step-up screen

The step-up screen named the methods a workspace accepts but only rendered
a control for some of them: `magic_link` had no start path, and `passkey`
has no redirect at all, so both were listed and then unreachable. Someone
whose workspace accepted only those two was told what to do and given no
way to do it.

`magic_link` now starts at `request_magic_link_path`, which fills the
address in from the signed-in user rather than asking for it again, and
the passkey ceremony runs inline on the page.

Also: the sign-in methods page is admin-only in the sidebar, the three
standalone auth screens center their content, and the two settings pages
render inside AuthLayout so they keep the sidebar and page padding.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* fix(mailer): address emailed links the way the browser reaches the app

config/application.rb derives ActionMailer's default_url_options from
Settings.domain and Settings.protocol, so they follow DOMAIN. development.rb
then set them again to a hardcoded host plus the port the process listens on.
Those two ports are the same only when nothing is published in front of the
app: behind a port mapping, a proxy or a container they differ, and every
emailed link points at a port the recipient cannot open. A sign-in link from a
second dev stack led back to the first one.

MagicLinkMailer built its URL as a string to dodge this, and blamed url_for in
a comment. url_for was never at fault — passing a host that carries a port
works fine until a `port:` option overrides it, which is exactly what the
override added. Both mailers now use the ordinary url helpers.

The guard has to read the config files: nothing in a test run exercises the
development environment.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* feat(auth): show a scannable QR when enrolling authentication codes

Enrolment handed over a 32-character base32 secret and left the person to
retype it. The server already built the otpauth:// URI that an authenticator
reads from a QR; nothing rendered it.

Auth::QrCode renders that URI as an SVG data: URI, so the page shows it with
a plain img tag — no QR library in the bundle and no server-built markup
injected into the document. The image carries its own white ground and the
four-module quiet zone the format requires: left transparent it inherits the
page, which on the dark theme is dark-on-dark and unscannable. The typed
secret stays as the fallback for an authenticator with no camera.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* fix(auth): say why company SSO and the emailed link are inactive

Both sit above the email field and both are disabled until it has something,
because both start from the address: SSO resolves the workspace from its
domain, and a link has to be sent somewhere. Google and a passkey need no
address — Google runs its own account picker, a passkey is discoverable — so
they stay active. Nothing on screen said any of that, and a greyed control
with no reason reads as broken.

A line under the group now names the reason while the address is missing, and
narrows itself when the installation offers no emailed link.

The block was also duplicated between the ordinary card and the error card;
it is one SignInMethods component now.

Reconciles docs/design/federated-identity.md with the dropped SAML sidecar:
the scope, goals, identity-binding and Keycloak paragraphs still described a
bridge that no longer exists, and the open-questions table still listed five
questions that are all now answered or withdrawn.

Corrects the callback_url comment, which repeated a wrong diagnosis of
url_for. The reason to build that string by hand is real but different: the
value must match what the customer registered byte for byte and must not vary
with the request, and url_for in a controller takes the host from the incoming
request.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* docs(auth): add a screenshot walkthrough and finish the SAML reconciliation

The RFC now shows the shipped surfaces: signing in, SSO discovery (one
connection, several, none), the emailed link end to end, company auth policy
with an unverified connection, the entry gate before and after, code
enrolment, and the admin-only policy surface refused to a member both ways.
Captured from a running build with the TOTP secret redacted and the secret it
encoded destroyed afterwards.

docs/index.md still described a SAML sidecar in three entries and counted 17
ADs where the spine has 28; the spec still carried an open question about
IdP-initiated SSO that only existed because of SAML. The spine itself was
already coherent — AD-8 and AD-9 are marked retired by AD-28.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* docs(config): document the variables this branch adds

The Settings refactor that landed on develop (#270) brought a guard: every
environment variable a settings file reads must have a row in
docs/reference/configuration.md, and the docs portal must serve that file
rather than a hand-copy. Rebasing onto it surfaced four undocumented
variables from this branch.

AUTH_ENABLED_KINDS is worth reading twice: availability is derived from which
credentials are actually present, so the allowlist can only ever offer less
than that — an installation with no Microsoft credentials never offers
Microsoft however it is set.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* fix(auth): never auto-join a company that refuses the method used

The email domain picks WHICH company someone joins. It never asked WHETHER
that company accepts the method they just signed in with, so a Google sign-in
could plant a membership in a workspace that has Google switched off.

That membership can never be entered — the entry gate re-checks the policy on
every request — and once active it strands its holder, which makes
PolicyUpdater refuse EVERY later policy edit by that company's admins. A
membership nobody can use is worse than no membership: it reads as access,
counts as a member, and quietly freezes the policy screen.

Auth::PolicyResolver.accepts? answers the question with one EXISTS rather than
plucking the whole set to test a single id, and lives beside the rest of the
effective-set arithmetic because that module is declared its only computation.

The test for the freeze goes through IdentityResolver rather than the factory
on purpose: a factory-built user carries a password identity and could never
be stranded, so the first version of it proved nothing.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* chore(routes): regenerate the TypeScript route helpers

Hand-merging this generated file during the rebase dropped a closing brace.
Regenerated from the routes themselves rather than patched.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* fix(auth): finish the move onto develop's server-side sessions

Rebasing surfaced four things the merge itself could not.

`sign_in_or_prove` ended up defined twice — the second copy, from the
defects commit, still named the model this branch no longer has, and being
last it won. The Google callback's `rescue StandardError` turned the
resulting NameError into a plain "oauth_failed" redirect, so the only visible
symptom was a proof that never appended.

The test helper still called a SessionService method that is gone. A cookie
carrying only a user id is adopted into a session row on first use, but an
adopted row holds no proof and the entry gate reads proofs, so the helper
mints the row itself.

Encryptable changed shape on develop: `encryption_key :name` replaces the
old override. Both of this branch's secrets were also encrypting through the
raw encryptor rather than the concern, which kept them out of
`encrypted_columns` — so `encryption:reencrypt` would have skipped them and a
key rotation would have left them unreadable once the retired key was
dropped. They go through `encrypt_secret`/`decrypt_secret` now, which also
gives them the purpose binding #309 introduced.

Impersonation hygiene is develop's now: impersonating is a sign-in of its own
recording `impersonator_id`, which covers the escalation this branch had
patched by hand. The test moves to that design and gains the case their
model's own comment promises — suspending the operator mid-impersonation
ends their admin access.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* chore(db): renumber the proofs migration past a colliding timestamp

The template marketplace (#312) landed a migration at the same timestamp this
branch had used, which aborts `db:migrate` outright. The table it creates
depends only on user_sessions and identity_providers, both far earlier, so the
later slot costs nothing.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* fix(auth): let an admin verify a connection that is not enabled yet

AD-7 wants a company-scoped connection proved before it can be enabled, and
the proof is a completed sign-in through it. Refusing to START a disabled
connection made that impossible: no sign-in until enabled, no enabling until
signed in. Only a platform operator could break the cycle, so a company admin
could never set up their own SSO — while the screen told them to "sign in
through it once, then enable it here".

An admin of the owning company may now start one that is still switched off.
It stays a verification rather than a way in: the company does not accept the
method, so the entry gate turns the resulting session away exactly as before,
and the connection still cannot be enabled until the sign-in actually
completed. The screen gains the Verify button that starts it, and the toggle
is held shut until it has.

Found by deploying to staging. Both guards were individually tested and green
— "a disabled connection cannot be started" asserts the refusal as correct,
and the enable guard seeds the identity directly. Only the pair deadlocks,
which no unit of either could see.

Also corrects three documents that still promised one forced global
re-authentication at the cutover. That followed from this feature owning the
session record; it no longer does, so live sessions survive and the cutover
costs one step-up instead.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* fix(auth): verify a connection through a real form, not an Inertia visit

Verifying redirects to the customer's identity provider, and an Inertia
`router.post` is an XHR: the browser refuses to follow a cross-origin redirect
from one, reports it as CORS, and the page simply sits there. The server was
right all along — the authorize URL was built with PKCE and returned as a 302 —
so no request test could see it. GoogleLoginButton is a form for exactly this
reason; the Verify button now is too.

Still POST with a CSRF token rather than a link: a GET start can be triggered
on a victim's session from an external page (CVE-2015-9284).

The page gains the tests that express the difference a request test cannot —
that Verify submits a form at the start path carrying an authenticity token,
that an unverified connection holds its switch shut, that Verify disappears
once proved, and that a member sees neither Verify nor Remove.

Found on staging within minutes of deploying the fix it belongs to.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* fix(scim): route the paths a real directory actually calls

SCIM fixes its collection at "/Users", capital U, and Scimitar advertises
it that way in ResourceTypes. Rails routing is case-sensitive, so the
`resources :users` draw answered "/scim/users" and returned 404 for the
only spelling Entra or Okta ever sends — the feature could not have
worked against a live provider.

The same draw pointed PUT at Scimitar's #update, which expects a PATCH
"Operations" body, so a provider's replace would have been parsed as a
patch. PUT now reaches #replace.

Neither fault was visible to the request tests: they chose their own
URLs, and lowercase happened to be the one they chose. The added routing
assertions pin the canonical spellings, and the round-trip test follows
the Location header of a created member back to a fetch.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* feat(scim): throttle the directory endpoint before publishing it

On a deployment that exposes /scim to the internet, one bearer token is
everything standing between a stranger and a company's membership list,
and nothing else about the request identifies the caller.

Two throttles: per credential, generous enough for a real directory's
reconciliation sweep, and per IP, which caps guessing at a rate no
attacker can use. The cache key is a digest, so a throttle bucket never
holds a live credential.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* docs(auth): publish the sign-in and SSO guides under /docs

Two pages: one for a workspace admin — what the methods are, how a
workspace decides which it accepts, connecting an OIDC provider, the
verify-before-enable step, step-up, directory sync — and one for whoever
runs the installation, covering the credentials each provider needs and
why availability is derived from them rather than declared.

Registered in all five places a /docs page has to appear, including the
Ruby slug list in Web::DocsController that is the easy one to miss.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* style(docs): order the new doc imports alphabetically

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* feat(auth): keep live sessions signed in through the cutover

The policy gate answers "which method backs this session" from
user_session_proofs. Sessions that predate that table have no proof, so
every one of them would be sent to step-up on the first request after
deploy — not because a company's policy changed, but because
user_sessions records no method and the question is new.

Where the answer is unambiguous it is recovered instead of asked for: a
user holding exactly one identity provider authenticated through that
one, because there was nothing else to authenticate through. A user
holding several is skipped, since choosing between them would be
inventing the proof rather than recovering it, and step-up is the right
outcome there.

The proof is dated from the session's own creation, not from the
deploy — that is when the person actually authenticated.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* test(auth): build the cutover fixtures from how identities actually appear

Setting a password creates its identity (User#link_password_identity),
so a plain factory user already holds one provider. The tests were
written as if it held none, which inverted every expectation: the
"no identity" case was proved and the single-provider cases were skipped
as ambiguous.

The shapes now mirror the ones a deployment actually has after the
backfill — a password user, a Google-only user, and the two edges the
migration refuses to guess at.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* fix(scim): name the SCIM routes instead of letting Rails derive them

Left unnamed, Rails takes the name from the literal path segment: the
collection became `scim_Users` — capital and all, which then reaches the
frontend as `scimUsersPath` — and the next route on the same path fell
back to a bare `scim` that requires an `:id`, reading as the engine root
rather than a member.

The paths themselves are unchanged; only their names are. Nothing in the
frontend referenced the derived helpers, since SCIM is machine-facing.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* fix(auth): let SSO discovery actually reach the provider

Resolving an address to its company's single connection answered with a
303 to /auth/oidc/:id/start. That route is POST only — deliberately, so
a GET cannot be triggered on a victim's session (CVE-2015-9284) — and a
redirect is followed with GET, so the browser landed on a routing error
instead of signing in. Every workspace with exactly one connection had
no working "Sign in with your company SSO".

Discovery now begins the authorization itself, sharing the redirect with
#start so the two ways of reaching a connection cannot drift. It is
already the person's own POST with their CSRF token, so the second hop
added nothing.

The test asserted the redirect TARGET was oidc_start_path, which is
precisely what was broken — it never asked whether a browser could
follow it. It now checks that discovery leaves for the provider, and a
second test pins that it never again answers with one of our own paths.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* refactor(settings): move sign-in methods into company settings as Access (#337)

* refactor(settings): move sign-in methods into company settings as Access

They read as settings and were reached from a separate sidebar entry, so
the screen is now the Access tab of company settings: which methods the
workspace accepts, its own OIDC connection, its directory sync, and who
may join without an invitation.

Each tab is its own URL rather than a client-side panel swap, because
the two halves save differently — General is one form behind one Save,
Access applies every control on the spot. A tab that is also a route
keeps that honest and stays linkable.

Domain auto-join moves with it: it answers the same question as
everything around it. It is saved on the spot too, since a lone Save
button for one switch would be the only control on the tab that behaved
differently, and settings#update now returns to the tab the edit came
from. General no longer carries autoAcceptUsers at all — resending a
stale copy from there would have quietly undone a change made here.

The list is now reachable by members, read-only: knowing which methods a
workspace accepts is how someone makes sense of a step-up prompt.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* fix(settings): follow the moved Access page from every caller

Removing the auth_policies index route removed company_auth_policies_path
with it, and three controllers still redirected there: adding, updating
and removing an OIDC connection, both SCIM token actions, and the return
from verifying a connection. Rails only raises on the call, so the page
itself looked fine.

The two settings tests that covered the Joining card move to where the
card now lives. What replaces them on the general tab asserts the
absence: a second control for the same field would fight the one on
Access, and this page's deferred Save would send a stale copy over it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

---------

Signed-off-by: Artem Petrov <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

* refactor(auth): draw every sign-in method with one component (#339)

The five methods were built by three components with five different
recipes: two at size lg and three at the default, two with variant
subtle so they carried no border at all, and MicrosoftLoginButton
applying `classes.googleButton` from a stylesheet that never defined it
— so it silently got none of Google's styling and fell back to the
browser font. Only two methods had an icon, so their labels started at
four different x positions.

AuthMethodButton fixes the shape once: one height, one border, and a
fixed icon column held even where a method has no icon, which is what
puts every label on the same x. Google and Microsoft were byte-identical
apart from an icon, a path and a label, and are now exactly that.

Credentials move above the methods. Two of them wait on the address, and
the field they wait on used to sit below them — the hint said "enter it
below", pointing past the controls it excused.

Also collapses the login card: `error ? <Paper>…</Paper> :
<Paper>…</Paper>` held two byte-identical branches of ~85 lines each.

Signed-off-by: Artem Petrov <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

* feat(auth): ask for the address first, then offer what the workspace takes (#341)

* feat(auth): ask for the address first, then offer what the workspace takes

The login screen offered every method at once and greyed out the two
that need an address — with the field they need sitting below them. Now
it asks for the address, and what comes back is decided by its domain:
a workspace that signs in through a provider goes straight there, one
that does not gets a second step drawn from exactly the methods it
accepts. Nothing that cannot complete is ever offered.

Decided by the DOMAIN, never by whether an account exists. An unknown
address at a known domain answers identically to a known one, or the
screen becomes an oracle for which addresses are registered — there is a
test that compares the two responses field by field.

Authentication codes are excluded at the service: six digits confirm a
session that already exists, and there is nobody to look up from them.

/login/sso becomes /login/identify. Its "this domain has no SSO" branch
stops being the error `no_sso_connection` and becomes the ordinary
second step, which is what it is for most domains.

Validation splits with the screen: the address is settled on step one
and is not editable on step two, so a complaint about it there would
have had nowhere to appear.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* fix(auth): keep a refused password on the step it was typed on

Signing in is two screens now, and two things still assumed one.

The system-test page object filled an address and a password together;
the password box only exists on the second screen, so every system test
that signs in died on it. It walks both steps now, and waits for the
second to arrive rather than reaching for a field the server has not
sent yet.

And a refused password redirected to /login — which is the ADDRESS step,
so a typo cost you the address you had already given. It re-renders the
credentials step instead, with the workspace's methods and the refusal
on it. An address no workspace claims still goes back to the start;
there is no step two to return to.

The render moves to a concern, since #identify and #create both reach it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

* test(auth): assert the refusal, not the redirect it used to be

A soft-deleted account is still refused at login; it now stays on the
credentials step with the message instead of redirecting, like any other
refusal. The test pinned the redirect, which was the transport rather
than the behaviour.

What it was there for is untouched and still asserted: no session comes
out of it, so the account is refused AT LOGIN rather than signed in and
then dropped by current_user's not_deleted scope.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>

---------

Signed-off-by: Artem Petrov <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

---------

Signed-off-by: Artem Petrov <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
aixle-com Bot pushed a commit that referenced this pull request Nov 20, 2026
aixle-com Bot pushed a commit that referenced this pull request Nov 20, 2026
aixle-com Bot pushed a commit that referenced this pull request Nov 20, 2026
aixle-com Bot pushed a commit that referenced this pull request Nov 21, 2026
Runner.not_retired and TerminalSession.ready/on_runner scopes, one RelayRoute
service for the holders answer and the machine_session signal, strict
session_id in checks, signal type in the failure log, and Machines.let_go!
instead of update_all.

Signed-off-by: Alex <[email protected]>
aixle-com Bot pushed a commit that referenced this pull request Nov 21, 2026
aixle-com Bot pushed a commit that referenced this pull request Nov 21, 2026
aixle-com Bot pushed a commit that referenced this pull request Nov 21, 2026
aixle-com Bot pushed a commit that referenced this pull request Nov 21, 2026
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