Skip to content

Use writeFileAtomic in Distribution.Client.Config and remove .tmp workaround#28

Merged
ulysses4ever merged 3 commits intomasterfrom
copilot/use-writefileatomic-distribution-client-config
Apr 21, 2026
Merged

Use writeFileAtomic in Distribution.Client.Config and remove .tmp workaround#28
ulysses4ever merged 3 commits intomasterfrom
copilot/use-writefileatomic-distribution-client-config

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 21, 2026

This updates config-file persistence in Distribution.Client.Config to use atomic writes directly to the target path, instead of a fixed sibling *.tmp file and rename sequence. It also aligns unit tests with the new behavior and adds a focused concurrency regression test for config updates.


Template Α: This PR modifies behaviour or interface

  • Config write path hardening

    • writeConfigFile now:
      • ensures parent directory exists
      • writes directly via writeFileAtomic file ...
    • removed ad-hoc file <.> "tmp" + renameFile flow
  • UserConfig unit tests

    • added concurrentUpdateConfig to exercise concurrent userConfigUpdate calls and assert no exceptions
    • removed teardown cleanup for configFile ++ ".tmp" (no longer applicable)
writeConfigFile file comments vals = do
  createDirectoryIfMissing True (takeDirectory file)
  writeFileAtomic file $
    LBS.fromStrict . toUTF8BS $
      explanation ++ showConfigWithComments comments vals ++ "\n"

Include the following checklist in your PR:

Copilot AI and others added 2 commits April 21, 2026 13:42
Agent-Logs-Url: https://github.com/ulysses4ever/cabal/sessions/ed90ade9-a00f-4613-acaa-c34cdbfe746a

Co-authored-by: ulysses4ever <6832600+ulysses4ever@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ulysses4ever/cabal/sessions/ed90ade9-a00f-4613-acaa-c34cdbfe746a

Co-authored-by: ulysses4ever <6832600+ulysses4ever@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Distribution.Client.Config to use writeFileAtomic Use writeFileAtomic in Distribution.Client.Config and remove .tmp workaround Apr 21, 2026
Copilot AI requested a review from ulysses4ever April 21, 2026 13:47
@ulysses4ever ulysses4ever marked this pull request as ready for review April 21, 2026 13:52
@ulysses4ever ulysses4ever merged commit d2c12a1 into master Apr 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use writeFileAtomic in Distribution.Client.Config

2 participants