Skip to content

Add atomic stack fmt command - #4

Merged
konojunya merged 1 commit into
mainfrom
jj/add-stack-fmt
Sep 3, 2026
Merged

Add atomic stack fmt command#4
konojunya merged 1 commit into
mainfrom
jj/add-stack-fmt

Conversation

@konojunya

Copy link
Copy Markdown
Member

背景

Task 17 adds the formatter surface to the private native CLI while preserving the engine as the only implementation of Stack formatting semantics.

実装方法

  • add stack fmt <FILE>, stack fmt --check <FILE>, and stack fmt -
  • read and format bytes through the pinned Stack Engine API
  • replace changed files with an exclusively created temporary file in the same directory, preserving permissions and syncing before rename
  • skip replacement entirely when canonical bytes already match
  • keep syntax, encoding, diagnostic-stream, and host I/O failures from changing the original file
  • format syntactically valid semantic-error source while preserving diagnostics and exit 1
  • pin the canonical formatter suite to specification SHA f382069928c805fe69b7a192bfd6a877036bc036

テスト方法

  • cargo +stable fmt --check
  • cargo +stable test --locked
  • pinned specification formatter conformance through the CLI
  • cargo +stable clippy --all-targets --all-features --locked -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo +stable doc --no-deps --locked
  • coverage: 91.23% regions, 98.11% functions, 93.04% lines
  • stable release build and command metadata smoke
  • Rust 1.85 tests and Clippy
  • process tests for comment preservation, idempotence, semantic errors, syntax no-write, stdin/stdout, check-only, permission preservation, unchanged inode, and atomic I/O failure cleanup

Review 視点 / 懸念点

  • confirm semantic-error source should be formatted while still returning exit 1
  • confirm - is the intended explicit stdin/stdout spelling
  • atomic replacement currently relies on same-directory rename, matching the initial macOS/Linux delivery scope

@konojunya
konojunya merged commit b218ae8 into main Sep 3, 2026
2 checks passed
@konojunya
konojunya deleted the jj/add-stack-fmt branch September 3, 2026 08:06
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.

1 participant