Skip to content

[codex] structure server secret store errors#3243

Merged
juliusmarminge merged 2 commits into
codex/server-auth-error-boundariesfrom
codex/server-secret-store-errors
Jun 20, 2026
Merged

[codex] structure server secret store errors#3243
juliusmarminge merged 2 commits into
codex/server-auth-error-boundariesfrom
codex/server-secret-store-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • replace free-form secret resource strings with structured secret name, path, operation, and byte-count fields
  • preserve directory initialization failures as tagged errors with their original causes
  • narrow each secret-store service method to the failures it can actually produce
  • remove key-pair constructor aliases and use catchTags for concurrent-create recovery

Stack

Validation

  • vp check
  • vp run typecheck
  • vp test apps/server/src/auth/ServerSecretStore.test.ts apps/server/src/auth/dpop.test.ts apps/server/src/cloud/environmentKeys.test.ts apps/server/src/cloud/http.test.ts

Note

Medium Risk
Touches secret persistence and cloud link/auth HTTP surfaces with breaking error shapes for in-process matchers, though wire decoding stays compatible with legacy payloads.

Overview
This PR reshapes failure reporting across the environment server’s secret store, cloud HTTP layer, and shared HTTP contracts.

ServerSecretStore drops generic resource strings in favor of structured fields (secretName, secretPath, operation, byteCount, directoryPath). Directory init failures are explicit tagged errors; each store method’s Effect error union is narrowed. Concurrent-create recovery uses Effect.catchTags instead of broad isSecretStoreError checks.

Environment HTTP errors in @t3tools/contracts gain stable reason / operation (and relay relayOperation / relayPhase) codes with centralized user-facing messages. Wire encoding omits internal cause; decoders still accept legacy message-only bodies for rolling deploys.

Cloud relay calls map client failures to CloudRelayRequestError (phase, redacted URL diagnostics, no secrets in messages). Internal 500s log causeTag only; clients see stable relay failure text. Unauthorized link flows use cloud_cli_authorization_required (mobile test updated accordingly).

Reviewed by Cursor Bugbot for commit 050fbe6. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Structure server secret store and HTTP environment errors with typed, contextual fields

  • Refactors all ServerSecretStore error classes in ServerSecretStore.ts to carry structured fields (e.g. secretName, secretPath, operation, cause) instead of plain messages, and narrows per-method error union types.
  • Adds structured reason codes and canonical messages to HTTP error contracts in environmentHttp.ts for 400, 401, 409, 500, and 503 responses; legacy message-only payloads are preserved on decode.
  • Rewrites cloud HTTP handlers in http.ts to emit typed errors with operation context (e.g. generate_link_proof, persist_relay_configuration) and redact sensitive details from logs and response bodies.
  • Introduces CloudRelayRequestError and CloudRelayConfigurationError for relay-specific failures, classifying errors by phase (encode/send/status/decode) with sanitized URL diagnostics.
  • Behavioral Change: error messages across all secret store operations and HTTP responses are now standardized; clients consuming raw message strings from these errors will see different text.

Macroscope summarized 050fbe6.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b6ce9f26-5052-4573-a8ee-df5fd935deca

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/server-secret-store-errors

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

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR refactors error types in the secret store to provide more structured diagnostic information (specific field names, reason codes, operation context). The changes are mechanical restructuring of error classes and handlers without altering runtime behavior beyond error reporting.

You can customize Macroscope's approvability policy. Learn more.

Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge juliusmarminge force-pushed the codex/server-auth-error-boundaries branch from a92067e to 93072ff Compare June 20, 2026 16:56
@juliusmarminge juliusmarminge force-pushed the codex/server-secret-store-errors branch from 47c0424 to 8090110 Compare June 20, 2026 16:56
Co-authored-by: codex <codex@users.noreply.github.com>
@github-actions github-actions Bot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Jun 20, 2026
@juliusmarminge juliusmarminge merged commit 7d654e4 into codex/server-auth-error-boundaries Jun 20, 2026
16 checks passed
@juliusmarminge juliusmarminge deleted the codex/server-secret-store-errors branch June 20, 2026 18:48
juliusmarminge added a commit that referenced this pull request Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
juliusmarminge added a commit that referenced this pull request Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
juliusmarminge added a commit that referenced this pull request Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
juliusmarminge added a commit that referenced this pull request Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
juliusmarminge added a commit that referenced this pull request Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
juliusmarminge added a commit that referenced this pull request Jun 21, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant