This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
Commit daa7caf
fix(console,auth): the login and register pages offer sign-up only where the audience posture admits it (objectui#11691) (#11703)
Fixes #11691
Clause-②: yes
## What this changes
`/api/v1/auth/config` states the sign-up rule as two keys:
`emailPassword.disableSignUp` (the hard off switch) and
`features.audiencePosture` (who may self-register). The server
deliberately does not force the first from the second: under
`invite_only` its sign-up route still admits a pending invitee. The
console read only the first, so under the default `invite_only` posture
`/login` offered "Sign up" and `/register` refused the finished form
with `403 SELF_REGISTRATION_CLOSED`.
Both console pages now decide through one shared function,
`decideSignUpOffer` in the new
`apps/console/src/pages/auth/signUpOffer.ts`:
| config | `/login` | `/register` |
|---|---|---|
| `disableSignUp: true` | no "Sign up", as objectui#11634 does | bounces
to `/login` as before, invitation redirects included |
| posture `open` or `email_domain` | unchanged | unchanged |
| posture `invite_only`, reached from an invitation
(`?redirect=/accept-invitation/ID`) | "Sign up", carrying the redirect |
the form |
| posture `invite_only`, deployment with no owner yet
(`bootstrap-status` answers `hasOwner: false`) | "Sign up" | the form |
| posture `invite_only`, otherwise | no "Sign up" | says
"Self-registration is not open on this environment. Ask an administrator
for an invitation." before any field, with a Sign in link |
| no `audiencePosture` key (older server) | `disableSignUp` alone
decides, as before | same |
| a posture value outside the spec vocabulary | read as closed | read as
closed |
- `@object-ui/auth`: `AuthPublicConfig.features` declares
`audiencePosture?: AudiencePosture` (the type from
`@objectstack/spec/system`), beside `tenancyPosture`. The README's
server-feature-flags section says how to read it beside `disableSignUp`.
- `@object-ui/auth`'s `@objectstack/spec` floor moves from `^17.0.0` to
`^17.3.0`. The published `types.d.ts` now references `AudiencePosture`,
which 17.0.0 to 17.2.0 do not export, and `check:spec-floors` names that
exact finding when the old floor is restored (see Evidence). The
matching `pnpm-lock.yaml` change is one specifier line, the shape PR
#11623 used for plugin-form.
- The posture predicate is restated locally
(`audienceAdmitsUninvitedSignUp`) rather than imported at runtime. This
follows the `postureHasOrgWall` precedent in app-shell's
`useTenancyPosture.ts`, because the login and register pages are in the
console's eager closure. A parity test imports the spec's
`audiencePermitsSelfRegistration` and `AUDIENCE_POSTURES` and asserts
agreement for every declared posture.
- No new i18n key. The register page's explanation reuses
`auth.register.errors.selfRegistrationClosed`, which is the refusal's
own copy, plus the existing title and "Already have an account? Sign in"
keys.
### One addition beyond the triage direction: the first-owner window
Triage's direction (comment 6010280240) names two cases that keep the
generic sign-up under `invite_only`: an `open` or `email_domain`
posture, and an invitation redirect. Measured, a third case is
load-bearing:
- The server's `decideAudienceAdmission` admits a bootstrap creation
under every posture, with the comment "a fresh install must never lock
its operator out".
- The objectstack self-hosting guide's first-run step is "Open the
deployment's root URL and sign up".
- The console has no automatic route to `/setup`: nothing in
`apps/console/src` or app-shell navigates there.
Without the window, an unseeded fresh deployment on the default posture
would land its operator on a login page with no way to create the first
account. So under a closed posture the pages ask `GET
/api/v1/auth/bootstrap-status` through `useBootstrapStatus` from
`components/setupEntry.ts` (reused, not edited), and keep "Sign up"
while `hasOwner` is false. The probe runs only when the posture is
closed and the visitor is not an invitee. `open`, `email_domain` and
older servers make no extra request, which is pinned. There is no server
change and no new key. If the seat prefers the literal direction,
removing the `context.bootstrap === 'fresh'` line from
`decideSignUpOffer`, together with its two pins, reverts it.
## Premises measured
1. **Key path and vocabulary.** `features.audiencePosture` is emitted by
`getPublicConfig` in objectstack's `auth-manager.ts` (origin/main
`01e0f71a`) and by the published `@objectstack/plugin-auth@17.6.0`
tarball (`audiencePosture: audience.posture`). The spec's closed
vocabulary is `AUDIENCE_POSTURES` = `invite_only`, `email_domain`,
`open` (`@objectstack/spec/system`, installed 17.6.0). Its
`audiencePermitsSelfRegistration` is true for `email_domain` and `open`
only. `getAuthConfig` unwraps the `{ success, data }` envelope, so the
pages read `cfg.features.audiencePosture`.
2. **Older server.** For a config without the key, `decideSignUpOffer`
returns the pre-change answer and makes no bootstrap probe. This is
pinned for both pages.
3. **Invitation redirect.** No marker is needed.
`DefaultAcceptInvitationPage` bounces a signed-out visitor to
`/login?redirect=` plus the router path `/accept-invitation/ID`, and
`/login` already forwards `redirect` to `/register`. The pages recognise
the `/accept-invitation/` prefix followed by a non-empty id, and
`AcceptInvitationPage.tsx` is not edited. Recognition is an affordance
only: a non-invitee who types the URL by hand still meets the server's
refusal, which the form renders localized.
4. **Clause-②.** The published surface that moved is `@object-ui/auth`'s
`dist/types.d.ts`, with a new optional `features.audiencePosture` member
and a new type import from `@objectstack/spec/system`, plus the
package's spec floor. No locale key and no export was added or removed.
## Evidence
All results are at branch head `efcf1ea` unless another commit is named.
- **New pins.**
`apps/console/src/pages/auth/__tests__/signUpFollowsPosture-11691.test.tsx`:
16 passed. A real `AuthProvider` runs over a real `createAuthClient`
against a stub server. The end-to-end case clicks "Sign up" from
`/login` with an invitation redirect, fills the form, and reads the
`/sign-up/email` request body.
- **Ablation.** Run on committed `387c36b` in WRAP mode through
objectstack's `scripts/ablation-replace.mjs`; each restore was proven as
blob equal to HEAD with an empty `git diff HEAD`.
- With the decision ignoring the posture (the pre-fix behaviour): 3
failed, 13 passed. The failures are the decision table, "/login under
invite_only offers no generic Sign up", and "/register explains instead
of rendering the form".
- With the invitation exception deleted: 3 failed, 13 passed. The
failures are the decision table, "/login offers Sign up to an invitation
redirect", and "an invitation redirect reaches a working registration".
- **Type reverse check.** A probe file assigning `audiencePosture:
'invite-only'` turns console `tsc` red with TS2820 on that value only;
the `'invite_only'` line beside it compiles. With the probe removed,
console `type-check` is green.
- **Floor reverse check.** Restoring `"@objectstack/spec": "^17.0.0"`
makes `check:spec-floors` report `@object-ui/auth [floor-too-low]
packages/auth/dist/types.d.ts references AudiencePosture from
@objectstack/spec/system, which @objectstack/spec@17.0.0 does not
export`. The floor was then restored.
- **Union at `efcf1ea`.** `pnpm exec vitest run
apps/console/src/pages/auth/ packages/auth/` plus the four `App.*` and
`internalFormShell` tests that mock these pages: 43 files and 367 tests
passed.
- **Type-check and lint.** `pnpm --filter @object-ui/auth run
type-check` exits 0. `pnpm --filter @object-ui/console run type-check`
exits 0, after building the `@object-ui/console^...` closure (34 tasks).
`lint` for both packages reports 0 errors; its warnings are on
pre-existing lines only. Type-check and lint ran at `8e12c74`, whose
sources are byte-identical to `efcf1ea`: that later commit adds only the
changeset.
- **Root gates at `efcf1ea`, each exit 0:** `check:new-line-citations`
(0 new), `check:control-bytes`, `check:changeset-claims`,
`check:pending-changeset-literals`, `check:i18n-keys`,
`check:i18n-dead-keys`, `check:test-path-roots`, `check:readme-exports`,
`check:spec-symbols`, `check:phantom-deps`, `check:lockfile-integrity`,
`check:lockfile-dedupe`, `check:unreferenced-sources`,
`check:installed-pin-claims`, `check:vi-mock-specifiers`,
`check:spec-floors`, `check:eager-closure`, `node
scripts/check-changeset-no-major.mjs` and `node
scripts/check-changeset-presence.mjs`.
- `check:readme-exports` needs `@object-ui/cli` and
`@object-ui/plugin-ai` built, so they were built first.
- `check:eager-closure` ran on a fresh console `vite build`.
- `check-governed-queue-guard.mjs --test` answers NOT GOVERNED for all 9
paths.
- **Left to CI:** the repo-wide `pnpm lint`, the full `pnpm test`, and
`check:i18n-drift` (no `en` value changed).
## Acceptance notes
- **The same defect, outside this claim.** app-shell's published
`DefaultLoginPage` and `DefaultRegisterPage` read only `disableSignUp`.
A throwaway probe, not committed, measured it with `audiencePosture:
'invite_only'` and `disableSignUp: false`: `DefaultLoginPage` offers
"Sign up" to `/register`, and `DefaultRegisterPage` renders the full
form. Its control leg (`disableSignUp: true`) hides the link.
`examples/console-starter/src/App.tsx` routes both pages. This goes to
the seat for its own card and is not edited here, because it is a
different package with its own verification surface.
- **Doc drift, noted only.** objectstack's
`content/docs/permissions/authentication.mdx` says "The Console's root
route uses it to choose between `/login` (normal) and `/setup`
(first-run owner creation)", but no console code navigates to `/setup`.
Carrier: none.
- **Files outside the claim's listed surface, declared here.**
`signUpOffer.ts` is a new file beside the two pages.
`packages/auth/package.json` and the one-line `pnpm-lock.yaml` change
are there for floor honesty, under objectui#5793's ruling.
`packages/auth/README.md` is there because AGENTS.md rule 2 asks for
docs.
- **Untouched, as triage directed:** the settings follow-up
(`signup_enabled` versus `audience_posture` on the objectstack settings
page).
---
_Generated by [Claude
Code](https://claude.ai/code/session_01FngvPpdrnhHMdHHq6vwwju)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 3409fe8 commit daa7caf
9 files changed
Lines changed: 611 additions & 21 deletions
File tree
- .changeset
- apps/console/src/pages/auth
- __tests__
- packages/auth
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| 25 | + | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
| 31 | + | |
| 32 | + | |
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
| |||
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
61 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
62 | 71 | | |
63 | 72 | | |
64 | 73 | | |
| |||
100 | 109 | | |
101 | 110 | | |
102 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
103 | 121 | | |
104 | 122 | | |
105 | 123 | | |
| |||
127 | 145 | | |
128 | 146 | | |
129 | 147 | | |
130 | | - | |
| 148 | + | |
131 | 149 | | |
132 | 150 | | |
133 | 151 | | |
134 | 152 | | |
135 | 153 | | |
136 | 154 | | |
137 | | - | |
| 155 | + | |
138 | 156 | | |
139 | 157 | | |
140 | 158 | | |
| |||
296 | 314 | | |
297 | 315 | | |
298 | 316 | | |
299 | | - | |
| 317 | + | |
300 | 318 | | |
301 | 319 | | |
302 | 320 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
16 | 20 | | |
17 | 21 | | |
18 | 22 | | |
19 | | - | |
| 23 | + | |
| 24 | + | |
20 | 25 | | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
| 30 | + | |
| 31 | + | |
25 | 32 | | |
26 | 33 | | |
27 | 34 | | |
| |||
53 | 60 | | |
54 | 61 | | |
55 | 62 | | |
56 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
57 | 67 | | |
58 | 68 | | |
59 | 69 | | |
| |||
67 | 77 | | |
68 | 78 | | |
69 | 79 | | |
70 | | - | |
| 80 | + | |
71 | 81 | | |
72 | 82 | | |
73 | 83 | | |
74 | 84 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
| 85 | + | |
82 | 86 | | |
83 | 87 | | |
84 | | - | |
| 88 | + | |
85 | 89 | | |
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
89 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
90 | 114 | | |
91 | 115 | | |
92 | 116 | | |
| |||
132 | 156 | | |
133 | 157 | | |
134 | 158 | | |
135 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
136 | 166 | | |
137 | 167 | | |
138 | 168 | | |
| |||
151 | 181 | | |
152 | 182 | | |
153 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
154 | 214 | | |
155 | 215 | | |
156 | 216 | | |
| |||
0 commit comments