Skip to content

refactor(config): consolidate starter-config creation on atomic writer (closes #144) - #160

Open
txltedxgod wants to merge 1 commit into
falbany:mainfrom
txltedxgod:fix/issue-144-consolidate-starter-config-atomic
Open

txltedxgod wants to merge 1 commit into
falbany:mainfrom
txltedxgod:fix/issue-144-consolidate-starter-config-atomic

Conversation

@txltedxgod

Copy link
Copy Markdown
Contributor

Summary

Closes #144

Consolidates the three independent implementations of 'format template + write' onto \write_starter_config\ and ensures all starter-config writes are atomic:

  1. Atomic starter creation: \write_starter_config\ now writes via \write_text_atomic\ (temp file in same directory + \os.replace), preventing corrupted/truncated .profiles\ files on interrupted --init\ or creation prompts.
  2. Consolidated delegation:
    • \profiles.app.init_default_config\ delegates directly to \write_starter_config.
    • \profiles.core.config.loader.propose_config_creation\ delegates directly to \write_starter_config.
    • \profiles.launch.creation.propose_creation\ (and the /api/config/create\ endpoint) continues delegating to \write_starter_config.
  3. Custom \cwd\ parameter: \write_starter_config\ now supports an optional \cwd\ keyword argument (defaulting to \Path.cwd()) for template placeholder substitution.
  4. Test coverage:
    • Added \ est_uses_atomic_write\ and \ est_writes_with_custom_cwd\ to \ ests/core/test_actions.py.
    • Added \ est_delegates_to_write_starter_config\ to \ ests/test_app.py.
    • Updated \ est_write_error_returns_false\ in \ ests/core/config/test_loader.py\ to verify atomic writer error handling.

All 227 configuration and creation tests pass cleanly.

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.

config: consolidate starter-config creation on one atomic writer (3 duplicate implementations, none atomic)

1 participant