René's URL Explorer Experiment


Title: fix(billing): atomize usage_log and userStats writes via central recordUsage() by waleedlatif1 · Pull Request #3767 · simstudioai/sim · GitHub

Open Graph Title: fix(billing): atomize usage_log and userStats writes via central recordUsage() by waleedlatif1 · Pull Request #3767 · simstudioai/sim

X Title: fix(billing): atomize usage_log and userStats writes via central recordUsage() by waleedlatif1 · Pull Request #3767 · simstudioai/sim

Description: Summary Central recordUsage() wraps usage_log INSERT + userStats UPDATE in a single Postgres transaction, fixing drift between currentPeriodCost and usage_log All cost mutation paths (workflow execution, copilot, wand) now go through recordUsage() Removed duplicate tool hosting cost logging (logFixedUsage) — tool costs already included in model totals via provider response Cleaned up dead code: skipFixedUsageLog, old helper functions, stale test mocks Type of Change Bug fix Testing All 4557 tests pass Verified no remaining references to removed functions 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 Central recordUsage() wraps usage_log INSERT + userStats UPDATE in a single Postgres transaction, fixing drift between currentPeriodCost and usage_log All cost mutation paths (workflow exe...

X Description: Summary Central recordUsage() wraps usage_log INSERT + userStats UPDATE in a single Postgres transaction, fixing drift between currentPeriodCost and usage_log All cost mutation paths (workflow exe...

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

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:4ed9c385-d229-b38f-57b5-e3a03e9571b4
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id92FE:370E32:EA8982:140929F:6AFB5E54
html-safe-nonce4dd5f5b3f412c4529a448295a6a1757bbb9f5338bfbdd42a1e73b703dad70b55
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MkZFOjM3MEUzMjpFQTg5ODI6MTQwOTI5Rjo2QUZCNUU1NCIsInZpc2l0b3JfaWQiOiIyMTYyOTYzMjAwNTI5NzcyMzYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac5adddcdd526c4347c8fad5693418df9a416ab9734e082b52c3a3a1e69b3ac2cb
hovercard-subject-tagpull_request:3447303550
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/3767/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 Central recordUsage() wraps usage_log INSERT + userStats UPDATE in a single Postgres transaction, fixing drift between currentPeriodCost and usage_log All cost mutation paths (workflow exe...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94
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
release59ef97164c52cf59bd10558ddec9c4f482763988
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/3767/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F3767%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%2F3767%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/3767/files
Reloadhttps://github.com/simstudioai/sim/pull/3767/files
Reloadhttps://github.com/simstudioai/sim/pull/3767/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests197 (197)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
waleedlatif1/billing-metering-fixhttps://github.com/simstudioai/sim/tree/waleedlatif1/billing-metering-fix
Conversation 16 https://github.com/simstudioai/sim/pull/3767
Commits 6 https://github.com/simstudioai/sim/pull/3767/commits
Checks 10 https://github.com/simstudioai/sim/pull/3767/checks
Files changed https://github.com/simstudioai/sim/pull/3767/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/3767/files
fix(billing): atomize usage_log and userStats writes via central recordUsage() https://github.com/simstudioai/sim/pull/3767/files#top
Show all changes 6 commits https://github.com/simstudioai/sim/pull/3767/files
95ea77f fix(billing): atomize usage_log and userStats writes via central reco… waleedlatif1 Mar 25, 2026 https://github.com/simstudioai/sim/pull/3767/commits/95ea77f9d6ae9b1cf67155aa095129d38d1184d7
9e6cc1d fix(billing): address PR review — re-throw errors, guard reserved key… waleedlatif1 Mar 25, 2026 https://github.com/simstudioai/sim/pull/3767/commits/9e6cc1d1f8bcc76b2d9ef78a03b7ec18c2dce286
d1e72b4 chore(lint): fix formatting in hubspot list_lists.ts from staging waleedlatif1 Mar 25, 2026 https://github.com/simstudioai/sim/pull/3767/commits/d1e72b454f3ba3badbc7960b2292ac88625921b1
69ce274 fix(billing): tighten early-return guard to handle empty additionalSt… waleedlatif1 Mar 25, 2026 https://github.com/simstudioai/sim/pull/3767/commits/69ce274bdacab10c712c279ecc8227bc1f46144a
d4b1593 lint waleedlatif1 Mar 25, 2026 https://github.com/simstudioai/sim/pull/3767/commits/d4b159308ab1ee2c1b044e23a15341658e9a1f7a
4135fdc chore(billing): remove implementation-decision comments waleedlatif1 Mar 25, 2026 https://github.com/simstudioai/sim/pull/3767/commits/4135fdc4271978b38f760c02f6acc060934ae3ed
Clear filters https://github.com/simstudioai/sim/pull/3767/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/3767/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/3767/files
route.ts https://github.com/simstudioai/sim/pull/3767/files#diff-f3ec9e3eecbe194c2377f2e873f10be432af241ae9be88b693e9fec6699f335b
route.ts https://github.com/simstudioai/sim/pull/3767/files#diff-08a223d8f6a719c90d783e4d077eddeddb4683e619d18ec27b8e7c9a214b0cc6
usage-log.ts https://github.com/simstudioai/sim/pull/3767/files#diff-61e17bbb06140b8753417feb8b60df7a9170f3216b76d314f14d5210cb9e8431
logger.test.ts https://github.com/simstudioai/sim/pull/3767/files#diff-8c4f5ac108be5428c5d49656f82f56b6b45192e331adf3e402db58e1cda8e064
logger.ts https://github.com/simstudioai/sim/pull/3767/files#diff-c93eef5145bbe011ec0c231c435952a4a5d8f1826332935030595b98b5980ee6
utils.test.ts https://github.com/simstudioai/sim/pull/3767/files#diff-8eabf1c02c2ea4149f157a0f4345ce7273b3f388cd42a32c660e07f72335025b
utils.ts https://github.com/simstudioai/sim/pull/3767/files#diff-e5a8ed3fe51b6470c7acddd9beac4eecb4c915cacc23d40b68b566a998ac121e
list_lists.ts https://github.com/simstudioai/sim/pull/3767/files#diff-15081e5738498474672d10b51e82fb4942792df6171d73e0d0aea4bf470cd67a
index.test.ts https://github.com/simstudioai/sim/pull/3767/files#diff-9ba0f7033f9247e496b4f9e0f46183a13c79b1bb48d721ba4bf042bdd08e4dd0
index.ts https://github.com/simstudioai/sim/pull/3767/files#diff-47ae0066fea628681d98d136239929a240a55aaf3d99ef293c83b3eca7e197c1
chat.ts https://github.com/simstudioai/sim/pull/3767/files#diff-67c743df3365996972b56140065742eb6ed1af80b4c60a58418c23b59a059fc6
types.ts https://github.com/simstudioai/sim/pull/3767/files#diff-183540ce4359174673a854639c5032c16e740cb4951781bf2591b50f1cb68fac
apps/sim/app/api/billing/update-cost/route.tshttps://github.com/simstudioai/sim/pull/3767/files#diff-f3ec9e3eecbe194c2377f2e873f10be432af241ae9be88b693e9fec6699f335b
View file https://github.com/simstudioai/sim/blob/4135fdc4271978b38f760c02f6acc060934ae3ed/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/3767/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/3767/files#diff-f3ec9e3eecbe194c2377f2e873f10be432af241ae9be88b693e9fec6699f335b
https://github.com/simstudioai/sim/pull/3767/files#diff-f3ec9e3eecbe194c2377f2e873f10be432af241ae9be88b693e9fec6699f335b
Please reload this pagehttps://github.com/simstudioai/sim/pull/3767/files
https://github.com/simstudioai/sim/pull/3767/files#diff-f3ec9e3eecbe194c2377f2e873f10be432af241ae9be88b693e9fec6699f335b
apps/sim/app/api/wand/route.tshttps://github.com/simstudioai/sim/pull/3767/files#diff-08a223d8f6a719c90d783e4d077eddeddb4683e619d18ec27b8e7c9a214b0cc6
View file https://github.com/simstudioai/sim/blob/4135fdc4271978b38f760c02f6acc060934ae3ed/apps/sim/app/api/wand/route.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/3767/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/3767/files#diff-08a223d8f6a719c90d783e4d077eddeddb4683e619d18ec27b8e7c9a214b0cc6
https://github.com/simstudioai/sim/pull/3767/files#diff-08a223d8f6a719c90d783e4d077eddeddb4683e619d18ec27b8e7c9a214b0cc6
https://github.com/simstudioai/sim/pull/3767/files#diff-08a223d8f6a719c90d783e4d077eddeddb4683e619d18ec27b8e7c9a214b0cc6
https://github.com/simstudioai/sim/pull/3767/files#diff-08a223d8f6a719c90d783e4d077eddeddb4683e619d18ec27b8e7c9a214b0cc6
https://github.com/simstudioai/sim/pull/3767/files#diff-08a223d8f6a719c90d783e4d077eddeddb4683e619d18ec27b8e7c9a214b0cc6
https://github.com/simstudioai/sim/pull/3767/files#diff-08a223d8f6a719c90d783e4d077eddeddb4683e619d18ec27b8e7c9a214b0cc6
https://github.com/simstudioai/sim/pull/3767/files#diff-08a223d8f6a719c90d783e4d077eddeddb4683e619d18ec27b8e7c9a214b0cc6
https://github.com/simstudioai/sim/pull/3767/files#diff-08a223d8f6a719c90d783e4d077eddeddb4683e619d18ec27b8e7c9a214b0cc6
https://github.com/simstudioai/sim/pull/3767/files#diff-08a223d8f6a719c90d783e4d077eddeddb4683e619d18ec27b8e7c9a214b0cc6
https://github.com/simstudioai/sim/pull/3767/files#diff-08a223d8f6a719c90d783e4d077eddeddb4683e619d18ec27b8e7c9a214b0cc6
Please reload this pagehttps://github.com/simstudioai/sim/pull/3767/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/3767/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.