Skip to content

Phase 2: add volume scan engine MVP - #15

Merged
kutaelee merged 1 commit into
mainfrom
ulw/volume-auto-scan-phase-2
Mar 6, 2026
Merged

Phase 2: add volume scan engine MVP#15
kutaelee merged 1 commit into
mainfrom
ulw/volume-auto-scan-phase-2

Conversation

@kutaelee

@kutaelee kutaelee commented Mar 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add POST /admin/volumes/{volume_id}/scan endpoint with optional dry_run request.
  • Implement volume tree scan worker MVP in scripts/dev_server.mjs with directory walk, symlink/permission handling, and node/blob upsert by path.
  • Return scan jobs as VOLUME_AUTO_SCAN and expose volume scan-state fields in volume responses.

Validation

  • node --check scripts/dev_server.mjs
  • npx @redocly/cli lint openapi/openapi.yaml (pass with existing warnings only)

@kutaelee
kutaelee merged commit ad38924 into main Mar 6, 2026
2 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 33219c046f

ℹ️ 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".

Comment thread scripts/dev_server.mjs
Comment on lines +559 to +563
const cleanup = cleanupMissingScannedArtifacts({
volumeId,
seenStorageKeys: runState.seenStorageKeys,
dryRun,
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Skip destructive cleanup when scan had read/upsert errors

In runVolumeAutoScanBatch, scan failures are downgraded to warnings (for example readdirSync/statSync and upsert errors around lines 452-539), but the code still unconditionally calls cleanupMissingScannedArtifacts here. If a subtree is unreadable (e.g., EPERM) or node/blob upsert fails, those files are never added to seenStorageKeys, so cleanup misclassifies existing rows as missing and soft-deletes their nodes/blobs metadata even though the files still exist on disk. This makes partial scans destructive instead of best-effort.

Useful? React with 👍 / 👎.

Comment thread scripts/dev_server.mjs
Comment on lines +3341 to +3342
} catch (err) {
sendJson(res, 500, errorResponse('INTERNAL', String(err)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Return 404 when requested volume does not exist

This handler maps every failure from createOrReuseVolumeAutoScanJob to HTTP 500, but that function explicitly throws Volume not found when the volume UUID is absent. As a result, POST /admin/volumes/{volume_id}/scan returns INTERNAL instead of NOT_FOUND for missing volumes, which conflicts with the endpoint contract and prevents clients from handling nonexistent resources correctly.

Useful? React with 👍 / 👎.

@kutaelee
kutaelee deleted the ulw/volume-auto-scan-phase-2 branch March 6, 2026 09:52
@kutaelee

kutaelee commented Mar 6, 2026

Copy link
Copy Markdown
Owner Author

Reviewed Codex review note post-merge: no inline actionable threads were present. Scan MVP changes were validated by CI pass before merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant