René's URL Explorer Experiment


Title: fix(api): report the real rate-limit ceiling on every v1 endpoint by waleedlatif1 · Pull Request #6011 · simstudioai/sim · GitHub

Open Graph Title: fix(api): report the real rate-limit ceiling on every v1 endpoint by waleedlatif1 · Pull Request #6011 · simstudioai/sim

X Title: fix(api): report the real rate-limit ceiling on every v1 endpoint by waleedlatif1 · Pull Request #6011 · simstudioai/sim

Description: Summary Found while testing the v1 export/import endpoints against production — the response headers contradicted each other: x-ratelimit-limit: 200 x-ratelimit-remaining: 399 ← remaining > limit X-RateLimit-Limit reported the bucket's refill rate; X-RateLimit-Remaining reported tokens left in the bucket. createBucketConfig sets maxTokens = refillRate * burstMultiplier, so the two headers described different quantities and remaining routinely exceeded limit. Any client computing used = limit - remaining got a negative number. Now reports the bucket capacity, which is what remaining counts down from. This is in the shared checkRateLimit, so it affected every v1 endpoint — workflows, logs, tables, files, knowledge, audit-logs, copilot. One-line source, one-line fix. Stops publishing rate-limit headers on an authentication failure. That path never reaches the bucket, so the placeholder (limit: 10, remaining: 0) advertised a quota that doesn't exist and told unauthenticated callers they'd been throttled. Missing required fields now name themselves. The shared id schemas used z.string().min(1, 'Workspace ID is required'), but .min(1) only fires for a present-but-empty string — an omitted field fell back to Zod's Invalid input: expected string, received undefined. Adding the message to the z.string() constructor covers both. Affects workspaceId / organizationId / workflowId / fileId across every contract that builds on them. Documents all three headers in the OpenAPI spec as reusable components, including the burst-capacity semantics and their absence on auth failures. They were previously undocumented — only Retry-After was. Type of Change Bug fix Testing Adds the first tests for the v1 middleware (6 cases): limit is capacity not refill rate, remaining <= limit always, zero limit on auth failure and on checker error, consistent headers on 429, and no rate-limit headers on 401. Extends the primitives tests (12 cases) covering omitted vs empty vs valid for all four shared id schemas, plus an assertion that Zod's default wording never leaks. 312 tests pass across app/api/v1/, lib/api/contracts/ and lib/core/rate-limiter/. Typecheck, lint, check:api-validation:strict and the monorepo boundary check all pass. Verified no consumer asserted the old behavior. The header values were confirmed wrong against production before the fix; the corrected values have not yet been observed on a deployed build. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Open Graph Description: Summary Found while testing the v1 export/import endpoints against production — the response headers contradicted each other: x-ratelimit-limit: 200 x-ratelimit-remaining: 399 ← remaining > li...

X Description: Summary Found while testing the v1 export/import endpoints against production — the response headers contradicted each other: x-ratelimit-limit: 200 x-ratelimit-remaining: 399 ← remaining &gt...

Opengraph URL: https://github.com/simstudioai/sim/pull/6011

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:dc571aa4-68c4-ed23-8029-57555cbaa25d
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB026:15DF38:871D35:B8C2F6:6AFB4730
html-safe-noncedc1b767f8ceb37adf7b39e38b4795294b3d200df485113ebf8228f8cf985cb74
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDI2OjE1REYzODo4NzFEMzU6QjhDMkY2OjZBRkI0NzMwIiwidmlzaXRvcl9pZCI6IjQ4NjM3ODc5MjE3NTM5ODI3NjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac4da0b7bb0f25c817338ef9ae6f88a7bfcfb88b566fdf368da75c04000da09879
hovercard-subject-tagpull_request:4154214709
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6011/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altSummary Found while testing the v1 export/import endpoints against production — the response headers contradicted each other: x-ratelimit-limit: 200 x-ratelimit-remaining: 399 ← remaining > li...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneacf7616d06cc051644705b379878c9bb13dc5e70ecf4ffd9b34140f8ac01d7e1
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release26504db649b58525278f77a52b80ba5f10d5f4de
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/6011/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6011%2Ffiles
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%2Fsimstudioai%2Fsim%2Fpull%2F6011%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/6011/files
Reloadhttps://github.com/simstudioai/sim/pull/6011/files
Reloadhttps://github.com/simstudioai/sim/pull/6011/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests199 (199)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
worktree-v1-ratelimit-headershttps://github.com/simstudioai/sim/tree/worktree-v1-ratelimit-headers
Conversation 3 https://github.com/simstudioai/sim/pull/6011
Commits 1 https://github.com/simstudioai/sim/pull/6011/commits
Checks 19 https://github.com/simstudioai/sim/pull/6011/checks
Files changed https://github.com/simstudioai/sim/pull/6011/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6011/files
fix(api): report the real rate-limit ceiling on every v1 endpoint https://github.com/simstudioai/sim/pull/6011/files#top
Show all changes 1 commit https://github.com/simstudioai/sim/pull/6011/files
d9f4e14 fix(api): report the real rate-limit ceiling on every v1 endpoint waleedlatif1 Jul 28, 2026 https://github.com/simstudioai/sim/pull/6011/commits/d9f4e149022ef664df696fb8ba2e91420176f2d7
Clear filters https://github.com/simstudioai/sim/pull/6011/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6011/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6011/files
openapi.json https://github.com/simstudioai/sim/pull/6011/files#diff-612205ed5fc9b224d33e1a4f77c1bedab051de4574c7b2a8b183cc3c6fa26db7
middleware.test.ts https://github.com/simstudioai/sim/pull/6011/files#diff-844914da3ba6667a333ecd270a410535768371b82e7de4c84e75f7624b9f40db
middleware.ts https://github.com/simstudioai/sim/pull/6011/files#diff-92f74d9ee4f123e429cd83a651c51fe276952d40ddd7fea7b0cb32bc48593ffe
primitives.test.ts https://github.com/simstudioai/sim/pull/6011/files#diff-18d8231f79aa855974fcdf44c398fece7eddaad948bba6b3ccf1c7080a4dc385
primitives.ts https://github.com/simstudioai/sim/pull/6011/files#diff-74acbd246ecd57f97189320f8dbdafcd78d0d5150fd1d25da51057ebd06f43f1
apps/docs/openapi.jsonhttps://github.com/simstudioai/sim/pull/6011/files#diff-612205ed5fc9b224d33e1a4f77c1bedab051de4574c7b2a8b183cc3c6fa26db7
View file https://github.com/simstudioai/sim/blob/d9f4e149022ef664df696fb8ba2e91420176f2d7/apps/docs/openapi.json
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6011/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6011/files#diff-612205ed5fc9b224d33e1a4f77c1bedab051de4574c7b2a8b183cc3c6fa26db7
https://github.com/simstudioai/sim/pull/6011/files#diff-612205ed5fc9b224d33e1a4f77c1bedab051de4574c7b2a8b183cc3c6fa26db7
https://github.com/simstudioai/sim/pull/6011/files#diff-612205ed5fc9b224d33e1a4f77c1bedab051de4574c7b2a8b183cc3c6fa26db7
apps/sim/app/api/v1/middleware.test.tshttps://github.com/simstudioai/sim/pull/6011/files#diff-844914da3ba6667a333ecd270a410535768371b82e7de4c84e75f7624b9f40db
View file https://github.com/simstudioai/sim/blob/d9f4e149022ef664df696fb8ba2e91420176f2d7/apps/sim/app/api/v1/middleware.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6011/{{ revealButtonHref }}
apps/sim/app/api/v1/middleware.tshttps://github.com/simstudioai/sim/pull/6011/files#diff-92f74d9ee4f123e429cd83a651c51fe276952d40ddd7fea7b0cb32bc48593ffe
View file https://github.com/simstudioai/sim/blob/d9f4e149022ef664df696fb8ba2e91420176f2d7/apps/sim/app/api/v1/middleware.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6011/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6011/files#diff-92f74d9ee4f123e429cd83a651c51fe276952d40ddd7fea7b0cb32bc48593ffe
https://github.com/simstudioai/sim/pull/6011/files#diff-92f74d9ee4f123e429cd83a651c51fe276952d40ddd7fea7b0cb32bc48593ffe
https://github.com/simstudioai/sim/pull/6011/files#diff-92f74d9ee4f123e429cd83a651c51fe276952d40ddd7fea7b0cb32bc48593ffe
https://github.com/simstudioai/sim/pull/6011/files#diff-92f74d9ee4f123e429cd83a651c51fe276952d40ddd7fea7b0cb32bc48593ffe
https://github.com/simstudioai/sim/pull/6011/files#diff-92f74d9ee4f123e429cd83a651c51fe276952d40ddd7fea7b0cb32bc48593ffe
https://github.com/simstudioai/sim/pull/6011/files#diff-92f74d9ee4f123e429cd83a651c51fe276952d40ddd7fea7b0cb32bc48593ffe
https://github.com/simstudioai/sim/pull/6011/files#diff-92f74d9ee4f123e429cd83a651c51fe276952d40ddd7fea7b0cb32bc48593ffe
apps/sim/lib/api/contracts/primitives.test.tshttps://github.com/simstudioai/sim/pull/6011/files#diff-18d8231f79aa855974fcdf44c398fece7eddaad948bba6b3ccf1c7080a4dc385
View file https://github.com/simstudioai/sim/blob/d9f4e149022ef664df696fb8ba2e91420176f2d7/apps/sim/lib/api/contracts/primitives.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6011/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6011/files#diff-18d8231f79aa855974fcdf44c398fece7eddaad948bba6b3ccf1c7080a4dc385
https://github.com/simstudioai/sim/pull/6011/files#diff-18d8231f79aa855974fcdf44c398fece7eddaad948bba6b3ccf1c7080a4dc385
https://github.com/simstudioai/sim/pull/6011/files#diff-18d8231f79aa855974fcdf44c398fece7eddaad948bba6b3ccf1c7080a4dc385
apps/sim/lib/api/contracts/primitives.tshttps://github.com/simstudioai/sim/pull/6011/files#diff-74acbd246ecd57f97189320f8dbdafcd78d0d5150fd1d25da51057ebd06f43f1
View file https://github.com/simstudioai/sim/blob/d9f4e149022ef664df696fb8ba2e91420176f2d7/apps/sim/lib/api/contracts/primitives.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6011/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6011/files#diff-74acbd246ecd57f97189320f8dbdafcd78d0d5150fd1d25da51057ebd06f43f1
https://github.com/simstudioai/sim/pull/6011/files#diff-74acbd246ecd57f97189320f8dbdafcd78d0d5150fd1d25da51057ebd06f43f1
https://github.com/simstudioai/sim/pull/6011/files#diff-74acbd246ecd57f97189320f8dbdafcd78d0d5150fd1d25da51057ebd06f43f1
Please reload this pagehttps://github.com/simstudioai/sim/pull/6011/files
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

Viewport: width=device-width


URLs of crawlers that visited me.