fix(build): resolve type errors and make OG image generation hermetic#76
Merged
Conversation
The production build (`astro check && astro build`) was failing for two reasons:
1. `astro check` reported 3 TypeScript errors in the `scripts/` tooling:
- `face.ts`: untyped (implicit-any) `createFile` parameter that was also
ignored — now typed `string` and actually used.
- `generate-thumbnail.ts`: OpenAI `input_image` content was missing the
required `detail` field — added `detail: "auto"`.
- `generate-thumbnail.ts`: `Buffer.from()` received the nullable image
result — added a null guard before use.
2. `astro build` failed during OG image generation because Satori fetched the
logo from a remote CDN URL at build time. Switch to embedding the bundled
local `src/images/logo.png` as a base64 data URI so the build is hermetic
and has no external network dependency, mirroring the existing local font
loading pattern.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AQkE4GN3oPKWA2YZcwD1hT
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pnpm build(astro check && astro build) was failing. This PR fixes it so the build completes cleanly end-to-end.There were two distinct failures:
1.
astro check— 3 TypeScript errors inscripts/The recently-added OpenAI tooling didn't type-check, which aborted the build before
astro buildeven ran:scripts/face.ts—createFile(filePath)had an implicit-anyparameter that was also ignored (the body read a module-level path). Typed itstringand used it.scripts/generate-thumbnail.ts— the OpenAIinput_imagecontent item was missing the requireddetailfield (ResponseInputImagerequires it). Addeddetail: "auto".scripts/generate-thumbnail.ts—Buffer.from()was passed the nullable image result (ImageGenerationCall.resultisstring | null). Added a null guard before use.2.
astro build— OG image generationsrc/components/OpenGraph/OG.tsxhardcoded a remote logo URL that Satori fetches and rasterizes at build time. This makes the build depend on external network availability. Switched to embedding the bundled localsrc/images/logo.pngas a base64 data URI, mirroring the existing local font-loading pattern increateImage.ts. The build is now hermetic with no external dependency, and the OG layout/sizing is unchanged (logo is square 1800×1800).Test plan
pnpm astro check→ 0 errors (was 3).pnpm build→ completes successfully; all 71/posts/*-og.pngimages generated with no remote fetch and no Satori "Image size cannot be determined" error. Exit code 0.Out of scope (non-blocking, unchanged)
Pre-existing
z is deprecatedwarnings insrc/content.config.ts, a couple of unused-import hints, and theis:inlinehint inindex.astro— none of these fail the build.🤖 Generated with Claude Code
https://claude.ai/code/session_01AQkE4GN3oPKWA2YZcwD1hT
Generated by Claude Code