Add @rushstack/heft-zod-schema-plugin and pilot it on rush-lib's experiments.json#5788
Draft
Add @rushstack/heft-zod-schema-plugin and pilot it on rush-lib's experiments.json#5788
Conversation
…om zod validators Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/f6417dd3-99b5-4eb5-9343-ecf5de6c37c4 Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/f6417dd3-99b5-4eb5-9343-ecf5de6c37c4 Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/f6417dd3-99b5-4eb5-9343-ecf5de6c37c4 Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
iclanton
April 19, 2026 03:22
View session
Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/b7297c08-8212-4a0e-b5fa-f4d4ff39a8db Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
…c; fix shold→should typo Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/b7297c08-8212-4a0e-b5fa-f4d4ff39a8db Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.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.
Pivot the original
experiments.jsonpilot into a dedicated home,@rushstack/rush-schemas, that owns the zod source-of-truth for Rush configuration schemas and emits both the runtime validators and the*.schema.jsonartifacts via@rushstack/heft-zod-schema-plugin.Scope
libraries/rush-schemas(package.json / Heft / rig / eslint / tsconfig); register inrush.json@rushstack/heft-zod-schema-plugininto the new project'sheft.jsonexperiments.zod.tsfrom rush-lib to rush-schemas; rush-lib re-exportsIExperimentsJsonzod-schemastask inlibraries/rush-lib/config/heft.json); rush-lib returns to a vanilla TS+lint pipelinecobuild.zod.ts(small required-fields case;z.inferfor@betainterface)repo-state.zod.ts(small internal state-file case;z.inferfor@internalinterface)build-cache.zod.ts(discriminated-union case; surfaces pitfalls of provider-specificoneOfschemas)libraries/rush-schemas/README.mdrush build --to @rushstack/rush-schemas,rush build --to @microsoft/rush-lib, rush-lib tests (627/627 passing), heft-zod-schema-plugin tests (9/9 passing)parallel_validation(Code Review feedback addressed; CodeQL timed out)Per-schema authoring decisions
experiments@betaAPI; per-property TSDoc must be preserved verbatimcobuildOmit<z.infer<typeof cobuildSchema>, '$schema'>@betabut tiny; collapsing toz.inferkeeps a single source of truthrepo-stateOmit<z.infer<typeof repoStateSchema>, '$schema'>@internalstate file;z.inferis the pragmatic choicebuild-cacheNotable trade-offs surfaced by the four ports
experiments— the consolidation made several pre-existing inconsistencies between the schema descriptions and the interface TSDoc visible side-by-side; harmonized them in this PR.build-cache— the JSON Schema is more restrictive than the runtime TypeScript shape by design (cloud cache providers extend the config object at runtime via plugins). Validators and types are not reconcilable structurally; this is the central pitfall of portingoneOf-style schemas, and the schemas package has to acknowledge it rather than try to pretend otherwise.common/reviews/api/rush-lib.api.mdnow recordsIExperimentsJsonas a re-export rather than an inline declaration. The interface structure is unchanged for downstream consumers; this is the documented trade-off of moving the type into a separate package.Out of scope
*.schema.jsonartifacts. The legacy hand-authored ones inlibraries/rush-lib/src/schemas/remain authoritative; the new package's output is for review/diff during this pilot.oneOf) before committing the whole repo to a pattern.custom-tips.schema.json(already generated from a TS source-of-truth) andchange-file.schema.json/changelog.schema.json(also consumed by@microsoft/rushand external changelog tooling).