[codex] Add structured asset access context#3378
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: Approved This PR adds structured context (operation type and resource info) to existing error objects for improved debugging. The changes are purely additive, don't alter control flow, and include corresponding test updates. You can customize Macroscope's approvability policy. Learn more. |
Summary
AssetAccessErrorValidation
pnpm vp test apps/server/src/assets/AssetAccess.test.ts(7 tests)pnpm vp check(20 pre-existing warnings)pnpm vp run typecheckStacked on #3369, which is stacked on #3342, so it extends the existing asset error work rather than conflicting with it.
Note
Medium Risk
Contract change requires every AssetAccessError construction to include new fields; behavior is unchanged but touches asset-access error paths that are security-adjacent.
Overview
AssetAccessErrornow carries typedoperationandresourcefields alongside existingmessageand optionalcause, via a newAssetAccessOperationliteral union in contracts.Every failure path in
issueAssetUrl(workspace files, attachments, project favicons, signing key) and in the WebSocketassetsCreateUrlworkspace-context resolution now sets a specific operation (e.g.validate-workspace-path,inspect-workspace-asset,resolve-workspace-context) and echoes the requestedAssetResource.User-facing messages and underlying causes are unchanged; tests assert the new fields on representative path-validation and inspection failures.
Reviewed by Cursor Bugbot for commit eeacdc5. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add structured
operationandresourcefields toAssetAccessErrorAssetAccessErrorinpackages/contracts/src/assets.tswith two required fields:operation(a constrainedAssetAccessOperationliteral) andresource(theAssetResourcebeing processed).AssetAccess.issueAssetUrland the workspace RPC handler inws.tsto populate these fields with operation-specific literals.AssetAccessErrorconstruction is now a breaking change — all call sites must supplyoperationandresourceor the schema validation will fail.Macroscope summarized eeacdc5.