[codex] structure server secret store errors#3243
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Needs human review Changes modify files in the auth/ directory (ServerSecretStore.ts, dpop.test.ts), which requires human review regardless of the structural nature of the error refactoring. You can customize Macroscope's approvability policy. Learn more. |
Summary
Stack
Validation
Note
Medium Risk
Touches filesystem-backed secret storage and auth/cloud code paths, but changes are largely structural with preserved behavior and expanded test coverage.
Overview
ServerSecretStore errors move from a single free-form
resourcestring to structured fields (secretName,secretPath,operation,byteCount,directoryPath) so callers and tests can assert on concrete data instead of message substrings.Directory setup failures are split into
SecretStoreDirectoryCreateError(replacing the old secure error formakeDirectory) andSecretStoreDirectorySecureErrorforchmod, each carryingdirectoryPathand the original cause. Persist/read/remove/temp-path/random/decode/encode errors follow the same pattern;SecretStorePersistErrornow records whether the failure wascreateorset.The
ServerSecretStoreservice interface narrows each method’s error union to the failures that path can actually emit. Concurrent-create recovery ingetOrCreateRandomandenvironmentKeysswitches from broadcatchIf(isSecretStoreError)tocatchTags({ SecretStorePersistError: ... }), with environment key helpers inlining decode/encode/concurrent errors using the real secret name constant.Tests add directory-create failure coverage and update fixtures/assertions across auth, DPoP, cloud HTTP, and environment keys.
Reviewed by Cursor Bugbot for commit 47c0424. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure
ServerSecretStoreerrors with contextual fields per operationReplaces broad
SecretStoreErrortypes with specific, field-rich error classes for eachServerSecretStoreoperation. Each error now carries relevant context such assecretName,secretPath,operation('create'|'set'),byteCount, andcause.SecretStoreDirectoryCreateErrorandSecretStoreDirectorySecureErrorfor failures during store initialization (directory creation andchmod).SecretStoreReadError,SecretStorePersistError,SecretStoreRemoveError,SecretStoreDecodeError,SecretStoreEncodeError,SecretStoreRandomGenerationError, andSecretStoreConcurrentReadErrorto include structured fields instead of generic message strings.SecretStoreTemporaryPathErrortoSecretStoreTemporaryPathGenerationErrorand addssecretName/secretPathfields.dpop,http, andenvironmentKeysto construct errors with the new fields.ServerSecretStoremethods have changed; any code pattern-matching on error messages or the old field names will break.Macroscope summarized 47c0424.