Skip to content

post: a localeCompare in a build script minted different public URLs per machine - #49

Open
clarkbw wants to merge 1 commit into
mainfrom
post/locale-slugs
Open

post: a localeCompare in a build script minted different public URLs per machine#49
clarkbw wants to merge 1 commit into
mainfrom
post/locale-slugs

Conversation

@clarkbw

@clarkbw clarkbw commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Post: 2026-08-11-localecompare-not-deterministic-across-machines-icu-collation-sort-order-gitignored-generated-file-different-public-slugs-codepoint-compare.md

Blog candidate #10 from planning/docs/blog-candidates-2026-08-11.md.

Title: A localeCompare in a build script minted different public URLs per machine

Source work: slackwater-web 3257631 (the assignSlug ladder), 9975873 (codepoint sort + the pinned-output test), 8130b15 (spec).

The story. ~40 of the 133 bundled NOAA current stations share a landmark name. A deterministic ladder hands out the colliding slugs — but "deterministic" only holds given an order, and the order came from .sort((a, b) => a.name.localeCompare(b.name)) in a build script whose output (src/data/currents.json) is gitignored and rebuilt by dev, build and test. So the collation of whichever machine ran the command decided permanent public URLs, with no tracked diff anywhere to notice it. Switching to codepoint compare + id tiebreak reassigned six live slugs across three name groups.

Receipts re-derived for the post, not copied from the commit message:

  • 133 stations, 110 distinct base names, 17 names shared by more than one station, 40 stations in a collision group.
  • Six stations flip: Hale Passage, Pickering Passage, The Narrows — matches the three groups the original commit reported.
  • New finding, worth a look: pinning the locale doesn't fix it. All 15 locales/collation keywords I tested (incl. en-US-u-kf-upper) produce identical output, and all 15 disagree with codepoint order. The axis that actually varies is ICU presence (Node's docs mark localeCompare "partial (not locale-aware)" under --with-intl=none, which is the codepoint column) and ICU/CLDR version. I say so in the post rather than implying LANG was the culprit.

Deliberate omissions / choices:

  • Dropped the commit's second bug (velocity-phase M2 vs height turn) entirely — different subject, would have split the post.
  • Used my own verified counts (40 of 133) rather than the "37 colliding station names" figure in the build-script comment; I couldn't reproduce 37 and didn't want an unverifiable number in public.
  • Nothing private: slackwater-web is public and everything shown is in it.

Figures (2, hand-written SVG, dark-ground):

  1. slug-ladder-two-sort-orders.svg — the four-rung ladder plus the same three Hale Passage stations under both comparators, with the swapped pair marked.
  2. gitignored-artifact-no-tracked-diff.svg — the pipeline top-to-bottom with the ✕ on the sort and the "no tracked diff" annotation on the gitignored artifact.

Verified: python3 script/lint-liquid.py → 35 posts clean; bundle exec jekyll build → clean; both <img> tags present in _site/<slug>/index.html, both SVGs in _site/assets/img/<slug>/, template literals (${r.slug}-current) intact in the rendered code blocks, both post_url related links resolved.

Note: date: 2026-08-11 is the draft date — bump at merge with script/bump.py.

…per machine

Draft for review. Date is the authoring date; publisher bumps at merge.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HaMaRk9UijJQMDX48EVvTk
@clarkbw clarkbw added the publish Approved to publish via the drip-publisher routine label Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

publish Approved to publish via the drip-publisher routine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant