Skip to content

Commit the formatting, and stop the release from dirtying its own tree - #192

Merged
brentrager merged 2 commits into
mainfrom
fix/format-drift
Aug 20, 2026
Merged

Commit the formatting, and stop the release from dirtying its own tree#192
brentrager merged 2 commits into
mainfrom
fix/format-drift

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

What broke

Dropping cargo publish --allow-dirty (#186) surfaced what the flag had been hiding. The 4.5.2 release published to npm and PyPI, then:

error: 1 files in the working directory contain changes that were not yet committed into git:

rust/logger/README.md

to proceed despite this and include the uncommitted changes, pass the `--allow-dirty` flag

crates.io, the Go tag, and NuGet were all skipped.

Where the dirt comes from

release.yml's own Format step. It runs pnpm format, which rewrites files and then never commits them — so cargo publish, a few steps later, is looking at a dirty tree. --allow-dirty existed to shrug that off, which means every crate published from this repo silently carried uncommitted reformatting.

And main really is format-drifted, across seven files:

file drift
.claude/settings.json 4-space indent vs oxfmt's 2
README.md 94 lines
CHANGELOG.md 8 lines
package.json devDependencies unsorted, peerDependencies out of position
python/tests/test_otel_correlation.py ruff
src/Logger.otel.spec.ts oxfmt
rust/logger/README.md *errors*_errors_

Nothing was checking. PR checks run oxlint but never a formatter check, and pnpm format:check did not exist — despite release.yml having had a Format step the whole time.

Fix

  1. Commit the formatting. pnpm format is now a no-op on main.
  2. Add format:checkoxfmt --check + ruff format --check + cargo fmt --check + gofmt -l — and run it in PR checks so this cannot drift again.
  3. release.yml's FormatFormat check. Check, never rewrite. A release pipeline that mutates the tree and discards the result is precisely what made --allow-dirty look necessary.

The part that would have bitten again next release

changeset version writes CHANGELOG.md and package.json, and oxfmt wants both formatted differently from what changesets emits. Without handling that, the very next release PR lands unformatted, its format:check goes red, and cargo publish --locked breaks all over again. So the version lifecycle now ends with oxfmt --write CHANGELOG.md package.json, inside the same command whose output changesets/action commits:

"version": "changeset version && node scripts/sync-versions.mjs && oxfmt --write CHANGELOG.md package.json"

Verification

  • pnpm format:check → exit 0 on this branch.
  • Hand-broke it twice — trailing whitespace in rust/logger/README.md, and mangled import spacing in src/Logger.otel.spec.ts — and confirmed exit 1 both times, then green again after pnpm format.
  • node scripts/check-versions.mjs → OK at 4.5.2; vitest 89 passing; go test ./... ok.

After this merges

The 4.5.2 release needs finishing: npm and PyPI have it, crates.io / the Go tag / NuGet do not. Merging this makes the tree clean, and re-running the Release workflow will publish the remainder.

🤖 Generated with Claude Code

https://claude.ai/code/session_0152bbE1veqfG1SVJdyLCBxC

@changeset-bot

changeset-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bccefed

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@smooai/logger Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

brentrager and others added 2 commits August 20, 2026 14:51
Dropping `cargo publish --allow-dirty` (#186) surfaced what the flag had been
hiding for who knows how long:

  error: 1 files in the working directory contain changes that were not yet
  committed into git:
      rust/logger/README.md

The dirt comes from release.yml's own `Format` step. It runs `pnpm format`,
which REWRITES files and then never commits them — so `cargo publish` a few
steps later stares at a dirty tree. `--allow-dirty` existed to shrug that off,
which meant every published crate silently carried uncommitted reformatting.

main is format-drifted across seven files: .claude/settings.json (4-space vs
oxfmt's 2), README.md (94 lines), CHANGELOG.md, package.json (devDependencies
unsorted, peerDependencies out of position), a Python test, a TS spec, and
rust/logger/README.md. Nothing checked: PR checks run oxlint but never a
formatter check, and `pnpm format:check` did not exist.

Three changes:

1. Commit the formatting. `pnpm format` is now a no-op on main.
2. Add `format:check` (oxfmt + ruff + cargo fmt + gofmt) and run it in PR
   checks, so this cannot drift again. Verified red by hand-breaking both a
   markdown file and a TS file.
3. release.yml's `Format` step becomes `Format check` — check, never rewrite. A
   release pipeline that mutates the tree and discards the result is exactly the
   thing that made `--allow-dirty` look necessary.

Also: `changeset version` writes CHANGELOG.md and package.json, and oxfmt wants
both formatted differently, so the version lifecycle now ends with
`oxfmt --write CHANGELOG.md package.json`. Without it the very next release PR
would land unformatted and break `cargo publish --locked` all over again.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0152bbE1veqfG1SVJdyLCBxC
Needed for its own sake (this changes package.json scripts) and to unstick the
release: crates.io, NuGet and the Go tag stalled at 4.5.0 while npm and PyPI
reached 4.5.2, and the downstream publish steps only fire when changesets
reports it published something — which needs a version bump.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0152bbE1veqfG1SVJdyLCBxC
@brentrager
brentrager merged commit be2b735 into main Aug 20, 2026
1 check passed
@brentrager
brentrager deleted the fix/format-drift branch August 20, 2026 18:54
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