Skip to content

openapi: 5 repo maintainer-report routes missing from spec (maintainer-noise, ams-miner-cohort, gate-precision, outcome-calibration, activation-preview) #9302

Description

@JSONbored

⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.

⚠️ Required pattern: mirror how GET /v1/repos/{owner}/{repo}/gate-config/effective is documented
in src/openapi/spec.ts — issue #6611 fixed the exact same class of gap for that route.

Context

Five GET /v1/repos/:owner/:repo/* maintainer-report routes in src/api/routes.ts are all live,
maintainer-authenticated, and each already has an MCP tool with its own Zod output shape in
src/mcp/server.ts — but none of the five appears in src/openapi/spec.ts:

  • .../maintainer-noiseloopover_get_maintainer_noise. Its response schema,
    MaintainerNoiseReportSchema, is even already imported into spec.ts and
    registry.register("MaintainerNoiseReport", MaintainerNoiseReportSchema)'d as a component — it is
    simply never attached to a registerPath, so it's orphaned in the components section and
    unreachable from paths.
  • .../ams-miner-cohortloopover_get_ams_miner_cohort. Same situation: AmsMinerCohortComparisonSchema
    is registered as a component but never attached to a path.
  • .../gate-precisionloopover_get_gate_precision (outputSchema: gatePrecisionOutputSchema,
    no OpenAPI schema exists yet).
  • .../outcome-calibrationloopover_get_outcome_calibration (outputSchema: maintainerMeasurementReportOutputSchema, no OpenAPI schema exists yet).
  • .../activation-previewloopover_get_activation_preview (outputSchema: activationPreviewOutputSchema, no OpenAPI schema exists yet).

All five share the same owner/repo path params and maintainer-only auth boundary as their
already-documented sibling .../gate-config/effective and .../live-gate-thresholds (#6611 fixed
this same class of gap for .../gate-config/effective).

Requirements

  • For maintainer-noise and ams-miner-cohort: the response schemas already exist
    (MaintainerNoiseReportSchema, AmsMinerCohortComparisonSchema, already registry.register'd in
    src/openapi/spec.ts) — just add the missing registry.registerPath({...}) entries for
    GET /v1/repos/{owner}/{repo}/maintainer-noise and GET /v1/repos/{owner}/{repo}/ams-miner-cohort.
  • For gate-precision, outcome-calibration, and activation-preview: define new
    z.object({...}) schemas in src/openapi/schemas.ts (GatePrecisionResponseSchema,
    OutcomeCalibrationResponseSchema, ActivationPreviewResponseSchema), using
    gatePrecisionOutputSchema, maintainerMeasurementReportOutputSchema, and
    activationPreviewOutputSchema (the raw Zod shapes already validated in src/mcp/server.ts) as
    the source of truth, registry.register them, then add registerPath entries for their three
    routes.
  • All five paths take owner/repo path params and (where applicable) the same optional
    windowDays query param their MCP tool siblings accept — mirror the request shape
    .../gate-config/effective and .../live-gate-thresholds already use.
  • Schema is the contract — regenerate and commit. Run npm run ui:openapi after the schema/spec
    edits and commit the regenerated apps/loopover-ui/public/openapi.json in this same PR. CI
    enforces this via npm run ui:openapi:check (part of npm run test:ci).

Deliverables

  • registerPath entries added for all five routes in src/openapi/spec.ts.
  • Three new response schemas added to src/openapi/schemas.ts for gate-precision,
    outcome-calibration, and activation-preview, matching their MCP tools' output shapes
    field-for-field.
  • apps/loopover-ui/public/openapi.json regenerated via npm run ui:openapi and committed.
  • npm run ui:openapi:check passes in CI.

All deliverables are required in this one PR — there is no follow-up issue.

Test Coverage Requirements

99%+ Codecov patch target (codecov/patch, unsharded via npm run test:coverage) on any new schema
helper code. Add a regression test asserting all five paths appear in buildOpenApiSpec()'s output
with the correct method and a response schema whose keys match each route's MCP tool output shape.

Expected Outcome

All five maintainer-report routes are documented in GET /openapi.json /
apps/loopover-ui/public/openapi.json, matching what their MCP tool counterparts already validate —
closing the drift for the entire "repo maintainer advisory report" route family in one pass.

Links & Resources

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