fix: rebuild database when custom file filters are provided#495
fix: rebuild database when custom file filters are provided#495MuLeiSY2021 wants to merge 1 commit intoAsyncFuncAI:mainfrom
Conversation
When users specify excluded/included files or directories via the "Refresh Wiki" advanced options, the cached .pkl database was returned immediately without applying the filter parameters. This caused file exclusion rules to be silently ignored. Now, when any custom file filter parameter is provided, the existing database cache is removed and rebuilt with the new filters applied. Fixes AsyncFuncAI#494 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, 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 an issue where custom file filtering options were not correctly applied when refreshing a wiki. It introduces a mechanism to detect the presence of custom filters and, if found, forces a rebuild of the database to ensure that the new exclusion/inclusion rules are properly incorporated, thereby improving the accuracy and relevance of the generated wiki content. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request modifies api/data_pipeline.py to introduce logic for handling custom file filters. If custom filters (excluded/included directories or files) are provided, the existing database is removed to force a rebuild, ensuring the new filters are applied. Otherwise, the existing database is loaded as before. A review comment suggests wrapping the os.remove() call in a try-except block to handle potential OSError exceptions, which would improve the application's robustness.
| "Existing database contains no usable embeddings. Rebuilding embeddings..." | ||
| if has_custom_filters: | ||
| logger.info("Custom file filters provided. Rebuilding database to apply filters...") | ||
| os.remove(self.repo_paths["save_db_file"]) |
There was a problem hiding this comment.
The os.remove() call is not wrapped in a try-except block, which could lead to unhandled exceptions (e.g., PermissionError) and cause the request to fail. It's best practice to handle potential file system errors to make the application more robust.
| os.remove(self.repo_paths["save_db_file"]) | |
| try: | |
| os.remove(self.repo_paths["save_db_file"]) | |
| except OSError as e: | |
| logger.warning(f"Could not remove cached database file: {e}. Proceeding to rebuild.") |
Summary
.pkldatabase is now removed and rebuilt with the new filters appliedFixes #494
Changes
api/data_pipeline.py—prepare_db_index()method:excluded_dirs,excluded_files,included_dirs,included_files) before loading cached database.pklcache file is deleted to force a rebuild with the new filtersTest plan
README.mdin the excluded files listREADME.md🤖 Generated with Claude Code