Repository navigation
fix(domain): preserve retryable capability failures through redaction - #2494
Merged
morluto merged 1 commit intoOct 13, 2026
Merged
Conversation
redactExplicitFailure rebuilds each typed failure field by field so explicit literals are removed while the projected code stays the same. The rebuild for AnalysisCapabilityUnavailableError carried providerId, operation, reason and userMessage but not retryable, and the constructor defaults that field to false. Redacting a transient capability failure therefore made it permanent and changed the remediation shown to the caller. Pass the field through with the same conditional-spread shape used for userMessage. The constructor recomputes retryable from cleanupIncomplete, and cleanup is already part of the reconstructed context, so a value that was true before redaction stays true and a false value stays absent. Verified with 66 error projection, access-denied, redaction and capture-failure tests, check:fast and verify:test-discovery on macOS arm64. The regression test failed with "expected false to be true" before the change.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Owner
|
@greptileai review |
Contributor
|
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explicit-value redaction rebuilds each error from its fields, and
AnalysisCapabilityUnavailableError.retryablewas missing from the rebuild. Redaction therefore reset a documented semantic field tofalse.Summary
redactExplicitFailurereconstructs typed failures field by field so that explicit sensitive literals are removed while the error stays projected as the same code. ForAnalysisCapabilityUnavailableErrorit carriedproviderId,operation,reasonanduserMessage, but notretryable:retryableis a semantic field with its own doc comment ("Incomplete cleanup must settle before the operation can be retried") and it drivesprojectAnalysisError, the error category, and the remediation text the caller is shown. Because the constructor defaults it tofalse, redacting any capability failure silently converted a transient condition into a permanent one: the remediation changed from "Review details.reason, then retry the same analysis after the condition clears." to "This analysis is unavailable for the current target. Choose another analysis or target." The field was recently added to the error class, and the existing redaction test for this class coversuserMessageonly, so the loss was uncovered.Change and scope
explicitSensitiveFailurepasses the field through with the same conditional-spread shape already used foruserMessage:Passing it is safe by construction: the constructor computes
options?.retryable === true && !this.cleanupIncomplete, andcleanupis already part of the reconstructedcontext, so a value that wastruebefore redaction staystrueand a value that wasfalsestays absent. No other class, projection, presentation or remediation path changes, and no new representation or wrapper is introduced.Related cleanup that remains
The same rebuild covers
AnalysisCancelledError,AnalysisTimeoutError,AnalysisAccessDeniedError,AnalysisArtifactChangedError,AnalysisInputError,AnalysisOutputError,AnalysisCapabilityUnavailableError,AnalysisResourceConstraintError,ProviderCleanupErrorandProviderAdapterError;AnalysisUnsupportedTargetErroris not in the chain and falls through toreturn error, so itspath,reasonandremediationActionare returned unredacted. I did not change that here: extending redaction to a class it has never covered is a privacy/evidence decision rather than a field-preservation fix, and the function's doc scopes it to "common acquisition/decoder failures". I am flagging it rather than folding it in.Contract and boundary impact
retryablekeeps its documented meaning for redacted and unredacted failures alike; only a redacted transient capability failure no longer reports itself as permanent.Evidence and regression coverage
A new case in
explicitSensitiveFailure.test.ts, "preserves a retryable capability failure through explicit-value redaction", builds a retryable capability failure whose reason embeds an explicit literal, asserts the unredacted projection is alreadyretryable, then asserts the redacted error instance and its projection are both stillretryableand still free of the literal.Before the change it failed with
expected false to be true; the 18 existing cases in that file passed throughout, which is why the field was uncovered. Verification on macOS 26.5.1 arm64 with Node.js 24.18.0 and npm 11.16.0, based onbb54082:npm run test:focusedover the redaction suite, the error-projection suite, the access-denied suite and the browser capture-failure suite: 66 passed, 0 failed.npm run check:fast: passed.npm run verify:test-discovery: all 1015 test files discovered exactly once.Unavailable coverage: no Windows or Linux run and no real-provider run — the change is provider-neutral domain logic and the regression input is a constructed error.