Conversation
Greptile SummaryThis PR adds a deploy approval workflow to VectorFlow: when Key observations:
Confidence Score: 3/5
|
2c2914a to
39a84c5
Compare
Add DeployRequest table to track deploy approval requests with status tracking (PENDING/APPROVED/REJECTED/CANCELLED), requester/reviewer relations, and environment-level requireDeployApproval toggle.
Modify the deploy.agent procedure to intercept deploys when the environment requires approval and the user role is EDITOR. Add listPendingRequests, approveDeployRequest, rejectDeployRequest, and cancelDeployRequest procedures. Extend environmentInfo to return requireDeployApproval flag. Add requestId resolver for DeployRequest in withTeamAccess and audit middleware.
…e list Deploy dialog shows "Request Deploy" for editors when approval is required, and switches to review mode for admins with pending requests. Flow toolbar displays a "Pending Approval" badge with requester info and a cancel button for the requester. Pipeline list shows a pending approval badge on pipelines with outstanding deploy requests.
Add a "Require approval for deploys" switch in the environment edit form and display the approval status in the deployment overview card.
Document the deploy approval workflow in the pipelines guide and add a deploy approval section to the environments guide covering how to enable approval requirements and the review process.
Use useMemo instead of calling Date.now() during render to satisfy the react-hooks/purity rule.
…pending requests - Environment update: reject requireDeployApproval changes from EDITORs (only ADMINs can toggle the approval requirement) - Deploy reject: use updateMany with status=PENDING condition to prevent race between concurrent approve and reject operations - Deploy request creation: check for existing PENDING request on the same pipeline before creating a new one (returns CONFLICT)
- cancelDeployRequest: use updateMany with status+owner guard (atomic) - approveDeployRequest: wrap deployAgent in try-catch, revert to PENDING on failure - Request creation: await validateConfig before storing, fix error message formatting - detail-panel: use storeKey instead of undefined componentKey for LiveTailPanel
…rom VIEWER responses - Persist nodeSelector from DeployRequest to pipeline after successful approval deploy, matching the direct-deploy path behavior - Replace withAudit middleware on agent mutation with manual writeAuditLog calls: "deploy.agent" for direct deploys, "deploy.request_submitted" for pending-approval requests - Switch listPendingRequests from include to select, only exposing configYaml to ADMIN/SUPER_ADMIN callers (contains decrypted secrets)
- Add input.requestId to audit entity ID resolution chain so approve/reject/cancel log the DeployRequest ID, not the user ID - Wrap duplicate-pending check + create in a Serializable transaction to prevent TOCTOU race between concurrent editors
39a84c5 to
250e53c
Compare
|
@greptile review |
Summary
DeployRequestmodel with Prisma migration for tracking deploy approval requests (PENDING/APPROVED/REJECTED/CANCELLED)requireDeployApprovaltoggle to Environment model and settings UIdeploy.agentprocedure to intercept deploys when approval is required and user role is EDITOR, creating a DeployRequest instead of deploying directlylistPendingRequests,approveDeployRequest,rejectDeployRequest, andcancelDeployRequesttRPC procedureswithTeamAccessand audit middleware to resolverequestIdfor DeployRequest entitiesTest plan