Skip to content

types(tools/photos): the photo pipeline is TypeScript - #526

Merged
oddharsh merged 1 commit into
mainfrom
types/tools-photos-ts
Aug 24, 2026
Merged

oddharsh merged 1 commit into
mainfrom
types/tools-photos-ts

Conversation

@oddharsh

Copy link
Copy Markdown
Owner

Second slice of tools/. 12 files renamed, specifiers rewritten across 16 more — including the shell scripts that invoke them and the og-cards workflow.

The JSDoc trap was checked first this time, rather than discovered: both casts were converted to real syntax in the same pass, so neither annotation spent a moment inert.

What the types found

All one family — a bag whose keys arrive later:

  • ICON_DEFS entries are spread into sectionTile(prefix, colors, art), and a widened (string | string[])[] has no arity for a spread to satisfy
  • the favicon map, the photo-semantics entries and their out record, and photo-index.json's per-stem shape — which this checker's whole job is to assert, and which json() answers as unknown
  • inject-og-meta's alt is optional, which its own caller already assumed
  • the Fuji recipe card is a flat bag off metadata.json, so its values need stringifying before reaching a template

Two provenance banners were lying

gen-desktop-partial writes its own name and its input's name into the generated lib/desktop.ts and into an HTML comment. Both still said .mjs after the rename. Regenerated, so the file names the generator that actually produced it.

A git lesson worth keeping

git mv here staged the adds while leaving the deletes unstaged, so git ls-files reported both extensions and #520's new coverage check refused a tree where tools/photos/*.mjs still appeared to exist.

The check was right and the working tree was wrong. git add -A settled it — and it's a good sign that the check landed hours before it caught something.

353/353 under bun, 352 under node, photos:check green, route oracle green, six type programs clean, tools baseline still 0.

Second slice. 12 files renamed, specifiers rewritten across 16 more, including
the shell scripts that invoke them and the og-cards workflow.

The JSDoc trap was checked FIRST this time rather than discovered: both casts in
gen-desktop-partial and gen-quadgram-table were converted to real syntax in the
same pass, so neither annotation spent a moment inert.

What the types found, all of it the same family — a bag whose keys arrive later:

  - ICON_DEFS entries are spread into sectionTile(prefix, colors, art), and a
    widened (string | string[])[] has no arity for a spread to satisfy.
  - the favicon map, the photo-semantics entries and their `out` record, and
    photo-index.json's per-stem shape, which this checker's whole job is to
    assert and which json() answers as unknown.
  - inject-og-meta's `alt` is optional, which its own caller already assumed.
  - the Fuji recipe card is a flat bag off metadata.json, so its values need
    stringifying before they reach a template.

TWO PROVENANCE BANNERS WERE LYING. gen-desktop-partial writes its own name and
its input's name into the generated lib/desktop.ts and into an HTML comment, and
both still said .mjs after the rename. Regenerated, so the file now names the
generator that actually produced it.

And a git lesson worth keeping: `git mv` here staged the ADDS while leaving the
DELETES unstaged, so `git ls-files` reported both extensions and #520's coverage
check correctly refused a tree where tools/photos/*.mjs still appeared to exist.
The check was right and the working tree was wrong. `git add -A` settled it.

353/353 under bun, 352 under node, photos:check green, route oracle green, six
type programs clean, tools baseline still 0.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
aadhar-sh 54af920 Aug 24 2026, 01:02 AM

@github-actions

Copy link
Copy Markdown
Contributor

Wire-size diff vs merge base

d2d818a → fc9a82b

Brotli q11, the quality the edge serves. Every number here is deterministic:
an unchanged file produces no row. Advisory — this check fails on nothing.

Client assets

No change. 22 files, 77.74 KiB Brotli total.

Pages

Total Brotli: 531.35 KiB → 531.29 KiB (-0.06 KiB, -0.0%) across 50 files, 46 changed.

No single file moved by 0.13 KiB or more.

Plus 46 files under the 0.13 KiB floor, net -0.06 KiB — usually content-hash churn in /a/ references, counted in the total above.

Worker bundle

No change. 237.91 KiB gzip.

Dictionary deltas (pd/)

146 → 146 deltas, 486.79 KiB → 492.24 KiB (+5.45 KiB).

@oddharsh
oddharsh merged commit 1682f73 into main Aug 24, 2026
7 checks passed
@oddharsh
oddharsh deleted the types/tools-photos-ts branch August 24, 2026 01:03
oddharsh added a commit that referenced this pull request Aug 24, 2026
…named

#526 moved the photo pipeline to TypeScript and says it rewrote "the shell
scripts that invoke them". It got add-photos.sh (check-photo-pipeline.ts) and
missed three:

  extract-photo-metadata.sh  build-exif-index.mjs        -> .ts
  extract-photo-metadata.sh  build-histogram-index.mjs   -> .ts
  hash-thumbnails.sh         build-image-fingerprints.mjs -> .ts

All three throw MODULE_NOT_FOUND, because no file answers to those names any
more. Two of them are the steps that roll the per-photo files into the two
committed indexes, so the failure lands after the expensive work rather than
before it.

This is the same family as the rest of this branch and it is why the branch
exists: a rename that a grep for the old string cannot find, in a pipeline
nobody has run since the moves, so the break sits there looking fine. Worth
noting that the extension is the visible half. The reason a sweep misses these
is that the specifier is assembled from a variable and a literal, which is
gotcha 29's blind spot again.

node 26 runs a .ts file directly (type stripping), verified here, so `node` is
still correct in front of these and only the name was wrong.

Controls, all three run after the change. build-image-fingerprints.ts exits 0
on a clean checkout. The other two exit 1 on a MISSING public/images/meta,
which is the gitignored build output that extract-photo-metadata.sh writes
earlier in the same script, so standalone in a clean tree that is the honest
answer; with the directory present both exit 0 and regenerate exif.json and
histograms.json byte-identically, no drift against the committed copies.
oddharsh added a commit that referenced this pull request Aug 24, 2026
…named (#529)

#526 moved the photo pipeline to TypeScript and says it rewrote "the shell
scripts that invoke them". It got add-photos.sh (check-photo-pipeline.ts) and
missed three:

  extract-photo-metadata.sh  build-exif-index.mjs        -> .ts
  extract-photo-metadata.sh  build-histogram-index.mjs   -> .ts
  hash-thumbnails.sh         build-image-fingerprints.mjs -> .ts

All three throw MODULE_NOT_FOUND, because no file answers to those names any
more. Two of them are the steps that roll the per-photo files into the two
committed indexes, so the failure lands after the expensive work rather than
before it.

This is the same family as the rest of this branch and it is why the branch
exists: a rename that a grep for the old string cannot find, in a pipeline
nobody has run since the moves, so the break sits there looking fine. Worth
noting that the extension is the visible half. The reason a sweep misses these
is that the specifier is assembled from a variable and a literal, which is
gotcha 29's blind spot again.

node 26 runs a .ts file directly (type stripping), verified here, so `node` is
still correct in front of these and only the name was wrong.

Controls, all three run after the change. build-image-fingerprints.ts exits 0
on a clean checkout. The other two exit 1 on a MISSING public/images/meta,
which is the gitignored build output that extract-photo-metadata.sh writes
earlier in the same script, so standalone in a clean tree that is the honest
answer; with the directory present both exit 0 and regenerate exif.json and
histograms.json byte-identically, no drift against the committed copies.

Co-authored-by: Aadharsh Pannirselvam <19518661+oddharsh@users.noreply.github.com>
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