René's URL Explorer Experiment


Title: clef-proxy: the upstream half of PR #691's fix has no regression test — and the hardcoded gateway URL makes it untestable · Issue #692 · developing-today/code · GitHub

Open Graph Title: clef-proxy: the upstream half of PR #691's fix has no regression test — and the hardcoded gateway URL makes it untestable · Issue #692 · developing-today/code

X Title: clef-proxy: the upstream half of PR #691's fix has no regression test — and the hardcoded gateway URL makes it untestable · Issue #692 · developing-today/code

Description: Finding PR #691 fixed both halves of #690 in bin/clef-proxy.mjs, but only the client-body half got a regression test. The upstream half — a non-JSON or null/scalar gateway response is reported as an upstream failure preserving the upstre...

Open Graph Description: Finding PR #691 fixed both halves of #690 in bin/clef-proxy.mjs, but only the client-body half got a regression test. The upstream half — a non-JSON or null/scalar gateway response is reported as a...

X Description: Finding PR #691 fixed both halves of #690 in bin/clef-proxy.mjs, but only the client-body half got a regression test. The upstream half — a non-JSON or null/scalar gateway response is reported as a...

Opengraph URL: https://github.com/developing-today/code/issues/692

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"clef-proxy: the upstream half of PR #691's fix has no regression test — and the hardcoded gateway URL makes it untestable","articleBody":"## Finding\n\nPR #691 fixed both halves of #690 in `bin/clef-proxy.mjs`, but only the client-body half got a regression test. The upstream half — a non-JSON or `null`/scalar gateway response is reported as an upstream failure preserving the upstream status instead of throwing into a 500 — has no test that can fail if it regresses, and as written it cannot be tested at all: the gateway URL is hardcoded, so no stub upstream can be injected.\n\n## Evidence\n\n- PR: https://github.com/developing-today/code/pull/691 (merged 2026-10-23T21:39:55Z, merge commit `8e05af24341b321779851bc824177b14cfd57b9f`, commit `02183adb78c00e20fab4bebb2e7100a6f4e58bcc`, fixes #690, now CLOSED)\n- Upstream guard on current main `8e05af24` (`bin/clef-proxy.mjs:157-165`, blob `b61de077` cross-checked via `gh api`): `cfData` starts `null`, `await cfRes.json()` is in its own `try {} catch {}`, and the success check is `cfRes.ok && cfData?.success && cfData.result?.answers`; the failure branch answers `cfRes.status >= 400 ? cfRes.status : 502`.\n- The new test file's own header says the upstream is out of scope (`bin/clef-proxy.test.mjs:4-6`): \"The proxy forwards valid requests to the Cloudflare AI gateway, which these tests never reach: they cover the paths that answer locally\". Its four subtests are health 200, invalid JSON 400, non-object JSON 400, missing token 401 — none reaches the fetch. Verified this run (pr-diff-review): `node --test bin/clef-proxy.test.mjs` passes 5/5 on current main, and reverting only the upstream guard (unguarded `cfRes.json()` / `cfData.success`) would fail none of them.\n- The gateway base is not overridable (`bin/clef-proxy.mjs:141`): `const cfUrl = \\`https://gateway.ai.cloudflare.com/v1/${accountId}/${gatewayId}/workers-ai/run/${model}\\``. Account, gateway and token all come from env/config (`getCredentials`, :56-73), but the host does not, so a test cannot point the proxy at a local stub gateway without a code change first.\n- #690's acceptance criteria required tests only for the local paths (health / invalid JSON 400 / missing token 401), so the issue closed with the upstream behaviour — two of its own acceptance bullets — unpinned. Same pattern as #688 (the untested streaming half of PR #685's design-code-proxy fix).\n\n## Why it matters\n\nThe upstream guard is the half that fires exactly when Cloudflare is misbehaving — an HTML 502/429 page or a malformed gateway body is when clients most need the real upstream status instead of a misleading JSON-parse 500. Today the code is correct; what is missing is the pin that keeps it correct, and the hardcoded gateway host means a future contributor cannot add that pin without first refactoring the URL construction.\n\nSingle-repo: `clef-proxy` and the `gateway.ai.cloudflare.com` URL exist only in this repo (git grep across the local clones of developing-today/opencode, developing-today/openchamber and dezren39/nix finds neither).\n\n## Acceptance criteria\n\n- [ ] The gateway base URL is overridable for tests (e.g. an env var such as `CLEF_PROXY_GATEWAY_BASE_URL` / `CLOUDFLARE_GATEWAY_BASE_URL` defaulting to `https://gateway.ai.cloudflare.com/v1`), or an equivalent fetch/stub injection exists; production behaviour with the override unset is byte-identical.\n- [ ] New tests in `bin/clef-proxy.test.mjs` run the proxy against a stub gateway and cover at least: a non-JSON upstream body with an error status (client gets that status / 502 upstream failure, not a JSON-parse 500), and a `null` (or scalar) upstream JSON body (no throw on `cfData.success`, reported as an upstream failure).\n- [ ] Ablation: with the upstream guard reverted (unguarded `await cfRes.json()` and `cfData.success`), the new tests fail; with the guard in place, the full clef-proxy suite passes (`node --test bin/clef-proxy.test.mjs`).\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-23T21:41:20Z","url":"https://github.com/developing-today/code/issues/692"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b9fad223-8735-cab1-fa3b-d7eeedf33149
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id98E8:572F9:A7CC22:E08C74:6B06412B
html-safe-noncec768584c0e92c4e7bfdadd6b992229c0e89bf2cecfee8b63367c7a738c712118
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OEU4OjU3MkY5OkE3Q0MyMjpFMDhDNzQ6NkIwNjQxMkIiLCJ2aXNpdG9yX2lkIjoiNjcwMjA3NDI1ODQ4MDU3ODg1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaca4d52a54c40e62e63ef9e5baaaf3abb2bdb188cc328d6a1be5ce11e4739d91db
hovercard-subject-tagissue:6005866388
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/692/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3b999a2221f66273ff11d91286ee177ff6620679c2d94267a6715be69a5a9d89/developing-today/code/issues/692
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3b999a2221f66273ff11d91286ee177ff6620679c2d94267a6715be69a5a9d89/developing-today/code/issues/692
og:image:altFinding PR #691 fixed both halves of #690 in bin/clef-proxy.mjs, but only the client-body half got a regression test. The upstream half — a non-JSON or null/scalar gateway response is reported as a...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedezren39
hostnamegithub.com
expected-hostnamegithub.com
None1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652
turbo-cache-controlno-preview
go-importgithub.com/developing-today/code git https://github.com/developing-today/code.git
octolytics-dimension-user_id26439447
octolytics-dimension-user_logindeveloping-today
octolytics-dimension-repository_id627308783
octolytics-dimension-repository_nwodeveloping-today/code
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id627308783
octolytics-dimension-repository_network_root_nwodeveloping-today/code
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseac613d3698d3d8565651455086e1f74da07bf277
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/developing-today/code/issues/692#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fdeveloping-today%2Fcode%2Fissues%2F692
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fdeveloping-today%2Fcode%2Fissues%2F692
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=developing-today%2Fcode
Reloadhttps://github.com/developing-today/code/issues/692
Reloadhttps://github.com/developing-today/code/issues/692
Reloadhttps://github.com/developing-today/code/issues/692
developing-todayhttps://github.com/developing-today
codehttps://github.com/developing-today/code
Codehttps://github.com/developing-today/code
Issues1.1k (1.1k)https://github.com/developing-today/code/issues
Pull requests172 (172)https://github.com/developing-today/code/pulls
Discussionshttps://github.com/developing-today/code/discussions
Actionshttps://github.com/developing-today/code/actions
Projectshttps://github.com/developing-today/code/projects
Wikihttps://github.com/developing-today/code/wiki
Security and qualityhttps://github.com/developing-today/code/security
Insightshttps://github.com/developing-today/code/insights
https://github.com/developing-today/code
New issuehttps://github.com/login?return_to=https://github.com/developing-today/code/issues/692
New issuehttps://github.com/login?return_to=https://github.com/developing-today/code/issues/692
#3172https://github.com/developing-today/code/pull/3172
clef-proxy: the upstream half of PR #691's fix has no regression test — and the hardcoded gateway URL makes it untestablehttps://github.com/developing-today/code/issues/692#top
#3172https://github.com/developing-today/code/pull/3172
https://github.com/dezren39
effort/shttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22effort%2Fs%22
kind/testhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22kind%2Ftest%22
meta/enrichedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22meta%2Fenriched%22
priority/normalhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22priority%2Fnormal%22
source/pr-diff-reviewhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22source%2Fpr-diff-review%22
task/triagehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22task%2Ftriage%22
https://github.com/dezren39
dezren39https://github.com/dezren39
on Oct 23, 2026https://github.com/developing-today/code/issues/692#issue-6005866388
#691https://github.com/developing-today/code/pull/691
#690https://github.com/developing-today/code/issues/690
fix(clef-proxy): malformed client JSON is a 400, not a 500 (#690) #691https://github.com/developing-today/code/pull/691
clef-proxy: invalid client JSON returns 500 instead of 400 — body parse shares the upstream try/catch, non-JSON upstream is masked, and there are no tests #690https://github.com/developing-today/code/issues/690
https://gateway.ai.cloudflare.com/v1/${accountId}/${gatewayId}/workers-ai/run/${model}\``https://gateway.ai.cloudflare.com/v1/$%7BaccountId%7D/$%7BgatewayId%7D/workers-ai/run/$%7Bmodel%7D%5C%60%60
clef-proxy: invalid client JSON returns 500 instead of 400 — body parse shares the upstream try/catch, non-JSON upstream is masked, and there are no tests #690https://github.com/developing-today/code/issues/690
design-code-proxy: the streaming half of PR #685's Content-Length fix has no regression test — the stub never sets Content-Length on SSE responses #688https://github.com/developing-today/code/issues/688
fix(design-code-proxy): don't forward the backend's Content-Length for re-serialized bodies (#684) #685https://github.com/developing-today/code/pull/685
Nexthttps://github.com/developing-today/code/issues/692?timeline_page=1
github-actionshttps://github.com/apps/github-actions
dezren39https://github.com/dezren39
on Oct 23, 2026https://github.com/developing-today/code/issues/692#event-34094037579
dezren39https://github.com/dezren39
task/triagehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22task%2Ftriage%22
source/pr-diff-reviewhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22source%2Fpr-diff-review%22
status/needs-triagehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fneeds-triage%22
on Oct 25, 2026https://github.com/developing-today/code/issues/692#event-34207239230
https://github.com/dezren39
dezren39https://github.com/dezren39
on Oct 26, 2026https://github.com/developing-today/code/issues/692#issuecomment-6412587612
#691https://github.com/developing-today/code/pull/691
#690https://github.com/developing-today/code/issues/690
#688https://github.com/developing-today/code/issues/688
dezren39https://github.com/dezren39
kind/testhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22kind%2Ftest%22
priority/normalhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22priority%2Fnormal%22
effort/shttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22effort%2Fs%22
meta/enrichedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22meta%2Fenriched%22
queue/claimedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22queue%2Fclaimed%22
work/assignedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22work%2Fassigned%22
status/in-progresshttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fin-progress%22
status/needs-triagehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fneeds-triage%22
on Oct 26, 2026https://github.com/developing-today/code/issues/692#event-34242889295
https://github.com/dezren39
dezren39https://github.com/dezren39
on Oct 31, 2026https://github.com/developing-today/code/issues/692#issuecomment-6546928554
clef-proxy: the upstream half of PR #691's fix has no regression test — and the hardcoded gateway URL makes it untestable #692https://github.com/developing-today/code/issues/692
clef-proxy: the upstream half of PR #691's fix has no regression test — and the hardcoded gateway URL makes it untestable #692https://github.com/developing-today/code/issues/692
clef-proxy: the upstream half of PR #691's fix has no regression test — and the hardcoded gateway URL makes it untestable #692https://github.com/developing-today/code/issues/692
https://github.com/dezren39
dezren39https://github.com/dezren39
on Oct 31, 2026https://github.com/developing-today/code/issues/692#issuecomment-6546938128
fix(clef-proxy): malformed client JSON is a 400, not a 500 (#690) #691https://github.com/developing-today/code/pull/691
clef-proxy: the upstream half of PR #691's fix has no regression test — and the hardcoded gateway URL makes it untestable #692https://github.com/developing-today/code/issues/692
dezren39https://github.com/dezren39
work/assignedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22work%2Fassigned%22
queue/claimedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22queue%2Fclaimed%22
status/in-progresshttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fin-progress%22
queue/queuedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22queue%2Fqueued%22
on Oct 31, 2026https://github.com/developing-today/code/issues/692#event-34787912779
https://github.com/dezren39
dezren39https://github.com/dezren39
on Oct 31, 2026https://github.com/developing-today/code/issues/692#issuecomment-6546993179
dezren39https://github.com/dezren39
queue/parkedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22queue%2Fparked%22
status/parkedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fparked%22
status/in-progresshttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fin-progress%22
queue/claimedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22queue%2Fclaimed%22
on Oct 31, 2026https://github.com/developing-today/code/issues/692#event-34788071414
dezren39https://github.com/dezren39
on Oct 31, 2026https://github.com/developing-today/code/issues/692#event-34791861325
Merge pull request #3172 from developing-today/queue/4596-692-clef-pr…https://github.com/developing-today/code/commit/fe62dc72711a795ed370cf23efce2e53102b7949
#3172https://github.com/developing-today/code/pull/3172
fe62dc7https://github.com/developing-today/code/commit/fe62dc72711a795ed370cf23efce2e53102b7949
dezren39https://github.com/dezren39
completedhttps://github.com/developing-today/code/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#3172https://github.com/developing-today/code/pull/3172
on Oct 31, 2026https://github.com/developing-today/code/issues/692#event-34791862080
dezren39https://github.com/dezren39
status/parkedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fparked%22
queue/parkedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22queue%2Fparked%22
work/assignedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22work%2Fassigned%22
on Oct 31, 2026https://github.com/developing-today/code/issues/692#event-34791884610
https://github.com/dezren39
dezren39https://github.com/dezren39
on Oct 31, 2026https://github.com/developing-today/code/issues/692#issuecomment-6547607184
test(clef-proxy): CLEF_PROXY_GATEWAY_BASE seam + upstream guard regression tests (#692) #3172https://github.com/developing-today/code/pull/3172
fe62dc7https://github.com/developing-today/code/commit/fe62dc72711a795ed370cf23efce2e53102b7949
af14242https://github.com/developing-today/code/commit/af1424238a07ed5cbf04939b809ffab5cd963773
test(clef-proxy): CLEF_PROXY_GATEWAY_BASE seam + upstream guard regression tests (#692) #3172https://github.com/developing-today/code/pull/3172
Sign up for freehttps://github.com/signup?return_to=https://github.com/developing-today/code/issues/692
Sign in to commenthttps://github.com/login?return_to=https://github.com/developing-today/code/issues/692
dezren39https://github.com/dezren39
effort/shttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22effort%2Fs%22
kind/testhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22kind%2Ftest%22
meta/enrichedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22meta%2Fenriched%22
priority/normalhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22priority%2Fnormal%22
source/pr-diff-reviewhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22source%2Fpr-diff-review%22
task/triagehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22task%2Ftriage%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.