T13.7: dry run for the Okta sync, OKTA_SYNC_DRY_RUN (D22)

This commit is contained in:
2026-10-16 14:53:05 -07:00
parent 2d4e96d668
commit bcef0e8145
7 changed files with 243 additions and 12 deletions

View File

@@ -0,0 +1,31 @@
# Decisions: October 16, 2026
## D22: dry run for the Okta deprovisioning sync
**Asked by:** Matt Mabrey, 2026-10-16. **Extends:** D18 (wave 13). **Task:** T13.7.
**Why:** The sync disables a local account when Okta does not list the person.
If the Okta profile attribute is wrong for some accounts, the first live run can
disable people who have not left (see BL-069). The attribute `profile.login` is
the default for `preferred_username`. It is not confirmed against the tenant, and
the person who deploys has no access to the Okta admin console.
**Decision:** Add the environment variable `OKTA_SYNC_DRY_RUN`.
- Values `1`, `true`, `yes`, `on` (any case) turn it on. Any other value, or no
value, leaves the sync live. It is off by default, so a deploy that does not set
it behaves as before.
- In a dry run the sync does every step of a live run: the fetch, the match, the
zero-match guard and the fail-closed rules. It then changes no account and writes
no audit row.
- It logs one line for each account it would disable, and one summary line with the
number of Okta users, active local accounts, matches, and accounts that would be
disabled. Read them with `docker compose logs api | grep "Okta sync"`.
- The startup line shows the mode.
**Not decided here:** a limit on accounts disabled in one run, and a rule to keep the
last active admin (BL-069). The dry run lets a person see the result before the
first live run. It does not stop a bad live run.
**Rules from D18 that stay:** fail closed, only disable, one audit row for each
change, actor `system:okta_sync`.

View File

@@ -333,3 +333,19 @@ T13.6 result (2026-10-16, merged release tree, Edge on the PC): 47 test scripts,
The two failures are not regressions. `token_check.py` exits 2 (CLI usage detail).
`generalinfo_check.py` finds an old color-literal gap in `wp-creation-styles.css`.
Alembic upgrade, downgrade, upgrade passed. Import check passed.
## T13.7: D22 dry run for the Okta sync
**Item:** D22 (`docs/waves/decisions-2026-10-16.md`). Extends T13.3 and T13.4.
**Done when:**
- [x] `OKTA_SYNC_DRY_RUN` on: the sync fetches and matches, logs the accounts it would disable, and changes no account and writes no audit row (`tests/okta_sync_dry_run_check.py`)
- [x] both guards (zero match, fail closed) still apply in a dry run
- [x] flag off or unset: behavior is unchanged (`okta_sync_job_check.py` still passes)
- [x] the startup line names the mode
- [x] `.env.example`, `docker-compose.yml` and `DEPLOYMENT.md` describe the flag and the first-deploy steps
- [x] mutation check: if the dry-run guard is removed, the new test fails
Result 2026-10-16: all Okta sync tests and `security_check.py` pass in the sandbox.
This task changes no frontend file.