Skip to content

check-openapi-settings-parity.mjs only checks RepositorySettingsSchema, not RepoSettingsPreviewSchema despite its own header naming both #7011

Description

@JSONbored

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

  • A field-name extraction function for RepoSettingsPreviewSchema's TS counterpart
  • A diff check wired into main(), failing CI with an actionable message on drift
  • Test(s) for the new extraction/diff functions, mirroring the existing RepositorySettingsSchema test coverage

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:924RepoSettingsPreviewSchema. src/signals/settings-preview.tsbuildRepoSettingsPreview, the real source of truth to diff against.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions