Resolve the CLI's language for every command, not by accident - #61
Merged
Merged
Conversation
`pylon update` answered in English on a machine set to Turkish. The language was being resolved inside loadConfig(), and most commands reach that only on their way somewhere else: they call socketPath() to find the daemon, and socketPath() loads the config. `update` talks to no daemon and reads no config, so it fell through both and ran on the default. It is resolved once in main() now, before dispatch, which is where a process-wide setting belongs rather than as a side effect of path lookup. An unreadable config no longer silences the preference either — the preference file and the environment never depended on it, so the error is dropped and the rest of the chain still decides. Found while verifying the v0.1.0 release, after the update path had shipped. The two tests pin the resolution — the preference wins, and a config that will not parse does not suppress it. They do not catch the regression of deleting the call from main(), because they call setLanguage() directly; that wiring was verified by running the binary from outside the checkout, where the released v0.1.0 prints "You're already up to date" and this build prints "Yeni sürüm var".
YCistak
force-pushed
the
fix/cli-language
branch
from
August 13, 2026 20:31
9dceb85 to
d11f14b
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.
pylon updateanswered in English on a machine set to Turkish.The language was resolved inside
loadConfig(), and most commands reach that only on their way somewhere else: they callsocketPath()to find the daemon, andsocketPath()loads the config.updatetalks to no daemon and reads no config, so it fell through both and ran on the default.It is resolved once in
main()now, before dispatch — where a process-wide setting belongs, rather than as a side effect of path lookup. An unreadable config no longer silences the preference either: the preference file and the environment never depended on it.Found while verifying the v0.1.0 release, after the update path had already shipped.
Verification
Same directory, same conditions, from outside the checkout:
Two tests pin the resolution: the preference wins, and a config that will not parse does not suppress it.
setLanguage()directly, so deleting the call frommain()would not fail them. The wiring is covered only by the run above. Testing it properly means executing the built binary, which this package's tests do not do for anything else.Not a bug, but worth knowing
Running
pylonfrom a checkout looks for the preference file beside that checkout'spylon.yaml, not in~/.config/pylon, becauseprefDir()isfilepath.Dir(configPath()). So inside the repo this build still prints English — the preference there is genuinely unset. That is the documented behaviour (a checkout uses its own config, and the preference overrides the config it sits next to), and this PR does not change it.🤖 Generated with Claude Code