Skip to content

Commit 7157830

Browse files
authored
style: fix CI formatting issues in login_screen.rs (#4)
* style: fix formatting issues in login_screen.rs - Fix trailing whitespace on empty lines - Reformat tracing::trace! macro call to proper multi-line format Fixes CI Format check failures. * fix(test): prevent flaky test_caching test with serial execution The test_caching test uses a static cache shared across all tests. When tests run in parallel, other tests can modify the cache between clear_cache() and the cache_size() assertions, causing spurious failures. Fix by adding #[serial] attribute from serial_test crate to ensure this test runs in isolation from other tests that use the cache.
1 parent e0adfe2 commit 7157830

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cortex-engine/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,4 @@ tempfile = { workspace = true }
132132
tokio-test = { workspace = true }
133133
wiremock = { workspace = true }
134134
insta = { workspace = true }
135+
serial_test = { workspace = true }

src/cortex-engine/src/config/config_discovery.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ pub fn git_root(path: &Path) -> Option<PathBuf> {
247247
#[cfg(test)]
248248
mod tests {
249249
use super::*;
250+
use serial_test::serial;
250251
use tempfile::TempDir;
251252

252253
fn setup_test_dir() -> TempDir {
@@ -344,8 +345,9 @@ mod tests {
344345
}
345346

346347
#[test]
348+
#[serial]
347349
fn test_caching() {
348-
// Clear cache first since tests run in parallel and share static cache
350+
// Clear cache first - must use #[serial] since tests share static cache
349351
clear_cache();
350352
assert_eq!(cache_size(), 0);
351353

src/cortex-tui/src/runner/login_screen.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl LoginScreen {
223223
return Ok(result);
224224
}
225225
}
226-
226+
227227
// Handle async messages from token polling
228228
msg = async {
229229
if let Some(ref mut rx) = self.async_rx {
@@ -237,7 +237,7 @@ impl LoginScreen {
237237
self.handle_async_message(msg);
238238
}
239239
}
240-
240+
241241
// Periodic render tick to keep UI responsive
242242
_ = render_interval.tick() => {
243243
// Just continue to re-render
@@ -713,7 +713,7 @@ async fn poll_for_token_async(
713713
tx: mpsc::Sender<AsyncMessage>,
714714
) {
715715
tracing::debug!("Token polling started");
716-
716+
717717
let client = match cortex_engine::create_default_client() {
718718
Ok(c) => c,
719719
Err(e) => {
@@ -736,7 +736,11 @@ async fn poll_for_token_async(
736736
return;
737737
}
738738

739-
tracing::trace!("Polling for token (attempt {}/{})", attempt + 1, max_attempts);
739+
tracing::trace!(
740+
"Polling for token (attempt {}/{})",
741+
attempt + 1,
742+
max_attempts
743+
);
740744

741745
let response = match client
742746
.post(format!("{}/auth/device/token", API_BASE_URL))
@@ -756,7 +760,7 @@ async fn poll_for_token_async(
756760

757761
if status.is_success() {
758762
tracing::debug!("Token response received (success)");
759-
763+
760764
#[derive(serde::Deserialize)]
761765
struct TokenResponse {
762766
access_token: String,

0 commit comments

Comments
 (0)