Implement role-based account journeys with database and browser acceptance suites
Some checks failed
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Build and Publish Container Image / build-and-push (push) Successful in 20s
Account journey acceptance / journeys (push) Failing after 0s

Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a092fe-13b1-7f12-ac74-7d258af4d79c
This commit is contained in:
tegwick 2026-09-13 12:20:02 +02:00
parent 75750c0036
commit 1127f852dd
24 changed files with 1554 additions and 148 deletions

View file

@ -94,6 +94,20 @@ must be tested against controlled accounts; self-service credentials are not an
administrative lookup credential. The portal help page is reachable before login
so OTP-required login does not hide recovery.
## Executable implementation status
Implementation workplans: USER-WP-0028 (users), USER-WP-0029 (tenant admins),
USER-WP-0030 (platform admins), USER-WP-0031 (automated suites), and NK-WP-0038
(scoped provider lifecycle). The original review column above records the starting
gaps. For the current per-journey implementation state and executable tests, use
`tests/journey-coverage.json` and `make test-journeys`; the report never equates
provider-boundary tests with real OTP or mail acceptance.
Now implemented: actual login-name handoff, profile validation/retry, scoped
provider lifecycle, role succession, cross-connection last-admin protection,
confirmation/stale-state checks, first-admin bootstrap rollback/retry, invitation
delivery readout, onboarding follow-up, tenant audit, and platform delivery retry.
## Acceptance and remaining work
USER-WP-0027 tracks the matrix and role-based usability gaps. KEY-WP-0035 tracks

View file

@ -0,0 +1,50 @@
# Automated journey acceptance
Run `make test` for all regression and layer checks, then `make test-journeys` for
the role-based acceptance selection. Tests exercise WSGI routes, authorization,
CSRF, persisted records, provider failure/retry and confirmation state. They do
not send email or modify real directory users.
Examples:
```sh
make test-journeys JOURNEY_ARGS="--role user"
make test-journeys JOURNEY_ARGS="--role tenant_admin"
make test-journeys JOURNEY_ARGS="--role platform_admin"
make test-journeys JOURNEY_ARGS="--report /tmp/user-engine-journeys.json"
make test-journeys JOURNEY_ARGS="--require-complete"
```
The last command is deliberately a release-completeness gate: it fails while any
journey still has an implementation or external acceptance gap. A local suite
passing is distinct from all 29 journeys being complete. `tests/journey-coverage.json`
contains every journey ID, executable test selectors, implementation status and
named remaining work. In particular, OTP help tests do not claim provider OTP
activation coverage. KeyCape's Go suite and NetKingdom's provider suite are
separate owner checks.
CI `.forgejo/workflows/journeys.yaml` runs full regression and journey selection
against the exact pushed commit, and prints the JSON report. All fake identities,
provider failure controls and test sessions live in tests, not production routes.
Tenant lifecycle and role changes hold an in-memory lock or tenant-scoped
PostgreSQL advisory lock across provider calls and local mutation. Tests cover
concurrent administrator suspension with independent database connections, lock
release on exception and preservation of caller transactions. Nested first-admin
bootstrap transactions roll back all local records after a failure. Directory
changes and local state still are not one database transaction: desired-state
retry/readback is required after a crash between external success and local save.
`make test-browser-journeys` starts a loopback-only synthetic portal and isolated
Chromium profile, then drives user/admin/operator navigation and confirmation
with Node's native CDP client. Set `JOURNEY_CHROME` if Chromium cannot be found.
Missing browser dependencies fail explicitly; no test login endpoints are added
to the production application. The ordinary CI job runs the WSGI suites; the
browser command can also run on a runner provisioned with Node and Chromium.
Database suite: `tests/test_journey_postgres.py` uses the existing
`USER_ENGINE_POSTGRES_TEST_DSN` plus `USER_ENGINE_POSTGRES_TEST_RESET=1` contract.
Use only a disposable database: conformance tests reset user-engine tables.
The 2026-09-13 run used a fresh local Docker PostgreSQL container and completed
all 210 regression tests with zero skips. The normal dependency-free run skips
seven opt-in PostgreSQL tests. See the rollout evidence for exact commands.