fix: register all projects in profile cache to prevent lookup errors#310
fix: register all projects in profile cache to prevent lookup errors#310phelype123 wants to merge 1 commit intoautomagik-dev:mainfrom
Conversation
Previously, only projects with .genie folders were registered in the profile cache during startup. This caused "Project not registered in profile cache" errors when accessing profiles for projects without .genie folders. Now all projects are registered: - Projects with .genie folder: registered with custom profiles - Projects without .genie folder: registered with default profiles - Projects with profile loading errors: still registered to prevent cache lookup failures 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary of ChangesHello @phelype123, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves critical profile cache lookup errors by enhancing the project registration process during application startup. Previously, only projects with a Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request fixes an issue where projects without a .genie folder or with profile loading errors were not registered in the profile cache, leading to lookup errors. The changes correctly modify the logic to ensure all projects are registered at startup. I've found a small opportunity to improve code maintainability by removing some duplication, which I've detailed in a specific comment.
| 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; |
There was a problem hiding this comment.
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.
Summary
.geniefolders.geniefoldersTest plan
.geniefolders, some without)/api/forge/projects/{id}/profilesendpoint for projects without.geniefolder🤖 Generated with Claude Code