Skip to content

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

  • Nothing yet.
  • Nothing yet.
  • WriteFuncWithPerm(path, fn, perm) — streaming atomic writes with an explicit file permission. WriteFunc always inherited the existing file’s mode (or the 0o644 default for new files), so streamed exports like a PII journal dump could only land 0644 unless callers chmod’d after the fact (racy, or leaves a visible wrong-mode window). The variant creates the staged temp file with the requested mode, so the final file appears atomically with the correct permissions — mirroring what WriteWithPerm does for byte-slice writes. Parameter order follows the package convention of putting the distinguishing argument last (WriteFuncVerified(path, fn, fp), WriteWithPerm(path, data, perm)).
  • Website docs now cover the *Perm variants — WriteWithPerm shipped in v0.5.0 but was absent from the API reference; both permission variants are now documented (sections, decision table, API summary).
  • Deterministic collision test for the temp-path contract — randomSuffix became an injectable seam so the uniqueness guarantee is pinned from both sides: 512 concurrent real writers derive distinct, correctly-shaped temp paths, and a fixed injected suffix reproduces the collision precondition and the wrapped suffix-failure path deterministically (previously only a statistical 200-writer test existed).
  • Landing redesign: “the commit ledger” — the hero code window is now a first-class, always-dark editor artifact in both themes (the pale light-theme code window was the page’s weakest surface), the decorative glow is gone, the stats row is a ruled ledger, FAQ and use cases drop the identical-card kit for ruled rows, the mismatch callout is the page’s one bold dark block, and the light theme is warm paper against green-tinted ink instead of near-white on near-white. Six gates pass unchanged (contrast AA, hero parity, smoke, Lighthouse budgets, brand mirror, links), and the smoke suite grows keyboard tab-order and theme first-paint asserts.
  • Sitemap postbuild gate — check-sitemap.mjs (wired into postbuild after verify-build) asserts the sitemap index resolves, lists ≥ 10 urls, and carries real <lastmod> dates, with four negative tests in the script suite; the lighthouse:deployed “collection gap” was root-caused as a cwd-relative outputDir, not a missing reports bug.
  • Missing parent directories are created on write — every write entrypoint now runs MkdirAll on the target’s parent directory before staging, so a first write into a fresh cache or config directory succeeds instead of failing with no such file or directory at temp-file creation. Found via mr-sync: two on-disk caches (sizes.json, github-listings.json) silently ENOENT’d on every save for weeks because the NixOS unit pre-created the dir but bare machines did not. Concurrent MkdirAll on the same directory is safe (TestTempPathsNeverCollide now exercises 200 concurrent writers through the real path).
  • fleet-bump.sh vendor sync ordering — the vendor directory was resynced at the end of each consumer bump, after the after-build/after-test hooks ran; consumers that build with -mod=vendor saw a stale vendor tree mid-bump. The sync now runs directly after go mod tidy, before any build or test step.
  • Website CI lockfile drift recovery — daemon-committed manifest changes without their pnpm-lock.yaml counterpart broke pnpm install --frozen-lockfile repeatedly; the drift-guard job now fails fast on a missing lockfile update, and lockfiles are regenerated in the same change as any manifest edit.
  • Declarative copy buttons — a CopyButton.astro component now backs both landing-page copy actions; the displayed code and the copied payload derive from one source, a single delegated listener (/js/copy-code.js) serves every [data-copy] element and rebinds across client-side navigations, and success/failure is announced through a polite live region.
  • PNG raster pipeline — pnpm run brand:png rasterizes the generated SVGs into favicon.ico, the 1200×630 OG card, PWA icons (180/192/512), and apple-touch-icon.png via ImageMagick (quantized where file size matters). Brand colors now live in assets/brand/brand-tokens.json as the single source, and the generator’s check mode fails if the SVG mirrors drift from those tokens or if any emitted SVG has unbalanced tags.
  • “When not to use” guide + FAQ page — the docs tree gains an honest anti-recommendations page (situations where go-atomic-write is the wrong tool) and a full FAQ (ported from the landing section), both wired into the docs sidebar.
  • Brand raster pipeline + usage rules — pnpm run brand:png now also writes the five brand compositions as 2× PNG rasters (assets/brand/png/) for SVG-less slots, the GitHub social preview card (assets/brand/social-preview.png, 1280×640, owner uploads once via repo Settings — no API exists), and a labeled contact-sheet.png overview grid. The brand README documents usage rules: clear space (25% of mark height), minimum sizes (16/150/170 px), composition-by-slot selection, tokenized colors only, and background-matched variants.
  • Source + dist gates wired into the Website workflow — pnpm run check:hero (source-level hero parity) and pnpm run audit:contrast (WCAG AA over the full palette, both themes) now run in CI’s build job after the build, next to pnpm run validate; the new gates can no longer regress locally-only. The Lighthouse budget job (added with the 2026-11-04 budget tightening) runs the full 10-page assertion suite on every push.
  • gitleaks secret scanning — SHA-pinned gitleaks action over full git history runs on every push and PR; verified clean on first run.
  • Build-script regression tests — pnpm run test:scripts (node --test) covers the CSP hasher’s quoting and idempotency, the changelog sync’s escaping, and the link checker’s negative paths; the negative-first tests caught real bugs before they shipped.
  • Internal link checker — pnpm run check:links crawls dist/, resolves #fragments against target headings and README references, and fails the Website workflow on broken links or fragments.
  • Playwright smoke suite + PR preview channels — a four-test smoke suite (copy payloads, FAQ count, 320px overflow, animation binding) runs against the production build in a new Website CI job, and every non-fork PR deploys an ephemeral Firebase preview channel (pr-<number>) so reviewers see the rendered site before merge.
  • SEO hygiene batch — the sitemap emits real lastmod dates (must be a Date object, not an ISO string — Astro rejects strings), pages gain og:image:type, og:image:site_name, and twitter:image:alt, theme-color ships as a light/dark media pair, and the website declares engines.node >= 24.
  • Config-reloader use case — a fourth use case (“Never publish a half-written config”) joins the landing grid (4-up on desktop), and the HowItWorks section drops its misleading concurrent-race branch in favor of the fingerprint-mismatch reality.
  • CONTRIBUTING gains release + deploy runbooks — the release checklist (lint gate, CI green before tag, version trio, no re-tags) and the Firebase deploy recipes are written down where contributors look.
  • Deploy-secret posture decided — docs/deploy-secret-posture.md compares Workload Identity Federation (Option A, concrete OIDC commands) against key rotation (Option B) and documents the stale firebase-adminsdk key cleanup; CI keeps the shared github-website-deploy service account key until WIF lands.
  • Fleet npm sweep tracker — the recurring devDep-bump behavior is documented as ad-hoc fleet sessions (not a scheduler), alongside the guards that self-heal its known fallout (typescript@>=7 override, *.out.css gitignore, CI drift guard).
  • CSP hash sources were invalid for 3.5 months — every allow-listed inline script was silently blocked — fix-csp.mjs emitted hash sources bare (sha256-…), but the CSP grammar requires single quotes ('sha256-…'); browsers parsed every hash as an invalid source and ignored it, so since v0.4.0 (2026-07-26) Starlight’s theme pickers, sidebar state, search shortcut, and Astro-inlined modules never executed on any page. Masked for months because the site’s behavioral JS lives in external /js/* files, and “verification” fetched HTML instead of reading a browser console. Hashes are now quoted, frame-ancestors was dropped from the meta CSP (browsers ignore it there; X-Frame-Options: DENY already ships as a header), and verify-build.mjs now asserts every inline script is covered by a quoted hash so this incident class cannot silently return. Verified: zero CSP console violations on landing + docs pages.
  • Mobile layout overflow fixed — the hero code block’s min-content width propagated through the flex container, pushing the landing page’s scrollWidth to 527 px at 320 px viewport; the newsletter input+button row overflowed and stats labels clipped. The hero container now drops its min-width floor (min-w-0 w-full), the newsletter stacks vertically on small screens, and the stats grid wraps 2×2. Verified: scrollWidth 310 == clientWidth 310 at 320 px, zero uncontained elements.
  • Light-mode color audit: every text/background pair now meets WCAG AA — the audit script (pnpm run audit:contrast, kept in-repo) computes real contrast ratios for all 11 foreground tokens against all backgrounds in both themes. Fixes: the hero code snippet’s import string and amber strings were near-invisible in light mode (accent-hover 2.43:1, amber ~1.6:1 on near-white), light accent as text sat at 3.61:1, and code comments missed 4.5:1 in both themes. Light mode now uses the deeper emerald (#047857) with white button text; success/danger stay as icons (WCAG 1.4.11 graphics threshold, passing).
  • Newsletter form worked again — the hash-based CSP declared form-action 'self', which silently blocked the footer form’s POST to https://buttondown.email on every page since the CSP shipped (v0.4.0); clicking Subscribe did nothing. The CSP now allows form-action 'self' https://buttondown.email (the only cross-origin form target on the site).
  • OG card voice aligned with the landing page — the generated social-share card still said “TOCTOU-safe” (the pre-September mechanism voice) and pointed at the GitHub URL on every Slack/X/Facebook preview. The brand generator now emits “No lost updates” (consequence voice) and the pkg.go.dev URL; og-image.svg/png, the lockups, and favicon.ico were regenerated from the same geometry (brand:check gates the SVGs).
  • Source split into focused files — the single atomicwrite.go had grown past BuildFlow’s 350-line file budget (391 lines) while mixing four concerns. Same flat single package, now four files: atomicwrite.go (public write API), fingerprint.go (xxhash64 fingerprinting), commit.go (verification + locking + rename commit), stage.go (temp-file staging + fsync). Test files split to mirror them. No API or behavior change; all 31 tests moved verbatim.
  • Temp file leaked when the final rename failed — every public writer returned the rename error without removing the staged .<random>.tmp file (reachable when the target path is a directory, or on rename ENOSPC/EIO). All rename sites now route through commitRename, which removes the staging file when the rename fails, so a failed write never leaves .tmp residue next to the target.
  • Brand identity: “the atomic swap” logo — an emerald squircle holding two opposing arrows (new bytes in, old bytes out), generated from a single geometry in scripts/generate-brand-assets.mjs into every surface: favicon (SVG + ICO), site header/footer logo, Starlight docs header, the OG card (SVG + PNG), the README hero lockup (dark/light variants), and standalone marks in assets/brand/. The old identity was a squircle with the letter “A”, hand-copied (and drifted) across the favicon, the logo component and the OG image. pnpm run brand:check (wired into both CI workflows) fails if any generated artifact drifts from the generator.
  • website/src/styles/global.out.css — a 44 KB generated Tailwind output with no references anywhere in the build; a leftover from an older CLI workflow. Fleet sweeps kept regenerating it (twice on 2026-11-03); it is now deleted again AND src/styles/*.out.css is gitignored so it can never be committed again.
  • Root package.json stub — a stray npm init -y default stub (no deps, no lockfile, no scripts) was auto-committed 2026-09-22 (commit 5a6302f) and made the npm directory: / Dependabot job fail on every run since. The stub is deleted and that Dependabot entry removed; only the healthy /website npm ecosystem remains.
  • npm dependency sweep — pnpm-lock.yaml fully regenerated with pnpm 11.20.0: open advisories went from 62 (1 critical, 28 high) to 1 moderate (minimatch@3.1.5 via the dev-only chrome-launcher chain; forcing it to 11 breaks glob@7’s CJS API at runtime — tracked BLOCKED in TODO_LIST.md). Enabled by overrides in pnpm-workspace.yaml (pnpm 11 silently ignores overrides in package.json — same class as the allowBuilds incident, so the previous brace-expansion override had been inert): fast-uri ^3.1.9, brace-expansion ^5.0.12 (previous pin 5.0.6 sat six advisories behind), glob@>=13 <14 ^14.0.2, minimatch@>=10 <11 ^11.0.1, basic-ftp ^6.2.1 (get-uri declares ^5 but 6.2.5 verified CJS-loadable, 2026-11-03).
  • astro check requires TypeScript 6.x — website pinned typescript ^7.0.2 → ^6.0.3 (and regenerated pnpm-lock.yaml). TS7’s native compiler dropped the programmatic API that astro check depends on. Shipped in the v0.5.2 tag but missed from its changelog section. Re-fixed 2026-11-03 with a self-healing guard: the fleet npm sweep re-bumped the manifest to ^7.0.2 twice more; a typescript@>=7 → ^6.0.3 override in pnpm-workspace.yaml now resolves any future major bump back to 6.x automatically.
  • golangci-lint GitHub Action upgraded v6 → v7 (SHA-pinned, version: v2.13.2 explicit) — action v6 cannot install golangci-lint v2, and version: latest resolves to the ancient v1.x line. Shipped in the v0.5.2 tag but missed from its changelog section.
  • golangci-lint pin bumped v2.13.2 → v2.14.0 — the v2.13.2 binary is built with go1.26 and cannot typecheck the Go 1.27 stdlib (export data version 5 > maximum supported 4), so master CI failed at lint while build/test passed. Lesson recorded: the pinned lint binary must be built with the repo’s Go generation; bump the pin when the toolchain minor rises.
  • Cross-compile job — builds windows/amd64, darwin/amd64, darwin/arm64 on every push/PR. The v0.5.1 Windows compile break class is now caught by CI before a tag can ship it.
  • govulncheck job — golang/govulncheck-action v1.1.0 (SHA-pinned) scanning ./....
  • Drift-guard job — go mod tidy -diff, a version-trio check (go.mod vs .golangci.yml run.go vs AGENTS.md; the error names the drifted file), and pnpm install --frozen-lockfile in website/. Auto-commit-daemon manifest drift (CI breaks 09-09/09-13/09-15/09-17 and another four-package drift on 11-03) now fails fast with a named message.
  • GOTOOLCHAIN: local at the workflow level — a rogue toolchain download can no longer silently pick a different Go than the one setup-go installed.
  • pnpm run lighthouse:deployed — Lighthouse CI against the live site (lighthouserc.deployed.json, same budgets, filesystem upload) as a repeatable post-deploy check.
  • README benchmarks re-measured on Go 1.27.0 as min–max ranges over 3 runs, with the load-sensitivity of the memory-bound xxhash64 documented (previous: single Go 1.26.3 numbers); website throughput claims updated ~27 → ~23 GB/s to match.
  • go directive is now go 1.27 (fleet minor policy, ADR-0001 in go-version-auto-configure) — raised from the patch-form go 1.26.7 that v0.5.2 published. Environments must provide a Go 1.27 toolchain; the directive is major.minor only, so any 1.27.x toolchain satisfies it and GOTOOLCHAIN=auto picks one up automatically. (This section was reconstructed on 2026-11-03: the v0.6.0 tag was cut without moving [Unreleased] content; everything below shipped between v0.5.2 and this tag.)
  • Landing page leads with the consequence instead of the mechanism — the hero subheadline now names the failure mode (“if two processes write the same file, one silently loses data”) rather than listing four mechanisms, and the primary hero action is the copyable go get command. Feature titles state outcomes (“No silent overwrites”, “Survives power loss”) instead of implementation names.
  • Meta description rewritten for search results and social previews: crash-safe framing instead of a TOCTOU and fsync mechanism list.
  • Module path is now a single constant (siteConfig.modulePath) — the hero snippet, the copyable go get command, the GitHub link, the pkg.go.dev link, and the Starlight docs meta description all derive from it. The module path was previously rebuilt by string-replacing siteConfig.github in two separate files, a smaller copy of the same split-brain bug.
  • Remaining corporate-register copy replaced — the feature grid subtitle now describes what the library does instead of “every decision optimized for…”, and the README lead names the three concrete failure modes rather than a mechanism list.
  • Landing page FAQ — answers “why not a temp file plus rename?”, “what does a write cost?”, “what happens when two writers race?”, and “when should I not use this?”.
  • Build-time verification gate (website/scripts/verify-build.mjs, run from postbuild) — asserts the hero code shown in dist/index.html is byte-identical to the code its copy button copies, that the install command matches the go.mod module path, and that every [data-copy] button carries a non-empty payload. A regression of the hero split brain now fails the build.
  • pnpm run validate — runs html-validate on the built landing page; wired into the Website CI workflow.
  • i18n content collection (src/content/i18n/en.json, intentionally empty) — silences the The collection "i18n" does not exist or is empty warning Starlight emitted on every build.
  • Landing page hero sample did not compile — the rendered snippet called atomicwrite.Write(path, newData, fp), but Write takes only (path, data); the copy button copied the correct WriteVerified call, so the visible code and the copied code disagreed. Both now derive from a single token list in website/src/data/hero-code.ts, so they cannot drift again.
  • README attributed ErrConcurrentModification to the wrong function — it claimed Write returns it on fingerprint mismatch, but Write takes no fingerprint. Corrected to WriteVerified.
  • Copy buttons survive navigation and announce success — copy-code.js now installs one delegated click listener instead of binding per element, so it cannot double-bind across ClientRouter navigations, and it writes “Copied to clipboard” into a role="status" live region for screen readers.
  • Website deploys unblocked — the FIREBASE_SERVICE_ACCOUNT_LARS_SOFTWARE repository secret was missing, so every CI deploy failed at the final step and the live site was frozen at the 0.4.0 content since 2026-07-26. A key for the shared github-website-deploy@lars-software service account is now registered, and the site is live again with current content. The Firebase deploy action was also pointed at website/ and manual dispatches now deploy.
  • workflow_dispatch trigger on the Website workflow so deploys can be run manually without pushing a website/** change.
  • Toolchain: Go 1.26.5 → 1.26.7 — go.mod and .golangci.yml aligned. No language or API changes; a toolchain maintenance/security bump only.
  • Dependency bumps — gofrs/flock v0.13.0 → v0.13.1 and golang.org/x/sys (indirect) v0.47.0 → v0.48.0. No API changes.
  • golangci-lint config realigned to the v2.x schema — the gating check had drifted from the installed linter versions; findings from linters that no longer match this codebase’s patterns are silenced, and the now-unnecessary //nolint:gosec comments were removed (no behavior change).
  • Website HTML cache rule never matched cleanUrls pages — the **/*.html rule missed directory-style URLs, so HTML fell back to Firebase’s default max-age=3600 (the same stale-content bug class behind the 2026-09-03 go-output outage). Cache-Control: public, max-age=0, must-revalidate moved into the ** catch-all, which Firebase applies last per header.
  • Website deploy pipeline repaired — pnpm is enabled via corepack before setup-node (its cache: pnpm needs the binary, which runners don’t preinstall), pnpm exec replaces pnpm dlx (which ran unpinned latest tooling and crashed astro check), and firebase-tools installs via npm i -g so its bin is on PATH.
  • Dependabot config — weekly grouped minor/patch updates for Go modules, GitHub Actions, and npm, capped at 5 open PRs per ecosystem.
  • Windows builds now compile (rename_windows.go) — isRetryableRename referenced syscall.ERROR_SHARING_VIOLATION, which Go’s stdlib syscall package does not define on windows (it only exports a small errno subset). Every GOOS=windows build of this library — direct or transitive — failed with undefined: syscall.ERROR_SHARING_VIOLATION. The constant is now defined locally by value (syscall.Errno(32), the WinAPI ERROR_SHARING_VIOLATION code), preserving the intended retry-on-sharing-violation behavior.
  • WriteWithPerm(path, data, perm) — atomic write with explicit file permissions (0.4.0’s API always used 0o644).
  • Test hygiene: zero-length make to satisfy the makezero linter.
  • WriteIfChanged(path, data) (changed bool, err error) — writes only if content differs from disk. Returns changed=true when the file was written, false when skipped (identical content). This is the idiomatic primitive for config-file writers and code generators that must not produce spurious diffs on re-runs: no content change means no file mutation, no mtime bump, no file-watcher trigger. Composes FingerprintFile + WriteVerified; first-write uses plain Write (no prior content to protect).
  • BREAKING: Write / WriteFunc API split (atomicwrite.go) — the previous Write(path, data, fingerprint) mixed two distinct intents behind a zero-value Fingerprint{}, which silently skipped TOCTOU verification (a footgun). The API is now split by intent:
    • Write(path, data) / WriteFunc(path, fn) — plain atomic write, no TOCTOU check (the common case).
    • WriteVerified(path, data, fingerprint) / WriteFuncVerified(path, fn, fingerprint) — atomic write WITH fingerprint verification. A zero-value fingerprint here means “the file must NOT already exist” — a concurrent creation is treated as a conflict and fails, rather than being silently ignored.
  • This is a source-incompatible change: every call site passing Fingerprint{} to skip verification migrates to Write/WriteFunc; every call site passing a real fingerprint migrates to the *Verified variant. All in-repo consumers were updated.
Before After
Write(path, data, Fingerprint{}) Write(path, data)
Write(path, data, fp) (real fingerprint) WriteVerified(path, data, fp)
WriteFunc(path, fn, Fingerprint{}) WriteFunc(path, fn)
WriteFunc(path, fn, fp) (real fingerprint) WriteFuncVerified(path, fn, fp)
  • Website docs taught the removed API — api-reference.mdx, getting-started/quick-start.mdx (4 examples), getting-started/installation.mdx, guides/error-handling.mdx, the landing-page hero code (hero-code.ts), and the “How it works” steps (sections.ts) all used the removed Write(path, data, fingerprint) 3-arg signature. Rewritten to the current Write / WriteVerified / WriteIfChanged / WriteFunc / WriteFuncVerified split.
  • Dual changelog split brain — website/src/content/docs/changelog.mdx duplicated root CHANGELOG.md and had already diverged (no [Unreleased], old signatures). The website page is now generated from the root file by website/scripts/sync-changelog.mjs (single source of truth, wired into prebuild/predev).
  • docs/DOMAIN_LANGUAGE.md documented the removed .bak pattern as a value object and event. Corrected to reflect single-rename atomicity and the full write-API split.
  • pulse-dot animation ignored prefers-reduced-motion — the reduced-motion media query only targeted [data-animate]. Now disables .animate-pulse-dot too (accessibility: vestibular disorders).
  • Hash-based Content Security Policy — website/scripts/fix-csp.mjs post-build patcher injects a per-file CSP <meta> into every built HTML page. Inline scripts are allow-listed by SHA-256 hash (no 'unsafe-inline' for script-src); style-src 'unsafe-inline' is retained for Tailwind’s inlined critical CSS.
  • CI/CD pipelines — .github/workflows/ci.yml (Go vet + build + test -race + golangci-lint) and .github/workflows/website.yml (typecheck + build on every change; deploy to Firebase Hosting live channel on master).
  • Changelog sync hook — pnpm run sync:changelog and automatic prebuild/predev generation of the website changelog page.
  • CONTRIBUTING.md — added a website/ section (build/dev/deploy commands, the generated-changelog note), corrected the stale “No flake.nix” claim (the website has one), and documented golangci-lint as the gating check.
  • Dead website code — unused comparisons array (sections.ts), unused ComparisonItem interface (types.ts), and the unused fade-in-up keyframe + theme variable (global.css). comparisonMatrix (which IS rendered) is retained.
  • OG / social-share image — static 1200×630 og-image.png (generated from og-image.svg source) with og:image, twitter:image, and twitter:card=summary_large_image meta tags on both the landing page and all Starlight docs pages.
  • favicon.ico — multi-resolution (16/32/48/64px) ICO generated from favicon.svg, referenced via <link rel="alternate icon"> for legacy browsers that only request .ico.
  • Lighthouse CI — website/lighthouserc.json with performance/accessibility/SEO budgets (desktop preset), @lhci/cli devDependency, pnpm run lighthouse script, and chromium in the Nix devShell (CHROME_PATH set). Verified: Performance 100, Accessibility 100, Best-Practices 96, SEO 100.
  • website/.editorconfig — standalone editor config for the website subtree (2-space indent for all web files, root = true to decouple from the Go tab-based root config).
  • WCAG AA contrast failure — --color-text-muted was #78716c (4.08:1 on the dark #0a0908 background, below the 4.5:1 AA minimum). Dark mode lightened to #8b827a (5.28:1); light mode darkened to #6e6762 (5.32:1) for comfortable margin.
  • Comparison matrix screen-reader inaccessible — check/X icons in ComparisonSection.astro had no text alternative. Each data cell now has a descriptive aria-label (e.g., “TOCTOU-safe, go-atomic-write: Yes”); feature-name cells changed to <th scope="row">; the ~ partial symbol marked aria-hidden="true".
  • website/flake.nix pinned Node 24 — replaced pkgs.nodejs (Node 22 on unstable) with pkgs.nodejs_24 across all apps and devShell, matching the .node-version file and AGENTS.md requirement.
  • website/flake.nix app metadata — added meta.description and meta.mainProgram to every mkApp (dev, build, preview, deploy); nix flake check no longer warns about missing attributes.
  • WriteFunc(path, fn, fingerprint) — streaming atomic writes via a callback. The callback receives a bufio.Writer (64KB buffer) so callers can stream large or incrementally-produced content (JSON encoders, diagram renderers, etc.) without holding the full payload in memory. The temp file is fsync’d before atomic rename, and TOCTOU fingerprint verification works identically to Write.
  • Comprehensive WriteFunc tests — first run, overwrite, large stream (400KB across 100 chunks), callback error cleanup, permission preservation, and no-leftover-files verification
  • Benchmark data generation extracted into a shared benchData helper — eliminates duplicated make([]byte, size) + fill-by-index across 4 benchmark functions
  • .gitattributes added for cross-platform line-ending normalization
  • Full marketing website launched with Astro + Starlight + Tailwind v4 at atomicwrite.lars.software
  • Removed .bak two-rename pattern — the old atomicRename did path→.bak then tmp→path, opening a window where the target didn’t exist. A concurrent reader could see ENOENT, and a crash between the two renames left the target missing. The library named “atomic-write” was not atomic. Now a single os.Rename(tmp, path) is one atomic syscall on POSIX and atomically replaces on Windows via MoveFileEx.
  • Concurrent writer corruption — tmpPath was computed before the lock (path + ".tmp"), so two concurrent Write() calls to the same target both truncated and wrote the same staging file, interleaving bytes. Now each writer gets a unique temp file via crypto/rand suffix (path + "." + randomHex + ".tmp").
  • Concurrency test couldn’t catch the bug — TestConcurrentWriteRACE used identical content from all writers, so byte interleaving was undetectable. Rewritten with 10 writers using divergent content (writer-0 through writer-9) plus an integrity check verifying the final file is exactly one writer’s payload.
  • “Crash safety” doc claim was false — no fsync was called anywhere. Now writeAndSync() opens the temp file, writes data, calls file.Sync(), and closes (with cleanup on error). On POSIX, the target directory is also fsync’d after rename via syncDir(). The package doc now says “atomic rename, and fsync for crash durability” — and means it.
  • fsync for crash durability — temp file is fsync’d before rename; target directory is fsync’d after rename (POSIX only; Windows has no equivalent directory sync)
  • Unique temp file names — crypto/rand 4-byte hex suffix prevents concurrent writer staging-file corruption
  • Platform-specific rename — split into rename_unix.go (single rename(2) + directory fsync) and rename_windows.go (retry loop on ERROR_ACCESS_DENIED/ERROR_SHARING_VIOLATION, 5 retries with exponential backoff 1–16ms, matching Go’s own cmd/go fix for issue 36568)
  • writeAndSync() — opens temp file, writes data, fsyncs, closes; cleans up temp file on any error
  • randomSuffix() — generates random hex suffix for unique temp file names
  • syncDir() — opens and fsyncs the target directory after rename (POSIX only)
  • TestWriteLeavesNoLeftoverFiles — verifies no .bak and no .tmp files remain after a successful write
  • Status report — full HTML dashboard at docs/status/2026-06-28_03-32_atomicity-durability-overhaul.html
  • Package doc: “atomic rename for crash safety” → “atomic rename, and fsync for crash durability”
  • Write() now stages to a unique temp file instead of a shared path + ".tmp"
  • atomicRename() no longer creates .bak files — single os.Rename replaces atomically
  • TestConcurrentWriteRACE rewritten: 10 writers, divergent content, integrity check
  • TestTempFileCleanedUpOnError uses filepath.Glob instead of hardcoded temp path
  • AGENTS.md, README.md updated: new architecture, data flow, file structure, platform-specific behavior, removed all .bak references
  • go.sum tidied — removed stale testify/go-spew/go-difflib/yaml.v3 checksums
  • TestWriteCreatesBackup — tested the .bak pattern as a feature; the pattern was a bug
  • .bak file creation — no longer created alongside the target
  • Windows rename retry loop and FlushFileBuffers compile via build tags but are untested on real Windows hardware
  • No POSIX-equivalent directory fsync on Windows — the directory entry after rename may not be durable after a crash
  • No stale temp file cleanup — crashed writes leave .tmp files (unique names prevent interference but don’t self-clean)
  • LICENSE changed from PROPRIETARY to MIT — the README already stated MIT; the LICENSE file now matches
  • .golangci.yml now permits github.com/cespare/xxhash/v2 and github.com/gofrs/flock in the depguard allow list (both are intentional runtime dependencies, not candidates for replacement)
  • Tests use //nolint:gosec annotations with rationale for os.ReadFile/os.WriteFile calls that operate exclusively on t.TempDir() paths
  • TestConcurrentWriteRACE now calls t.Parallel() to satisfy paralleltest and to actually run in parallel with other tests
  • Benchmark helpers call b.Helper() so failures are attributed to the caller
  • Variable names lengthened for varnamelen compliance: fp → fingerprint, wg → waitGroup, h → hasher, mb → megabyte
  • Inline if err := …; err != nil { … } blocks in tests refactored to plain assignment plus if for noinlineerr compliance
  • Documentation formatting and accuracy fixes across README, CHANGELOG, CONTRIBUTING, DOMAIN_LANGUAGE, and AGENTS.md
  • errcheck: h.Write return value is now explicitly discarded (_, _ = hasher.Write(…)) in the streaming benchmark
  • *.bak added to .gitignore — backup files from atomic writes were showing as untracked
  • TOCTOU-safe file writes via xxhash64 fingerprint verification
  • Cross-platform file locking (flock on Unix, LockFileEx on Windows) via gofrs/flock
  • Atomic rename with .bak backup of previous content
  • Fingerprint type ([8]byte) with IsZero() and Matches() methods
  • FingerprintFile — computes fingerprint from file path (zero-value for nonexistent files)
  • FingerprintFromBytes — computes fingerprint from raw bytes
  • Write(path, data, fingerprint) — main API with TOCTOU protection
  • ErrConcurrentModification sentinel error for fingerprint mismatch detection
  • File permission preservation from existing file (defaults to 0644 for new files)
  • xxhash64 vs SHA-256 benchmarks demonstrating ~11× speed advantage
  • Unit tests, permission preservation tests, and concurrent writer contention test