Move dictionary downloads off the spell-check path - #301
Merged
Conversation
Fixes #300. Spell checks never touch the network: get_dictionary is disk-only, and a background worker greedily prefetches every dictionary the config can resolve to (plus all per-language word lists) with per-id exponential backoff. When a Hunspell pair that previously couldn't load lands, the LSP re-checks open documents; everything else is picked up by the next natural check. - Downloader: split into local_path + single-attempt fetch with staged PendingDownload/commit (aff/dic pairs commit all-or-nothing, in lockstep across generations); connect/overall timeouts; NO_NETWORK env var refuses requests before any socket while stale cached copies still serve. - Cold cache noops instead of flagging every word: checks require a primary-capable (Hunspell or local-override) configured dictionary. - CLI lint still warms dictionaries synchronously, and fails the run (exit 2) when no primary dictionary is usable, instead of reporting a false clean. - In-memory dictionary cache is invalidation-epoch guarded so a check racing a background commit can't pin stale content, with a negative cache keyed to the same epoch keeping the per-keystroke path free of repeated disk probes.
blopker
marked this pull request as ready for review
August 2, 2026 02:14
|
Wow, that was fast. How do I enable this and how do I add the dictionaries? |
Owner
Author
|
Hey! I haven't landed it yet in a public release. I wanted to test a few things first. But the 2 main changes are that downloads never block checking now, so for a no network machine you can just copy the cache folder over and it should work fine. The second is that you can disable network checks completely by having the unix standard "NO_NETWORK=1" environment variable. Anyway, I'll do some more testing tomorrow and land it this week. Then it will propagate through the normal update channels. If you want to help test (which would be awesome), the pre-release binaries are here: https://github.com/blopker/codebook/releases/tag/v0.3.43 |
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.
Fixes #300. Spell checks never touch the network: get_dictionary is disk-only, and a background worker greedily prefetches every dictionary the config can resolve to (plus all per-language word lists) with per-id exponential backoff. When a Hunspell pair that previously couldn't load lands, the LSP re-checks open documents; everything else is picked up by the next natural check.