feat(gax)!: stable paginator#1466
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1466 +/- ##
==========================================
- Coverage 95.95% 95.18% -0.77%
==========================================
Files 38 38
Lines 1531 1538 +7
==========================================
- Hits 1469 1464 -5
- Misses 62 74 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
coryan
left a comment
There was a problem hiding this comment.
I think you need a new integration test that does not enable unstable-stream and still runs the iterations.
src/gax/src/paginator.rs
Outdated
| /// Enable the `unstable-stream` feature to interact with a [`futures::stream::Stream`]. | ||
| /// | ||
| /// [`futures::stream::Stream`]: https://docs.rs/futures/latest/futures/stream/trait.Stream.html | ||
| pub async fn next_stable(&mut self) -> Option<Result<T, E>> { |
There was a problem hiding this comment.
Can we arrange things so this function is called next()? If not, can we call it next_page()?
There was a problem hiding this comment.
Calling this function next() seems to work.
generator/internal/rust/templates/crate/src/builders.rs.mustache
Outdated
Show resolved
Hide resolved
I went with gating the unit test for the feature and testing the crates with all features or no features: google-cloud-rust/.github/workflows/sdk.yaml Lines 45 to 48 in 18ab348 |
coryan
left a comment
There was a problem hiding this comment.
I think this works, but we need to decide if we want to depend on futures (which is at 0.3) in our implementation.
generator/internal/rust/templates/crate/src/builders.rs.mustache
Outdated
Show resolved
Hide resolved
Ack. I did not make the dep on If you think it is cleaner to not use
modification: I reverted the changes to I have a meeting item to discuss the build cache anyway. |
6593c68 to
82ca8d4
Compare
coryan
left a comment
There was a problem hiding this comment.
The code looks fine to me, but the test coverage results look weird. I worry that maybe something in the features setting is making us miss testing?
| - run: cargo doc --workspace | ||
| env: | ||
| RUSTDOCFLAGS: "-D warnings" | ||
| - run: cargo doc --package google-cloud-gax |
There was a problem hiding this comment.
As I recall, cargo doc can fail to build if you have some features enabled vs. disabled (e.g. if you link an element that is not present because the feature is disabled). I believe we should keep this test.
There was a problem hiding this comment.
I reverted all changes to .github/workflows/sdk.yaml, but that is not obvious from the 9000 commits associated with this PR.
| let mut stream = client | ||
| .list_rpc_stream(TestRequest::default()) | ||
| .items() | ||
| .to_stream(); |
There was a problem hiding this comment.
codecov.io seems confused about the coverage for to_stream(). is this code running?
There was a problem hiding this comment.
Hm, it should be exercised here:
Locally:
$ cargo test --workspace | grep to_stream
test paginator::tests::test_item_paginator_to_stream ... ok
test paginator::tests::test_paginator_to_stream ... okThere was a problem hiding this comment.
FWIW, I believe the coverage build uses a different set of options:
google-cloud-rust/.github/workflows/sdk.yaml
Lines 69 to 74 in 6682457
There was a problem hiding this comment.
oh, duh. I misread the yaml.
There was a problem hiding this comment.
Should we have a test for to_stream() in this file?
There was a problem hiding this comment.
Added. The crate depends on clients with the unstable-stream feature enabled. I will clean up the features/dependencies in a follow up PR.
|
Congrats on the code removal btw. |
Part of the work for #720
Makes the
Paginatorclass part of gax. It is no longer gated by theunstable-streamfeature. ThePaginatorpicks up ato_stream()function which is gated by theunstable-streamfeature. (Same goes forItemPaginator).We renamed the
stream()function topaginator()on the paginated builders.unstable-streamfeature in client cratesAll downstream crates still have an
unstable-streamfeature. I think we should get rid of them, and let applications opt in via the dependency on gax. If we want to do this, I will send another PR.We would need to update some of our docs, because we could no longer one-line things like:
On testing feature configurations...
We now testing gax with and without
unstable-stream. (By removing bothdev.dependencieson this feature).