Skip to content

feat(tenant_consent): live progress page for the admin-consent flow (PPT-2032) - #441

Open
camreeves wants to merge 1 commit into
PPT-2000-graph-replication-retryfrom
PPT-2032-consent-progress
Open

feat(tenant_consent): live progress page for the admin-consent flow (PPT-2032)#441
camreeves wants to merge 1 commit into
PPT-2000-graph-replication-retryfrom
PPT-2032-consent-progress

Conversation

@camreeves

Copy link
Copy Markdown
Contributor

Stacked on #440 (base branch = its head, so this diff shows only the new work; retarget to master once #440 merges).

Why

After the admin clicks Accept, the browser waits on our callback for the whole Graph sequence — up to minutes in bad replication weather — while still displaying Microsoft's consent page. Indistinguishable from a hang, and it races nginx's 60s proxy timeout (we measured 54s callbacks).

What

The callback now spawns the Graph work into a fiber and responds immediately with a progress page — plain HTML/JS served by rest-api itself, zero frontend build involvement:

  • step list with live pending → running → done/failed states (Register Visualiser app → Register User Auth app → Configure Outlook add-in → Save configuration)
  • replication-retry visibility: "Waiting for Microsoft to replicate (attempt N)" via a new optional on_retry hook on GraphReplicationRetry
  • elapsed timer, connectivity-loss notice, friendly error panel on failure
  • on completion: redirect to the domain's authentication tab (fixing the double-slash redirect that landed on /domains/-/about) and a BroadcastChannel("placeos_admin_consent") announcement so a future Backoffice listener can refresh the original tab — answering the open 2025 UX question without requiring a frontend change today

Flow state lives in redis (RedisStorage.with_redis, 15 min TTL) so any replica answers the polling. The flow id is an unguessable capability token; the payload carries no secrets. Specs cover the state machine (step advancement, failure marking, unknown-flow 404 path).

🤖 Generated with Claude Code

…PPT-2032)

The consent callback previously held the browser for the full Graph
sequence - up to minutes when directory replication is slow - while the
tab still displayed Microsoft's consent page, indistinguishable from a
hang. It also risked browser/proxy timeouts (54s callbacks measured
against nginx's 60s default).

Now the callback spawns the work into a fiber and responds immediately
with a self-contained progress page (served by rest-api, no frontend
build involvement) that polls GET /admin_consent/flow/:id and shows:
- each step with pending/running/done/failed states
- live replication-retry detail ("Waiting for Microsoft to replicate
  (attempt N)") via a new optional on_retry hook on
  GraphReplicationRetry
- an elapsed timer, connectivity-loss notice, and a friendly error
  panel on failure
- on completion: BroadcastChannel announcement (for any future
  Backoffice listener) and redirect to the domain's authentication tab
  (also fixes the double-slash redirect that landed on /domains/-/about)

Flow state lives in redis with a 15 minute TTL so any replica can
answer the polling. The flow id is an unguessable capability token and
the payload contains no secrets. Specs cover the state machine.
@github-actions github-actions Bot added the type: enhancement new feature or request label Aug 4, 2026
@camreeves

Copy link
Copy Markdown
Contributor Author

✅ Verified with the full browser flow on placeos-dev (67a1e25 deployed): button → account picker → real consent page → Accept.

  • Callback response: 2.4ms (previously 54,000ms) — the browser lands on the progress page instantly; nginx-timeout risk eliminated.
  • Progress page showed live step states (tick / spinner / pending), the replication-retry narration ("Waiting for Microsoft to replicate (attempt 4)" observed live), and the elapsed timer.
  • Flow completed server-side in ~65s absorbing 13 replication retries, zero errors; redirected to the domain's authentication tab (double-slash landing bug confirmed fixed).
  • New auth strategy created with populated client_id/secret; authority login_url updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement new feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants