Skip to content

feat: integrate cloud folder virus scanning into the frontend#274

Merged
DenizAltunkapan merged 2 commits into
Vault-Web:mainfrom
GabrielBBaldez:feat/cloud-virus-scan
Jul 21, 2026
Merged

feat: integrate cloud folder virus scanning into the frontend#274
DenizAltunkapan merged 2 commits into
Vault-Web:mainfrom
GabrielBBaldez:feat/cloud-virus-scan

Conversation

@GabrielBBaldez

Copy link
Copy Markdown
Member

Wires the Cloud Page folder virus scanning (backend Vault-Web/cloud-page#96) into the Cloud frontend.

What

  • Scan action in the Cloud folder view scans the current folder via POST /api/files/scan?path=<relative>.
  • Polls GET /api/files/scan/{jobId} (1.2s) and stops on a terminal status (COMPLETED/FAILED).
  • Shows PENDING/RUNNING with live files-scanned / infected counters, then renders findings on completion:
    • infected files (path + threat),
    • files that could not be scanned,
    • a clean "no threats found" state.
  • Disabled / unavailable scanner (the backend reports this by returning an ERROR verdict for every file) is surfaced as one clear message instead of a wall of per-file errors — "turned off on the server" vs. "currently unavailable, try again later".
  • Rate-limit (429) on start and start/poll failures (incl. an evicted job 404) are handled with friendly messages rather than a generic crash.

How

  • New ScanJobDto / FileScanResultDto types mirror the backend DTOs.
  • CloudService.startFolderScan / getScanJob.
  • Scan UI lives in the existing CloudComponent (dialog + toolbar action), with a scanRunId generation guard (mirroring the existing contentRequestId pattern) so a closed dialog or a superseding scan can't leave a poll running.

Testing

  • New cloud.component.spec.ts exercises the full state machine with a mocked CloudService and Jasmine's fake clock: running→completed transition, polling termination, disabled/unreachable detection, clean result, 429, 404, and dialog-close (including a close that races the initial start request). ng test → all green.
  • ng build + prettier clean.

Closes #272

Copilot AI review requested due to automatic review settings July 14, 2026 23:15
GabrielBBaldez added a commit to GabrielBBaldez/oss-contributions that referenced this pull request Jul 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Integrates the backend async “folder virus scan” workflow into the Cloud UI by adding scan API calls, a polling-based scan dialog, and DTOs/tests to support the full scan state machine.

Changes:

  • Added CloudService APIs to start a folder scan and poll scan job status.
  • Added scan dialog UI + polling lifecycle management and result rendering (infected / errored / clean / unavailable).
  • Added DTOs for scan jobs/results and a dedicated CloudComponent spec covering the scan state machine.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
frontend/src/app/services/cloud.service.ts Adds startFolderScan and getScanJob HTTP APIs.
frontend/src/app/pages/cloud/cloud.component.ts Implements scan state, polling control, and scan-result helpers.
frontend/src/app/pages/cloud/cloud.component.html Adds “Scan” action and a scan status/results dialog.
frontend/src/app/pages/cloud/cloud.component.scss Styles the scan dialog states and findings lists.
frontend/src/app/pages/cloud/cloud.component.spec.ts Adds tests for scan polling, terminal states, and error/unavailable handling.
frontend/src/app/models/dtos/ScanJobDto.ts Introduces ScanJobDto / ScanStatus types mirroring backend.
frontend/src/app/models/dtos/FileScanResultDto.ts Introduces FileScanResultDto / ScanVerdict types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/src/app/pages/cloud/cloud.component.ts
A 429 while polling only means we asked too often; the scan itself is
untouched and keeps running on the server. Tearing the dialog down and
reporting "Lost track of the scan" was both wrong and unrecoverable.

Back off to 5s and keep polling, giving up after 5 consecutive throttled
attempts with a message that says the scan may still be running rather
than claiming it failed. The counter resets on a successful poll and on
each new scan.
@GabrielBBaldez

Copy link
Copy Markdown
Member Author

Done in 3cfba9a — thanks for the catch, and it turned out to be more than a missing message.

Aborting on a throttled poll was the wrong behaviour regardless of wording: a 429 says our polling was too frequent, not that the scan died. It keeps running server-side, so the old code threw away a scan that was still in progress, with no way back to it.

Now a rate-limited poll backs off to 5s and keeps waiting. Only after 5 consecutive throttled attempts does it stop, and the message says the scan may still be running rather than claiming failure. The counter resets on any successful poll and on each new scan.

Two tests added: one where a 429 is followed by a successful poll (the scan must stay in its running state, then complete normally), and one where the backend stays throttled (bounded retries, no false failure). ng test 14/14, build and prettier clean.

@DenizAltunkapan DenizAltunkapan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@GabrielBBaldez thank you for your contribution!

@DenizAltunkapan
DenizAltunkapan merged commit 7d2157d into Vault-Web:main Jul 21, 2026
2 checks passed
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.

[Feature]: Integrate Cloud Page folder virus scanning into the frontend

3 participants