Skip to content

fix: rate limits, AI routing, and a type-check gate - #3529

Open
Salazareo wants to merge 1 commit into
mainfrom
DS/metering
Open

fix: rate limits, AI routing, and a type-check gate#3529
Salazareo wants to merge 1 commit into
mainfrom
DS/metering

Conversation

@Salazareo

Copy link
Copy Markdown
Member
  • declare rate + concurrency limits on every route and driver that lacked one
  • add acquireConcurrent for websocket connections and the DAV mount
  • bucket AI models by identity key only; keep resold duplicates of any vendor
  • skip recently-failed provider routes; cap the fallback chain at 3 attempts
  • let full-access access tokens bind a worker to an app their own user owns
  • cache resolved subscriptions so tiered limits don't add a round trip

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 93.52%
⬆️ +0.04%
21580 / 23073
🔵 Statements 91.94%
⬆️ +0.04%
23144 / 25171
🔵 Functions 89.54%
⬆️ +0.10%
3604 / 4025
🔵 Branches 80.63%
⬆️ +0.05%
15645 / 19403
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
extensions/appTelemetry.ts 92.85%
⬆️ +0.26%
87.5%
🟰 ±0%
85.71%
🟰 ±0%
97.67%
⬆️ +0.11%
26, 79, 81, 82
extensions/installedApps.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
extensions/metering.ts 88.23%
⬆️ +0.23%
72.22%
🟰 ±0%
100%
🟰 ±0%
91.3%
⬆️ +0.19%
16, 19, 24-27, 55, 60-64
extensions/whoami.ts 88.4%
🟰 ±0%
76.08%
🟰 ±0%
66.66%
🟰 ±0%
89.55%
🟰 ±0%
82-86, 107-110, 115, 140-142
src/backend/types.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
src/backend/clients/alarm/AlarmClient.ts 99.29%
⬆️ +0.04%
98.82%
⬆️ +0.03%
100%
🟰 ±0%
100%
🟰 ±0%
298
src/backend/clients/alarm/types.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
src/backend/clients/database/SQLBatcher.js 95.03%
🟰 ±0%
86.79%
⬆️ +1.08%
86.36%
🟰 ±0%
96.62%
🟰 ±0%
140, 187, 204, 212, 224, 229, 302, 380
src/backend/clients/database/retriableErrors.ts 100%
🟰 ±0%
90%
⬆️ +2.50%
100%
🟰 ±0%
100%
🟰 ±0%
src/backend/clients/s3/S3Client.ts 99.05%
⬆️ +0.01%
88.31%
⬆️ +0.48%
88.88%
⬆️ +1.38%
99%
🟰 ±0%
89-92
src/backend/controllers/apps/AppController.js 93.24%
⬆️ +0.09%
86.31%
🟰 ±0%
95%
🟰 ±0%
95.07%
⬆️ +0.07%
127, 277, 360, 377, 399, 480-481, 511-512
src/backend/controllers/auth/AuthController.ts 91.41%
⬆️ +0.05%
79.8%
🟰 ±0%
78.51%
🟰 ±0%
92.05%
⬆️ +0.05%
6, 24-26, 32, 33, 34, 38-39, 44, 45, 47, 503-505, 519-521, 649-650, 724-726, 743-745, 888, 957, 1003, 1014, 1028-1036, 1077-1078, 1081-1086, 1120, 1214, 1258-1259, 1279-1283, 1297-1298, 1306-1308, 1310-1312, 1360, 1388-1399, 1474-1476, 1489, 1549-1551, 1585, 1598-1600, 1626-1628, 1659, 1663-1665, 1763, 1898, 1943, 2003, 2016-2019, 2059-2061, 2124-2126, 2138-2140, 2145-2147, 2166, 2185, 2196, 2306-2313, 2351-2355, 2375-2381, 2399, 2430-2432, 2444-2450, 2510-2515, 2589-2591, 2654, 2682, 2723-2725, 2791, 2821, 2981-2983, 2985-2987, 2991-2994, 3007-3010, 3075-3080, 3083-3085, 3112, 3131, 3149, 3167, 3180, 3203, 3215, 3232, 3242, 3253, 3407, 3437-3441, 3450-3452, 3466, 3469-3473, 3548
src/backend/controllers/desktop/DesktopController.js 96.77%
⬆️ +0.05%
87.03%
🟰 ±0%
100%
🟰 ±0%
96.66%
⬆️ +0.05%
87-91, 97-101
src/backend/controllers/drivers/DriverController.ts 86.69%
⬇️ -0.11%
53.09%
🟰 ±0%
60.52%
🟰 ±0%
93.65%
⬇️ -0.06%
6, 13, 16, 24-26, 32-34, 38-39, 43, 44, 45, 46, 47, 152, 240, 293, 441-443, 449, 451-454
src/backend/controllers/fs/FSController.ts 91.95%
🟰 ±0%
75.91%
🟰 ±0%
91.27%
🟰 ±0%
93.42%
🟰 ±0%
6, 24-26, 32, 33, 34, 38-39, 44, 45, 47, 93-101, 284, 366, 404, 410, 415-422, 425, 456-460, 527-531, 551-555, 607-611, 676-678, 697-701, 905, 1178, 1179, 1180, 1196-1198, 1230, 1234, 1266-1268, 1281, 1285, 1293, 1344-1346, 1355-1357, 1363, 1381-1382, 1389-1390, 1401, 1425, 1441, 1445, 1449, 1472, 1528-1530, 1568, 1575-1578, 1583-1585, 1589-1591, 1645-1647, 1731, 1760, 1785, 1826-1830, 1833, 1836, 1880-1883, 1891, 1960-1964, 2017-2019, 2028-2036
src/backend/controllers/fs/LegacyFSController.ts 92.01%
⬆️ +0.01%
80.1%
🟰 ±0%
80.48%
🟰 ±0%
93%
⬆️ +0.01%
95-105, 385-391, 445, 976-977, 1169, 1206, 1267-1269, 1332-1341, 1346-1352, 1360, 1402-1404, 1673, 1738-1748, 1791-1793, 1918, 1974-1975, 1989, 2021-2025, 2030, 2171-2173, 2213-2215, 2358-2363, 2367-2372, 2376-2381, 2417-2423, 2427, 2441, 2449, 2459, 2463, 2484-2485, 2490-2493, 2512-2514, 2526, 2527, 2529, 2560-2570
src/backend/controllers/fs/limits.ts 100% 100% 100% 100%
src/backend/controllers/hosting/HostingController.js 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
src/backend/controllers/notification/NotificationController.ts 80.39%
🟰 ±0%
48.43%
🟰 ±0%
48.14%
🟰 ±0%
90%
🟰 ±0%
6, 24-26, 32, 33, 34, 38-39, 43, 44, 45, 46, 47, 98, 118
src/backend/controllers/oidc/OIDCController.ts 96.42%
🟰 ±0%
81.25%
🟰 ±0%
85.71%
🟰 ±0%
97.19%
🟰 ±0%
82, 86, 208-212, 263, 323, 338, 453-455, 498
src/backend/controllers/peer/PeerController.ts 98.57%
🟰 ±0%
97.72%
🟰 ±0%
100%
🟰 ±0%
98.41%
🟰 ±0%
72
src/backend/controllers/puterai/PuterAIController.ts 97.89%
🟰 ±0%
91.76%
🟰 ±0%
100%
🟰 ±0%
98.67%
🟰 ±0%
1084-1085, 1176-1178, 1274, 1279, 1310-1312, 1653, 1693, 1731, 1791
src/backend/controllers/static/StaticPagesController.ts 100%
🟰 ±0%
86.84%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
src/backend/controllers/system/SystemController.js 92.72%
⬆️ +0.57%
76.59%
🟰 ±0%
100%
🟰 ±0%
94.33%
⬆️ +0.58%
118, 196, 211, 238
src/backend/controllers/webdav/WebDAVController.ts 92.63%
⬇️ -1.44%
81.94%
⬇️ -0.91%
96.77%
⬆️ +0.35%
92.8%
⬇️ -1.18%
89, 96-97, 122-123, 130-131, 246, 263-276, 282-285, 532-534, 699-703, 882
src/backend/controllers/wisp/WispController.ts 93.1%
🟰 ±0%
85%
🟰 ±0%
100%
🟰 ±0%
93.1%
🟰 ±0%
122-124, 150
src/backend/core/http/middleware/rateLimit.js 93.92%
⬆️ +0.46%
85.83%
⬆️ +1.35%
89.36%
⬇️ -1.33%
93.93%
⬆️ +0.42%
65-66, 228-247, 334, 591-594
src/backend/drivers/ai-chat/ChatCompletionDriver.ts 96.63%
⬆️ +2.07%
88.65%
⬆️ +1.03%
100%
🟰 ±0%
97.63%
⬆️ +2.21%
169-172, 290, 320, 334, 367-369, 459-463, 504, 677, 701, 707, 714, 1121
src/backend/drivers/ai-chat/utils/modelRouting.ts 100%
🟰 ±0%
88.88%
⬆️ +3.17%
100%
🟰 ±0%
100%
🟰 ±0%
src/backend/drivers/ai-chat/utils/providerHealth.ts 100% 100% 100% 100%
src/backend/drivers/apps/AppDriver.js 86.29%
⬆️ +0.06%
79.6%
🟰 ±0%
100%
🟰 ±0%
90.59%
⬆️ +0.05%
104, 232-234, 372, 536, 717, 763-765, 772, 774-775, 807, 809, 817, 831-832, 876, 884, 897, 915, 969, 1002-1021, 1063, 1082, 1087, 1103, 1117-1121, 1126, 1152, 1154, 1167-1173, 1178, 1207, 1208, 1209, 1210, 1211, 1233-1241, 1245, 1257, 1258, 1259, 1354-1360, 1363-1369, 1378-1384, 1402, 1428-1432
src/backend/drivers/kv/KVStoreDriver.ts 97.93%
⬆️ +0.02%
98.75%
🟰 ±0%
92.3%
🟰 ±0%
98.55%
⬆️ +0.01%
239, 250-253, 265-268
src/backend/drivers/notification/NotificationDriver.ts 91.52%
⬆️ +0.15%
81.81%
🟰 ±0%
100%
🟰 ±0%
92.98%
⬆️ +0.13%
147-154, 193-195, 214-216, 232
src/backend/drivers/subdomain/SubdomainDriver.ts 96.26%
⬆️ +0.08%
80.46%
⬆️ +0.15%
100%
🟰 ±0%
97.76%
⬆️ +0.04%
500-502, 614-615, 670, 691, 696, 706, 732
src/backend/drivers/workers/WorkerDriver.ts 85.54%
⬆️ +0.09%
78.84%
🟰 ±0%
86%
🟰 ±0%
90.16%
⬆️ +0.07%
94, 106-109, 198, 206, 209-211, 339-341, 369-372, 553-557, 625, 689, 690, 754, 756, 771, 823, 831, 839, 854, 857, 864, 871, 896-903, 932-939, 952, 955, 968, 982, 990, 994, 1023-1038, 1053, 1064-1067, 1087
src/backend/services/auth/AuthService.ts 90.26%
⬆️ +0.11%
74.18%
⬆️ +0.28%
81.48%
🟰 ±0%
94.84%
⬆️ +0.07%
6, 9, 13, 16, 24-26, 32, 33, 34, 38-39, 44, 45, 47, 77, 81, 124-126, 155, 212-214, 246-248, 278, 404-407, 419, 571, 803-807, 816, 889, 891, 933, 950, 976, 1013, 1038, 1040, 1046, 1059-1061, 1088-1090, 1116-1120, 1156, 1171, 1194, 1207, 1209, 1227-1229
src/backend/services/health/ServerHealthService.ts 99.46%
⬆️ +0.25%
96.26%
⬆️ +1.35%
100%
🟰 ±0%
100%
🟰 ±0%
271
src/backend/services/metering/MeteringService.ts 89.87%
⬇️ -0.77%
85.18%
⬇️ -1.88%
89.36%
⬆️ +0.48%
90.81%
⬇️ -0.59%
143-144, 346-367, 517-536, 794-795, 827, 960, 973-975, 1111, 1137, 1172, 1229-1269
src/backend/services/socket/SocketService.ts 89.75%
⬇️ -2.44%
82.35%
⬇️ -3.51%
97.05%
⬆️ +0.63%
93.42%
⬇️ -1.23%
80, 147, 150-152, 167-168, 192-195, 227, 238, 241, 250-251, 254, 259, 269, 295, 360
src/backend/stores/systemKv/SystemKVStore.ts 97.39%
🟰 ±0%
85.25%
🟰 ±0%
100%
🟰 ±0%
98.8%
🟰 ±0%
193-195, 247, 259, 260, 298, 780-781, 889-891, 918, 1103, 1288, 1308
src/backend/stores/systemKv/tableDefinition.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
src/backend/util/identifier.js 100%
🟰 ±0%
85.71%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
Generated in workflow #680 for commit d93ff67 by the Vitest Coverage Report Action

@Salazareo
Salazareo force-pushed the DS/metering branch 2 times, most recently from 94dcc69 to 290024f Compare August 9, 2026 03:19
- declare rate + concurrency limits on every route and driver that lacked one
- add acquireConcurrent for websocket connections and the DAV mount
- bucket AI models by identity key only; keep resold duplicates of any vendor
- skip recently-failed provider routes; cap the fallback chain at 3 attempts
- let full-access access tokens bind a worker to an app their own user owns
- cache resolved subscriptions so tiered limits don't add a round trip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant