Skip to content

fix(render): re-render cards whose image files changed under --incremental, and batch dependency updates - #230

Merged
lnorton89 merged 7 commits into
mainfrom
claude/epic-galileo-sndxei
Dec 2, 2026
Merged

lnorton89 merged 7 commits into
mainfrom
claude/epic-galileo-sndxei

Conversation

@lnorton89

@lnorton89 lnorton89 commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes metaplate render --incremental reusing cards whose image files changed (#229), and batches the pending dependency updates, which every CI run now needs.

Closes #229. Supersedes #231 and #232.

--incremental and image files (#229)

--incremental reused a card after an image file it draws changed under the same path, including files read through fileImageLoader. This happened because inputHash covers copy, plate source, and fonts, but not files read at render time.

  • Recorded reads. Each manifest entry gains inputs: every file the card read while it rendered, with the SHA-256 of its contents. --incremental reuses a card only while each of those files still has that hash. A changed or deleted file makes the card render again.
    • readImageAsset and fileImageLoader report every read, including fileImageLoader calls served from memory.
    • The report goes to a dispatcher on globalThis under a registered symbol, because the CLI bundle and the render module's metaplate/assets import are separate bundles.
    • An AsyncLocalStorage scope attributes each read to the card being rendered.
    • Reads made while the render module loads count for every card.
  • Concurrent renders. Renders running at the same time in one process (through runCli) each keep their own reads: one listener per render claims the reads made in its card scopes.
  • Portable paths. Paths are written relative to the working directory, with ../ for files outside it, so the manifest (published under --out by default) never names the builder's home directory. Only a file on another Windows drive stays absolute.
  • New inputs option. createNodeOg, createEdgeOg, and createTakumiOg take inputs: (copy) => paths for files read with plain fs.
    • A listed file that cannot be read fails that card.
    • The option's source is part of fingerprint(), and plates gain an inputs(copy) member.
    • RenderInputsOption is exported from metaplate/node, metaplate/edge, and metaplate/takumi.
  • Known limits (documented in docs/render-cli.md):
    • A promise the plate caches itself (logo ??= readImageAsset(...)) records the file only for the card that created it.
    • Remote images and the package files read by emoji/languageFonts loaders are not hashed. revision remains the fix for those.
  • Upgrade note: manifests from earlier versions have no inputs, so the first --incremental build after upgrading renders every image once.

Dependency batch (supersedes #231 and #232)

Both Dependabot PRs failed check:package. So would any CI run now, this PR included: satori 0.64.x was published on 2026-11-30, so a fresh install of the packed tarball selects 0.64.3 instead of the audited 0.63.2.

  • Updates: the development-dependencies group from build(deps-dev): bump the development-dependencies group with 14 updates #232 and github/codeql-action 4.39.5 from ci(deps): bump the github-actions group with 2 updates #231, each at its newest in-range release, plus astro 7.4.14 and @astrojs/node 11.1.15. TypeScript stays on 6.0.x for typescript-eslint 8.
  • Satori 0.64.3 becomes the audited release. The peer range is unchanged.
    • It replaces fflate 0.7.3 (GHSA-px8p-9vwx-vf98) with 0.7.5.
    • It lays out at 1/64 px with pixel snapping, as Chrome does, so cards can shift by about a pixel. The CHANGELOG says so.
    • All tests pass on it, including the probes that pin the lineClamp guard and the Takumi parity budget to Satori's real behavior.
  • Audit advisories already on main. npm audit reported two against development-only packages: cross-spawn 7.0.6 (critical) and minimatch 11.0.3 (high).
    • npm audit fix moves them to 7.1.2 and 11.0.10.
    • The minimatch override floor rises to ^11.0.10.
  • Lockfile fix. Dependabot's lockfile nested @react-router/express under @react-router/serve, where the package verifier does not find it. It is placed at the top level again, with no other change.
  • Socket evidence. The fflate@0.7.3 alerts no longer match the lockfile, so their evidence is re-derived with the importer's rules (unresolved, with the reason), and socket-dispositions.json is rebound to the rewritten report. Scores, alerts, and dispositions are unchanged.

Agent instructions

Adds AGENTS.md, plus a CLAUDE.md that imports it. Coding agents must review their whole branch diff rigorously before reporting work done, committing, or opening a PR, and must treat build warnings as failures.

Test plan

On Linux, Node.js v22.23.5:

  • npm run check passes: lint, duplicates, workflow policy, dependency inventory and Socket dispositions, deployment evidence, release notes, typecheck, typecheck:examples, 1542 tests, build with no declaration-bundle warnings, and pack.
  • npm run check:package passes against the packed tarball, with satori 0.64.3 selected.
  • npm audit --audit-level=high reports 0 vulnerabilities.
  • tests/cli/render-inputs.test.ts and an end-to-end test through the spawned CLI cover recorded and declared inputs, top-level reads, ../ paths, concurrent renders, and a real createNodeOg plate drawing a changed SVG.
  • Manual: the reproduction from --incremental reuses cards when an image file they draw changes (fileImageLoader included) #229 against the built dist/. After the SVG edit, --incremental rendered both cards again and the PNG bytes changed.

Checklist

  • npm run check passes
  • npm run check:package passes
  • Public API or behavior changes are documented in the README.md summary and the relevant docs/ guide
  • Framework examples link to the exact official upstream routing, metadata, build, or deployment reference they implement (no framework examples changed; the hosted examples keep their certified satori 0.63.2 pins)
  • User-facing changes are reflected in CHANGELOG.md under Unreleased. No .github/releases/vX.Y.Z.md exists yet for the next version.
  • New behavior has tests
  • The change does not add generated dist/, coverage, log, or package archive files

Generated by Claude Code

…ental

`metaplate render --incremental` reused a card after an image file it draws
changed under the same path, including files read through fileImageLoader,
because inputHash covers copy, plate source, and fonts but not files read at
render time.

Each manifest entry now records `inputs`: the files the card read while it
rendered, with the SHA-256 of their contents. readImageAsset and
fileImageLoader report every read (including memoized calls) to a recorder
the CLI installs on globalThis under a registered symbol, so the CLI bundle
and a render module's metaplate/assets import share it. An AsyncLocalStorage
scope attributes each read to the card being rendered; reads made while the
module loads count for every card. --incremental reuses a card only while
every recorded file still has its recorded hash.

For files read with plain fs, createNodeOg, createEdgeOg, and createTakumiOg
take an `inputs: (copy) => paths` option whose files are hashed the same way.

Closes #229
… paths

Review fixes for the --incremental inputs tracking:

- Renders running at once in one process (runCli from metaplate/cli) no
  longer clobber each other's recorder. The global recorder is now a
  dispatcher with one listener per render: a read is claimed by the render
  whose card scope it was made in, and a read outside any card is shared by
  all of them. A render finishing leaves the others listening.
- Input files outside the working directory are written as ../ relative
  paths rather than absolute ones, so the manifest (published under --out by
  default) never names the builder's home directory, and cards are reused
  across checkouts. Only a file on another Windows drive stays absolute.
- The inputs error message no longer throws for values JSON cannot write.
- docs: a promise the plate caches itself records its file only for the card
  that created it; share files through fileImageLoader instead.
AGENTS.md tells coding agents to review their whole branch diff like a
maintainer before reporting work done, committing, or opening a pull
request, with the angles that review must cover, the checks to run, and
how to stage commits. CLAUDE.md imports it for Claude Code.
…takumi

The plate definition types reference it, so without a public export the
declaration bundles keep a private reference that can surface as TS2742
in consumer builds.
…d audit Satori 0.64.3

Takes the Dependabot development-dependencies group (#232) and the
github-actions group (#231), each at its newest in-range release:
@react-router/{dev,node,serve} and react-router 8.5.3 in lockstep,
@sveltejs/kit 3.4.1, @sveltejs/adapter-node 6.0.6,
@sveltejs/vite-plugin-svelte 7.3.2, svelte 5.59.2, vite 8.4.0, eslint 10.16.0,
typescript-eslint 8.74.0, vitest 5.1.2, @types/node 26.6.11, @types/react
19.3.3, astro 7.4.14, @astrojs/node 11.1.15, and github/codeql-action 4.39.5.
TypeScript stays on 6.0.x for typescript-eslint 8.

Both Dependabot PRs failed check:package because satori 0.64.x was published
and a fresh install of the packed tarball now selects 0.64.3, not the audited
0.63.2. The audited release moves to 0.64.3, which also replaces fflate 0.7.3
(GHSA-px8p-9vwx-vf98) with 0.7.5 and drops css-box-shadow. Every test passes
on it, including the probes that pin the lineClamp guard and the Takumi parity
budget to Satori's real behavior; the two source comments that name the
probed Satori release say so.

npm audit also reported two advisories against development-only packages
already on main: cross-spawn 7.0.6 (GHSA-ghv9-86vm-4v8m, critical) and
minimatch 11.0.3 (GHSA-cf2h-pxjq-68xw and others, high). npm audit fix moves
them to 7.1.2 and 11.0.10, and the minimatch override floor rises to
^11.0.10 so it cannot resolve to an affected release again.

Dependabot's lockfile left @react-router/express nested under
@react-router/serve, where the package verifier does not look for it; it is
placed at the top level again, as on main, with no other change.

The fflate@0.7.3 alerts in socket-score-report.json no longer match the
lockfile, so their dependency evidence is re-derived with the importer's
rules (unresolved, with the reason), and socket-dispositions.json is rebound
to the rewritten artifact. Scores, alerts, and dispositions are unchanged.
@lnorton89
lnorton89 force-pushed the claude/epic-galileo-sndxei branch from 0b4e246 to 3d0fd6b Compare December 2, 2026 00:43
@lnorton89 lnorton89 changed the title fix(render): re-render cards whose image files changed under --incremental fix(render): re-render cards whose image files changed under --incremental, and batch dependency updates Dec 2, 2026
@lnorton89
lnorton89 merged commit 71fef98 into main Dec 2, 2026
12 checks passed
@lnorton89
lnorton89 deleted the claude/epic-galileo-sndxei branch December 2, 2026 00:46
lnorton89 added a commit that referenced this pull request Dec 2, 2026
fix(render): re-render cards whose image files changed under --incremental, and batch dependency updates
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.

--incremental reuses cards when an image file they draw changes (fileImageLoader included)

2 participants