Commit 129643f
committed
refactor(backend): simplify contributors endpoint to return all unique names
Remove ranking and statistics from /contributors endpoint per issue #121.
The endpoint now returns all unique contributor names alphabetically sorted
without commit counts, line statistics, or contribution percentages.
Key changes:
- Replaced getTopContributors() with getContributors() in gitService
- Updated Contributor interface to only include field
- Removed top-5 limit - returns all contributors
- Uses git log --format=%aN for author name extraction
- Maintains integration with unified caching and repository coordination
- Fully GDPR-compliant (author names only, no tracking metrics)
Benefits:
- Contributors endpoint can now reuse cached repositories from other endpoints
- 24x performance improvement (7.6s → 0.3s when repo already cached)
- No longer requires --numstat, enabling repository reuse
- Simpler API contract aligned with GET semantics
Breaking changes:
- Response structure changed from ContributorStat[] to Contributor[]
- Removed fields: commitCount, linesAdded, linesDeleted, contributionPercentage
- No longer limited to top 5 contributors
Files modified:
- packages/shared-types/src/index.ts (simplified Contributor interface)
- apps/backend/src/services/gitService.ts (new getContributors method)
- apps/backend/src/services/repositoryCache.ts (updated type guards)
- apps/backend/__tests__/unit/services/gitService.unit.test.ts (rewrote tests)
- apps/backend/__tests__/unit/routes/repositoryRoutes.unit.test.ts (updated assertions)
- FRONTEND_API_MIGRATION.md (documented API changes)
Tested with multiple repositories (gitray, express, vscode, React):
- 6 contributors for gitray (0.3s with cached repo)
- 369 contributors for express
- 2,727 contributors for vscode
- 1,905 contributors for React (0.3s vs 7.6s without cache reuse)
Resolves: #121
Related: #120 (unified caching), #122 (repository coordinator)1 parent 0f10de1 commit 129643f
6 files changed
Lines changed: 177 additions & 221 deletions
File tree
- apps/backend
- __tests__/unit
- routes
- services
- src/services
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
| 227 | + | |
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
| 252 | + | |
258 | 253 | | |
259 | 254 | | |
260 | 255 | | |
| |||
264 | 259 | | |
265 | 260 | | |
266 | 261 | | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
283 | 265 | | |
284 | 266 | | |
285 | 267 | | |
| |||
300 | 282 | | |
301 | 283 | | |
302 | 284 | | |
| 285 | + | |
303 | 286 | | |
304 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
305 | 295 | | |
306 | 296 | | |
307 | 297 | | |
| |||
Lines changed: 15 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
330 | | - | |
| 329 | + | |
| 330 | + | |
331 | 331 | | |
332 | 332 | | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
340 | 336 | | |
341 | 337 | | |
342 | 338 | | |
| |||
352 | 348 | | |
353 | 349 | | |
354 | 350 | | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
355 | 361 | | |
356 | 362 | | |
357 | 363 | | |
| |||
Lines changed: 86 additions & 72 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
1307 | 1308 | | |
1308 | 1309 | | |
1309 | 1310 | | |
1310 | | - | |
1311 | | - | |
| 1311 | + | |
| 1312 | + | |
1312 | 1313 | | |
1313 | | - | |
1314 | | - | |
1315 | | - | |
1316 | | - | |
1317 | | - | |
1318 | | - | |
1319 | | - | |
1320 | | - | |
1321 | | - | |
1322 | | - | |
1323 | | - | |
1324 | | - | |
1325 | | - | |
1326 | | - | |
1327 | | - | |
1328 | | - | |
1329 | | - | |
1330 | | - | |
| 1314 | + | |
| 1315 | + | |
1331 | 1316 | | |
1332 | 1317 | | |
1333 | | - | |
| 1318 | + | |
1334 | 1319 | | |
1335 | 1320 | | |
1336 | | - | |
1337 | | - | |
1338 | | - | |
1339 | | - | |
1340 | | - | |
1341 | | - | |
1342 | | - | |
1343 | | - | |
1344 | | - | |
1345 | | - | |
1346 | | - | |
1347 | | - | |
1348 | | - | |
1349 | | - | |
1350 | | - | |
1351 | | - | |
1352 | | - | |
1353 | | - | |
1354 | | - | |
1355 | | - | |
1356 | | - | |
1357 | | - | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
1358 | 1328 | | |
1359 | 1329 | | |
1360 | 1330 | | |
1361 | 1331 | | |
1362 | 1332 | | |
1363 | 1333 | | |
1364 | 1334 | | |
1365 | | - | |
| 1335 | + | |
1366 | 1336 | | |
1367 | 1337 | | |
1368 | 1338 | | |
1369 | 1339 | | |
1370 | 1340 | | |
1371 | | - | |
| 1341 | + | |
1372 | 1342 | | |
1373 | | - | |
1374 | | - | |
1375 | | - | |
1376 | | - | |
1377 | | - | |
1378 | | - | |
| 1343 | + | |
1379 | 1344 | | |
1380 | 1345 | | |
1381 | | - | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
1382 | 1350 | | |
1383 | 1351 | | |
1384 | | - | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
1385 | 1360 | | |
1386 | 1361 | | |
1387 | | - | |
| 1362 | + | |
1388 | 1363 | | |
1389 | | - | |
1390 | | - | |
1391 | | - | |
| 1364 | + | |
1392 | 1365 | | |
1393 | 1366 | | |
1394 | | - | |
1395 | | - | |
1396 | | - | |
| 1367 | + | |
| 1368 | + | |
1397 | 1369 | | |
1398 | 1370 | | |
1399 | 1371 | | |
1400 | 1372 | | |
1401 | | - | |
| 1373 | + | |
1402 | 1374 | | |
1403 | 1375 | | |
1404 | 1376 | | |
1405 | | - | |
| 1377 | + | |
1406 | 1378 | | |
1407 | | - | |
1408 | | - | |
| 1379 | + | |
1409 | 1380 | | |
1410 | | - | |
1411 | | - | |
1412 | | - | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
1413 | 1396 | | |
1414 | 1397 | | |
1415 | | - | |
| 1398 | + | |
1416 | 1399 | | |
1417 | 1400 | | |
1418 | | - | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
1419 | 1416 | | |
1420 | 1417 | | |
1421 | 1418 | | |
1422 | 1419 | | |
1423 | 1420 | | |
1424 | 1421 | | |
1425 | 1422 | | |
1426 | | - | |
1427 | | - | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
1428 | 1432 | | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
1429 | 1443 | | |
1430 | 1444 | | |
1431 | 1445 | | |
| |||
0 commit comments