You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consolidates the three independent implementations of 'format template + write' onto \write_starter_config\ and ensures all starter-config writes are atomic:
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.
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.
Custom \cwd\ parameter: \write_starter_config\ now supports an optional \cwd\ keyword argument (defaulting to \Path.cwd()) for template placeholder substitution.
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.
Thanks for this — clean consolidation, and making write_starter_config the single atomic writer is exactly what #144 called for. I've verified locally on your branch (3c2011e): 1521 tests pass, coverage 88.93%, pylint 9.88, pyright clean, and the logic reviewed well (the lazy profiles.core.actions import in loader.py avoids circularity, and the test mocks land correctly).
Two small things before merge:
ruff format now runs as a CI gate (see .github/workflows/ci.yml, added today). Your branch has one violation: a missing blank line at tests/test_app.py:578 (after the from profiles.core.actions import ... line). Just run ruff format tests/test_app.py.
Please rebase onto (or merge in) latest main — CI/Linux portability fixes landed in tests/core/test_actions.py, the same file this PR touches, and it's good to validate against the new quality gates.
Everything else looks good; no other changes requested. One non-blocking note: write_text_atomic uses mkstemp, so newly created .profiles files get 0600 permissions instead of umask defaults — arguably an improvement for a config file, just flagging the delta.
Thanks for the review @falbany! Addressed both items on d14e065:
Ran ruff format on tests/test_app.py (ruff format --check . now reports all 223 files formatted, ruff check . clean).
Rebased cleanly onto main (7c1e949).
Both Quality gates (Python) and Web front-end (build & tests) checks have passed on the updated branch (Windows packaging dry-run is still running).
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
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
Closes #144
Consolidates the three independent implementations of 'format template + write' onto \write_starter_config\ and ensures all starter-config writes are atomic:
All 227 configuration and creation tests pass cleanly.