Skip to content

fix(openapi): declare in:path parameters for every {templated} path segment - #5664

Merged
JSONbored merged 2 commits into
mainfrom
fix/openapi-path-params
Jul 14, 2026
Merged

fix(openapi): declare in:path parameters for every {templated} path segment#5664
JSONbored merged 2 commits into
mainfrom
fix/openapi-path-params

Conversation

@JSONbored

@JSONbored JSONbored commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • buildOpenApiSpec() had 27 registerPath() calls whose path templates referenced {owner}/{repo}/{number}/{id}/{login} without a matching request.params schema, so the generated spec never declared formal in: path parameters for those operations.
  • Discovered via Cloudflare Schema Validation import against the live https://loopover.ai/openapi.json — it flagged warning 30046 ("path parameter expected but not found") grouped across the same 27 operations, auto-fixing them client-side but leaving our own source spec incomplete.
  • Adds a regression test asserting every {templated} path segment across all 97 generated paths has a declared in: path parameter (verified it fails without the fix).
  • Also adds npm run cloudflare:schema (scripts/write-cloudflare-schema.ts): the full public openapi.json (~480KB, pretty-printed, full response bodies/component schemas/prose) exceeds Cloudflare's Free-plan zone schema-storage limit (204800 bytes — confirmed via a real "Zone schema storage limit ... exceeded" upload rejection once the path-param warnings above were fixed). Schema Validation only inspects incoming requests, never responses, so this derives a compact (~24KB) variant with the response/prose stripped and now-unreferenced component schemas pruned by reachability.

Test plan

  • npm run test:ci — full local gate, clean (16043 tests passed, 0 failed)
  • npm run ui:openapi:check — regenerated spec matches committed openapi.json
  • Manually confirmed zero remaining path-param gaps across all 97 paths via script
  • New regression test in test/unit/openapi.test.ts verified to fail without the fix, pass with it
  • New test/unit/write-cloudflare-schema.test.ts pins the trimmed output under budget, spec-valid, path-params intact, and components.schemas pruned by real $ref reachability

…egment

buildOpenApiSpec() had 27 registerPath() calls whose path templates
referenced {owner}/{repo}/{number}/{id}/{login} without a matching
request.params schema, so the generated spec never emitted the parameters
those operations need. Cloudflare's Schema Validation flagged this as
warning 30046 (path parameter expected but not found) on import against
https://loopover.ai/openapi.json.

Adds a regression test asserting every templated path segment across all
97 paths has a declared in:path parameter.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
loopover-ui 1b492de Commit Preview URL

Branch Preview URL
Jul 13 2026, 10:47 PM

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 13, 2026
@loopover-orb

loopover-orb Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-14 01:44:10 UTC

6 files · 1 AI reviewer · 2 blockers · readiness 93/100 · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
This PR adds `request: { params: z.object({...}) }` to 27 `registerPath()` calls in `src/openapi/spec.ts` so each `{templated}` path segment gets a corresponding `in: path` parameter in the generated OpenAPI spec, regenerates `openapi.json` accordingly (+438 lines, all mechanical parameter blocks matching the existing path templates), and adds a regression test that walks all 97 generated paths asserting every `{param}` has a declared path parameter. The mapping between path segments and declared params is correct in every hunk shown (owner/repo/number/id/login all line up), the generated JSON diff is consistent with the schema.ts changes, and the new test genuinely exercises the real `buildOpenApiSpec()` output rather than a fabricated payload — it would fail before the fix and pass after. This is a narrow, well-scoped, non-functional (spec-only) correctness fix with good regression coverage.

Nits — 4 non-blocking
  • The PR description doesn't link an eligible open issue in the gittensory repo (only cites an external Cloudflare warning as motivation) — worth confirming this ties to a tracked issue per repo convention.
  • openapi.json and spec.ts are both large generated/near-generated files; consider whether the openapi.json diff could be summarized or verified solely via `npm run ui:openapi:check` in CI rather than requiring full manual diff review.
  • Confirm this PR closes or links a maintainer-authorized issue per repo convention before merging.
  • Nothing functionally to change in src/openapi/spec.ts or the test — the fix is well-targeted at the source layer (schema declarations) rather than patching the generated JSON directly.

Concerns raised — review before merging

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.

2. Maintainer requires a linked issue — Link the relevant issue (for example `Closes #123`) before opening the PR.
Signal Result Evidence
Code review ❌ 2 blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 45 registered-repo PR(s), 36 merged, 321 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 45 PR(s), 321 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Improvement ✅ Minor risk: clean · value: minor — Code changes are accompanied by test evidence.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, Ruby, Go, JavaScript, MDX, Shell, Solidity
  • Official Gittensor activity: 45 PR(s), 321 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
[BETA] Chat with Gittensory

Ask Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @gittensory ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @gittensory chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @gittensory mention with a real question is routed to the closest matching read-only command automatically -- no exact syntax required.

Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands

Visual preview
Route Viewport Before (production) After (this PR's preview) Diff
/ desktop before / after /
/ mobile before / (mobile) after / (mobile)

Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 13, 2026
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.04%. Comparing base (b579eb6) to head (4ef26a1).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5664   +/-   ##
=======================================
  Coverage   95.04%   95.04%           
=======================================
  Files         577      577           
  Lines       45987    45987           
  Branches    14708    14708           
=======================================
  Hits        43707    43707           
  Misses       1527     1527           
  Partials      753      753           
Flag Coverage Δ
shard-1 43.98% <ø> (ø)
shard-2 35.68% <ø> (ø)
shard-3 32.46% <ø> (+0.06%) ⬆️
shard-4 32.87% <ø> (+0.30%) ⬆️
shard-5 31.78% <ø> (-0.01%) ⬇️
shard-6 44.43% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/openapi/spec.ts 99.42% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…hema Validation

The full public openapi.json (~480KB pretty-printed, full response bodies +
component schemas + prose) exceeds Cloudflare's Free-plan zone schema-storage
limit of 204800 bytes (confirmed via a real "Zone schema storage limit ...
exceeded" (code 20400) upload rejection).

Schema Validation only inspects incoming requests, never responses, so
`npm run cloudflare:schema --silent > cloudflare-schema.json` derives a
compact (~24KB) variant: strips response bodies/prose descriptions and
prunes components.schemas down to whatever's still $ref-reachable (nothing,
today, since every request body here is inline Zod rather than a named
ref) — well under budget with real headroom as the API keeps growing.
@JSONbored
JSONbored merged commit ab7dd9b into main Jul 14, 2026
18 checks passed
@JSONbored
JSONbored deleted the fix/openapi-path-params branch July 14, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant