René's URL Explorer Experiment


Title: fix(billing): keep billing a request whose period start moved forward before its first charge by waleedlatif1 · Pull Request #8480 · simstudioai/sim · GitHub

Open Graph Title: fix(billing): keep billing a request whose period start moved forward before its first charge by waleedlatif1 · Pull Request #8480 · simstudioai/sim

X Title: fix(billing): keep billing a request whose period start moved forward before its first charge by waleedlatif1 · Pull Request #8480 · simstudioai/sim

Description: Summary Problem. If a Stripe billing-anchor reset moved a subscription's period start forward between a request's admission and its first cost callback, every cost callback after the first one for that request was refused with a billing-context mismatch. That spend was never billed. Root cause. The first charge stamps the ledger row with the period that is current at that moment, which is the reset period. Later callbacks still carry the period frozen at admission. assertCumulativeUsageLedgerBinding accepted a later stamped period only when it started at or after the admitted period's end. That covers a request that outlives its period, but not an anchor reset, where the new start falls inside the admitted period. Fix. The binding now uses the same forward-only rule as the roll into a new period row: it accepts any stamped period whose start is later than the admitted start. A stamped period that starts earlier than the admitted one is still refused. The upgrade-card subscription read in update-cost now runs under the same 1 s standing deadline as the verdict read. Before, a slow read there could hold the callback past its budget. Behaviour changes A request whose period start moved forward before its first charge keeps billing into the stamped period and is no longer refused. A request admitted after the period its first charge was stamped with is still refused with billing period as the mismatched field. update-cost still answers usageExceeded: false when the verdict read outlasts the standing budget. When the verdict is exceeded but the upgrade-card read runs past the same budget, it keeps usageExceeded: true and falls back to the upgrade_plan card. Before, the upgrade-card read was unbounded. Test plan usage-log.integration.ts against disposable Postgres (bun run test:integration): new case keeps billing a request whose period start moved forward before its first charge fails on the old >= end rule and passes with the fix; refuses a request admitted after the period its first charge was stamped with pins the backward direction. Suite: 19/19 passed. update-cost/route.test.ts: new case keeps the exceeded verdict with the plan-upgrade card when the card read outlasts the callback budget fails before the deadline covers the upgrade read and passes after. Suite: 52 passed, 1 skipped. bun run type-check (apps/sim) Biome check on the changed files bun run check:audits

Open Graph Description: Summary Problem. If a Stripe billing-anchor reset moved a subscription's period start forward between a request's admission and its first cost callback, every cost callback after the first ...

X Description: Summary Problem. If a Stripe billing-anchor reset moved a subscription's period start forward between a request's admission and its first cost callback, every cost callback after th...

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

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:5f2d7725-66ef-3d95-dbf7-0f111c026dd5
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idCE12:EE197:1BC2475:25A3F38:6AFB949E
html-safe-nonce1d92cb6becee5cfbbf9c830cdafbc89e5c01ace5e239fda1ffb831088bea2c21
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTEyOkVFMTk3OjFCQzI0NzU6MjVBM0YzODo2QUZCOTQ5RSIsInZpc2l0b3JfaWQiOiIzNjQzOTMxODA4NTYwMjg4OTI2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac62ebad520b2646ce1014f23e91179e814d02ebffc4cf2b8a702cf4f15dbe29f6
hovercard-subject-tagpull_request:4696552823
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/8480/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 Problem. If a Stripe billing-anchor reset moved a subscription's period start forward between a request's admission and its first cost callback, every cost callback after the first ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None4f01efe06174a5ba6342fd58e42d02295e0675bedbb465d6bef2dbaec8e46556
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
releasea52db8866b6543b4e83730cd6a6b1360f1a9e4dc
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/8480/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F8480%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%2F8480%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/8480/files
Reloadhttps://github.com/simstudioai/sim/pull/8480/files
Reloadhttps://github.com/simstudioai/sim/pull/8480/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests198 (198)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
fix/billing-anchor-reset-first-callbackhttps://github.com/simstudioai/sim/tree/fix/billing-anchor-reset-first-callback
Conversation 14 https://github.com/simstudioai/sim/pull/8480
Commits 2 https://github.com/simstudioai/sim/pull/8480/commits
Checks 32 https://github.com/simstudioai/sim/pull/8480/checks
Files changed https://github.com/simstudioai/sim/pull/8480/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8480/files
fix(billing): keep billing a request whose period start moved forward before its first charge https://github.com/simstudioai/sim/pull/8480/files#top
Show all changes 2 commits https://github.com/simstudioai/sim/pull/8480/files
5a41b18 fix(billing): keep billing a request whose period start moved forward… waleedlatif1 Sep 30, 2026 https://github.com/simstudioai/sim/pull/8480/commits/5a41b182a319ce4174a47f2f6878750ff46ab3f9
ac744d7 fix(billing): keep an exceeded verdict when the upgrade-card read is … waleedlatif1 Sep 30, 2026 https://github.com/simstudioai/sim/pull/8480/commits/ac744d7f57f31c0127170789d415ec87ed4f65bb
Clear filters https://github.com/simstudioai/sim/pull/8480/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8480/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8480/files
route.test.ts https://github.com/simstudioai/sim/pull/8480/files#diff-677bfcaef15030c7faf8ec352470f5316a835307b7e997ca1fac1a9e357b1d59
route.ts https://github.com/simstudioai/sim/pull/8480/files#diff-f3ec9e3eecbe194c2377f2e873f10be432af241ae9be88b693e9fec6699f335b
usage-log.integration.ts https://github.com/simstudioai/sim/pull/8480/files#diff-d2e514f1318ddfc455458154faa0cc2a1a07d587a0568b5adf6e5a1aef4f328f
usage-log.ts https://github.com/simstudioai/sim/pull/8480/files#diff-61e17bbb06140b8753417feb8b60df7a9170f3216b76d314f14d5210cb9e8431
usage-upgrade.ts https://github.com/simstudioai/sim/pull/8480/files#diff-7ead4da0c3d0a477558a9c09aae4281b2d1d36362712829d1f100f3830886364
apps/sim/app/api/billing/update-cost/route.test.tshttps://github.com/simstudioai/sim/pull/8480/files#diff-677bfcaef15030c7faf8ec352470f5316a835307b7e997ca1fac1a9e357b1d59
View file https://github.com/simstudioai/sim/blob/ac744d7f57f31c0127170789d415ec87ed4f65bb/apps/sim/app/api/billing/update-cost/route.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8480/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8480/files#diff-677bfcaef15030c7faf8ec352470f5316a835307b7e997ca1fac1a9e357b1d59
https://github.com/simstudioai/sim/pull/8480/files#diff-677bfcaef15030c7faf8ec352470f5316a835307b7e997ca1fac1a9e357b1d59
apps/sim/app/api/billing/update-cost/route.tshttps://github.com/simstudioai/sim/pull/8480/files#diff-f3ec9e3eecbe194c2377f2e873f10be432af241ae9be88b693e9fec6699f335b
View file https://github.com/simstudioai/sim/blob/ac744d7f57f31c0127170789d415ec87ed4f65bb/apps/sim/app/api/billing/update-cost/route.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8480/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8480/files#diff-f3ec9e3eecbe194c2377f2e873f10be432af241ae9be88b693e9fec6699f335b
https://github.com/simstudioai/sim/pull/8480/files#diff-f3ec9e3eecbe194c2377f2e873f10be432af241ae9be88b693e9fec6699f335b
https://github.com/simstudioai/sim/pull/8480/files#diff-f3ec9e3eecbe194c2377f2e873f10be432af241ae9be88b693e9fec6699f335b
https://github.com/simstudioai/sim/pull/8480/files#diff-f3ec9e3eecbe194c2377f2e873f10be432af241ae9be88b693e9fec6699f335b
apps/sim/lib/billing/core/usage-log.integration.tshttps://github.com/simstudioai/sim/pull/8480/files#diff-d2e514f1318ddfc455458154faa0cc2a1a07d587a0568b5adf6e5a1aef4f328f
View file https://github.com/simstudioai/sim/blob/ac744d7f57f31c0127170789d415ec87ed4f65bb/apps/sim/lib/billing/core/usage-log.integration.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8480/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8480/files#diff-d2e514f1318ddfc455458154faa0cc2a1a07d587a0568b5adf6e5a1aef4f328f
https://github.com/simstudioai/sim/pull/8480/files#diff-d2e514f1318ddfc455458154faa0cc2a1a07d587a0568b5adf6e5a1aef4f328f
apps/sim/lib/billing/core/usage-log.tshttps://github.com/simstudioai/sim/pull/8480/files#diff-61e17bbb06140b8753417feb8b60df7a9170f3216b76d314f14d5210cb9e8431
View file https://github.com/simstudioai/sim/blob/ac744d7f57f31c0127170789d415ec87ed4f65bb/apps/sim/lib/billing/core/usage-log.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8480/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8480/files#diff-61e17bbb06140b8753417feb8b60df7a9170f3216b76d314f14d5210cb9e8431
https://github.com/simstudioai/sim/pull/8480/files#diff-61e17bbb06140b8753417feb8b60df7a9170f3216b76d314f14d5210cb9e8431
Please reload this pagehttps://github.com/simstudioai/sim/pull/8480/files
https://github.com/simstudioai/sim/pull/8480/files#diff-61e17bbb06140b8753417feb8b60df7a9170f3216b76d314f14d5210cb9e8431
apps/sim/lib/billing/usage-upgrade.tshttps://github.com/simstudioai/sim/pull/8480/files#diff-7ead4da0c3d0a477558a9c09aae4281b2d1d36362712829d1f100f3830886364
View file https://github.com/simstudioai/sim/blob/ac744d7f57f31c0127170789d415ec87ed4f65bb/apps/sim/lib/billing/usage-upgrade.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8480/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8480/files#diff-7ead4da0c3d0a477558a9c09aae4281b2d1d36362712829d1f100f3830886364
https://github.com/simstudioai/sim/pull/8480/files#diff-7ead4da0c3d0a477558a9c09aae4281b2d1d36362712829d1f100f3830886364
https://github.com/simstudioai/sim/pull/8480/files#diff-7ead4da0c3d0a477558a9c09aae4281b2d1d36362712829d1f100f3830886364
https://github.com/simstudioai/sim/pull/8480/files#diff-7ead4da0c3d0a477558a9c09aae4281b2d1d36362712829d1f100f3830886364
Please reload this pagehttps://github.com/simstudioai/sim/pull/8480/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.