Make all the codegen we do incremental - #64331
Wesley Wigham (weswigham) wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Stringer can reuse stale output for package-wide changes, direct Go generation can lose formatter resolution, and duplicate broken test files remain.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (3)
What changed in this PR
Adds hash-based incremental caching and force-regeneration support across repository code generators.
Changes:
- Introduces shared generated-file caching and generator utilities.
- Wraps Go and TypeScript generators with cache-aware entry points.
- Adds extensive code-generation integration tests.
| File | Description |
|---|---|
tsc/internal/vfs/vfsmatch/vfsmatch.go |
Uses cached stringer wrapper. |
tsc/internal/vfs/vfs.go |
Uses cached moq wrapper. |
tsc/internal/testutil/projecttestutil/projecttestutil.go |
Migrates mock generation. |
tsc/internal/stringutil/generate.go |
Consolidates Unicode formatting. |
tsc/internal/stringutil/_scripts/generate-unicode-data.mts |
Caches Unicode outputs. |
tsc/internal/project/project.go |
Migrates stringer generation. |
tsc/internal/ls/autoimport/export.go |
Migrates stringer generation. |
tsc/internal/diagnostics/diagnostics.go |
Uses cached diagnostics generator. |
tsc/internal/core/tristate.go |
Migrates stringer generation. |
tsc/internal/core/scriptkind.go |
Migrates stringer generation. |
tsc/internal/core/languagevariant.go |
Migrates stringer generation. |
tsc/internal/core/compileroptions.go |
Migrates stringer generation. |
tsc/internal/checker/types.go |
Migrates stringer generation. |
tsc/internal/bundled/bundled.go |
Uses cached bundle generator. |
tsc/internal/ast/kind_generated.go |
Updates generated directive. |
tools/scripts/tsc/tsconfig.json |
Extends shared generator config. |
tools/scripts/tsc/schema.ts |
Reuses shared repository root. |
tools/scripts/tsc/generate.ts |
Propagates forced regeneration. |
tools/scripts/tsc/generate-ts-ast.ts |
Caches TypeScript AST outputs. |
tools/scripts/tsc/generate-go-ast.ts |
Caches Go AST outputs. |
tools/scripts/tsc/generate-encoder.ts |
Caches protocol encoder outputs. |
tools/scripts/generatedFile.test.mts |
Adds duplicate root-level tests. |
tools/scripts/generatedFile.mts |
Adds duplicate cache implementation. |
tools/scripts/gen/utils.mts |
Adds shared generator utilities. |
tools/scripts/gen/tsconfig.json |
Configures generator type checking. |
tools/scripts/gen/generateStringer.mts |
Adds cached stringer wrapper. |
tools/scripts/gen/generateMoq.mts |
Adds cached moq wrapper. |
tools/scripts/gen/generateDiagnostics.mts |
Adds cached diagnostics generation. |
tools/scripts/gen/generatedFile.test.mts |
Tests incremental generation. |
tools/scripts/gen/generatedFile.mts |
Implements generated-output caching. |
tools/scripts/gen/generateBundled.mts |
Adds cached library bundling. |
tools/scripts/gen/generateAPI.mts |
Adds cached API generation. |
packages/typescript/scripts/generateSync.ts |
Caches sync API outputs. |
packages/typescript/scripts/generate.ts |
Coordinates package generators. |
packages/typescript/package.json |
Uses unified package generator. |
Herebyfile.mjs |
Adds force handling and cached tasks. |
Files not reviewed (1)
- tsc/internal/ast/kind_generated.go: Generated file
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The cache implementation validates inputs and outputs, handles failed or concurrent input changes safely, supports forced regeneration, and includes broad integration coverage.
Review effort: Balanced
Findings: None
Resolved since last review (3)
Files not reviewed (1)
- tsc/internal/ast/kind_generated.go: Generated file



This PR adds incremental cache wrappers around all of the codegen we perform in the repo, which, experimentally, can cut up to 80% of the time off of some
generatesubtasks if the cached results are reusable. Very useful if you have an agent repeatedly running them just in case it modified a file that affects codegen.