Skip to content

Conversation

seveibar
Copy link
Contributor

Summary

  • add a /circuit_json endpoint that returns the generated circuit JSON and prefers compressed code when both sources are present
  • expose a styled "Download Circuit JSON" link on the debug page that points to the new endpoint
  • extend the debug page test to confirm the link and download behavior

Testing

  • bunx tsc --noEmit
  • bun test tests/debug-page.test.ts

https://chatgpt.com/codex/tasks/task_b_68ed34188e14832e9a3a4605e6d5e906

Copy link

vercel bot commented Oct 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
svg-tscircuit-com Ready Ready Preview Comment Oct 13, 2025 5:38pm

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines +36 to +41
const circuitJsonDownloadUrl = new URL(ctx.url.toString())
circuitJsonDownloadUrl.pathname = "/circuit_json"
circuitJsonDownloadUrl.searchParams.delete("debug")
if (ctx.compressedCode && ctx.fsMap) {
circuitJsonDownloadUrl.searchParams.set("circuit_source", "code")
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve /api prefix in circuit JSON download link

The download URL is built from ctx.url and then its pathname is overwritten with /circuit_json. Because ctx.url has already had the /api prefix stripped for internal routing, this produces a link to /circuit_json instead of /api/circuit_json. In the deployed Next.js environment the API handler only lives under /api, so clicking the link rendered on /api?debug=1 will 404 and never reach the new endpoint, even though the Bun test passes (it serves the handler at /). The generated URL should retain the original request’s path prefix or explicitly add /api/circuit_json so the download works in production.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant