Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

REFACTOR (docs): Plan replacing the seeded admin account with the first signup

Rostislav Duginb866d811847b
diff --git a/openspec/changes/replace-seeded-admin-with-first-signup/.openspec.yaml b/openspec/changes/replace-seeded-admin-with-first-signup/.openspec.yaml
new file mode 100644
index 00000000..cbd245e4
--- /dev/null
+++ b/openspec/changes/replace-seeded-admin-with-first-signup/.openspec.yaml
@@ -0,0 +1,2 @@
+schema: spec-driven
+created: 2026-09-20
diff --git a/openspec/changes/replace-seeded-admin-with-first-signup/design.md b/openspec/changes/replace-seeded-admin-with-first-signup/design.md
new file mode 100644
index 00000000..1a36f20a
--- /dev/null
+++ b/openspec/changes/replace-seeded-admin-with-first-signup/design.md
@@ -0,0 +1,261 @@
+## Context
+
+See proposal.md - Why for the motivation. What shapes the approach is how widely the literal string `admin` has spread as a stand-in for "this is the owner's account", and that the change has to serve two populations at once: instances that already hold the seeded account, and instances that will never have one.
+
+The seeded account is created at startup by `CreateInitialAdmin`, called from `backend/cmd/main.go:109` and implemented at `backend/internal/features/users/repositories/user_repository.go:65-86`. It writes a row with `Email: "admin"`, a nil password, the ADMIN role and an active status. Seven code paths then decide something by comparing against that text:
+
+- `user_repository.go:66` - the idempotence check that stops a second seeded account from being created on every restart.
+- `user_services.go:300` (`IsRootAdminHasPassword`) - answers whether the instance is still unclaimed.
+- `user_services.go:313` (`SetRootAdminPassword`) - the account the unauthenticated claim path writes a password to.
+- `management_service.go:74` - only the root administrator may deactivate an ADMIN-role account.
+- `management_service.go:108` - only the root administrator may reactivate one.
+- `management_service.go:154` - only the root administrator may grant or revoke the ADMIN role.
+- `user_services.go:468` - the refusal to change that account's address.
+
+The first three disappear with the seeding and the claim path. The next three move onto the flag. The last is deleted.
+
+An eighth site, `user_services.go:159`, is the sign-in hint naming the `admin` login. Two more live outside production code, both in `backend/internal/features/users/testing/user_utils.go`: `RecreateInitialAdmin` (`:67-79`) renames the current `admin` row to `admin-<uuid>` and calls `CreateInitialAdmin` again so each test starts from a fresh bootstrap account, and `RecreateInitAdminAndGetAccess` (`:50-65`) calls it and then reads the account back by address to mint a token.
+
+The claim path is thinner than it looks. `AdminPasswordComponent` renders a disabled email field reading `admin` and one password field (`frontend/src/features/users/ui/AdminPasswordComponent.tsx:92-105`), posts it, then signs in with `email: 'admin'` (`:70`). `AuthPageComponent` chooses between that component and the ordinary authentication modes by asking `GET /users/admin/has-password` (`AuthPageComponent.tsx:28-40`). Registration already does everything that screen does, and asks for the address as well. The client even has the call for the question that replaces it: `userApi.isAnyUserExists` issues a GET to `/users/is-any-user-exist` and reads `{ isExist: boolean }` back (`frontend/src/entity/users/api/userApi.ts:62-74`), a route the backend never registered (`user_controller.go:26-41`), so the function is dead code today.
+
+The frontend makes the address comparison independently in one more place. `ProfileComponent.tsx` disables the email input when `user.email === 'admin'` (`:234`), explains the lock with `users.profile.adminEmailReadOnly` (`:236-238`), skips validating the field (`:138`) and omits it from the update request (`:157`).
+
+Two things the change does not have to build already exist. Uniqueness is enforced twice, by `users_email_idx` (`backend/migrations/20250605090323_init.sql:14`) and by the explicit check at `user_services.go:471-479`, and the address change is already written to the audit log at `user_services.go:486-506`.
+
+One thing it does have to build. Email syntax is validated where an address enters through the profile update (`UpdateUserInfoRequestDTO`, `binding:"omitempty,email"`, `backend/internal/features/users/dto/dto.go:42`) and through an invitation (`InviteUserRequestDTO`, `binding:"required,email"`, `:47`), but registration binds its address as `required` alone (`:12`). Anyone can register today with `foo` in the email column, and after this change that address could belong to the administrator - which is the one thing the change exists to prevent.
+
+Sessions survive a change of address. `GenerateAccessToken` puts the user id and the password creation time in the token and no email at all (`user_services.go:271-276`), and `GetUserFromToken` resolves the account by id (`:221-233`). An administrator who changes their address stays signed in.
+
+This change is constrained by [`backend/AGENTS.md`](../../../backend/AGENTS.md) for the migration, repository and controller-test conventions, by [`frontend/AGENTS.md`](../../../frontend/AGENTS.md) for the authentication screens and the interface dictionaries, and by [`website/AGENTS.md`](../../../website/AGENTS.md) and [`assets/readme/AGENTS.md`](../../../assets/readme/AGENTS.md) for the six-language documentation rules. The root [`AGENTS.md`](../../../AGENTS.md) language rule applies as written: the console output, the flag name and its help text are English, and the only translated text is the website copy, the README translations and the interface dictionary entries it already permits.
+
+## Goals / Non-Goals
+
+**Goals:**
+
+- Let an instance reach its first administrator without ever storing an address nobody can deliver to.
+- Identify that account by something that survives an address change.
+- Keep every privilege and every screen the seeded account has today working after an upgrade and after its address changes.
+- Give a locked-out owner a recovery path that does not depend on email delivery.
+
+**Non-Goals:**
+
+- Separating a login identifier from an email address. Sign-in stays keyed on the email column.
+- Changing who may deactivate, reactivate, promote or demote an administrator. The rule stays "only the root administrator"; only the way that account is recognized changes.
+- Emitting a confirmation message to a newly created administrator address.
+- Narrowing who can reach an instance that has not been set up yet.
+
+## Decisions
+
+### The first account on an empty instance becomes the administrator
+
+Account creation checks whether the instance holds any user. If it holds none, the account being created takes the ADMIN role and the bootstrap-administrator flag; otherwise nothing changes about how accounts are created. Both entry points ask the same question through the same decision, so registration (`user_services.go:50-135`) and a first external sign-in (`getOrCreateUserFromOAuth`, `:963-974`) answer it the same way. It ignores `IsAllowExternalRegistrations`, which defaults to true (`migrations/20251031143019_add_many_users_and_settings.sql:7`) and which nobody can have turned off on an instance with no administrator to turn it off.
+
+Ignoring that setting is a question of where the count is asked, not of a flag handed further down. Both paths refuse a new account with `external registration is disabled` before they ever reach the insert - `user_services.go:110-111` for registration, `:951-952` for a first external sign-in - so asking the count inside the insert branch would be too late: on an empty instance whose setting happens to be off, the caller would get that refusal and the instance would have no way to gain an administrator at all. The count is therefore asked ahead of that refusal, and an empty instance skips it. Everything else about the two paths stays where it is.
+
+Both entry points fork before they reach the branch that creates an account. `SignUp` completes an existing invited account first (`:66-101`) and `getOrCreateUserFromOAuth` links or activates an existing one (`:896-944`); the grant belongs only in the branch that inserts a new row (`:114-127` and `:963-976`). The distinction costs nothing to honor and keeps the rule readable: the account that takes the instance is one that did not exist a moment ago. Reaching either of the other branches on an instance with no users is impossible anyway, since both need an account to already be there.
+
+Alternatives rejected:
+
+- **Keep seeding the account and only let its address change.** This was the previous plan, and it leaves the placeholder address in the product forever: every new install still starts with an account no mail server can reach, and every piece of documentation still has to explain a login called `admin`. The address change alone treats the symptom.
+- **Seed the account but ask for the address on the claim screen.** It keeps the claim path, the second unauthenticated write endpoint and a second screen that duplicates registration, to end up where registration already is.
+- **Promote the first account only when it registers through the form, not through Google or GitHub.** An instance that has OAuth configured and no users would then hand its first visitor a member account and have no administrator at all, with no way to appoint one.
+
+### Validate the registration address the way every other entry point does
+
+`SignUpRequestDTO.Email` gains `email` beside `required`, so the binding validator rejects a value that is not an address before the service sees it, exactly as the invitation and the profile update already do.
+
+This refuses input that was previously accepted, which is a break in the sign-up contract. It is a small one - a caller sending a non-address was creating an account that could never receive mail - and it is stated in the proposal rather than smuggled in.
+
+Alternative rejected: validating only when the account being created is the administrator. Two rules for one field, and the member registered with `foo` still cannot be reached by password reset or by anything else the product mails.
+
+### One flag, and a partial unique index that settles the race
+
+`users.is_root_admin boolean not null default false` records the account, and `CREATE UNIQUE INDEX ... ON users (is_root_admin) WHERE is_root_admin` allows at most one row to carry it. Two people registering on the same empty instance both see no users and both try to insert a flagged account; the database admits one, and the loser retries as an ordinary registration under the open-registration policy. The outcome is deterministic without a lock or a serializable transaction.
+
+Which violation was refused has to be read from the constraint, not from the fact that a unique index fired. `users` carries two of them: `users_email_idx` (`migrations/20250605090323_init.sql:14`) and the new partial one. Retrying on any unique violation would turn a registration for an address that is already taken into a second insert that fails the same way, and the caller would get an error naming the wrong thing. The retry is therefore conditional on `pgconn.PgError.ConstraintName` matching the bootstrap index; every other violation propagates as it does today, and the duplicate-address message registration already returns stays what it is. Unwrapping a driver error with `errors.As` into `*pgconn.PgError` is how the repository already reads PostgreSQL error codes (`internal/features/databases/service.go:335`, `backups/usecases/physical/postgresql/wal_rotation.go:167`).
+
+Alternatives rejected:
+
+- **Keep matching on the string `admin`.** It is what blocks the address change, and after this change there is no `admin` row on a new install for it to match.
+- **Take the oldest account holding the ADMIN role.** Needs no column, but the answer drifts the moment that account is demoted, and the instance would silently promote a different account into the bootstrap role. A stored flag cannot drift this way. The migration uses this rule once, as a backfill fallback, where drift cannot happen because it runs once.
+- **Count users inside a serializable transaction instead of the index.** It moves a database-level guarantee into application code and into every future caller that creates a user.
+
+### The flag is stored, not served
+
+`User` carries a `json` tag on every field (`models/user.go:11-22`), which reads like a wire format, but no handler serializes it. `GET /users/me` answers with `UserProfileResponseDTO` built in `GetCurrentUserProfile` (`user_controller.go:301`, `user_services.go:441-453`), and the user list builds the same DTO per row (`management_controller.go:91-101`). Nothing in the codebase hands the model to a client, so no response shape changes when the column lands, and no client work is needed either way.
+
+The field still gets `json:"-"`, for the same reason `HashedPassword` and the two OAuth ids already carry it (`models/user.go:14-20`): the tag is what keeps a fact out of the wire if some later handler does return the model directly, and which account owns the instance is exactly the kind of fact that should not travel by accident. Nothing on the client asks the question anyway - the whole point of the change is that the profile screen stops caring - and the three privilege checks that do ask run on the server with the model in hand.
+
+Alternative rejected: **tagging it `json:"isRootAdmin"` now because a later screen might mark the account in the user list.** That screen does not exist, and adding the field when it does is one tag.
+
+### Delete the claim path rather than keep it for upgraded instances
+
+`GET /users/admin/has-password` and `POST /users/admin/set-password` exist to let the first visitor set a password on the seeded account. With no account seeded, the first is always false for a new install and the second has nothing to write to. Keeping them for upgraded instances would mean keeping an unauthenticated password-setting endpoint alive for a row the migration has already resolved: claimed, and therefore not eligible for the claim path anyway; never claimed and alone, and therefore deleted; or never claimed beside other accounts, and therefore flagged, with the reset command as its way in.
+
+The authentication screen asks `GET /users/is-any-user-exist` instead, which is the question it actually needs and the call the client already makes.
+
+Alternative rejected: **leaving the endpoints in place and unused.** The repository's rule on backward compatibility is explicit, and an unauthenticated write endpoint that nothing calls is the worst kind of dead code.
+
+### Resolve the seeded account in the migration, not at startup
+
+The up step does three things in order: add the column and its index; delete the seeded row when it was never claimed - no password and no linked Google or GitHub identity - **and it is the only row in `users`**; set the flag on the remaining `admin` row, or, when none exists, on the oldest ADMIN-role account.
+
+Deleting an unclaimed row is safe because nobody could ever have acted as it. Sign-in requires a password hash, the claim path is the only way it could have got one, and the OAuth columns are empty by construction. Nothing can reference it: every foreign key into `users` either cascades or nulls (`audit_logs` sets null, `workspace_memberships`, `databases`, `download_tokens` and `password_reset_codes` cascade), and all of them are written by an authenticated caller.
+
+It is only safe while that row is alone, though, and it need not be. `POST /users/signup` answers regardless of what the authentication screen offers, and open registration is on by default (`migrations/20251031143019_add_many_users_and_settings.sql:7`), so an instance can hold ordinary members while its seeded account was never claimed. There the seeded row is the only ADMIN-role account - promoting anybody requires being the root administrator, and nobody could act as that account - so deleting it would leave members behind with no administrator and no route back: the first-account rule cannot fire, because the instance is not empty. On that shape the row is kept and flagged. It still has no password, which the reset command the README already documents can give it (`main.go:167-190`), and from there its owner moves it to a real address like any other administrator. That is why the condition is "unclaimed **and** alone" rather than "unclaimed".
+
+The fallback to the oldest ADMIN-role account covers an instance whose seeded row was renamed by hand. Such an instance still holds at least one ADMIN account: no code path deletes users, demoting an ADMIN requires being the root administrator, and that account may not act on its own role (`management_service.go:142`). The condition above is what keeps this true - the up step never deletes the last administrator out from under the fallback.
+
+Alternatives rejected:
+
+- **Resolve it at startup instead of in the migration.** Startup would then carry a one-time rule forever, and a deletion decided by application code is harder to review and to roll back than one statement in a migration.
+- **Leave the unclaimed row in place and let the owner keep claiming it.** The claim path is what this change removes. An instance whose single account cannot sign in and cannot be claimed would be bricked.
+- **Leave the unclaimed row and let the first registration take the flag from it.** The instance would then hold a second, useless ADMIN-role account with an undeliverable address, which is exactly what the change exists to remove, and `--list-admins` would report it forever.
+
+### Move the three administrator-management privileges onto the flag in the same change
+
+`UserManagementService` reserves three actions for the root administrator by comparing `changedBy.Email` (or `deactivatedBy` / `activatedBy`) against `"admin"`: deactivating an ADMIN account (`:74`), reactivating one (`:108`) and granting or revoking the ADMIN role (`:154`). Left alone, no account on a new install passes them, because none is called `admin`: nobody could appoint an administrator, ever. On an upgraded install they would break as soon as the owner set a real address.
+
+Note what the guard rules give us once they read the flag. Demoting or deactivating an ADMIN-role account requires being the root administrator, and that account may act on neither its own role nor its own status, so the flagged account cannot be stripped of its role or deactivated by anyone. The flag therefore stays on exactly one live, active ADMIN-role account for the life of the instance, and the design does not need an extra guard to keep it there. It does need a test: the property holds by composition of three separate rules and nothing in the code states it, so a future edit to any one of them could remove it silently.
+
+### Take the frontend lock down with the backend refusal
+
+`ProfileComponent.tsx` decides read-only-ness by comparing the address. All four sites go: the `disabled` prop, the explanatory line, the skipped validation and the omitted request field. The profile screen then treats every user the same, which is the point - the flag exists so the backend can answer "who is the root administrator", and the profile screen no longer needs to ask.
+
+`users.profile.adminEmailReadOnly` becomes unused and is deleted from `en`, `ru`, `es`, `pt`, `zh` and `fr`. No replacement string is introduced.
+
+Alternative rejected: **expose `isRootAdmin` in the profile DTO and keep the field locked for that account.** It would carry the flag to the client just to reinstate the restriction this change exists to remove.
+
+### The authentication screen opens on registration for an empty instance
+
+`AuthPageComponent` keeps its four modes and its single route. What changes is the question it asks on mount and the branch it takes: with no account on the instance it opens on registration and shows copy saying this account will administer the instance. An instance that holds accounts keeps exactly the screen it opens on today - the same four modes, starting on registration (`AuthPageComponent.tsx:21-23`), reachable to sign-in from there - without that copy. Which screen a populated instance opens on is a separate question from this change, and it is left where it is rather than quietly switched to sign-in.
+
+`AdminPasswordComponent` goes, with the dictionary keys `users.adminPassword.*` and `app.auth.adminPasswordCheckFailed`, its barrel export, and the client functions and types nothing else uses: `userApi.isAdminHasPassword`, `userApi.setAdminPassword`, `IsAdminHasPasswordResponse` and `SetAdminPasswordRequest` (`entity/users/index.ts:10-11`, `entity/users/api/userApi.ts:76-95`). Leaving the two client functions behind would keep dead callers of two deleted routes.
+
+The copy matters more than it looks. Without it the first visitor sees an ordinary registration form and has no way to know that this particular registration is the one that owns the instance.
+
+Alternative rejected: **a dedicated first-run screen.** It would be the registration form with different copy, which is what a mode already is.
+
+### Rebuild the bootstrap-account test helper on the flag
+
+`RecreateInitialAdmin` (`users/testing/user_utils.go:67-79`) relies on two things this change removes: the seeding function, and the idempotence check reading the address. It becomes a helper that retires whatever account currently holds the flag - selected by the flag - and creates a fresh flagged ADMIN account the way `CreateTestUser` already creates users (`:19-48`).
+
+`RecreateInitAdminAndGetAccess` (`:50-65`) is the caller that matters, since nine of the eleven call sites go through it. It reads the account back by address before minting a token, and that lookup answers `nil, nil` once nothing on the instance is called `admin`, so left alone it would hand a nil user to `GenerateAccessToken`. It returns the account the rebuilt helper just created instead, which also removes the second lookup.
+
+Selecting the outgoing account by address would not work: `RenameUserEmailForTests` matches `Where("email = ?", "admin")` and treats zero affected rows as success (`user_repository.go:147-157`), so after any test that moves the address to a real one the flag would stay behind, and the next test in the package would get no bootstrap account. Since Go runs a package's tests in sequence against a shared database, that failure would land on whichever test came next, far from the one that caused it. The helper fails loudly instead, naming what it could not find.
+
+Alternative rejected: keeping a seeding function in production code purely so tests can call it. Test support belongs in `users/testing`, and the helper is three statements.
+
+### A test says what the instance holds, because the database will not
+
+Everything this change adds is keyed on one question - does the instance hold any account - and no test can assume either answer. `cleanup_test_db` drops and recreates the per-slot metadata databases once per run (`backend/cmd/cleanup_test_db/main.go:64-97`), each test binary then claims a free slot with an advisory lock and releases it when the process exits (`internal/config/config.go:259-277`), so a later package inherits whatever the earlier one left in that slot. Around twenty packages outside `features/users` create accounts through `users_testing.CreateTestUser`, and nothing anywhere empties the `users` table. A test that needs an empty instance would therefore pass or fail on which package happened to run first.
+
+`users/testing` gains a helper that empties the table, and the tests that need the empty state call it. The same fact runs the other way too: a test that asserts an ordinary member account now depends on the instance not being empty, so it creates an account first instead of trusting what a neighbour left behind. `Test_UserLifecycleE2E_CompletesSuccessfully` (`controllers/e2e_test.go:120`) is the live example - it registers and asserts the member role (`:172`), and it passes today only because the test above it seeds the bootstrap account. Under the new rule that is an order dependency, and it gets its own precondition.
+
+Alternatives rejected:
+
+- **Emptying the table in a `TestMain` for the package.** It fixes the state at package start, which is not where the problem is: the tests that need an empty instance run after other tests in the same package have created accounts.
+- **Relying on the order tests happen to run in.** It is what makes the existing member assertion work, and it breaks under `-run` on a single test or under any reordering - the worst kind of failure, landing on a test that did nothing wrong.
+
+### Guard the missing password hash on the sign-in path
+
+`SignIn` reaches `bcrypt.CompareHashAndPassword([]byte(*user.HashedPassword), ...)` (`user_services.go:181`) after checking only the account's status. `hashed_password` became nullable so accounts could exist without one (`migrations/20251031143019_add_many_users_and_settings.sql:35-36`), and `getOrCreateUserFromOAuth` creates exactly such an account for a first Google or GitHub sign-in (`user_services.go:963-974`), so submitting the password form for one of those addresses dereferences a nil pointer and the recovery middleware turns it into a 500. `User.HasPassword()` already exists to ask the question properly (`models/user.go:56-58`).
+
+The guard answers with the same refusal a wrong password gets, so an anonymous caller learns nothing new. This is a pre-existing crash rather than one the change introduces; it lands here because this change owns the account-creation paths that produce passwordless accounts and the spec that describes how an instance is entered.
+
+Alternative rejected: refusing with a message that names the account as external ("this account signs in through Google"). It would tell an anonymous caller which accounts are linked to which provider.
+
+### Record audit entries in tests instead of discarding them
+
+The address change already writes an audit entry (`user_services.go:486-506`), and the controller tests install `AuditLogWriterStub`, whose `WriteAuditLog` has an empty body (`controllers/e2e_test.go:255-258`). No test in the users feature has ever asserted an audit entry, so the entries are effectively untested infrastructure.
+
+`users/testing` gains a writer that appends entries to a slice, and the controller test routers use it. That makes the audit requirement in this spec testable and gives `add-email-two-factor-auth`, which moves the "User signed in" entry to the verification step, something to assert against.
+
+Two mechanics decide how a test reaches it. The services are package-level singletons and `SetAuditLogWriter` mutates them (`services/di.go:10-28`), so a recorder installed while building a router replaces whichever one the previous test installed; since the four builders are called from about ninety sites across the feature's test files, they keep returning only the engine, and the recorder is reached through `users/testing` rather than through a changed signature. And an assertion looks for the entry it cares about among the entries recorded, not for a single entry: the setup leading up to it signs in and creates accounts, and those write entries of their own.
+
+Alternative rejected: reading the audit log back through its HTTP endpoint. It would pull the audit feature's storage, pagination and permissions into a test about one entry, and the stub the routers already install would still have to go.
+
+### Delete the sign-in hint rather than reword it
+
+`user_services.go:157-161` branches on `GetUsersCount() == 1` to answer an unknown address with `"user with this email does not exist, seems you need to sign in as \"admin\""`. The whole branch goes, leaving the generic response. `GetUsersCount` stays: the service method has a second caller in telemetry (`backend/internal/features/telemetry/service.go:102`), and the new account-creation rule asks it the same question.
+
+Alternatives rejected:
+
+- **Keep the hint and reword it to mention the console command.** It would still confirm to an anonymous caller that a single-user instance exists, which is the part worth removing.
+- **Show the hint only to callers from a private network address.** Trusting a client address for a disclosure decision is a weaker control than not disclosing, and the owner already has a better recovery path on the host.
+
+### Print the administrator list from the existing command-line entry point
+
+`backend/cmd/main.go:154-166` parses flags with the standard library and `resetPasswordIfRequested` (`:167-190`) runs after the database is initialized and exits the process when it is done. `--list-admins` follows the same shape: a boolean flag, a handler invoked from the same place in startup, printing to the process log and exiting. Output carries the address, display name, creation date and active state of every ADMIN-role account and marks which one holds the flag, and nothing else. The active state earns its place: an administrator whose account was deactivated reads as a perfectly good address to sign in with, and the owner would have no way to see why it is refused.
+
+The handler reads and prints; it writes no audit entry. That is a mechanical constraint as much as an editorial one. `UserService` dereferences its audit writer without a nil check (`user_services.go:128`), the writer is only installed once a feature calls `audit_logs.SetupDependencies()`, and that is exactly why `resetPasswordIfRequested` calls it before changing a password (`main.go:167-190`). A read-only listing needs no such setup, and it must not acquire a code path that assumes one.
+
+What goes in `cmd` is the flag, the call and the print. Everything worth asserting - selecting the administrators, ordering them, marking the flagged one and rendering the lines - lives under `backend/internal/features/users/`, because `make test` and CI both run `go test ./internal/...` and nothing else (`backend/Makefile:16`, `.github/workflows/ci-release.yml:221,345`). The two test files already sitting in `cmd/` (`storage_command_test.go`, `healthcheck_test.go`) are never executed by either. A listing whose logic stayed in `cmd` would ship with tests that look like coverage and provide none.
+
+This is the one place the change tests a service directly rather than through HTTP, which `backend/AGENTS.md` reserves for logic with no API surface. A recovery command for an owner who cannot sign in is exactly that: giving it an endpoint is the alternative rejected below.
+
+That startup point sits after `runMigrations` (`main.go:87`), so on an unmigrated database the command migrates first. For a recovery command run by the instance's owner on the instance's own database this is acceptable. It is the deliberate opposite of `--test-storage`, which exits before migrations precisely so it can run against a database it must not touch. On an instance where nobody has registered yet the command prints nothing and says so, which is the correct answer.
+
+The command is only usable once `restore-console-command-database-access` lands. A container that generates its metadata-database password at startup keeps that value in the environment of its first process, which `docker exec` does not inherit, so a console command started that way falls back to a stale baked-in connection string and fails with `password authentication failed for user "postgres"`. That is the defect the other change fixes for every console command. `--list-admins` inherits it, and so does the recovery path the documentation here points an owner at, which is why this change lands after it and why the task list verifies the command through `docker exec` against a running container rather than against a local database, where the defect is invisible.
+
+Alternatives rejected:
+
+- **A new subcommand argument in the style of `healthcheck` (`main.go:73`).** That path runs before configuration and the database are ready, which the listing needs.
+- **An authenticated HTTP endpoint.** The caller who needs it is the one who cannot sign in.
+- **Printing every user, not just administrators.** On a large instance the output becomes a user dump for a question that is only ever about administrators.
+
+### Documentation goes where a locked-out owner already looks
+
+The password page on the website (`website/app/(en)/password/page.tsx`, headings `reset-password`, `reset-password-command`, `parameters`) is already linked from `README.md:261` as the reset reference. Both commands are documented there and in the README's reset section rather than in a new page, and one home-page FAQ entry points at it.
+
+The README example at `README.md:266` reads `--email="admin"`, with line 269 telling the reader to substitute the real address, and the website page repeats the same example (`password/page.tsx:41`) and offers `admin` as the first illustration of a valid value (`:141`). Leading with `admin` now teaches an address that no new install has, so both examples use a real-looking address, and the text explains that an upgraded instance which has never changed the address still uses `admin`.
+
+The access-management page states that the system holds one user called `admin` (`website/app/(en)/access-management/page.tsx:220`, mirrored in five translations). That sentence is wrong for every new install, so it is rewritten to describe the first registered account.
+
+## What the tests already cover, and what they do not
+
+The users feature is well covered, which decides how much of the test work here is new and how much is a switch of the account the existing tests use.
+
+Already covered, and expected to keep passing unchanged once the helpers move onto the flag:
+
+- The full administrator-management matrix. `management_controller_test.go` pins the root administrator succeeding at all three privileges (`:574`, `:596`, `:618`, `:636`) and an ordinary ADMIN account being refused all three (`:486`, `:512`, `:538`, `:556`). Those tests take the bootstrap account from `RecreateInitAdminAndGetAccess`, so after this change they exercise an administrator whose address is an ordinary test address - which is the case that is impossible to construct today.
+- The guarantee that the bootstrap account cannot be stripped: it may not change its own role (`:665`) or deactivate itself (`:686`), and no other administrator may demote it (`:512`) or deactivate it (`:538`). The spec requirement that the instance is never left without a bootstrap administrator rests on those four, and what is missing is only that none of them names the flagged account specifically.
+- Registration: success, duplicate address, malformed body, binding failures (`user_controller_test.go:66-181`). Sign-in: valid credentials, wrong password, unknown address, rate limiting (`:182-277`, `:1216`). OAuth: a new account, linking by address and completing an invitation, for both providers; the missing-public-email fallback and the refusal when external registration is disabled exist for GitHub only (`:782-1215`). Profile update: name, address, address already taken (`:678-760`). Password reset end to end, including expiry, reuse, rate limiting and delivery failure (`password_reset_test.go`).
+
+Not covered today, next to code this change edits:
+
+- Password registration refused because external registration is disabled. Only the GitHub path has that test (`user_controller_test.go:1007`), even though `DisableExternalRegistrations` (`users/testing/settings_utils.go:21`) makes it a two-line setup. This change adds a deliberate bypass of that check, so the case it must not weaken needs pinning first.
+- The two sign-in refusals above the password comparison: an account still in the invited state and a deactivated one (`user_services.go:168-179`). The change inserts a third refusal between them and the comparison.
+- Audit entries. Every controller test installs a writer with an empty body, so nothing has ever been asserted about them.
+- Anything that depends on how many accounts the instance holds. No test states that precondition today, because nothing depended on it; every behavior this change adds does, and the helper above is what lets a test state it.
+
+Where a test is not the right instrument, and the task says so instead of pretending:
+
+- The migration's backfill. Goose has already run against the test databases before `go test` starts (`backend/Makefile:11-16`), so a test cannot observe an instance in the pre-migration shape. The five shapes - claimed, unclaimed and alone, unclaimed beside other accounts, renamed by hand, and empty - are checked by hand with `make migration-up` and `make migration-down` against a scratch database.
+- The authentication and profile screens. The frontend has 21 test files and all of them cover pure functions or dictionary parity - there is no component or page test in the repository, and this change is not where that convention gets introduced. The screens are verified by running the application; the locale edits are covered by `shared/i18n/dictionaries.test.ts`, which fails if the six files stop agreeing.
+
+## Risks / Trade-offs
+
+- **An instance is published before its owner registers, and a stranger becomes the administrator.** -> The same window exists today, with the claim screen handing the same power to whoever arrives first; the change does not widen it, and the documentation says plainly that the first account owns the instance. Recovery is also the same: an operator with a shell can reset any account's password, and `--list-admins` shows which addresses hold the role.
+- **An owner registers, then forgets which address they used.** -> The listing command reads the stored address directly from the database, so recovery needs no mail delivery. This is why the command ships in the same change.
+- **The migration deletes an account.** -> Only a row with no password and no linked identity, which nobody could ever have signed in as, and only when it is the one row the instance holds. The alternative is an instance nobody can enter at all. The down step cannot bring it back, which the migration plan states.
+- **The migration finds no row with the address `admin`.** -> It falls back to the oldest ADMIN-role account, which exists on any instance that still holds one, for the reasons above. An empty database backfills nothing, which is correct.
+- **The migration meets an instance whose seeded account was never claimed, but which already holds members.** -> Deleting the row there would leave members with no administrator and no way to appoint one, so the row is kept and flagged instead, and its owner takes it over with the reset command. This is the shape the earlier plan got wrong, and it is reachable without anything unusual: `POST /users/signup` answers whether or not the claim screen offers registration.
+- **The console command cannot reach the metadata database.** -> Every console command is affected today, not only this one, and `restore-console-command-database-access` fixes it. This change lands after it, and its verification runs the command through `docker exec` on a running container so the defect cannot hide behind a local database.
+- **A test silently depends on how many accounts the instance holds.** -> Slot databases are shared across packages within a run and nothing empties the `users` table, so the precondition is stated explicitly: a test that needs an empty instance empties it, and a test that needs a populated one creates an account.
+- **A privilege check is missed and the owner silently loses a power.** -> This is the change's main failure mode, and it is why the inventory above is exhaustive rather than illustrative and why the tasks cover each of the three management privileges with its own test. After the change, `"admin"` should survive in production code only in the MongoDB feature, which means something else entirely by it.
+- **Two people register on an empty instance at the same moment.** -> The partial unique index admits one flagged account; the other registration proceeds as an ordinary one. The tasks cover it with a test that inserts the second flagged account directly and expects the database to refuse it.
+- **An administrator sets an address that belongs to somebody else, and that somebody signs in through Google or GitHub.** `getOrCreateUserFromOAuth` (`user_services.go:891-900`) links an OAuth identity to an existing account by matching the email address. The behavior is unchanged by this change, but the bootstrap account was previously out of its reach, because no OAuth provider returns the address `admin`. A typo in the domain of an administrator address therefore hands the owner of that mailbox a route into the most privileged account on the instance. -> Not mitigated here: the same exposure already applies to every invited user, and narrowing it means changing how OAuth links accounts, which belongs in its own change. Recorded so that the change that narrows it knows this account is now in scope too.
+- **Password reset by email starts working for the bootstrap account.** This is an intended consequence rather than a risk, but it is a behavior change: an account that could never be reset by email now can be, and the reset flow's own protections (active status only, three codes per hour, one-hour expiry, `user_services.go:557-571`) are what stands behind it.
+- **The test helper and production code drift apart again.** -> The helper finds the bootstrap account by flag and fails with a clear message when it finds none, so the next divergence stops in the helper instead of appearing as an unrelated test failure later in the package.
+- **Six-language documentation drifts.** -> The website and README translation rules already govern this; the tasks treat each language as its own slice rather than one bulk edit.
+
+## Migration Plan
+
+One goose migration, with both directions as the repository requires.
+
+The up step adds `is_root_admin` with a `false` default and its partial unique index, deletes the seeded `admin` row when it holds no password and no linked identity and is the only row in `users`, and then sets the flag on the remaining `admin` row or, failing that, on the oldest ADMIN-role account. An unclaimed row on an instance that holds other accounts is kept and flagged, because deleting it would leave that instance with no administrator at all.
+
+The down step drops the index and the column. It cannot restore a deleted unclaimed account, and it does not try: an instance that was never claimed rolls back to a state where the old binary seeds the account again at startup, which is exactly where it was.
+
+Rolling the binary back on a claimed instance leaves an unused column behind, and the old code keeps matching on the address text - provided the address has not been changed in the meantime. An owner who has already moved to a real address and then rolls back is worse off: the old code looks the account up by the text `admin`, finds nothing, and `IsRootAdminHasPassword` fails. The authentication screen alerts and keeps its spinner without clearing the loading state (`frontend/src/pages/AuthPageComponent.tsx:28-40`), so nobody reaches the sign-in form, and the restored `Email != "admin"` privilege checks would freeze administrator management even if sign-in worked. It is a lockout rather than a takeover, since the claim path also finds no account to write a password to, and it is recoverable by rolling forward again or by setting the address back to `admin` in the database. The rollback window therefore closes the moment an owner changes the address, and the change's completion notes say so.
diff --git a/openspec/changes/replace-seeded-admin-with-first-signup/proposal.md b/openspec/changes/replace-seeded-admin-with-first-signup/proposal.md
new file mode 100644
index 00000000..ec08245a
--- /dev/null
+++ b/openspec/changes/replace-seeded-admin-with-first-signup/proposal.md
@@ -0,0 +1,81 @@
+## Why
+
+Databasus creates its first administrator at startup with the literal string `admin` in the email column (`backend/internal/features/users/repositories/user_repository.go:77`), and `backend/internal/features/users/services/user_services.go:468` refuses to change it. The bootstrap is sound in what it protects: a fresh install hands the owner an administrator account without requiring SMTP, an internet connection or a delivered email, which is what a self-hosted backup tool deployed behind NAT needs.
+
+The cost is that the most privileged account on the instance has no reachable address. Password reset by email (`user_services.go:545`) silently does nothing for it, because no mail server can deliver to `admin`, and neither can any future feature that has to mail the account holder. Meanwhile the only place the product ever mentions that the login is `admin` is a sign-in error string (`user_services.go:159`), shown when the instance holds exactly one user. It tells an anonymous visitor that the account exists, and it stops helping the moment a second user is invited.
+
+The seeded account buys nothing that registration does not. Claiming an instance today means filling in a password on a screen whose email field is disabled and reads `admin` (`frontend/src/features/users/ui/AdminPasswordComponent.tsx:92-93`), after which the client signs in with that literal address. Letting the first person who registers become the administrator asks for the same thing plus an address the owner already has, and no mail needs to leave the instance for it. The placeholder address then never exists on a new install, and the reachability problem is gone at the source rather than patched afterwards.
+
+Existing instances still hold that account, so the change has to serve both: give the seeded account a stored identity that survives an address change, let its owner move it to a real address, and stop creating it for anyone new.
+
+## Governing docs
+
+This change answers to [`AGENTS.md`](../../../AGENTS.md) at the repo root, [`backend/AGENTS.md`](../../../backend/AGENTS.md), [`frontend/AGENTS.md`](../../../frontend/AGENTS.md), [`website/AGENTS.md`](../../../website/AGENTS.md) and [`assets/readme/AGENTS.md`](../../../assets/readme/AGENTS.md). It touches no verification agent code, so [`agent/verification/AGENTS.md`](../../../agent/verification/AGENTS.md) does not apply.
+
+## What Changes
+
+- Stop seeding an account at startup. `CreateInitialAdmin` and its call from `backend/cmd/main.go:109` are deleted, together with the repository function that writes the row (`user_repository.go:65-86`). A fresh instance starts with an empty users table.
+- Make the first account on an empty instance the administrator. Whether it arrives through the registration form or through a first Google or GitHub sign-in, the account created while the instance holds no users gets the ADMIN role and is recorded as the bootstrap administrator. It is granted regardless of the open-registration setting, which nobody has been able to configure yet at that point.
+- **BREAKING** for the sign-up contract: validate the registration address as an email address. `SignUpRequestDTO.Email` binds `required` alone (`backend/internal/features/users/dto/dto.go:12`), while the invitation and the profile update both bind `email` (`:47`, `:42`), so registration accepts `foo` today. The first account on an instance is now its administrator, and an administrator whose address is not an address is the problem this change exists to remove.
+- Record in the audit log that the instance has been claimed. The account that takes the ADMIN role and the flag gets an entry of its own, beside the registration entry `SignUp` already writes (`user_services.go:130`). It is the one line in the log that explains every privilege that account exercises afterwards, and without it the grant is invisible.
+- Identify the bootstrap administrator by a stored flag instead of by its email text. A migration adds `users.is_root_admin`, and a partial unique index makes it impossible for two accounts to carry it, which is also what settles a race between two people registering on the same empty instance: one insert wins, the loser falls back to ordinary registration.
+- Keep that flag out of every response. `GET /users/me` and the user list both build `UserProfileResponseDTO` instead of serializing the model (`user_controller.go:301`, `management_controller.go:91-101`), so no response shape changes when the column lands. The field still carries `json:"-"`, the way `HashedPassword` does (`models/user.go:14`), so a handler that ever hands the model straight to a client cannot leak it by accident. Nothing on the client needs to know which account is the bootstrap administrator; the backend answers that question itself.
+- **BREAKING** removal of the claim path. `GET /users/admin/has-password` and `POST /users/admin/set-password` are deleted, along with `IsRootAdminHasPassword` (`user_services.go:299`), `SetRootAdminPassword` (`:312`), the two DTOs that exist only for them (`SetAdminPasswordRequestDTO` and `IsAdminHasPasswordResponseDTO`, `dto.go:30-36`), the screen that drives them (`AdminPasswordComponent.tsx`) and the client functions and types only that screen used (`userApi.isAdminHasPassword`, `userApi.setAdminPassword`, `IsAdminHasPasswordResponse` and `SetAdminPasswordRequest`). The authentication screen decides what to offer from whether the instance holds any account, through `GET /users/is-any-user-exist` - the endpoint `frontend/src/entity/users/api/userApi.ts:62-74` already calls and the backend never implemented. No compatibility shim is kept.
+- Upgrade an existing instance in the migration, in one of three ways depending on what the instance holds:
+ - **Claimed**: the `admin` row keeps its password and its sessions, and receives the flag, so the owner signs in exactly as before and can move to a real address afterwards. If that row is missing because somebody renamed it by hand, the flag goes to the oldest ADMIN-role account, which exists on any instance that still holds one: no code path deletes a user, and an ADMIN account can only be demoted by the root administrator, which cannot act on itself.
+ - **Never claimed and alone on the instance**: the seeded row has no password and no linked identity, nobody has ever signed in with it, and it owns nothing. It is deleted, which leaves an empty instance whose first registration becomes the administrator. Every foreign key into `users` cascades or nulls, and none of them can hold a reference to an account nobody could sign in as.
+ - **Never claimed, but other accounts exist**: `POST /users/signup` answers whether or not the claim screen offers registration, and open registration is on by default, so an instance can hold ordinary members while its seeded account was never claimed. Deleting the row there would take away the only ADMIN-role account and leave members behind with no administrator and no way to appoint one - the first-account rule cannot help, because the instance is not empty. The row is kept and flagged instead. The owner gives it a password with the existing reset command and then moves it to a real address, which is the same recovery an owner who forgot the password already uses.
+- Move every remaining decision that reads the address text onto the flag. Three sites survive the deletions above, and missing one turns an address change into a loss of function:
+ - `management_service.go:74` - only the root administrator may deactivate an ADMIN-role account.
+ - `management_service.go:108` - only the root administrator may reactivate one.
+ - `management_service.go:154` - only the root administrator may grant or revoke the ADMIN role.
+- Let the root administrator change their email like any other user, from the profile screen. The refusal at `user_services.go:468` is deleted, and the frontend stops treating the address `admin` as read-only: `ProfileComponent.tsx:234` disables the field, `:236-238` explains why, and `:138` and `:157` skip validating and sending the value. All four go, and the now-unused dictionary key `users.profile.adminEmailReadOnly` is removed from all six locale files. The new address is still validated as an email address, so an upgraded account cannot move from `admin` to another value no mail server can reach.
+- Reset the administrator's password by email. No new code: `SendResetPasswordCode` (`user_services.go:545`) works for any account with a deliverable address, which every new administrator now has from the first minute and an upgraded one has as soon as the owner changes the address. The specs record it as a behavior this change is responsible for.
+- Replace the claim screen with the registration form on an empty instance, and say what the account is. `AuthPageComponent.tsx:21-41` asks whether the administrator has a password and renders `AdminPasswordComponent` when it does not; it now asks whether any account exists and opens on registration, with copy explaining that this first account administers the instance. An instance that already holds an account keeps exactly the screen it opens on today - the same four modes, starting on registration - without that copy, so nothing changes for anyone but the first visitor. The dictionary keys `users.adminPassword.*` and `app.auth.adminPasswordCheckFailed` go, and the new copy lands in all six locale files.
+- Refuse sign-in to an account with no password instead of crashing on it. `SignIn` compares against `*user.HashedPassword` without checking that a hash exists (`user_services.go:181`), and `hashed_password` is nullable so that accounts can exist without one (`migrations/20251031143019_add_many_users_and_settings.sql:35-36`). Submitting the password form for an account created through Google or GitHub (`user_services.go:963-974`) therefore panics and answers 500 today.
+- Rework the test support, which this change touches in five places:
+ - Replace the tests that pin the behavior being deleted. `Test_CheckAdminHasPassword_WhenAdminHasNoPassword_ReturnsFalse`, the three `Test_SetAdminPassword_*` tests (`user_controller_test.go:278-374`) and `Test_UpdateUserInfo_WhenAdminTriesToChangeEmail_ReturnsBadRequest` (`:761`) cover the claim path and the address refusal, so they are replaced by tests of what takes their place. `Test_AdminLifecycleE2E_CompletesSuccessfully` (`e2e_test.go:21-119`) belongs to the same group and is the one that matters most: it walks a fresh instance from the claim call to a signed-in administrator, so it is rewritten to walk it from the first registration instead of deleted.
+ - Rebuild both bootstrap-account test helpers on the flag. `RecreateInitialAdmin` (`users/testing/user_utils.go:67-79`) renames the current `admin` row out of the way and calls `CreateInitialAdmin` again. With no seeding function left, it creates the account itself the way `CreateTestUser` (`:19-48`) does, retiring any account that currently holds the flag first - selected by the flag, because the rename it uses today selects by the address and returns without error when nothing matches (`user_repository.go:147-157`), which would leave the next test with no bootstrap account after any test that changes the address. `RecreateInitAdminAndGetAccess` (`:50-65`) reads the same account back with `GetUserByEmail(ctx, "admin")` and hands it straight to `GenerateAccessToken`, so it moves onto the flag too; left alone it would pass a nil user and panic in the nine tests that call it.
+ - Close the coverage gaps around the paths this change rewrites. Three branches next to the edits have no test today, so a regression in them would land silently: password registration refused because external registration is disabled (only the GitHub path has such a test, `user_controller_test.go:1007`), and the two sign-in refusals that stand immediately above the password comparison this change guards - an account still in the invited state and a deactivated one (`user_services.go:168-179`).
+ - Let a test decide whether the instance holds any account. The behavior this change introduces is keyed on an empty users table, and no test can assume one: `cleanup_test_db` recreates the per-slot databases once per run (`backend/cmd/cleanup_test_db/main.go:64-97`), each slot is then reused by whichever package claims it next, around twenty packages outside `features/users` create users through `users_testing.CreateTestUser`, and nothing anywhere empties the table. `users/testing` gains a helper that empties it, and the tests that assert an ordinary member account create one first instead of relying on what an earlier test left behind.
+ - Assert the audit entries this account produces rather than trusting them. The users feature writes audit entries through a stub that discards them in tests (`controllers/e2e_test.go:255-258`), so no test has ever checked one. A recording writer replaces that stub, which lets the address change assert the entry `user_services.go:486-506` already writes.
+- **BREAKING** for the sign-in experience: delete the hint `"user with this email does not exist, seems you need to sign in as \"admin\""` (`user_services.go:159`). A visitor who mistypes the address now gets the same response as on any other instance. The replacement for a genuinely forgetful owner is the console command and the documentation below, not an error message served to anonymous requests.
+- Add a console command that prints the administrators of the instance, so an owner who has forgotten which address to use can recover it from the host: `docker exec -it databasus ./main --list-admins` prints the email, name, creation date and active state of every user with the ADMIN role, marking which one is the bootstrap administrator. The active state is there because an owner reading the list needs to know why an address does not let them in. It prints no password material of any kind. The listing itself lives under `backend/internal/`, not in `backend/cmd/`, because `make test` and CI both run `go test ./internal/...` only (`backend/Makefile:16`, `.github/workflows/ci-release.yml:345`) - code under `cmd/` is linted but never tested. `main.go` keeps the flag and the call.
+- Document how an instance is set up now, and both recovery paths, where a locked-out owner will look: the root `README.md` password section and its five translations, the `/password` page on the website and its five translations, and one new FAQ entry on the website home page. Correct the access-management page, which tells the reader the system holds a user literally called `admin`.
+
+The console command reaches the same trust level as the existing `--new-password` reset: both require a shell inside the container, and whoever has that already controls the instance and its database.
+
+It also inherits the same defect. Console commands started with `docker exec` cannot currently reach the metadata database of a container that generates its password at startup, which is what `restore-console-command-database-access` fixes. Until that change lands, `--list-admins` fails with an authentication error in the default deployment, and so does the recovery path this change documents. This change therefore lands after it.
+
+### Out of scope
+
+- The second authentication factor itself. It lands in `add-email-two-factor-auth`, which depends on this change.
+- Who may reach an unconfigured instance first. An instance that is published before its owner registers hands the administrator account to whoever arrives first, exactly as the claim screen does today. The window is the same one, and the answer is the same: do not expose the instance before setting it up.
+- Verifying that the administrator's address receives mail. The address is an identifier and a delivery target; nothing here sends a confirmation message to it.
+- A guard against the bootstrap account losing its ADMIN role or its active status. None is needed: demoting or deactivating an ADMIN-role account requires being the root administrator (`management_service.go:74,108,154`), and that account may act on neither its own role (`:142`) nor its own status (`:63`), so nobody can strip it. No code path deletes a user.
+- Deleting users. The migration removes the seeded row of an instance nobody ever claimed and that holds nothing else, which is a one-time cleanup of an account that was never usable and never had company, not a general ability to delete accounts.
+- Linking a Google or GitHub identity to an account by matching email addresses (`user_services.go:891-900`). Every administrator now holds a real address, which brings the account within reach of that existing behavior; the behavior itself is unchanged. See design.md - Risks.
+- Hiding from an anonymous caller whether an instance has been set up. `GET /users/is-any-user-exist` answers that question without authentication, exactly as `GET /users/admin/has-password` does today; the authentication screen cannot decide what to render without it. The disclosure is unchanged, not new.
+- The user-enumeration shape of the remaining sign-in errors. `"user with this email does not exist"` and `"password is incorrect"` still tell an anonymous caller which of the two failed. Deleting the `admin` hint removes one leak but does not address the pair, and merging them changes behavior for every sign-in, which belongs in its own change.
+- Any rename of the ADMIN role.
+
+## Capabilities
+
+### New Capabilities
+
+- `root-admin-account`: how an instance gets its first administrator, how it keeps recognizing that account once its email address changes, which powers it holds over other administrators, and how an owner who has forgotten the address recovers it from the console.
+
+### Modified Capabilities
+
+None. No existing spec under `openspec/specs/` describes authentication or user accounts.
+
+## Impact
+
+- **Database**: a migration adding `users.is_root_admin` with a partial unique index, backfilling it on the claimed seeded account, and deleting the seeded account of an instance that was never claimed and holds no other account.
+- **Backend**: the sign-up and OAuth account-creation paths, the sign-in password check, the email-update path, the three root-administrator privilege checks in `UserManagementService`, two deleted routes and one added, an administrator listing under `backend/internal/features/users/`, and a new command-line flag parsed in `backend/cmd/main.go` alongside `--test-storage`, `--new-password` and `--email`.
+- **API**: `GET /users/admin/has-password` and `POST /users/admin/set-password` are removed, `GET /users/is-any-user-exist` is added, and the generated documentation changes with them. No existing response shape changes: the bootstrap-administrator flag is stored but not serialized.
+- **Test support**: both bootstrap-account helpers in `users/testing/user_utils.go` create the account directly and find it by flag; `users/testing` gains a helper that empties the users table, so a test can put the instance in the empty state the new rule is keyed on; and it gains an audit-log writer that records entries instead of discarding them, installed in the four test routers that build the users feature (`e2e_test.go:177,196,214,232`).
+- **Frontend**: the authentication screen opens on registration for an empty instance and loses `AdminPasswordComponent`; the profile screen stops locking the email field; the six locale files lose the claim-screen keys and `users.profile.adminEmailReadOnly` and gain the copy that explains the first account. The sign-in form keeps accepting `admin` as a login value (`SignInComponent.tsx:50`), because an upgraded instance that has not changed the address still uses it.
+- **Docs**: root `README.md` and `assets/readme/README.{ru,es,pt,zh,fr}.md`; `website/app/(en)/password/page.tsx` plus `website/app/[lang]/password/content/{ru,es,pt,zh,fr}.tsx`; `website/app/(en)/access-management/page.tsx` plus its five translated contents; the FAQ on `website/app/(en)/page.tsx`, in both its visible list and its structured-data block, plus the five translated home-page contents.
+- **Depends on**: `restore-console-command-database-access`, which restores the metadata-database access every console command needs. `--list-admins` and the recovery documentation added here do not work in the default deployment without it.
+- **Downstream**: `add-email-two-factor-auth` consumes the stored flag and the requirement that an administrator holds a real address.
diff --git a/openspec/changes/replace-seeded-admin-with-first-signup/specs/root-admin-account/spec.md b/openspec/changes/replace-seeded-admin-with-first-signup/specs/root-admin-account/spec.md
new file mode 100644
index 00000000..4ee381d7
--- /dev/null
+++ b/openspec/changes/replace-seeded-admin-with-first-signup/specs/root-admin-account/spec.md
@@ -0,0 +1,224 @@
+## Purpose
+
+Describes how a Databasus instance gets the administrator account its owner works from: how that account is created on a new instance, what happens to the account older instances were shipped with, how the instance keeps recognizing it once its email address changes, which powers it holds over other administrators, and how an owner who has forgotten the address recovers it from the host.
+
+## ADDED Requirements
+
+### Requirement: A new instance creates no account until somebody registers
+
+A started instance SHALL NOT create any account on its own. An instance that holds no account SHALL offer account creation as the way in, and SHALL say that the account being created administers the instance.
+
+Creating that account SHALL require nothing the owner cannot supply locally: no delivered email, no outbound network access and no configured mail server.
+
+An instance that already holds an account SHALL offer the ordinary way in - signing in, and creating an account where the registration policy allows it - and SHALL NOT repeat that the account being created administers the instance.
+
+The instance SHALL NOT offer any way to set a password on an account that already exists without either authenticating as that account or proving control of its address with an emailed reset code. Claiming an instance is account creation; recovering an account whose password is lost is the emailed reset or a command run inside the instance.
+
+#### Scenario: Opening a freshly deployed instance
+
+- **WHEN** an owner opens a freshly started instance that has no mail server configured and no network access
+- **THEN** the instance offers to create an account, saying that it will administer the instance
+- **AND** no account exists on the instance until that form is submitted
+
+#### Scenario: Setting up without any mail server
+
+- **WHEN** the owner submits the form on that instance
+- **THEN** the account is created and the owner is signed in as an administrator, with no email sent
+
+#### Scenario: Opening an instance that already holds accounts
+
+- **WHEN** a visitor opens an instance on which at least one account exists
+- **THEN** the entry screen offers signing in, and says nothing about the first account administering the instance
+
+#### Scenario: An anonymous caller tries to set a password on an existing account
+
+- **WHEN** an unauthenticated caller attempts to set a password on an account that already exists, without an emailed reset code
+- **THEN** the instance refuses, whether or not that account currently has a password
+
+### Requirement: The first account on an empty instance administers it
+
+The first account created on an instance that holds no other account SHALL receive the administrator role and SHALL be recorded as the instance's bootstrap administrator. This SHALL hold however the account is created, including a first sign-in through an external identity provider, and SHALL NOT depend on whether open registration is enabled.
+
+An instance SHALL never record more than one bootstrap administrator, including when two accounts are created at the same moment.
+
+An account created by registration SHALL carry a syntactically valid email address, so that the administrator of an instance always has an address the product can deliver to. An account created through an external identity provider carries the address that provider reports for it.
+
+Recording an account as the bootstrap administrator SHALL be visible in the audit log, so the log explains where that account's privileges came from.
+
+**BREAKING**: registration previously accepted any non-empty value as the email address. A value that is not an email address is now refused.
+
+#### Scenario: The first registration takes the instance
+
+- **WHEN** the first person registers on an instance that holds no account
+- **THEN** that account holds the administrator role and is the recorded bootstrap administrator
+- **AND** the audit log holds an entry naming that account as the instance's administrator
+
+#### Scenario: The first sign-in through an external provider takes the instance
+
+- **WHEN** the first person to reach an empty instance signs in through Google or GitHub instead of registering
+- **THEN** the account created for them holds the administrator role and is the recorded bootstrap administrator
+
+#### Scenario: A later registration is an ordinary account
+
+- **WHEN** somebody registers on an instance that already holds an account
+- **THEN** the new account holds the member role and the recorded bootstrap administrator is unchanged
+
+#### Scenario: Two people register at the same moment
+
+- **WHEN** two accounts are created concurrently on an empty instance
+- **THEN** exactly one of them is recorded as the bootstrap administrator
+
+#### Scenario: Registering with a value that is not an address
+
+- **WHEN** somebody submits a registration whose email is not a valid email address
+- **THEN** the registration is refused and no account is created
+
+### Requirement: An upgraded instance keeps the account its owner already uses
+
+An instance upgraded from a version that created an account with the login `admin` at startup SHALL carry the bootstrap-administrator record onto the account its owner already signs in with, so the upgrade changes nothing that owner can observe.
+
+An upgraded instance whose account was never claimed - it has no password and no linked external identity, so nobody has ever signed in with it - and which holds no other account SHALL be left in the state of a new instance: that account is removed, and the first account created afterwards administers the instance.
+
+An instance whose account was never claimed while other accounts already exist SHALL keep that account and record it as the bootstrap administrator. No upgrade SHALL leave an instance that holds accounts without a recognized bootstrap administrator, and the owner of such an instance SHALL be able to take that account over from the host, the same way a lost password is recovered.
+
+#### Scenario: Upgrading an instance in use
+
+- **WHEN** an instance whose owner has been signing in as `admin` is upgraded
+- **THEN** that account is the recorded bootstrap administrator
+- **AND** the owner signs in exactly as before, with the address `admin` and the same password
+
+#### Scenario: Upgrading an instance nobody ever set up
+
+- **WHEN** an instance that was deployed but never claimed, and holds nothing else, is upgraded
+- **THEN** it holds no account, and the first account created on it administers it
+
+#### Scenario: Upgrading an instance that was never claimed but already holds accounts
+
+- **WHEN** an instance whose placeholder account was never signed in with, but which holds other accounts, is upgraded
+- **THEN** that placeholder account is kept and recorded as the bootstrap administrator
+- **AND** the owner can give it a password from the host and then move it to a real address
+
+### Requirement: The instance recognizes its bootstrap administrator independently of that account's email address
+
+The instance SHALL record which account is the bootstrap administrator when it creates that account, and SHALL keep recognizing it by that record. No decision about that account SHALL depend on the text of any account's email address. This covers, at minimum, every privilege the requirement below reserves for the bootstrap administrator.
+
+#### Scenario: The bootstrap administrator keeps its role after changing address
+
+- **WHEN** the bootstrap administrator changes their email address
+- **THEN** the instance still treats that account as the bootstrap administrator
+
+#### Scenario: Restarting the instance
+
+- **WHEN** an instance is restarted
+- **THEN** no account is created, and the recorded bootstrap administrator is unchanged
+
+### Requirement: The bootstrap administrator keeps its powers over other administrators after changing address
+
+Granting or revoking the administrator role, deactivating an account that holds it, and reactivating one SHALL remain reserved for the bootstrap administrator, and SHALL be permitted on the basis of the instance's record of which account that is. Changing the bootstrap administrator's email address SHALL NOT remove any of these powers, and SHALL NOT grant them to any other account.
+
+#### Scenario: Appointing an administrator after the address has changed
+
+- **WHEN** the bootstrap administrator, having changed its address, grants the administrator role to another user
+- **THEN** the role is granted
+
+#### Scenario: Another administrator still cannot manage administrators
+
+- **WHEN** an account that holds the administrator role but is not the bootstrap administrator tries to grant the role, revoke it, or deactivate or reactivate an account holding it
+- **THEN** every one of those attempts is refused, whatever address the bootstrap administrator currently holds
+
+#### Scenario: The bootstrap administrator cannot be stripped of its role
+
+- **WHEN** any account attempts to revoke the administrator role from the bootstrap administrator or to deactivate it
+- **THEN** the attempt is refused, so the instance is never left without a recognized bootstrap administrator
+
+### Requirement: The bootstrap administrator can change their email address
+
+The bootstrap administrator SHALL be able to change their email address through the same profile update every other user has, with no field locked and no explanation of why it is locked. The instance SHALL accept only a syntactically valid email address, and SHALL refuse an address another account already holds.
+
+After the change, the administrator SHALL sign in with the new address, and the previous value SHALL no longer be accepted for that account. The administrator's existing session SHALL survive the change.
+
+#### Scenario: An upgraded instance moves off the placeholder address
+
+- **WHEN** the bootstrap administrator of an upgraded instance submits a real email address in place of `admin`
+- **THEN** the change is accepted, and the audit log holds an entry naming the old and the new address
+- **AND** the next sign-in succeeds with the new address and fails with `admin`
+
+#### Scenario: Editing the address on the profile screen
+
+- **WHEN** the bootstrap administrator opens their profile
+- **THEN** the email field is editable and carries no notice that the address cannot be changed
+
+#### Scenario: Rejecting a value that is not an address
+
+- **WHEN** an administrator submits a new email value that is not a valid email address
+- **THEN** the change is rejected and the stored address is unchanged
+
+#### Scenario: Rejecting an address another account already holds
+
+- **WHEN** the bootstrap administrator submits an address that belongs to another user
+- **THEN** the change is rejected and the stored address is unchanged
+
+### Requirement: An administrator can reset their password by email
+
+The ordinary password reset SHALL work for the bootstrap administrator on the same terms as for any other user: a code is sent to the stored address, and it expires, is single-use and is rate-limited exactly as it is elsewhere. On a new instance this holds from the moment the account is created; on an upgraded one it holds as soon as the owner replaces the placeholder address.
+
+A reset requested while an upgraded account still holds the placeholder address `admin` SHALL NOT deliver a code, because no mail server can reach that address. What the caller is told in that case is the existing behavior of the reset flow and is not specified here.
+
+#### Scenario: Resetting the administrator's password by email
+
+- **WHEN** the bootstrap administrator requests a password reset for their stored address
+- **THEN** a reset code is sent to that address
+- **AND** submitting the code sets a new password
+
+### Requirement: Sign-in refuses cleanly and discloses nothing about the accounts an instance holds
+
+A failed sign-in SHALL NOT tell the caller that an account with the login `admin` exists on the instance, SHALL NOT suggest signing in under that login, and SHALL NOT reveal how many accounts the instance holds. This applies regardless of how many accounts there are.
+
+A sign-in attempt for an account that has no password - one created through an external identity provider, or an unclaimed account on an instance that has not yet been upgraded - SHALL be refused the way an incorrect password is refused, and SHALL leave the instance serving other requests.
+
+**BREAKING**: an instance holding a single user previously answered a sign-in attempt with an unknown address by naming the `admin` login. That response is removed; an owner recovers the address from the console instead.
+
+#### Scenario: Mistyped address on a single-user instance
+
+- **WHEN** an anonymous visitor attempts to sign in to an instance that holds only its administrator, using an address that does not exist
+- **THEN** the response does not mention the login `admin` and does not reveal how many accounts the instance holds
+
+#### Scenario: Password sign-in for an account that has no password
+
+- **WHEN** somebody submits the password form for an account that signs in through Google or GitHub
+- **THEN** the attempt is refused in the same way an incorrect password is refused
+- **AND** the instance keeps answering every other request
+
+### Requirement: An owner can recover the administrator addresses from the host
+
+An operator with shell access to the running instance SHALL be able to list every account holding the administrator role, seeing for each one its email address, its display name, when it was created, whether it is still active, and whether it is the bootstrap administrator. The active state is part of the answer because a deactivated administrator explains why an address does not let its owner in. The listing SHALL print no password, no password hash, no token and no other secret.
+
+The listing SHALL be available only to a caller who can already execute commands inside the running instance, which is the same trust level the existing password-reset command requires.
+
+#### Scenario: Recovering a forgotten address
+
+- **WHEN** an owner who cannot remember which address to sign in with runs the administrator listing command on the host
+- **THEN** the output names every administrator account with its address, display name, creation date and active state, and marks the bootstrap administrator
+- **AND** the output contains no password material
+
+#### Scenario: Listing on an instance nobody has set up
+
+- **WHEN** the listing command runs on an instance where no account has been created yet
+- **THEN** it reports that the instance has no administrator, and lists nothing
+
+### Requirement: Setting up and recovering an instance are documented
+
+The product documentation SHALL describe how an instance gets its administrator - the first account created on it - and SHALL describe both how to reset an administrator password and how to recover a forgotten administrator address, in the same place and in every language the documentation ships. The public documentation SHALL also answer the question of what to do when the administrator address or password is lost, and link to those steps.
+
+Documented command examples SHALL NOT present `admin` as the address an owner is expected to use, and the documentation SHALL NOT describe the instance as holding a user named `admin`. Where the placeholder address is mentioned at all, it SHALL be as the account an instance created before this change still carries until its owner replaces it.
+
+#### Scenario: An owner searches the documentation
+
+- **WHEN** an owner who cannot sign in reads the published password documentation
+- **THEN** it explains both resetting the password and listing the administrator addresses
+- **AND** the same guidance is reachable from the questions answered on the home page
+
+#### Scenario: Reading about roles
+
+- **WHEN** a reader consults the access-management documentation in any of the six published languages
+- **THEN** it describes the first account created on the instance as its administrator, without claiming that account's address is `admin`
diff --git a/openspec/changes/replace-seeded-admin-with-first-signup/tasks.md b/openspec/changes/replace-seeded-admin-with-first-signup/tasks.md
new file mode 100644
index 00000000..20be0780
--- /dev/null
+++ b/openspec/changes/replace-seeded-admin-with-first-signup/tasks.md
@@ -0,0 +1,84 @@
+This change lands after `restore-console-command-database-access`. Console commands started with `docker exec` cannot reach the metadata database of a container that generates its password at startup, which that change fixes; without it the `--list-admins` command in section 5 and the recovery path documented in sections 7 and 8 fail with an authentication error on a normal deployment.
+
+## 1. Record the bootstrap administrator
+
+- [ ] 1.1 Create the migration with `make migration-create` under `backend/`: add `users.is_root_admin boolean not null default false`, add the partial unique index that allows at most one row to carry it, delete the seeded `admin` row when it has no password, no linked Google or GitHub identity **and is the only row in `users`**, and set the flag on the remaining `admin` row or, when none exists, on the oldest ADMIN-role account; write the down step that drops the index and the column. The "only row" condition is what keeps an instance that holds members while its seeded account was never claimed from losing its last administrator: registration answers on `POST /users/signup` whether or not the claim screen offers it, so that shape exists, and there the unclaimed row is kept and flagged instead of deleted. Verify with `make migration-up` then `make migration-down` on a scratch database, and check each shape by hand: a claimed `admin` row keeps its password and carries the flag, an unclaimed one alone on the instance is gone, an unclaimed one beside other accounts is kept and carries the flag, a renamed one leaves the flag on the oldest administrator, and an empty database backfills nothing. A test cannot stand in for this check - Goose has already run against the test databases before `go test` starts (`backend/Makefile:11-16`), so no test can observe an instance in the pre-migration shape.
+- [ ] 1.2 Add the field to the user model with `json:"-"`, the way `HashedPassword` and the OAuth ids carry it (`models/user.go:14-20`), so a handler that ever returns the model cannot leak it; add a repository lookup that finds the recorded bootstrap administrator by flag. No response shape changes: `GET /users/me` and the user list both build `UserProfileResponseDTO` rather than serializing the model (`user_controller.go:301`, `management_controller.go:91-101`), so there is nothing to assert about response bodies here. Verify with `make test` in `backend/` that the existing repository and controller suites still pass.
+- [ ] 1.3 Rebuild both bootstrap-account helpers in `backend/internal/features/users/testing/user_utils.go` on the flag. `RecreateInitialAdmin` (`:67-79`) retires the account currently holding the flag - found by flag, renamed and cleared in one statement - and creates a fresh flagged ADMIN account the way `CreateTestUser` (`:19-48`) does, panicking with a message that names what it could not find. `RecreateInitAdminAndGetAccess` (`:50-65`) returns the account that helper just created instead of reading it back with `GetUserByEmail(ctx, "admin")`, which would hand a nil user to `GenerateAccessToken` and panic. Selecting the outgoing account by address would no-op after any test that changes it (`user_repository.go:147-157`), leaving the next test without a bootstrap account. Verify with `make test` in `backend/` that all 11 call sites across `e2e_test.go`, `user_controller_test.go` and `management_controller_test.go` - 9 of them through `RecreateInitAdminAndGetAccess` - still get a usable bootstrap account and a working token.
+- [ ] 1.4 Add a test that pins the helpers against that failure: change the bootstrap address to a real one, call the helper, and confirm the fresh account carries the flag while the retired one holds neither the flag nor the old address; verify with `make test` in `backend/`.
+- [ ] 1.5 Add a test that the database refuses a second flagged account, by inserting one directly against an instance that already has a bootstrap administrator; verify with `make test` in `backend/`.
+- [ ] 1.6 Add an audit-log writer to `backend/internal/features/users/testing` that records the entries it receives, and use it in place of `AuditLogWriterStub` in all four test routers (`controllers/e2e_test.go:177`, `:196`, `:214`, `:232`), installing a fresh recorder per router so one test cannot read another's entries; delete the stub (`:255-258`). The services are package-level singletons and `SetAuditLogWriter` mutates them (`services/di.go:10-28`), and the four builders are called from about ninety sites, so keep their signatures and let a test reach the current recorder through `users/testing`. Verify with `make test` in `backend/` that the existing suites still pass with the recording writer installed.
+- [ ] 1.7 Add a helper to `backend/internal/features/users/testing` that empties the `users` table, so a test can put the instance in the state the new account-creation rule is keyed on. No test can assume that state: `cleanup_test_db` recreates the per-slot databases once per run (`backend/cmd/cleanup_test_db/main.go:64-97`), each binary claims a slot and releases it on exit (`internal/config/config.go:259-277`) so later packages inherit what earlier ones left, and around twenty packages outside `features/users` create accounts through `CreateTestUser`. Verify with `make test` in `backend/` that the suites still pass, and that a test calling the helper sees `GET /users/is-any-user-exist` answer false right afterwards (once task 2.6 lands).
+
+## 2. Create the administrator from the first account
+
+- [ ] 2.1 Delete the seeding: `CreateInitialAdmin` in the service (`user_services.go:291-293`) and the repository (`user_repository.go:65-86`), and its call in `backend/cmd/main.go:109`; verify with `make test` in `backend/` that nothing else referenced them.
+- [ ] 2.2 Grant the administrator role and the flag to an account created while the instance holds no user, on the path of each entry point that inserts a new row - `SignUp` (`user_services.go:114-127`) and `getOrCreateUserFromOAuth` (`:963-976`) - and not on the branches that complete an invitation or link an identity to an account that already exists (`:66-101`, `:896-944`). Ask the account count **before** the refusal `external registration is disabled` (`:110-111` for registration, `:951-952` for a first external sign-in), and let an empty instance skip that refusal: asking inside the insert branch is too late, because an empty instance whose setting is off would never reach it and could never gain an administrator. Write the audit entry recording that this account now administers the instance, beside the entry `SignUp` already writes (`:130`). Verify with controller tests, each starting from the empty-table helper, that the first registration on an empty instance comes back as an administrator, is the recorded bootstrap administrator and leaves that audit entry; that a first GitHub sign-in does the same; that a first Google sign-in does the same; that an empty instance grants it even with external registration disabled; and that a second account created afterwards is an ordinary member.
+- [ ] 2.3 Handle the lost race: when the insert is refused, unwrap the driver error with `errors.As` into `*pgconn.PgError` the way `internal/features/databases/service.go:335` does, and retry as an ordinary account under the open-registration policy only when `ConstraintName` names the bootstrap index - a violation of `users_email_idx` must keep returning the duplicate-address error it returns today. Verify with a test that creates the bootstrap administrator first and then registers again, expecting a member account and an unchanged bootstrap administrator, and with a test that registering on an address another account already holds is still refused as a duplicate.
+- [ ] 2.4 Add `email` to the `binding` tag of `SignUpRequestDTO.Email` (`backend/internal/features/users/dto/dto.go:12`); verify with a controller test that a registration whose email is not an address is refused and creates no account, and that a valid one still succeeds.
+- [ ] 2.5 Pin the check the previous tasks deliberately bypass, which has no test today: on an instance that already holds an account, a password registration is refused while external registration is disabled. Use `users_testing.DisableExternalRegistrations` (`testing/settings_utils.go:21`) and restore the setting with `ResetSettingsToDefaults`; the GitHub path already has its counterpart (`user_controller_test.go:1007`). Verify with `make test` in `backend/`.
+- [ ] 2.6 Replace `GET /users/admin/has-password` and `POST /users/admin/set-password` with `GET /users/is-any-user-exist`, answering `{ "isExist": boolean }` - the shape and the method the client already uses (`frontend/src/entity/users/api/userApi.ts:62-74`) - and delete `IsRootAdminHasPassword` (`user_services.go:299`), `SetRootAdminPassword` (`:312`), their controller handlers and the two DTOs that exist only for them (`dto.go:30-36`). Verify with controller tests that the new endpoint answers false on an empty instance - emptied through the helper from task 1.7 - and true once an account exists, and that both removed routes now answer 404, which is also what closes the unauthenticated password-setting path the spec refuses.
+- [ ] 2.7 Retire the tests that pin the removed claim path, once the tests above cover what replaces them. `Test_CheckAdminHasPassword_WhenAdminHasNoPassword_ReturnsFalse` and the three `Test_SetAdminPassword_*` tests (`user_controller_test.go:278-374`) are deleted outright. `Test_AdminLifecycleE2E_CompletesSuccessfully` (`controllers/e2e_test.go:21-119`) is rewritten rather than deleted: it opens by posting to the deleted `/users/admin/set-password`, and it is the walk this change makes canonical - an empty instance from the helper in task 1.7, a first registration that comes back as the bootstrap administrator, a sign-out and sign-in with that address, an address change, and a sign-in with the new address. Verify with `make test` in `backend/`.
+- [ ] 2.8 Give `Test_UserLifecycleE2E_CompletesSuccessfully` (`controllers/e2e_test.go:120`) its own precondition: it registers and asserts the member role (`:172`), which from now on only holds when the instance already has an account, and today it holds only because the test above it happens to seed one. Create that account in the test. Verify with `make test` in `backend/` and with `go test ./internal/features/users/... -run Test_UserLifecycleE2E_CompletesSuccessfully`, which must pass on its own.
+- [ ] 2.9 Run `make lint` in `backend/`.
+
+## 3. Free the administrator address
+
+- [ ] 3.1 Delete the refusal at `user_services.go:468`, and rewrite `Test_UpdateUserInfo_WhenAdminTriesToChangeEmail_ReturnsBadRequest` (`user_controller_test.go:761`), which pins the behavior being deleted, into a test that the change succeeds: the address becomes the new one, a sign-in with it works, and a sign-in with the previous value is rejected. Verify with `make test` in `backend/`.
+- [ ] 3.2 Assert with the recording audit writer that the recorded entries contain the one `user_services.go:486-506` builds for the address change, naming the old and the new address. Look for that entry among the recorded ones rather than expecting it to be the only one - the sign-in and account creation the test needs first write their own. Verify with `make test` in `backend/`.
+- [ ] 3.3 Verify that an invalid address is still rejected and that taking another user's address is still refused, by extending the same test with both cases; no new validation code is expected, since `UpdateUserInfoRequestDTO` already binds `omitempty,email` (`dto.go:42`) and `user_services.go:471-479` already checks uniqueness.
+- [ ] 3.4 Confirm with a test that the token issued before the address change still authenticates afterwards; `GenerateAccessToken` carries the user id and the password creation time and no email (`user_services.go:271-276`), so this is a check rather than a change.
+- [ ] 3.5 Add a test that the bootstrap administrator can request a password reset for their address and complete it with the emailed code.
+- [ ] 3.6 Delete the single-user sign-in hint branch at `user_services.go:157-161`; verify with a controller test that a sign-in attempt with an unknown address on a single-user instance returns a response whose text contains neither `admin` nor a user count. Confirm `GetUsersCount` stays, since telemetry calls it (`backend/internal/features/telemetry/service.go:102`) and the new account-creation rule asks it the same question.
+- [ ] 3.7 Guard the password comparison in `SignIn` (`user_services.go:181`) with `HasPassword()` (`models/user.go:56-58`) so an account with no password hash is refused the way a wrong password is, instead of dereferencing nil; verify with a controller test that submits the password form for an account created through Google or GitHub and expects the refusal rather than a 500.
+- [ ] 3.8 Pin the two refusals the new guard sits below, neither of which has a test today: signing in to an account still in the invited state and to a deactivated one (`user_services.go:168-179`). Both accounts are reachable through existing helpers - an invitation through `POST /users/invite`, a deactivation through the management endpoint. Verify with `make test` in `backend/`.
+
+## 4. Keep the root administrator's powers
+
+- [ ] 4.1 Switch the three root-administrator checks in `backend/internal/features/users/services/management_service.go` from comparing the caller's email to reading the flag: deactivation (`:74`), reactivation (`:108`) and the ADMIN-role grant or revoke (`:154`). Update the three comments above them so they describe the rule rather than the address.
+- [ ] 4.2 Confirm the existing privilege matrix still passes and now proves more than it did. `management_controller_test.go` already covers the bootstrap administrator succeeding at all three actions (`:574`, `:596`, `:618`, `:636`) and an ordinary ADMIN account being refused all three (`:486`, `:512`, `:538`, `:556`), and after task 1.3 those tests run against a bootstrap account whose address is an ordinary one. Add the case they cannot reach: change the bootstrap administrator's address first, then exercise all three actions through the API and expect them to succeed. Verify with `make test` in `backend/`.
+- [ ] 4.3 Add the test the spec requirement rests on and no existing test names: an ordinary ADMIN account cannot revoke the role of the flagged account or deactivate it, and the flagged account cannot do either to itself. The self-action refusals exist (`:665`, `:686`) but target whichever account the helper returns; assert here that the account they protect is the one holding the flag, so the instance is never left without a recognized bootstrap administrator. Verify with `make test` in `backend/`.
+- [ ] 4.4 Assert with the recording audit writer that the recorded entries contain the ones a role grant and a deactivation performed by the bootstrap administrator write (`management_service.go:165` and `:83`), again matching an entry rather than expecting a single one; verify with `make test` in `backend/`.
+- [ ] 4.5 Grep production code under `backend/` for the literal `"admin"` and confirm the only remaining occurrences are in the MongoDB feature, which means a database by it; anything else is a site this change missed.
+
+## 5. Console recovery
+
+- [ ] 5.1 Add the administrator listing to the users feature under `backend/internal/features/users/`: select every ADMIN-role account, order it, mark the one holding the flag, and render the lines carrying the address, display name, creation date and active state and nothing else. The active state is part of the answer because a deactivated administrator otherwise reads as an address that should work. The listing writes no audit entry: `UserService` dereferences its audit writer without a nil check (`user_services.go:128`) and that writer only exists after `audit_logs.SetupDependencies()`, which the console path calls only for the password reset (`main.go:167-190`). It goes here rather than in `backend/cmd/` because `make test` and CI run `go test ./internal/...` only (`backend/Makefile:16`, `.github/workflows/ci-release.yml:221,345`), so logic living in `cmd/` ships untested. This is the one place the change tests a service directly instead of through HTTP, which `backend/AGENTS.md` allows for logic with no API surface.
+- [ ] 5.2 Add tests covering the listing on an instance with several administrators, where the flagged one is marked, a deactivated administrator is shown as inactive and members do not appear, and on one where no account exists yet - emptied through the helper from task 1.7 - where it reports that the instance has no administrator; assert the rendered output carries no password hash. Verify with `make test` in `backend/`.
+- [ ] 5.3 Add the `--list-admins` flag to `parseCommandLineOptions` (`backend/cmd/main.go:154`) and a handler invoked from the same startup point as `resetPasswordIfRequested` (`main.go:115`) that calls the listing, prints it to the process log and exits; verify with `docker exec -it databasus ./main --list-admins` against a running container, not against a local database, and confirm the output lists the administrators and contains no password material. Running it through `docker exec` is the point: that is how an owner reaches it, and it is the path `restore-console-command-database-access` repairs.
+- [ ] 5.4 Run `make test` and `make lint` in `backend/` and fix what they report.
+
+## 6. Frontend
+
+- [ ] 6.1 Change `AuthPageComponent` (`frontend/src/pages/AuthPageComponent.tsx:21-41`) to ask whether any account exists instead of whether the administrator has a password, to open on registration when none does, and to drop the `AdminPasswordComponent` branch; delete that component, its barrel export (`frontend/src/features/users/index.ts:1`), and everything only it used: `userApi.isAdminHasPassword` and `userApi.setAdminPassword` (`entity/users/api/userApi.ts:76-95`) with the two types they are the only users of (`entity/users/model/IsAdminHasPasswordResponse.ts` and `entity/users/model/SetAdminPasswordRequest.ts`, exported at `entity/users/index.ts:10-11`). An instance that already holds accounts keeps the screen it opens on today - registration, with sign-in one click away - so the only branch that changes is the empty one. Verify in the running application against an empty instance and against one that already has accounts - the repository has no component or page tests, so this is a manual check rather than a missing one.
+- [ ] 6.2 Add the copy that tells the first visitor the account they are creating administers the instance, and delete the keys `users.adminPassword.*` and `app.auth.adminPasswordCheckFailed` from `frontend/src/shared/i18n/locales/{en,ru,es,pt,zh,fr}.ts`; verify the removed keys appear nowhere under `frontend/src`, and run `pnpm test` so the dictionary parity suite (`shared/i18n/dictionaries.test.ts`) confirms the six files still hold the same key set.
+- [ ] 6.3 Remove the four places in `frontend/src/features/users/ui/ProfileComponent.tsx` that treat the address `admin` as read-only: the skipped validation (`:138`), the omitted request field (`:157`), the `disabled` prop (`:234`) and the explanatory line (`:236-238`), and delete `users.profile.adminEmailReadOnly` from the six locale files; verify by changing the address on the profile screen of an upgraded instance.
+- [ ] 6.4 Confirm the sign-in form still accepts `admin` as a login value (`SignInComponent.tsx:50`), since an upgraded instance that has not changed the address still uses it; verify by signing in as `admin` against such an instance.
+- [ ] 6.5 Run `pnpm lint`, `pnpm format`, `pnpm test` and `pnpm build` in `frontend/` and fix what they report.
+
+## 7. English documentation
+
+- [ ] 7.1 Update the password section of the root `README.md` (lines 261-269): document `--list-admins` beside the existing reset command, and change the reset example so it no longer presents `--email="admin"` as the expected address, explaining that an instance created before this change still uses `admin` until its owner replaces it; verify by reading the rendered section as a reader who cannot sign in and can only reach the host.
+- [ ] 7.2 Add to the usage section of the root `README.md` (lines 251-259) the step that comes before everything else: open the instance and create the first account, which administers it; verify the section reads correctly for a reader who has just started the container.
+- [ ] 7.3 Add a section to `website/app/(en)/password/page.tsx` covering the administrator listing, with its own heading id so it can be linked, and correct the example command (`:41`) and the illustration of a valid address (`:141`) the same way; verify with `npm run build` in `website/` and by loading the page.
+- [ ] 7.4 Rewrite the sentence at `website/app/(en)/access-management/page.tsx:220-221` so it describes the first account created on the instance as its administrator rather than naming its address `admin`; verify with `npm run build` in `website/`.
+- [ ] 7.5 Add the FAQ entry "I forgot my admin email or password" to `website/app/(en)/page.tsx`, in both the visible FAQ list and the structured-data block that mirrors it, linking to the password page; verify with `npm run build` in `website/` and by confirming both copies carry the same answer text.
+- [ ] 7.6 Run `npm run lint` in `website/` and fix what it reports.
+
+## 8. Translations
+
+- [ ] 8.1 Translate the new password-page section into Russian in `website/app/[lang]/password/content/ru.tsx`, mirror the access-management correction in `website/app/[lang]/access-management/content/ru.tsx`, and add the FAQ entry to the Russian home-page content; verify with `npm run build` in `website/` and by reading all three pages under `/ru/`.
+- [ ] 8.2 Repeat for Spanish (`es`).
+- [ ] 8.3 Repeat for Portuguese (`pt`).
+- [ ] 8.4 Repeat for Chinese (`zh`).
+- [ ] 8.5 Repeat for French (`fr`).
+- [ ] 8.6 Mirror the README changes into `assets/readme/README.{ru,es,pt,zh,fr}.md`, following the translation rules in `assets/readme/AGENTS.md`; verify each file keeps the command lines byte-identical to the English ones.
+
+## 9. Verification and review
+
+- [ ] 9.1 Run `make test` and `make lint` in `backend/`, `pnpm lint`, `pnpm format`, `pnpm test` and `pnpm build` in `frontend/`, and `npm run lint` and `npm run build` in `website/`; fix every failure.
+- [ ] 9.2 Confirm every behavior in `specs/root-admin-account/spec.md` has a test or a documented manual check, and that no scenario is left unexercised. Three rest on manual checks: the migration shapes (task 1.1), the two screens (tasks 6.1 and 6.3) and the restart scenario (task 9.3, which restarts the instance rather than asserting it in Go). Everything else names a test.
+- [ ] 9.3 Walk a fresh install end to end: start an empty instance, register the first account, confirm it is an administrator, restart the container and confirm no account was created and the administrator is unchanged, invite a second user, confirm that user is a member and cannot manage administrators, and recover the address with `docker exec -it databasus ./main --list-admins`.
+- [ ] 9.4 Walk all three upgrade paths on databases seeded from the previous version: a claimed instance, where the owner signs in as `admin`, changes the address from the profile screen, signs out and signs in with the new address; an instance that was never claimed and holds nothing else, where the seeded account is gone and the first registration becomes the administrator; and an instance that was never claimed but holds a member registered through the API, where the seeded account is kept as the bootstrap administrator and a password set with `--new-password --email="admin"` gets the owner in.
+- [ ] 9.5 Record in the change's completion notes that the rollback window closes once an administrator address has been changed, and that the down step cannot restore the unclaimed account the up step deleted, as described in design.md - Migration Plan.
+- [ ] 9.6 Complete the mandatory compliance review for the finished diff and resolve every CHANGES REQUIRED finding.