Skip to content

refactor(web): replace global aria state with app resources and Foldkit overlays - #338

Merged
Makisuo merged 65 commits into
mainfrom
chore/foldkit-audit-fixes
Oct 15, 2026
Merged

Makisuo merged 65 commits into
mainfrom
chore/foldkit-audit-fixes

refactor(web): pending-button announcer as an app Resource; no ui/ari…

d620f82
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review completed Oct 15, 2026 in 8m 0s

Confidence 5/10 · 1 issue to address

🟡 Confidence 5/10 · needs attention
879 files: backend auth/outbox and most web hunks were read only through child reviewers, two of which stopped before answering, and 227 files went unread.
quality 90/100 · 1 warning · tests partial · risk high · 0/1 new units observable · 227 files not read

Refactors web state, overlays and backend auth/failure handling across 879 files; one real observability gap in the new session-failure path. 227 files, notably chat-sync-core-worker.ts and the backend route and test files, were not read. The open HttpClientError issues all point at services/common/atom-client.ts, which this diff deletes, so those stacks go away on deploy rather than being fixed.

  • verify and loadUser in hazel-session.ts map failures to SessionLoadError and log them
  • ServerFailureReporterLive logs RPC/HttpApi 5xx tags with their `Cause
  • Outbox handlers propagate retryable failures instead of logging them
  • Web overlays move to @foldkit/ui Dialog/Popover/Tooltip/Toast; Atom dropped

Before merge

  • Manual · Land this as a reviewable series; 879 files is past every reviewer and CI limit

Findings

🟠 Warning · F1 · verify drops the cause of a session-store failure and the reporter excludes its tag

observability · STAT-01 · apps/backend/src/services/hazel-session.ts:80-86

When auth.verifySession fails for any reason other than SessionInvalid, the new mapping keeps only error._tag in detail and produces a SessionLoadError with no cause, and apps/backend/src/lib/error-reporter.ts:6 deliberately skips every SessionLoadError on the premise that the raise sites log it. The DatabaseError site at line 35 does log; this one does not, so a broken session store answers every browser and native request with a 503 and leaves no log or trace of why. Log the failure here too (Effect.tapError((error) => Effect.logError("Session verification failed", Cause.fail(error))) before the mapError) or carry it as the error's cause.

Production impact

Open errors in the changed files
Issue Service Occurrences File
HttpClientError maple-web 27 apps/web-foldkit/src/core/lib/services/common/atom-client.ts
HttpClientError maple-web 12 apps/web-foldkit/src/core/lib/services/common/atom-client.ts
HttpClientError maple-web 9 apps/web-foldkit/src/core/lib/services/common/atom-client.ts
HttpClientError maple-web 9 apps/web-foldkit/src/core/lib/services/common/atom-client.ts
HttpClientError maple-web 8 apps/web-foldkit/src/core/lib/services/common/atom-client.ts
HttpClientError maple-web 8 apps/web-foldkit/src/core/lib/services/common/atom-client.ts
HttpClientError maple-web 4 apps/web-foldkit/src/core/lib/services/common/atom-client.ts
HttpClientError maple-web 4 apps/web-foldkit/src/core/lib/services/common/atom-client.ts
HttpClientError maple-web 4 apps/web-foldkit/src/core/lib/services/common/atom-client.ts
HttpClientError maple-web 3 apps/web-foldkit/src/core/lib/services/common/atom-client.ts

After this merges, Maple checks whether they stop.

Production traffic of the changed files (last 7 days)
File Calls/day Busiest operations
apps/backend/src/routes/webhooks.http.ts 974 POST 830/day, 4.0% err
POST 144/day, 0.5% err
apps/web-foldkit/src/core/lib/access-token.ts 974 POST 830/day, 4.0% err
POST 144/day, 0.5% err
apps/web-foldkit/src/composer/upload.ts 7 PUT 7/day, 0.0% err
Telemetry this change adds and removes (1)
  • ➕ span name MessageSideEffectService.nameThreadIfDue · apps/backend/src/services/message-side-effect-service.ts:110
What was checked
  • access-token.ts exchange keeps its attempt bound (Effect.retry times 2) and generation guard
  • Token retry only re-sends the idempotent POST /auth/token exchange
  • Backend RPC handlers group (bots, channels, connect-shares, organizations): no dropped auth or org check found
Observability coverage: 0 of 1 changes observable
Change Kind Observable Evidence
POST /auth/token token exchange wrapper in access-token.ts outbound-http no Runs via Effect.runPromise from fetch wrappers outside any runtime; no Client span, MAP-01
Files not reviewed (227)

The review ended before it read these diffs, so nothing above vouches for them.

  • .oxlintrc.json
  • apps/backend/.artifacts/chat-sync/chat-sync-diagnostics.jsonl
  • apps/backend/src/lib/error-reporter.test.ts
  • apps/backend/src/lib/policy-utils.test.ts
  • apps/backend/src/routes/api-v1/integrations.http.ts
  • apps/backend/src/routes/api-v1/messages.http.ts
  • apps/backend/src/routes/bot-commands.http.ts
  • apps/backend/src/routes/integration-commands.http.ts
  • apps/backend/src/routes/integration-resources.http.ts
  • apps/backend/src/rpc/middleware/auth-class.ts
  • apps/backend/src/rpc/middleware/auth.test.ts
  • apps/backend/src/services/chat-sync/chat-sync-core-worker.integration.test.ts
  • apps/backend/src/services/chat-sync/chat-sync-core-worker.ts
  • apps/backend/src/services/chat-sync/discord-gateway-service.ts
  • apps/backend/src/services/chat-sync/discord-sync-worker.test.ts
  • apps/backend/src/services/hazel-auth.test.ts
  • apps/backend/src/services/invitations.test.ts
  • apps/backend/src/services/message-side-effect-service.test.ts
  • apps/backend/src/services/org-resolver.test.ts
  • apps/backend/src/services/session-manager.ts
  • apps/electric-proxy/resources.ts
  • apps/web-foldkit/package.json
  • apps/web-foldkit/public/images/appearance/dark.svg
  • apps/web-foldkit/public/images/appearance/light.svg
  • apps/web-foldkit/public/images/appearance/system.svg
  • apps/web-foldkit/src/app/desktop.test.ts
  • apps/web-foldkit/src/auth/flows.test.ts
  • apps/web-foldkit/src/chat/embeds/url-embeds.ts
  • apps/web-foldkit/src/chat/image-viewer.ts
  • apps/web-foldkit/src/chat/markdown/leaves.test.ts
  • and 197 more

d620f82 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one. Check ids refer to Maple's instrumentation audit.

Annotations

Check warning on line 86 in apps/backend/src/services/hazel-session.ts

See this annotation in the file changed.

@maple-review-bot maple-review-bot / Maple / review

observability · STAT-01: `verify` drops the cause of a session-store failure and the reporter excludes its tag

When `auth.verifySession` fails for any reason other than `SessionInvalid`, the new mapping keeps only `error._tag` in `detail` and produces a `SessionLoadError` with no `cause`, and `apps/backend/src/lib/error-reporter.ts:6` deliberately skips every `SessionLoadError` on the premise that the raise sites log it. The `DatabaseError` site at line 35 does log; this one does not, so a broken session store answers every browser and native request with a 503 and leaves no log or trace of why. Log the failure here too (`Effect.tapError((error) => Effect.logError("Session verification failed", Cause.fail(error)))` before the `mapError`) or carry it as the error's `cause`.