Skip to content

38 improve google login retry behaviour - #45

Draft
rob-h-w wants to merge 13 commits into
mainfrom
38-improve-google-login-retry-behaviour
Draft

38 improve google login retry behaviour#45
rob-h-w wants to merge 13 commits into
mainfrom
38-improve-google-login-retry-behaviour

Conversation

@rob-h-w

@rob-h-w rob-h-w commented Jan 1, 2025

Copy link
Copy Markdown
Owner

Because it wasn't retrying if the first attempt didn't work for any reason.

Especially the unsafe use of NodeHandles and the test logger.
Because otherwise we're waiting for another init signal that will never
come.
To make it possible to write a test client.
@rob-h-w rob-h-w linked an issue Jan 1, 2025 that may be closed by this pull request
So Google tests can be added.
To define the basic Google World struct & execution mechanism.

`World` doesn't support explicit lifetimes, so storing `Future`s in the
`GoogleWorld` struct isn't an option because they'd all have to live
`'static`.
@codecov

codecov Bot commented Jan 6, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 83.67769% with 79 lines in your changes missing coverage. Please review.

Project coverage is 73.77%. Comparing base (eba79ea) to head (553b20f).

Files with missing lines Patch % Lines
functional_tests/tests/cucumber/google/client.rs 0.00% 36 Missing ⚠️
cloud_scraper/src/domain/oauth2/client.rs 33.33% 12 Missing ⚠️
...loud_scraper/src/integration/google/auth/config.rs 87.32% 9 Missing ⚠️
cloud_scraper/src/integration/google/source.rs 72.00% 7 Missing ⚠️
cloud_scraper/src/integration/google/tasks/sync.rs 0.00% 4 Missing ⚠️
cloud_scraper/src/server/errors.rs 77.77% 4 Missing ⚠️
...ud_scraper/src/integration/google/auth/delegate.rs 0.00% 2 Missing ⚠️
functional_tests/tests/cucumber/cli_world.rs 90.90% 2 Missing ⚠️
functional_tests/tests/cucumber/google_bindings.rs 94.59% 2 Missing ⚠️
functional_tests/src/main.rs 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (eba79ea) and HEAD (553b20f). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (eba79ea) HEAD (553b20f)
2 1
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #45      +/-   ##
==========================================
- Coverage   81.64%   73.77%   -7.87%     
==========================================
  Files          47       54       +7     
  Lines        4216     4485     +269     
==========================================
- Hits         3442     3309     -133     
- Misses        774     1176     +402     

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

And that the semaphore permit is released on initialisation.
And make `source.run` execute always - the run action just waits until the
`source.run`'s future has released a semaphore permit. The assumption is
that this means the source has started running, and other signals can be
sent.

Only do any of this once.
Comment thread src/domain/oauth2/config.rs Fixed
Comment thread src/domain/oauth2/config.rs Fixed
Comment thread src/integration/google/auth/config.rs Fixed
@rob-h-w
rob-h-w force-pushed the 38-improve-google-login-retry-behaviour branch from ce4dc9e to d3aab98 Compare January 9, 2025 21:17
Comment thread src/integration/google/auth/delegate.rs Fixed
@rob-h-w
rob-h-w force-pushed the 38-improve-google-login-retry-behaviour branch from d3aab98 to c3b6e4c Compare January 10, 2025 18:16
Incomplete because it needs to be able to mock things.
So they can depend on `mockall` without making the Cloud Scraper binary
need to depend on it.
@rob-h-w
rob-h-w force-pushed the 38-improve-google-login-retry-behaviour branch from c3b6e4c to 8ab2057 Compare January 11, 2025 22:45
The binary path for execution is wrong only in the CI build for coverage.

Use resolver behaviour "2".

Move the profiles from the cloud_scraper bin to the workspace.

Expose the binary path when spawning a child process fails.
Added by the cargo template.
use crate::domain::config::Config;
use crate::domain::mpsc_handle::{one_shot, OneshotMpscSenderHandle};
use crate::domain::node::{LifecycleChannelHandle, Manager};
use crate::domain::oauth2::{ApplicationSecret, ExtraParameters};

Check warning

Code scanning / clippy

unused imports: `ApplicationSecret` and `ExtraParameters`

unused imports: `ApplicationSecret` and `ExtraParameters`
use crate::domain::config::Config;
use crate::domain::mpsc_handle::{one_shot, OneshotMpscSenderHandle};
use crate::domain::node::{LifecycleChannelHandle, Manager};
use crate::domain::oauth2::{ApplicationSecret, ExtraParameters};

Check warning

Code scanning / clippy

unused imports: `ApplicationSecret` and `ExtraParameters`

unused imports: `ApplicationSecret` and `ExtraParameters`
use core::time::Duration;
#[cfg(test)]
use mockall::automock;
use std::path::Path;

Check warning

Code scanning / clippy

unused import: `std::path::Path`

unused import: `std::path::Path`
Comment thread cloud_scraper/src/integration/google/auth/config.rs Fixed
Comment thread cloud_scraper/src/integration/google/auth/web.rs Fixed
Comment thread cloud_scraper/src/integration/google/auth/web.rs Fixed
Comment thread cloud_scraper/src/integration/google/auth/web.rs Fixed
So test dependencies can be injected into the Google integration.

Doing this statically with generics failed because of
rust-lang/rust#100013.

Refactor to used boxed vtable-dispatching types. It's much less elegant.
@rob-h-w
rob-h-w force-pushed the 38-improve-google-login-retry-behaviour branch from adc0a0f to 2174e33 Compare January 31, 2025 22:26
Self: Sized + Sync + 'async_trait,
{
Box::pin(
async move { Ok(ConfigQuery::read_config(&State::path_for_name(name).await?).await?) },

Check warning

Code scanning / clippy

question mark operator is useless here

question mark operator is useless here
Comment on lines +63 to +73
pub fn new(
auth_uri: String,
auth_provider_x509_cert_url: String,
client_email: Option<String>,
client_id: String,
client_secret: String,
client_x509_cert_url: Option<String>,
project_id: String,
redirect_uris: Vec<String>,
token_uri: String,
) -> Self {

Check warning

Code scanning / clippy

this function has too many arguments (9/7)

this function has too many arguments (9/7)
pub(crate) async fn config_path() -> Result<PathBuf, io::Error> {
let root = State::path_for::<Self>().await?;
debug!("Root: {:?}", root);
Ok(PathBuf::from(root).join("config.yaml"))

Check warning

Code scanning / clippy

useless conversion to the same type: `std::path::PathBuf`

useless conversion to the same type: `std::path::PathBuf`
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.

Improve Google Login Retry Behaviour

2 participants