Skip to content

samples(storagecontrol): add delete folder recursive sample#16149

Open
nidhiii-27 wants to merge 1 commit into
mainfrom
add-delete-folder-recursive-sample
Open

samples(storagecontrol): add delete folder recursive sample#16149
nidhiii-27 wants to merge 1 commit into
mainfrom
add-delete-folder-recursive-sample

Conversation

@nidhiii-27

Copy link
Copy Markdown
Contributor

This PR adds the SDK sample and tests for the hierarchical namespace recursive delete feature, resolving b/521168740.

@nidhiii-27 nidhiii-27 requested review from a team as code owners June 10, 2026 08:52
@product-auto-label product-auto-label Bot added the samples Issues that are directly related to samples. label Jun 10, 2026

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request adds a new DeleteFolderRecursive sample and integrates it into the sample runner and AutoRun test flow. A critical compilation issue was identified in the new sample: DeleteFolderRecursive().get() returns a google::cloud::Status rather than a StatusOr, so checking !deleted and calling .status() will fail to compile. The reviewer provided a code suggestion to use .ok() and throw the status directly.

Comment on lines +91 to +92
auto deleted = client.DeleteFolderRecursive(name).get();
if (!deleted) throw std::move(deleted).status();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

The DeleteFolderRecursive function returns a google::cloud::future<google::cloud::Status>. Therefore, calling .get() returns a google::cloud::Status object, not a StatusOr. Since google::cloud::Status does not have an operator bool() or a .status() method, this code will fail to compile. It should check .ok() and throw the status directly.

    auto status = client.DeleteFolderRecursive(name).get();
    if (!status.ok()) throw std::move(status);
References
  1. Prefer defensive code, such as explicit ok() checks, even if they seem redundant based on the current implementation of a framework, as the framework's contract may change in the future.

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.70%. Comparing base (55df15b) to head (9a1880f).
⚠️ Report is 45 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16149   +/-   ##
=======================================
  Coverage   92.70%   92.70%           
=======================================
  Files        2353     2353           
  Lines      218352   218352           
=======================================
+ Hits       202418   202425    +7     
+ Misses      15934    15927    -7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant