Commit b1d04ac
fix(ccusage): dedupe Claude usage without request IDs (#985)
Use message.id as the fallback dedupe key when Claude usage entries do not include requestId. This keeps the existing messageId:requestId key when requestId is present, while allowing third-party Anthropic-compatible and transport paths that omit requestId to avoid counting repeated JSONL writes multiple times.
Add regression coverage for both the hash fallback and daily aggregation with duplicated requestId-less entries.
Co-authored-by: ryoppippi <1560508+ryoppippi@users.noreply.github.com>1 parent f53bbb7 commit b1d04ac
1 file changed
Lines changed: 53 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1173 | 1173 | | |
1174 | 1174 | | |
1175 | 1175 | | |
1176 | | - | |
| 1176 | + | |
1177 | 1177 | | |
1178 | 1178 | | |
1179 | 1179 | | |
1180 | | - | |
1181 | | - | |
1182 | | - | |
| 1180 | + | |
1183 | 1181 | | |
1184 | 1182 | | |
1185 | 1183 | | |
1186 | | - | |
1187 | | - | |
| 1184 | + | |
| 1185 | + | |
1188 | 1186 | | |
1189 | 1187 | | |
1190 | 1188 | | |
| |||
6204 | 6202 | | |
6205 | 6203 | | |
6206 | 6204 | | |
6207 | | - | |
| 6205 | + | |
6208 | 6206 | | |
6209 | 6207 | | |
6210 | 6208 | | |
| |||
6217 | 6215 | | |
6218 | 6216 | | |
6219 | 6217 | | |
6220 | | - | |
| 6218 | + | |
6221 | 6219 | | |
6222 | 6220 | | |
6223 | 6221 | | |
| |||
6519 | 6517 | | |
6520 | 6518 | | |
6521 | 6519 | | |
| 6520 | + | |
| 6521 | + | |
| 6522 | + | |
| 6523 | + | |
| 6524 | + | |
| 6525 | + | |
| 6526 | + | |
| 6527 | + | |
| 6528 | + | |
| 6529 | + | |
| 6530 | + | |
| 6531 | + | |
| 6532 | + | |
| 6533 | + | |
| 6534 | + | |
| 6535 | + | |
| 6536 | + | |
| 6537 | + | |
| 6538 | + | |
| 6539 | + | |
| 6540 | + | |
| 6541 | + | |
| 6542 | + | |
| 6543 | + | |
| 6544 | + | |
| 6545 | + | |
| 6546 | + | |
| 6547 | + | |
| 6548 | + | |
| 6549 | + | |
| 6550 | + | |
| 6551 | + | |
| 6552 | + | |
| 6553 | + | |
| 6554 | + | |
| 6555 | + | |
| 6556 | + | |
| 6557 | + | |
| 6558 | + | |
| 6559 | + | |
| 6560 | + | |
| 6561 | + | |
| 6562 | + | |
| 6563 | + | |
| 6564 | + | |
| 6565 | + | |
| 6566 | + | |
6522 | 6567 | | |
6523 | 6568 | | |
6524 | 6569 | | |
| |||
0 commit comments