Skip to content

feat: gate cloud copies on global provider sync - #177

Merged
seonghobae merged 9 commits into
mainfrom
feat/provider-global-sync-gate-v1
Aug 12, 2026
Merged

feat: gate cloud copies on global provider sync#177
seonghobae merged 9 commits into
mainfrom
feat/provider-global-sync-gate-v1

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add bounded, read-only macOS File Provider global queue evidence for OneDrive and Google Drive
  • block new GUI/CLI copies unless a fresh provider-wide dump is quiet
  • preserve existing iCloud admission gate and avoid retaining user paths

Validation

  • cargo test --manifest-path src-tauri/Cargo.toml provider_global_sync --lib
  • live disksage-cloud-plan runs for OneDrive, Google Drive, and iCloud
  • codegraph sync

This is intentionally copy-admission only; existing-copy adoption and source eviction still require their existing independent evidence gates.

Summary by CodeRabbit

  • 새 기능
    • OneDrive 및 Google Drive의 전역 동기화 상태를 확인해 클라우드 복사 가능 여부를 판단합니다.
    • 전송·인덱싱 대기, 오류 등 문제가 감지되면 관련 안내를 계획에 표시합니다.
  • 버그 수정
    • 동기화가 완료되지 않은 상태에서 새 복사본이 생성되는 것을 방지합니다.
    • 동기화 상태를 확인할 수 없거나 복사가 허용되지 않으면 작업을 안전하게 중단합니다.
    • iCloud는 기존 동기화 상태 확인 방식을 유지합니다.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 2 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 50208be8-4d80-47da-a476-78267f777e87

📥 Commits

Reviewing files that changed from the base of the PR and between 193c5a4 and ffc149c.

📒 Files selected for processing (6)
  • docs/superpowers/specs/2026-07-31-naruon-cloud-copy-readiness-design.md
  • src-tauri/src/bin/disksage-cloud-plan.rs
  • src-tauri/src/commands.rs
  • src-tauri/src/naruon_cloud_copy_readiness.rs
  • src-tauri/src/provider_global_sync.rs
  • src-tauri/tests/provider_global_sync_prefixed_markers.rs
📝 Walkthrough

Walkthrough

File Provider 전역 동기화 증거를 수집하고 상태를 판정하는 모듈을 추가했습니다. iCloud 외 제공자의 클라우드 복사 계획과 실행은 Clear 상태일 때만 새 복사본을 허용합니다.

Changes

제공자 전역 동기화 게이트

Layer / File(s) Summary
전역 동기화 증거 수집 및 파싱
src-tauri/src/provider_global_sync.rs, src-tauri/tests/provider_global_sync_duplicate_count.rs
OneDrive와 Google Drive의 fileproviderctl dump 출력을 파싱합니다. 전송, 인덱싱, 오류 상태를 집계합니다. macOS 실행 제한과 fail-closed 오류 처리를 추가했습니다.
새 복사본 허용 정책 및 알림
src-tauri/src/provider_global_sync.rs
증거가 완전하고 상태가 Clear일 때만 새 복사본을 허용합니다. 기존 관련 알림을 제거하고 현재 상태에 맞는 알림을 추가합니다.
클라우드 계획 및 복사 실행 연결
src-tauri/src/lib.rs, src-tauri/src/commands.rs, src-tauri/src/bin/disksage-cloud-plan.rs
계획 생성 시 상태 알림을 첨부합니다. 복사 실행 전에 허용 상태를 검증합니다. iCloud는 기존 icloud_sync_health 경로를 사용합니다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant 계획생성
  participant provider_global_sync
  participant fileproviderctl
  participant 복사실행

  계획생성->>provider_global_sync: inspect_new_copy_admission 호출
  provider_global_sync->>fileproviderctl: 동기화 덤프 요청
  fileproviderctl-->>provider_global_sync: 전역 동기화 출력 반환
  provider_global_sync-->>계획생성: 상태 notice 반환
  복사실행->>provider_global_sync: require_new_copy_admission 호출
  provider_global_sync-->>복사실행: 허용 또는 오류 반환
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 클라우드 복사를 전역 제공자 동기화 상태로 제한하는 주요 변경 사항을 정확하고 간결하게 설명합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/provider-global-sync-gate-v1

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 4

🧹 Nitpick comments (1)
src-tauri/src/provider_global_sync.rs (1)

314-322: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

인자 없는 format!을 제거하십시오.

format!에 포맷 인자가 없습니다. clippy::useless_format 경고가 발생합니다. 문자열 리터럴을 직접 사용하십시오.

♻️ 제안 수정
-        let dump = format!(
-            "com.google.drivefs.fpext\nsync engine state:\n temporarily disconnected: yes\n"
-        );
-        let report = parse_dump(CloudProvider::GoogleDrive, &dump).unwrap();
+        let dump = "com.google.drivefs.fpext\nsync engine state:\n temporarily disconnected: yes\n";
+        let report = parse_dump(CloudProvider::GoogleDrive, dump).unwrap();
🤖 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 `@src-tauri/src/provider_global_sync.rs` around lines 314 - 322, In the test
disconnected_provider_is_error_and_fails_closed, replace the argument-free
format! call used to create dump with the equivalent direct string literal,
preserving the existing dump contents and assertions.
🤖 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 `@src-tauri/src/commands.rs`:
- Around line 1310-1314: Update the cloud review flow around
cloud_plan_for_inputs and create_cloud_candidate_receipt to run
provider_global_sync::inspect_new_copy_admission only once and reuse its result
for both operations. Move the remaining synchronous provider-global-sync work
into spawn_blocking so the async runtime worker is not blocked, and avoid
holding the cloud_review mutex while that blocking work executes. Preserve the
existing error mapping and require_new_copy_admission validation.

In `@src-tauri/src/provider_global_sync.rs`:
- Around line 95-100: The pending indexable count in parse_dump currently
preserves the first parsed value, so an earlier zero suppresses later positive
counts; replace the or_else accumulation in
src-tauri/src/provider_global_sync.rs lines 95-100 with maximum-value
accumulation while retaining the existing parsing behavior. The expectations in
src-tauri/tests/provider_global_sync_duplicate_count.rs lines 4-21 are correct
and require no direct change; verify they pass after updating parse_dump.
- Around line 178-211: Update the reader flow around MAX_DUMP_BYTES and the
reader thread to detect when the output reaches the byte limit, treating that
condition as truncated output. After joining the reader, return the existing
probe failure error instead of parsing the bytes whenever truncation is
detected, while preserving normal parsing for outputs below the limit.
- Around line 101-117: Normalize each trimmed dump line by removing the optional
“+ ” prefix before evaluating it in the parsing logic. Update the needs-indexing
comparisons and errors: strip_prefix handling in the relevant parser function,
while preserving existing error matching and count behavior for lines without
the prefix.

---

Nitpick comments:
In `@src-tauri/src/provider_global_sync.rs`:
- Around line 314-322: In the test
disconnected_provider_is_error_and_fails_closed, replace the argument-free
format! call used to create dump with the equivalent direct string literal,
preserving the existing dump contents and assertions.
🪄 Autofix

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: ec1ae7b8-b90f-471b-acb8-823aca8f70d6

📥 Commits

Reviewing files that changed from the base of the PR and between 0ecb8c2 and 193c5a4.

📒 Files selected for processing (5)
  • src-tauri/src/bin/disksage-cloud-plan.rs
  • src-tauri/src/commands.rs
  • src-tauri/src/lib.rs
  • src-tauri/src/provider_global_sync.rs
  • src-tauri/tests/provider_global_sync_duplicate_count.rs

Comment thread src-tauri/src/commands.rs Outdated
Comment thread src-tauri/src/provider_global_sync.rs Outdated
Comment thread src-tauri/src/provider_global_sync.rs Outdated
Comment thread src-tauri/src/provider_global_sync.rs
@seonghobae

Copy link
Copy Markdown
Contributor Author

@opencode-agent @cwl-noema-review

Formal review-only request for exact current head f9d745182914ab9e26e547922cf30d01b04f1a9b. This change moves synchronous provider-global-sync inspection and cloud planning/copy commands into spawn_blocking, reuses the single fresh admission report, and preserves fail-closed gates. Local evidence: provider-global-sync unit tests 6 passed, duplicate/prefixed integration tests passed, and cargo check --all-targets passed. Please review this exact head; approve only if no further change is required, and do not merge while any current-head check is pending.

@seonghobae
seonghobae merged commit 4547503 into main Aug 12, 2026
35 checks passed
@seonghobae
seonghobae deleted the feat/provider-global-sync-gate-v1 branch August 12, 2026 02:49
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