Skip to content

chore(storage): migrate to std::optional#16229

Open
colinmoy wants to merge 1 commit into
googleapis:mainfrom
colinmoy:migrate-storage-optional
Open

chore(storage): migrate to std::optional#16229
colinmoy wants to merge 1 commit into
googleapis:mainfrom
colinmoy:migrate-storage-optional

Conversation

@colinmoy

@colinmoy colinmoy commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Replacing explicit usages of absl::optional with std::optional in the Storage Client library as part of broader modernization efforts

@colinmoy colinmoy requested review from a team as code owners July 1, 2026 20:39
@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Jul 1, 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 migrates the codebase from absl::optional to std::optional across various files in the Google Cloud Storage library, benchmarks, and tests. The review identified two critical issues: a missing # symbol in the #include <optional> directive in bucket_cors_entry.h which will cause a compilation error, and an incorrect attempt to link std::optional as a CMake target in google_cloud_cpp_storage_grpc.cmake instead of simply removing the absl::optional dependency.

#include "absl/types/optional.h"
#include <cstdint>
#include <iosfwd>
include <optional>

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 # symbol is missing from the #include <optional> directive, which will cause a compilation error.

#include <optional>

Comment on lines +233 to +234
gRPC::grpc++
absl::optional
std::optional

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

std::optional is a C++ standard library feature and not a CMake target. It should not be listed in target_link_libraries. Since the codebase is migrating to std::optional, the absl::optional dependency should simply be removed.

           gRPC::grpc++

@colinmoy colinmoy force-pushed the migrate-storage-optional branch 11 times, most recently from 6c4507d to a362644 Compare July 1, 2026 22:55
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.11268% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.24%. Comparing base (e0b2850) to head (f7ab610).
⚠️ Report is 36 commits behind head on main.

Files with missing lines Patch % Lines
google/cloud/storage/benchmarks/benchmark_utils.cc 0.00% 10 Missing ⚠️
...le/cloud/storage/internal/async/read_range_test.cc 0.00% 2 Missing ⚠️
...orage/internal/async/writer_connection_buffered.cc 0.00% 2 Missing ⚠️
...rage/internal/async/writer_connection_impl_test.cc 87.50% 2 Missing ⚠️
...ud/storage/internal/object_write_streambuf_test.cc 90.90% 2 Missing ⚠️
google/cloud/storage/benchmarks/bounded_queue.h 0.00% 1 Missing ⚠️
...rnal/async/object_descriptor_connection_tracing.cc 0.00% 1 Missing ⚠️
google/cloud/storage/internal/async/read_range.cc 66.66% 1 Missing ⚠️
...rage/internal/async/writer_connection_finalized.cc 0.00% 1 Missing ⚠️
...ud/storage/internal/async/writer_connection_impl.h 66.66% 1 Missing ⚠️
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16229      +/-   ##
==========================================
- Coverage   92.24%   92.24%   -0.01%     
==========================================
  Files        2265     2265              
  Lines      210126   210123       -3     
==========================================
- Hits       193839   193825      -14     
- Misses      16287    16298      +11     

☔ 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.

@colinmoy colinmoy force-pushed the migrate-storage-optional branch 4 times, most recently from 95f4ddc to e55baae Compare July 13, 2026 23:05
@colinmoy colinmoy force-pushed the migrate-storage-optional branch from e55baae to f7ab610 Compare July 13, 2026 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant