Repository navigation
refactor(config): split compaction settings and share XDG app directories - #253
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…ries config.rs held the snapshot, the thinking request types, compaction threshold math, display formatters, and URL validation under one long helper section, and five modules paired each XDG variable with its $HOME fallback by hand. Behavior is unchanged. - Move the compaction types, their resolution, and the threshold math into config/compaction.rs, and test the threshold math directly. - Move ThinkingConfig, ThinkingDisplay, and BlockBinding to model.rs, since ModelSpec::thinking is their only constructor. - Split the config.rs helpers into resolution, env, base URL, and display sections, add a load_with test helper, and order the Config::load test sections by call order. - Rename the OAuth keychain-or-file enum to Backend, since Store already names the login-location struct, and state outcomes in its test names. - Add util::path::XdgBase and app_dir, which every config, data, and state lookup now uses, with one "ox" directory constant.
hakula139
force-pushed
the
refactor/config-conventions
branch
from
October 16, 2026 09:07
d3b3581 to
b3b6e41
Compare
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.
Summary
config.rsgrouped the config snapshot, thinking request types, compaction threshold math, display formatters, and URL validation in one long helper section. Five modules also paired an XDG variable with its$HOMEfallback and declared their own"ox"directory. This moves each concern next to its owner and centralizes all XDG lookups in one helper. Behavior is unchanged.config/compaction.rsnow ownsCompactionConfig,AutoCompactionConfig, the threshold policy and percent types, their resolution from env and files, the threshold math, andtest_thresholds.resolve_auto_thresholdtakes the env token and percent values as separate named arguments. Unit tests now check the threshold clamps directly againstresolve_policy, and the test-only constructor is limited to the enabled-threshold case used by every caller. Callers import these items fromconfig::compaction.ThinkingConfig,ThinkingDisplay, andBlockBindingmove tomodel.rs. SinceModelSpec::thinkingis their only constructor and the model catalogue already owns per-model request capabilities, the client imports them frommodel.Helperssection is split into Resolution, Env Overrides, Base URL, and Display sections. Resolution helpers follow the order in whichConfig::loadcalls them. The config code now importspermission::{Mode, Policy},util::env, and the test CA bundle instead of spelling them inline.load_with(&dir, overrides)helper replaces the repeatedtemp_envandConfig::loadsetup in most load tests. Tests that unset a variable or load interactively still construct the environment by hand. TheConfig::loadtest sections now follow the order in which settings resolve, with new sections for status line and compaction.Backend, avoiding a name conflict withprovenance::Source.Storealready names the login-location struct, which now also handles the oldcredentials_pathlookup. Test names now state their outcomes, the test for missingclaudeAiOauthasserts the error text, and the parse tests use the shared credential fixture.util::pathgainsXdgBase { Config, Data, State }andapp_dir(base), centralizing the variable names, the spec defaults under$HOME, and the single"ox"directory name. Config loading, the log file, the permission gate's protected app directories, session storage, the device id, and OAuth login now resolve through them.Test plan
cargo fmt --all --checkcargo buildcargo clippy --all-targets -- -D warningscargo testcargo llvm-cov, with every changed line coveredpnpm format,pnpm lint, andpnpm spellcheckapp_dirreturningNonewithout a home directory has no unit test becausestd::env::home_dirfalls back to the passwd entry on Unix