feat: add taxonomy database background updater - #411
Merged
codeZe-us merged 3 commits intoAug 24, 2026
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
|
@akinboyewaSamson Fix the CI issue |
codeZe-us
self-requested a review
August 24, 2026 12:09
codeZe-us
approved these changes
Aug 24, 2026
Contributor
|
PR reviewed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements an automated, non-blocking background mechanism in the CLI to keep the taxonomy database up to date. It ensures users have the latest error definitions and diagnostic insights without interrupting their workflow, while also respecting offline mode preferences.
How It Was Done
-Updater Module (
updater.rs): Created a new module ingrat-corethat usesreqwestto ping the remote repository for the latest taxonomy version.directoriescrate for cross-platform paths and cached a 24-hour timestamp (~/.cache/grat/taxonomy_update.json) to prevent spamming the remote server on every invocation..tmpfile and atomically renamed to~/.local/share/grat/taxonomy/database.tomlto prevent database corruption during reads.TaxonomyDatabase::load_latest()to prioritize loading the downloaded file before falling back to the embeddeddata/*.tomlfiles.--offlineflag to explicitly disable network requests and spawned the update task concurrently incrates/cli/src/main.rs.Issues Encountered (If Any)
load_embedded()if no updated file exists or if it fails to parse.chronoto rely solely on standard librarySystemTimeinupdater.rsto maintain a clean dependency tree ingrat-core.Related Issue
Closes #407
How It Was Tested
cargo checkandcargo build.--offlineflag is respected and prevents background network requests.TaxonomyDatabase::load_latest()seamlessly cascades from the cache to the fallback without breaking existing tests.Screenshots / Video (If Applicable)
N/A - This is a background implementation with no UI changes.