fix(codegen): guard wire-spec generator on empty schema cache#1778
Merged
Conversation
…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>
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
schemas/cache/is gitignored and not yet downloaded), running the build beforenpm run sync-schemascausesgenerate-wire-spec-fieldsto overwrite the committedsrc/lib/server/wire-spec-fields.generated.tswith an empty stub.tscfor every consuming module until the dev manually re-syncs.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 buildagainst a populated schema cache: codegen behaves as before (idempotent write).npm run buildagainst an empty schema cache + pre-existing populated generated file: codegen short-circuits, logs skip message,tsc --noEmitclean.prettier --checkclean.