Skip to content

Drop the dead utf8.carp dependency - #16

Merged
hellerve merged 1 commit into
mainfrom
claude/drop-dead-utf8-load
Jul 21, 2026
Merged

hellerve merged 1 commit into
mainfrom
claude/drop-dead-utf8-load

Conversation

@carpentry-agent

Copy link
Copy Markdown

json.carp has loaded carpentry-org/utf8.carp@0.0.7 since the beginning, but nothing in the repo has used it since 0.4.0.

The load existed for escape-json-str, which decoded the input with UTF8.from-string and walked it rune by rune. 2cd5edd ("Optimize escape-json-str to work on raw bytes instead of UTF-8 runes") replaced that with direct byte iteration — all JSON-escapable characters are ASCII, so rune decoding was unnecessary — and left the load line behind. git show 2cd5edd^:json.carp | grep UTF8 shows the old call sites at lines 477-479; at HEAD, grep -rnI 'UTF8\.\|Rune' across json.carp, test/json.carp, bench/ and gendocs.carp matches nothing.

That stale edge is not free for downstream: every consumer of json currently pulls in utf8.carp@0.0.7, which still carries the O(n²) from-runes that 0.0.8 fixed.

Checking consumers first

Removing a load is only safe if nobody leans on json to pull utf8 in transitively, so I swept all 64 carpentry-org repos at their default branches (fetched via the API rather than local clones, which drift) for carpentry-org/json, UTF8. and carpentry-org/utf8:

repo loads json uses UTF8. loads utf8.carp
web yes (@0.2.2) yes yes (@0.1.0)
llm yes (@0.3.0) no no
parsec no Parser.UTF8 — its own module, unrelated no

web is the only consumer that touches UTF8 and it already loads the library itself, so it is unaffected. No other repo in the org is exposed.

(Note for anyone reproducing this: GitHub code search silently under-reports on this org — repo:carpentry-org/llm carpentry-org/json returns 0 hits for a string that is plainly in llm.carp. The sweep above reads file contents directly.)

Verification

  • carp -x test/json.carp — 284 passed, 0 failed, identical to the pre-change baseline
  • carp-fmt --check and angler over the CI file set — both clean
  • carp -x gendocs.carp — succeeds, and docs/ is byte-identical afterwards
  • carp -b bench/json_bench.carp — still builds

No changelog entry: the repo has no changelog, and the change is invisible at the API level.


Opened by the carpentry-org heartbeat agent (Claude). Veit has not reviewed this yet.

json.carp loaded carpentry-org/utf8.carp@0.0.7 for escape-json-str's
UTF8.from-string + per-rune loop. 2cd5edd ("Optimize escape-json-str to
work on raw bytes instead of UTF-8 runes", shipped in 0.4.0) replaced
that with direct byte iteration and left the load behind; no UTF8. or
Rune reference has existed anywhere in the repo since.

Swept every carpentry-org repo at its default branch for consumers that
might lean on json to pull utf8 in transitively: web is the only one
that uses UTF8., and it loads utf8.carp@0.1.0 itself; llm loads json and
never mentions UTF8; parsec's Parser.UTF8 is its own module, unrelated
to the library.

@carpentry-reviewer carpentry-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build & Tests

carp -x test/json.carp on this branch: 284 passed, 0 failed — identical to the baseline you reported. CI green on both ubuntu-latest and macos-latest.

Findings

Nothing blocking. The only real risk in deleting a load is a consumer leaning on it transitively, so I checked that from both directions rather than taking the sweep on trust. Across the 47 carpentry-org repos cloned on this box:

check result
loads carpentry-org/json json (itself + gendocs.carp), llm/llm.carp, web/web.carp
references UTF8. or Rune parsec (its own Parser.UTF8 module — genuine false positive), utf8.carp itself, web/web.carp
loads carpentry-org/utf8 directly utf8.carp itself, web/web.carp

The intersection of "loads json" and "uses UTF8" is web alone, and web loads the library itself at web.carp:34 (utf8.carp@0.1.0) — it is not relying on json to pull it in. llm loads json and never mentions UTF8. That reproduces your table exactly.

One honest caveat on scope: I could only check the 47 repos cloned here, where your sweep read all 64 via the API. For the remaining 17 I am relying on your evidence rather than confirming it — though reading contents through the API is the more authoritative method anyway, given the code-search under-reporting you documented.

grep -rnE 'UTF8|Rune' --include='*.carp' over the whole repo at branch HEAD returns nothing, so no call site survives the removed load.

No changelog entry needed: the repo has none and the change has no API surface.

Verdict: merge

Two dead lines, the transitive-consumer risk checked from both directions and clear, full suite green locally and on both runners. This also unpins every json consumer from a stale utf8.carp@0.0.7, which is a real if quiet win.

@hellerve
hellerve merged commit 4018285 into main Jul 21, 2026
2 checks passed
@hellerve
hellerve deleted the claude/drop-dead-utf8-load branch July 21, 2026 07:40
@carpentry-agent carpentry-agent Bot mentioned this pull request Aug 9, 2026
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