Skip to content

143 oauth enrichment cover all pages hide handles in random mode explain via tooltip merge - #157

Closed
Kzoeps wants to merge 10 commits into
mainfrom
143-oauth-enrichment-cover-all-pages-hide-handles-in-random-mode-explain-via-tooltip-merge
Closed

143 oauth enrichment cover all pages hide handles in random mode explain via tooltip merge#157
Kzoeps wants to merge 10 commits into
mainfrom
143-oauth-enrichment-cover-all-pages-hide-handles-in-random-mode-explain-via-tooltip-merge

Conversation

@Kzoeps

@Kzoeps Kzoeps commented May 5, 2026

Copy link
Copy Markdown
Contributor
  • fix(pds-core): scope chooser enrichment to account rows
  • test(pds-core): fix chooser enrichment test lint
  • fix(pds-core): match chooser enrichment identifiers exactly
  • fix(pds-core): tighten consent identity enrichment
  • fix(pds-core): keep consent tooltip open on first tap
  • fix(pds-core): resolve handle mode from OAuth client metadata
  • fix(auth): gate email login until handlers are ready
  • fix(auth): sign handle mode callback parameter

Summary by CodeRabbit

Release Notes

New Features

  • Email now appears as the primary account identifier on sign-in and app approval screens
  • Added identity information tooltip displaying your AT Protocol handle and associated email

Bug Fixes

  • Sign-in button waits for page initialization to complete before accepting clicks
  • Fixed inconsistent handle display behavior across account selection and approval screens
  • Removed brief display of generated handles during app approval
  • Improved screen-reader accessibility for account handle information

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@vercel

vercel Bot commented May 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
epds-demo Ready Ready Preview, Comment May 5, 2026 3:33pm

Request Review

@changeset-bot

changeset-bot Bot commented May 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cc54b3e

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@railway-app

railway-app Bot commented May 5, 2026

Copy link
Copy Markdown

🚅 Deployed to the ePDS-pr-157 environment in ePDS

Service Status Web Updated (UTC)
@certified-app/demo untrusted 🕒 Building (View Logs) Web May 5, 2026 at 3:33 pm
@certified-app/demo 🕒 Building (View Logs) Web May 5, 2026 at 3:33 pm
@certified-app/pds-core 🕒 Building (View Logs) Web May 5, 2026 at 3:33 pm
@certified-app/auth-service 🕒 Building (View Logs) Web May 5, 2026 at 3:33 pm

@railway-app
railway-app Bot temporarily deployed to ePDS / ePDS-pr-157 May 5, 2026 15:33 Destroyed
@coderabbitai

coderabbitai Bot commented May 5, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Kzoeps has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 55 minutes and 46 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e2287c13-6597-4fb2-9db7-b1338faccf33

📥 Commits

Reviewing files that changed from the base of the PR and between 72d9113 and cc54b3e.

📒 Files selected for processing (25)
  • .beads/issues.jsonl
  • .changeset/sign-in-account-presentation.md
  • e2e/step-definitions/consent.steps.ts
  • e2e/step-definitions/session-reuse-bugs.steps.ts
  • features/consent-screen.feature
  • features/session-reuse-bugs.feature
  • packages/auth-service/src/__tests__/build-epds-callback-url.test.ts
  • packages/auth-service/src/__tests__/callback-handle-mode.test.ts
  • packages/auth-service/src/__tests__/login-page.test.ts
  • packages/auth-service/src/routes/choose-handle.ts
  • packages/auth-service/src/routes/complete.ts
  • packages/auth-service/src/routes/login-page.ts
  • packages/pds-core/src/__tests__/chooser-enrichment.test.ts
  • packages/pds-core/src/__tests__/client-css-injection.test.ts
  • packages/pds-core/src/__tests__/epds-callback-authorize.test.ts
  • packages/pds-core/src/__tests__/preview-chooser.test.ts
  • packages/pds-core/src/__tests__/preview-consent.test.ts
  • packages/pds-core/src/chooser-enrichment.ts
  • packages/pds-core/src/index.ts
  • packages/pds-core/src/lib/client-css-injection.ts
  • packages/pds-core/src/lib/epds-callback-authorize.ts
  • packages/pds-core/src/lib/oauth-request-context.ts
  • packages/pds-core/src/lib/preview-consent.ts
  • packages/shared/src/__tests__/crypto.test.ts
  • packages/shared/src/crypto.ts
📝 Walkthrough

Walkthrough

This PR enriches account presentation in OAuth consent and account-chooser flows by adding email as a primary identifier, refining handle visibility in random-mode flows to use accessible descriptions, introducing a consent-screen identity tooltip, threading epds_handle_mode through auth/callback pipeline, implementing client-id resolution from pushed-authorization request URIs, and gating email sign-in form submission until page initialization completes.

Changes

Account Enrichment, Handle-Mode Threading, and Login Form Readiness

Layer / File(s) Summary
Data Shape & Types
packages/shared/src/crypto.ts, packages/auth-service/src/__tests__/build-epds-callback-url.test.ts
CallbackParams adds optional epds_handle_mode field; signCallback and verifyCallback include it in the signed payload (using empty-string sentinel when absent); verifyCallback now validates signature format before comparison.
OAuth Request Context & Utilities
packages/pds-core/src/lib/oauth-request-context.ts, packages/pds-core/src/lib/epds-callback-authorize.ts
New helpers resolve client-id from query parameter or pushed-auth request_uri; validate and construct /oauth/authorize URLs with conditional epds_handle_mode query parameter based on validated HandleMode.
Core Enrichment Script
packages/pds-core/src/chooser-enrichment.ts
Refactored to capture __deviceSessions/__sessions via property interceptors; adds account matching, identity formatting, and email-label enrichment; changes random-handle hiding from display:none to aria-describedby-linked visually-hidden description; adds consent-identity tooltip flow with accessibility features.
Chooser Enrichment Middleware
packages/pds-core/src/chooser-enrichment.ts (deps & factory)
Extended ChooserEnrichmentDeps with optional resolveClientIdFromRequestUri and logger; middleware now validates query epds_handle_mode, resolves client-id via request-uri when needed, fetches metadata, and logs resolution failures before fallback.
Auth-Service Login Page
packages/auth-service/src/routes/login-page.ts
Email OTP form renders with data-epds-login-ready="false" and disabled submit button; JavaScript caches form reference and enables button only after initialization completes via dataset.epdsLoginReady = 'true'.
Auth-Service Routes & Callback Building
packages/auth-service/src/routes/complete.ts, packages/auth-service/src/routes/choose-handle.ts
New resolveCompleteIdentity helper translates backup/recovery emails to primary DIDs; buildEpdsCallbackUrl accepts flowHandleMode and includes it in signed callback; both new-user and existing-user paths pass flow.handleMode to callback builder.
PDS Index Integration
packages/pds-core/src/index.ts, packages/pds-core/src/lib/client-css-injection.ts
Routes now pass epds_handle_mode through /oauth/epds-callback verification; post-creation redirects use buildEpdsCallbackAuthorizeUrl; shared resolveClientIdFromRequestUri helper eliminates code duplication; client-CSS middleware refactored to delegate client-id resolution.
Preview Handlers
packages/pds-core/src/lib/preview-consent.ts
Consent preview now resolves and injects handleMode via meta tag; enrichment script is injected into preview HTML; preview chooser includes enrichment script before session hydration.
Feature Scenarios
features/consent-screen.feature, features/session-reuse-bugs.feature
New consent-screen scenarios verify email display as primary identifier and tooltip exposure of public handles; session-reuse scenario updated to expect aria-describedby-based handle accessibility instead of title tooltips.
E2E Steps & Assertions
e2e/step-definitions/consent.steps.ts, e2e/step-definitions/session-reuse-bugs.steps.ts
Added consent-screen helper functions and steps validating email/handle presence, tooltip expansion/content, and handle non-visibility as primary identifier; session-reuse steps refactored to verify aria-describedby-linked hidden-handle descriptions instead of title attributes; added HiddenHandleDescriptionRow type for accessibility data extraction.
Unit & Integration Tests
packages/auth-service/src/__tests__/callback-handle-mode.test.ts, packages/auth-service/src/__tests__/login-page.test.ts, packages/auth-service/src/__tests__/build-epds-callback-url.test.ts, packages/shared/src/__tests__/crypto.test.ts
New callback-handle-mode test suite verifies epds_handle_mode threading through complete and choose-handle routes; login-page tests assert form readiness gate behavior; callback-url and crypto tests include epds_handle_mode in signed payloads; resolver rejection/fallback behavior logged via logger.debug.
Chooser Enrichment Tests
packages/pds-core/src/__tests__/chooser-enrichment.test.ts, packages/pds-core/src/__tests__/client-css-injection.test.ts, packages/pds-core/src/__tests__/epds-callback-authorize.test.ts, packages/pds-core/src/__tests__/preview-chooser.test.ts, packages/pds-core/src/__tests__/preview-consent.test.ts
Extensive test expansion: chooser enrichment now runs in Node vm sandbox with fake DOM; tests cover account-row enrichment, consent-identity tooltips, random-mode aria-describedby behavior, and middleware resolution from request_uri; preview tests verify enrichment script ordering and meta tag injection; new epds-callback-authorize test validates URL construction and optional handle-mode parameter.
Changelog & Tracking
.changeset/sign-in-account-presentation.md, .beads/issues.jsonl
Changeset documents sign-in presentation updates and epds_handle_mode behavior; issue tracking entry added for E2E coverage epic.

Sequence Diagram

sequenceDiagram
    actor User
    participant Browser
    participant AuthService as Auth Service
    participant PDS as PDS Core
    participant OAuthServer as OAuth Server
    
    User->>Browser: Navigate to app
    Browser->>AuthService: GET /auth/login-page
    AuthService-->>Browser: Render form (data-epds-login-ready="false", disabled button)
    Browser->>Browser: Initialize form<br/>(setup handlers, wait for readiness)
    Browser->>Browser: Set data-epds-login-ready="true"<br/>Enable submit button
    
    User->>Browser: Submit email OTP form
    Browser->>AuthService: POST /auth/send-otp
    AuthService-->>Browser: Render OTP entry form
    
    User->>Browser: Submit OTP
    Browser->>AuthService: POST /auth/complete (with auth_flow cookie)
    AuthService->>AuthService: Resolve identity via email<br/>(handle-mode from flow)
    AuthService-->>Browser: Redirect to /oauth/epds-callback<br/>(signed: epds_handle_mode)
    
    Browser->>PDS: GET /oauth/epds-callback<br/>(verify HMAC signature)
    PDS->>OAuthServer: Redirect to /oauth/authorize<br/>(with epds_handle_mode)
    OAuthServer-->>Browser: Render account chooser<br/>(enriched: email labels, aria-describedby)
    
    User->>Browser: Select account
    Browser->>OAuthServer: Submit chooser
    OAuthServer-->>Browser: Render consent screen<br/>(enriched: email primary,<br/>identity-tooltip with handle/email)
    
    User->>Browser: Grant consent
    Browser->>OAuthServer: Complete OAuth flow
    OAuthServer-->>Browser: Redirect to app with authorization
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly Related Issues

  • hypercerts-org/ePDS#143: Implementation directly addresses the requested enrichment scope broadening, random-mode handle accessibility via aria-describedby, and identity-tooltip flow for consent screens.
  • hypercerts-org/ePDS#149: Changes modify chooser enrichment account-row rendering and accessibility handling in packages/pds-core/src/chooser-enrichment.ts via aria-describedby wiring, which aligns with the hardening concerns in this issue.

Possibly Related PRs

  • hypercerts-org/ePDS#47: Modifies the same consent-screen E2E tests and step definitions (e2e/step-definitions/consent.steps.ts, features/consent-screen.feature).
  • hypercerts-org/ePDS#29: Directly related through shared handle-mode data plumbing (epds_handle_mode threading across auth-service routes, callback builders, and verification).
  • hypercerts-org/ePDS#103: Related through chooser enrichment script modifications, epds_handle_mode meta injection, and middleware client-id resolution refactoring.

Suggested Reviewers

  • aspiers
  • s-adamantine

🐰 A chooser now shows emails bright,
With handles tucked from public sight,
Tooltips expand to share the truth,
While forms wait patient, proof of youth.
Aria describes what once was hid—
Enrichment's done, the way it bid!

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 143-oauth-enrichment-cover-all-pages-hide-handles-in-random-mode-explain-via-tooltip-merge

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

sonarqubecloud Bot commented May 5, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
4.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@Kzoeps Kzoeps closed this May 5, 2026
@railway-app
railway-app Bot temporarily deployed to ePDS / pr-5c336d-148 May 5, 2026 15:34 Destroyed
@coveralls-official

Copy link
Copy Markdown

Coverage Report for CI Build 25385992445

Coverage increased (+2.6%) to 58.098%

Details

  • Coverage increased (+2.6%) from the base build.
  • Patch coverage: 8 uncovered changes across 3 files (38 of 46 lines covered, 82.61%).
  • 2 coverage regressions across 1 file.

Uncovered Changes

File Changed Covered %
packages/pds-core/src/index.ts 5 0 0.0%
packages/auth-service/src/routes/complete.ts 8 6 75.0%
packages/pds-core/src/lib/client-css-injection.ts 3 2 66.67%

Coverage Regressions

2 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
packages/pds-core/src/index.ts 2 0.0%

Coverage Stats

Coverage Status
Relevant Lines: 2951
Covered Lines: 1722
Line Coverage: 58.35%
Relevant Branches: 1822
Covered Branches: 1051
Branch Coverage: 57.68%
Branches in Coverage %: Yes
Coverage Strength: 6.05 hits per line

💛 - Coveralls

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant