Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 29 additions & 23 deletions forge-app/src/services/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,21 +188,16 @@ impl ForgeServices {
project.git_repo_path
);

if !genie_path.exists() || !genie_path.is_dir() {
tracing::debug!(
"Project '{}' has no .genie folder at {:?}",
let has_genie_folder = genie_path.exists() && genie_path.is_dir();

if has_genie_folder {
tracing::info!(
"📁 Loading .genie profiles for project: {} ({})",
project.name,
genie_path
project.git_repo_path.display()
);
continue;
}

tracing::info!(
"📁 Loading .genie profiles for project: {} ({})",
project.name,
project.git_repo_path.display()
);

tracing::debug!("Calling load_profiles_for_workspace...");
match self
.load_profiles_for_workspace(&project.git_repo_path)
Expand All @@ -215,28 +210,39 @@ impl ForgeServices {
.map(|e| e.configurations.len())
.sum();

// Register project → workspace mapping
// Register project → workspace mapping (for ALL projects, not just .genie ones)
self.profile_cache
.register_project(project.id, project.git_repo_path.clone())
.await;

tracing::info!(
"✅ Loaded {} profile variants for project: {} (registered project_id: {})",
variant_count,
project.name,
project.id
);

loaded_count += 1;
total_variants += variant_count;
if has_genie_folder {
tracing::info!(
"✅ Loaded {} profile variants for project: {} (registered project_id: {})",
variant_count,
project.name,
project.id
);
loaded_count += 1;
total_variants += variant_count;
} else {
tracing::debug!(
"Registered project '{}' (id: {}) with default profiles (no .genie folder)",
project.name,
project.id
);
}
}
Err(e) => {
tracing::warn!(
"⚠️ Failed to load .genie profiles for project '{}': {}",
"⚠️ Failed to load profiles for project '{}': {}",
project.name,
e
);
// Don't fail startup if one project has invalid profiles
// Still register the project even if profile loading fails
// This prevents "not registered in profile cache" errors
self.profile_cache
.register_project(project.id, project.git_repo_path.clone())
.await;
Comment on lines 214 to +245
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There's some code duplication here. The call to self.profile_cache.register_project(...) is present in both the Ok (lines 214-216) and Err (lines 243-245) arms of the match. To improve maintainability and reduce duplication, consider moving this call to before the match statement. This would make it clear that every project is registered regardless of the outcome of loading profiles.

}
}
}
Expand Down