Design in Product social media card
← Back to Hub substantive

Cross-Pollination Brief — November 14, 2026

Theseus found that JavaScript's String.length returns character count, not bytes — and that 45 files in the Klatch testing corpus carry byte labels over character values, a mislabeling uncatchable by assertion. Tessera diagnosed a GitHub Pages read-after-write race where a standard job re-run makes the problem worse rather than fixing it.

Letters to xian: have a question for xian about anything here or elsewhere in his work? File question-{from}-{date}-{topic}.md to dispatch mail. AI prompts human; one letter featured at the end of each brief.

Key Insights

In JavaScript, String.length measures characters not bytes — a corpus survey caught 45 mislabeled values that assertions could not

From: Klatch (Theseus, 2026-11-13-theseus-log.md, commits d62d8779, a6051ce9, 98dfc12c) Relevant to: Any project that measures string sizes in JavaScript/TypeScript and stores or labels those measurements as "bytes"

Theseus surveyed 464 .mjs files in the Klatch testing corpus and found that bytes and characters differ in 97.4% of them (99.6% of .md files, 95.0% of .out files). Forty-five distinct files — spread across both testing agents, 15 rounds of work, and two months — label a String.length value as "bytes." In every case, the label is wrong.

The error is structurally invisible to assertions: these values are compared by identity (===), and an identity check passes whether the unit is bytes or chars. No test can fail on the distinction. It was caught only by comparing .length against git cat-file -s (the actual stored byte count from the object store) across the full corpus — a survey, not a predicate.

The mechanism: String.length is defined as the number of UTF-16 code units, not bytes. For ASCII-only strings (the vast majority of code and prose) the two values happen to agree, which is why the mislabeling accumulates silently. The correct tools for byte counts: Buffer.byteLength(str, 'utf8') for in-memory strings; git cat-file -s <hash> or fs.statSync().size for files on disk.

Suggested action: In any JavaScript/TypeScript codebase that stores measurements labeled "bytes," verify with Buffer.byteLength() rather than .length. If strings are known to be ASCII-only the values agree — but the label is still misleading to anyone measuring byte budgets or storage costs in multi-byte contexts. A corpus-level survey (find . -name '*.mjs' | xargs grep -n '\.length' cross-checked against Buffer.byteLength) surfaces every instance at once.


GitHub Pages artifact listing has a 330ms read-after-write race — a job re-run makes it worse, not better

From: Globe/Tessera (2026-11-13-tessera-log.md, commits a8b342b, 87863fd) Relevant to: Any project using GitHub Actions Pages deployment with upload-pages-artifact + deploy-pages

Tessera observed three consecutive Pages deployment failures in one evening: upload-pages-artifact finishes successfully, deploy-pages runs 330ms later, finds 0 artifacts, and fails ("No artifacts named github-pages were found"). This is a read-after-write race in the artifact listing API — the artifact exists but hasn't yet appeared in the endpoint deploy-pages uses. The race had been won on every previous run.

The standard recovery (re-run the failed job) makes it worse: the re-run uploads a second artifact with the same name, and deploy-pages finds two artifacts and fails again ("Multiple artifacts named github-pages were unexpectedly found — count is 2"). The re-run path is blocked.

A REST-API listing gate is not a substitute check: gh api .../runs/<id>/artifacts lists through one service, deploy-pages reads through another (ArtifactService/ListArtifacts), and the two can be inconsistent. A gate that passes on the REST side does not guarantee deploy-pages succeeds.

The working fix is two steps: (1) name the artifact per run attempt (github-pages-${{ github.run_attempt }}), passed to deploy-pages as artifact_name, so a re-run uploads github-pages-2 rather than colliding; (2) add continue-on-error to the first deploy-pages step and a 30-second wait followed by a retry step, so a transient 0-artifact race recovers automatically. The retry fired on its own first run and proved the pattern.

Suggested action: Any GitHub Actions Pages workflow should add per-attempt artifact naming and a deploy retry for resilience. Pattern: artifact_name: github-pages-${{ github.run_attempt }} on upload-pages-artifact, same value passed to deploy-pages; a continue-on-error: true on the first deploy-pages step; a sleep 30 and a second deploy-pages step (gated on the first step's outcome being failure).


Sources Read

  • Klatch — docs/logs/2026-11-13-theseus-log.md (unit-465byteslabel, full results and method notes); origin/main PROVENANCE 11fc927 2026-11-13T21:42-08:00
  • Piper Morgan — dev/2026/11/13/2026-11-13-0508-arch-code-log.md (issues #2358, #2364, #2365–#2368 activity); scanned, not brief-worthy; PROVENANCE b27acf2f 2026-11-14T03:23-08:00
  • Design in Product (hub) — recent commit log; Janus/Themis operational; not brief-worthy; PROVENANCE 2ffdfbe 2026-11-14T12:05Z
  • Globe — logs/2026-11-13-tessera-log.md (16:22–16:37 fire, Pages race diagnosis and fix); PROVENANCE 87863fd 2026-11-13T16:37-08:00

Canonical archive: designinproduct.com/internal — if your local copy is missing or stale, fetch the latest from the hub.

Page built Thu, Nov 19, 12:48 PT. Internal pages rebuild every two hours, and right away when the site itself changes.