Skip to content

fix(codegen): guard wire-spec generator on empty schema cache#1778

Merged
bokelley merged 2 commits into
mainfrom
bokelley/codegen-empty-cache-guard
May 16, 2026
Merged

fix(codegen): guard wire-spec generator on empty schema cache#1778
bokelley merged 2 commits into
mainfrom
bokelley/codegen-empty-cache-guard

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

Summary

  • On a fresh clone (where schemas/cache/ is gitignored and not yet downloaded), running the build before npm run sync-schemas causes generate-wire-spec-fields to overwrite the committed src/lib/server/wire-spec-fields.generated.ts with an empty stub.
  • An empty stub breaks tsc for every consuming module until the dev manually re-syncs.
  • Detect the empty-cache + pre-existing-non-empty-output case and leave the committed file untouched, with a console line explaining the skip.

Background

Originally surfaced during PR #1754 (now closed as superseded by #1753). Carried forward as its own trivial PR per the post-merge expert review.

Test plan

  • npm run build against a populated schema cache: codegen behaves as before (idempotent write).
  • npm run build against an empty schema cache + pre-existing populated generated file: codegen short-circuits, logs skip message, tsc --noEmit clean.
  • prettier --check clean.

bokelley and others added 2 commits May 16, 2026 06:33
…ty cache

When schemas/cache/ is gitignored and not yet downloaded (fresh clone
before sync-schemas), the codegen overwrites the committed
src/lib/server/wire-spec-fields.generated.ts with an empty stub,
breaking tsc for every consuming module until the dev manually
re-syncs. Detect the empty-cache + pre-existing-non-empty-output case
and leave the committed file unchanged, with a console line that
names the skip.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Matches the sibling 'up to date' log line below it. Code reviewer
flagged the consistency nit during PR review.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley bokelley merged commit 286716b into main May 16, 2026
10 checks passed
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