On the line it’s about
Each finding is an inline comment with its severity, an explanation and a fix in words. A small, exact fix comes as a suggestion you can commit.
src/export/pages.ts+4 −0| @@ -8,0 +9,4 @@ export const PAGE_SIZE = 500; | ||
| 9 | Added: export function pageCount(total, pageSize = PAGE_SIZE) { | |
| 10 | Added: if (total === 0) return 0; | |
| 11 | Added: return Math.floor(total / pageSize); | |
MajorThe export leaves out the last page.
Math.floor rounds the page count down, so the rows after the last full page aren’t exported when the total isn’t a multiple of the page size. Round up instead.
Removed: return Math.floor(total / pageSize);Added: return Math.ceil(total / pageSize);
| 12 | Added: } |
MajorRetries can charge a customer twice.
retryCharge() makes a new idempotency key on every attempt. When the gateway takes a charge but answers with an error, a 504 from its proxy say, the next attempt has a new key and is charged as a second payment. Create the key once, before the loop.