Context
scripts/check-openapi-settings-parity.mjs's own header comment (lines 2-6) names both RepositorySettingsSchema and RepoSettingsPreviewSchema (src/openapi/schemas.ts:924) as hand-authored Zod schemas that need drift protection against a "field added to the TS type ... can silently miss the Zod schema forever, with no CI signal." But main() (lines 38-54) only builds and checks extractRepositorySettingsFieldNames/diffFieldSets for RepositorySettingsSchema against src/types.ts's RepositorySettings type — RepoSettingsPreviewSchema has no equivalent check at all.
RepoSettingsPreviewSchema.settings (a nested object, src/openapi/schemas.ts:928 onward) is populated by buildRepoSettingsPreview (src/signals/settings-preview.ts, wired at src/api/routes.ts:3080 via POST /v1/repos/:owner/:repo/settings-preview) — that function's return type (or the relevant subset of fields it actually populates) is the real source of truth this schema needs to stay in sync with, not RepositorySettings directly (the two schemas cover overlapping but not identical field sets).
Requirements
- Add a second field-name extraction + diff check to
check-openapi-settings-parity.mjs (or a sibling script, if that's a cleaner structure) covering RepoSettingsPreviewSchema.settings's field set against buildRepoSettingsPreview's actual return shape in src/signals/settings-preview.ts — investigate that function's return type/interface first to determine the correct TS source of truth (it may be a named return-type interface, or need one extracted if it doesn't already exist as a standalone named type).
- Follow the existing script's structure: a pure extraction function, a pure diff function, both exported and unit-testable, wired into
main() with the same fail-with-actionable-message behavior as the existing RepositorySettingsSchema check.
- Do not change the existing
RepositorySettingsSchema/RepositorySettings check — this issue only adds the missing second check the header comment already promises.
Deliverables
Test Coverage Requirements
99%+ Codecov patch coverage on every changed line and branch, plus test coverage for the new pure functions matching the existing ones' test style.
Expected Outcome
A field added to buildRepoSettingsPreview's return shape (or removed) without a matching RepoSettingsPreviewSchema update now fails CI, closing the exact "no CI signal" gap the script's own header comment already flags — for both schemas it names, not just one.
Links & Resources
scripts/check-openapi-settings-parity.mjs — the existing RepositorySettingsSchema check to mirror. src/openapi/schemas.ts:924 — RepoSettingsPreviewSchema. src/signals/settings-preview.ts — buildRepoSettingsPreview, the real source of truth to diff against.
Context
scripts/check-openapi-settings-parity.mjs's own header comment (lines 2-6) names bothRepositorySettingsSchemaandRepoSettingsPreviewSchema(src/openapi/schemas.ts:924) as hand-authored Zod schemas that need drift protection against a "field added to the TS type ... can silently miss the Zod schema forever, with no CI signal." Butmain()(lines 38-54) only builds and checksextractRepositorySettingsFieldNames/diffFieldSetsforRepositorySettingsSchemaagainstsrc/types.ts'sRepositorySettingstype —RepoSettingsPreviewSchemahas no equivalent check at all.RepoSettingsPreviewSchema.settings(a nested object,src/openapi/schemas.ts:928onward) is populated bybuildRepoSettingsPreview(src/signals/settings-preview.ts, wired atsrc/api/routes.ts:3080viaPOST /v1/repos/:owner/:repo/settings-preview) — that function's return type (or the relevant subset of fields it actually populates) is the real source of truth this schema needs to stay in sync with, notRepositorySettingsdirectly (the two schemas cover overlapping but not identical field sets).Requirements
check-openapi-settings-parity.mjs(or a sibling script, if that's a cleaner structure) coveringRepoSettingsPreviewSchema.settings's field set againstbuildRepoSettingsPreview's actual return shape insrc/signals/settings-preview.ts— investigate that function's return type/interface first to determine the correct TS source of truth (it may be a named return-type interface, or need one extracted if it doesn't already exist as a standalone named type).main()with the same fail-with-actionable-message behavior as the existingRepositorySettingsSchemacheck.RepositorySettingsSchema/RepositorySettingscheck — this issue only adds the missing second check the header comment already promises.Deliverables
RepoSettingsPreviewSchema's TS counterpartmain(), failing CI with an actionable message on driftRepositorySettingsSchematest coverageTest Coverage Requirements
99%+ Codecov patch coverage on every changed line and branch, plus test coverage for the new pure functions matching the existing ones' test style.
Expected Outcome
A field added to
buildRepoSettingsPreview's return shape (or removed) without a matchingRepoSettingsPreviewSchemaupdate now fails CI, closing the exact "no CI signal" gap the script's own header comment already flags — for both schemas it names, not just one.Links & Resources
scripts/check-openapi-settings-parity.mjs— the existingRepositorySettingsSchemacheck to mirror.src/openapi/schemas.ts:924—RepoSettingsPreviewSchema.src/signals/settings-preview.ts—buildRepoSettingsPreview, the real source of truth to diff against.