Skip to content

fix(fsx): replace bare os.WriteFile with atomic staged replacement - #128

Merged
pablontiv merged 1 commit into
masterfrom
pablontiv/w5-issue106-atomic-writes
Aug 6, 2026
Merged

fix(fsx): replace bare os.WriteFile with atomic staged replacement#128
pablontiv merged 1 commit into
masterfrom
pablontiv/w5-issue106-atomic-writes

Conversation

@pablontiv

Copy link
Copy Markdown
Owner

Summary

  • add a shared sibling-temp-file atomic write and copy utility
  • convert init, migrate, scaffold, rename, and template writes to atomic replacement
  • preserve existing destination permissions and document the per-file atomicity boundary

Changes

File Change
internal/fsx/atomic.go Adds atomic write/copy helpers with flush, mode preservation, rename, and cleanup
cmd/rootline/init.go, cmd/rootline/migrate.go Uses atomic replacement for generated .stem files
internal/migrate/, internal/templates/ Uses the shared helper for generated documents and template copies
docs/, .claude/skills/rootline/ Documents per-file atomicity and its non-transactional boundary

Test Plan

  • just test
  • just check
  • just coverage-check (TOTAL: 89.5%; internal/fsx: 85.4%)
  • Deterministic partial-write test proves the original destination remains intact

Contributor Checklist

  • Linked an approved issue
  • Added exactly one type:* label
  • No shell scripts changed
  • Rootline skill synchronized
  • Docs updated for changed behavior
  • Conventional commit format
  • No Co-Authored-By trailers

Fixes #106

@pablontiv pablontiv added the type:bug Bug fixes label Aug 6, 2026
@pablontiv pablontiv closed this Aug 6, 2026
@pablontiv pablontiv reopened this Aug 6, 2026
@pablontiv pablontiv closed this Aug 6, 2026
@pablontiv pablontiv reopened this Aug 6, 2026
@pablontiv
pablontiv merged commit 2adcd8d into master Aug 6, 2026
33 checks passed
@pablontiv
pablontiv deleted the pablontiv/w5-issue106-atomic-writes branch August 6, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bare os.WriteFile in migrate, init and templates can leave truncated .stem files

1 participant