fix: store persistent state under XDG state directory - #920
Open
mikemikimike wants to merge 2 commits into
Open
Conversation
Contributor
|
PR author is not in the allowed authors list. |
|
@mikemikimike is attempting to deploy a commit to the Modem Team on Vercel. A member of the Team first needs to authorize it. |
Member
|
Can you fix the PR description? It's poorly formatted. What problem are you solving, etc? (I can guess, but ...) |
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.
Problem
Hunk currently stores its persistent state file at
$XDG_CONFIG_HOME/hunk/state.json, alongside the user-editable configuration at$XDG_CONFIG_HOME/hunk/config.toml.This mixes two different kinds of data defined by the XDG Base Directory Specification:
XDG_CONFIG_HOMEis intended for user-editable configuration, whileXDG_STATE_HOMEis intended for data that persists across restarts but is not important or portable enough to belong inXDG_DATA_HOME. The state file and the user-scoped directory used for globally installed extensions belong in the latter category.Changes
state.jsonfrom$XDG_STATE_HOME/hunk, falling back to~/.local/state/hunkwhenXDG_STATE_HOMEis unset.config.tomlunder$XDG_CONFIG_HOME/hunk, with the existing~/.config/hunkfallback.Validation
bun test src/core/run/paths.test.ts src/extensions/discovery.test.ts src/extensions/startup.test.ts src/extensions/manage/install.test.tsbun run typecheckbun run lintbun run deps:checkgit diff --checkThe repository-wide format check reports pre-existing failures elsewhere in the checkout; the changed files pass the formatter check.
Compatibility / Known limitations
This changes the default location of persistent state and globally managed extensions on XDG-compatible systems. User-editable configuration remains at its existing location. Existing state or extensions under the old configuration directory are not migrated automatically.
Fixes #821