feat: 006 pinned scanner wrapper 및 sandbox lifecycle 구현 - #253
Conversation
|
Warning Review limit reached
Next review available in: 23 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (22)
📝 WalkthroughWalkthroughIntroduces a plan-bound SAST scanner wrapper and attested sandbox lifecycle with strict validation, cleanup evidence, persistent attempt tracking, production fail-closed analysis routing, reconciliation, deployment contracts, and end-to-end coverage. ChangesSAST runtime boundary
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c640eb2a5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/api/test/scan-plane/scan-plane.e2e-spec.ts (1)
155-170: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick winProve the rejected legacy request never invokes execution.
The 403 assertion permits a regression where validation occurs after sandbox/scanner dispatch. Restore an assertion that the execution-adapter mock has zero calls after this request.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/api/test/scan-plane/scan-plane.e2e-spec.ts` around lines 155 - 170, Add an assertion after the rejected request in the test case “rejects the legacy caller-controlled workspace, timeout, and isolation execution shape” verifying the execution-adapter mock has zero calls. Keep the existing 403 and response-secret assertions unchanged, and use the mock symbol already defined for execution dispatch.
🧹 Nitpick comments (2)
apps/api/test/client/analysis/analysis-api.module.e2e-spec.ts (1)
11-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMake the routing tests environment-independent and complete the matrix.
AnalysisApiModuleselects its provider when the module is imported, so the first test depends on inherited CI environment variables rather than explicitly proving thetest/mockcontract. Isolate the import after setting the expected environment, and add the missingNODE_ENV: 'test'+ANALYSIS_CLIENT_MODE: 'internal'case assertingfalse.Also applies to: 19-38
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/api/test/client/analysis/analysis-api.module.e2e-spec.ts` around lines 11 - 16, Update the routing tests around AnalysisApiModule to set the required environment variables before importing or compiling the module, preventing inherited CI state from affecting provider selection. Complete the test matrix with the NODE_ENV='test' and ANALYSIS_CLIENT_MODE='internal' scenario, asserting the expected false result, and isolate or reset module imports between cases so each configuration is evaluated independently.apps/api/prisma/migrations/20260724150000_sast_scanner_runtime_lifecycle/migration.sql (1)
167-277: 🩺 Stability & Availability | 🔵 TrivialBlocking locks when altering existing
ScannerRun/AuditEvent.The new-table portion is fine (empty table), but the
ScannerRunandAuditEventalterations add foreign keys,CHECKconstraints, and non-concurrent indexes that require full table scans and takeSHARE ROW EXCLUSIVElocks, blocking writes for the duration on already-populated tables. If these tables are large in production, plan the deploy for a maintenance window (or split constraint creation intoNOT VALID+ laterVALIDATE CONSTRAINToutside the migration transaction). Note theruntime_metadata_checkis correctly gated onattemptId IS NOT NULL, so existing rows won't fail validation.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/api/prisma/migrations/20260724150000_sast_scanner_runtime_lifecycle/migration.sql` around lines 167 - 277, Update the existing ScannerRun and AuditEvent alterations to avoid long blocking locks on populated tables: create foreign keys and CHECK constraints as NOT VALID, then validate them separately outside the migration transaction, and build the new indexes concurrently. Preserve the attemptId-gated behavior of ScannerRun_runtime_metadata_check so existing rows remain valid.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/api/src/scan-plane/scan-plane.service.ts`:
- Around line 85-122: Normalize listScannerRuns to an explicit, documented
return shape shared by both mock and persisted branches. Update the mock
scannerRuns mapping and Prisma select to expose the same fields, including
handling rawArtifactObjectKey and digest/termination fields consistently, or
declare an intentional union if the contract requires it; ensure consumers
receive a stable type in both modes.
In `@packages/shared/test/shared-contract-exports.test.mjs`:
- Around line 55-66: Update the export validation in the shared contract export
test to enumerate all exported declarations from contract and assert that the
complete set exactly matches the existing allow-list. Retain the current
required-export coverage while failing when any additional public interface,
const, function, or type is introduced.
---
Outside diff comments:
In `@apps/api/test/scan-plane/scan-plane.e2e-spec.ts`:
- Around line 155-170: Add an assertion after the rejected request in the test
case “rejects the legacy caller-controlled workspace, timeout, and isolation
execution shape” verifying the execution-adapter mock has zero calls. Keep the
existing 403 and response-secret assertions unchanged, and use the mock symbol
already defined for execution dispatch.
---
Nitpick comments:
In
`@apps/api/prisma/migrations/20260724150000_sast_scanner_runtime_lifecycle/migration.sql`:
- Around line 167-277: Update the existing ScannerRun and AuditEvent alterations
to avoid long blocking locks on populated tables: create foreign keys and CHECK
constraints as NOT VALID, then validate them separately outside the migration
transaction, and build the new indexes concurrently. Preserve the
attemptId-gated behavior of ScannerRun_runtime_metadata_check so existing rows
remain valid.
In `@apps/api/test/client/analysis/analysis-api.module.e2e-spec.ts`:
- Around line 11-16: Update the routing tests around AnalysisApiModule to set
the required environment variables before importing or compiling the module,
preventing inherited CI state from affecting provider selection. Complete the
test matrix with the NODE_ENV='test' and ANALYSIS_CLIENT_MODE='internal'
scenario, asserting the expected false result, and isolate or reset module
imports between cases so each configuration is evaluated independently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ed9eb263-ebf4-4a2c-9776-99ad0b18e127
📒 Files selected for processing (48)
.env.exampleapps/api/.env.exampleapps/api/prisma/migrations/20260724150000_sast_scanner_runtime_lifecycle/migration.sqlapps/api/prisma/schema.prismaapps/api/src/bootstrap/configure-app.tsapps/api/src/client/analysis/analysis-api.module.tsapps/api/src/client/analysis/analysis-fixture.policy.tsapps/api/src/client/analysis/disabled-analysis-api.client.tsapps/api/src/client/analysis/mock-analysis-api.client.tsapps/api/src/config/config.schema.tsapps/api/src/config/config.types.tsapps/api/src/scan-plane/prisma-sast-scanner-runtime.store.tsapps/api/src/scan-plane/sandbox-runtime-attestation.service.tsapps/api/src/scan-plane/sast-attempt-reconciliation.task.tsapps/api/src/scan-plane/sast-scanner-runtime.service.tsapps/api/src/scan-plane/sast-scanner-runtime.store.tsapps/api/src/scan-plane/scan-plane-mock.controller.tsapps/api/src/scan-plane/scan-plane.controller.tsapps/api/src/scan-plane/scan-plane.dto.tsapps/api/src/scan-plane/scan-plane.module.tsapps/api/src/scan-plane/scan-plane.service.tsapps/api/src/scan-plane/scan-plane.types.tsapps/api/src/scan-plane/scanner-runtime.errors.tsapps/api/src/scan-plane/scanner-sandbox-adapter.service.tsapps/api/src/scan-plane/scanner-sandbox-runtime.provider.tsapps/api/src/scan-plane/scanner-workspace-manifest.service.tsapps/api/src/scan/scan.processor.tsapps/api/src/scan/scan.service.tsapps/api/test/client/analysis/analysis-api.module.e2e-spec.tsapps/api/test/config/config.env-files.e2e-spec.tsapps/api/test/scan-plane/prisma-sast-scanner-runtime.store.e2e-spec.tsapps/api/test/scan-plane/sast-attempt-reconciliation.task.e2e-spec.tsapps/api/test/scan-plane/sast-scanner-runtime.e2e-spec.tsapps/api/test/scan-plane/scan-plane-production-read.e2e-spec.tsapps/api/test/scan-plane/scan-plane.e2e-spec.tsapps/api/test/scan-plane/scanner-runtime-persistence.e2e-spec.tsapps/api/test/scan/scan.processor.e2e-spec.tsapps/api/test/scan/scan.service.e2e-spec.tsdeploy/oracle/.env.exampledeploy/oracle/BOOTSTRAP.mddeploy/scanner-sandbox/provisioning-contract.jsonpackages/shared/src/index.tspackages/shared/src/types/sast-wrapper.tspackages/shared/test/shared-contract-exports.test.mjsspecs/006-production-sast-runtime-design/contracts/sast-runtime.mdspecs/006-production-sast-runtime-design/quickstart.mdspecs/006-production-sast-runtime-design/tasks.mdtest/github-actions/scanner-sandbox-provisioning.test.mjs
💤 Files with no reviewable changes (1)
- apps/api/src/scan-plane/scan-plane.types.ts
🎋 작업 중인 브랜치 및 이슈
feat/252-006-scanner-wrapper-lifecycle🔎 주요 변경 사항
SastScanAttempt영속화, scan별 active attempt 단일성, retry-eligible attempt 1에만 허용되는 attempt 2, final audit 결합, cleanup lifecycle 및 overdue reconciliation을 구현했습니다.ScannerRun·AuditEvent제약은NOT VALID후 online validation, 인덱스는 concurrent build로 구성했습니다.✅ 컨벤션 확인
type/issue-number-short-feature형식을 따르나요?<type>: <description>형식을 따르나요?Check List
검증
corepack pnpm lintcorepack pnpm test(shared 38, AI 17, web 54, API 74 suites / 307 tests, GitHub·CI·deployment contract 19)corepack pnpm typecheckcorepack pnpm buildnode --test test/runtime/*.test.mjsprisma validategit diff --check006 진행 상태
Closes #252
Summary by CodeRabbit
New Features
Bug Fixes
Documentation