Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Determine page completeness from raw upstream hits
Use upstream hit counts or continuation metadata to detect a full or exhausted page. Counts after mapping and filtering may shrink even when more raw hits remain.
Bad example
| 1 | const exhausted = <T>(mapped: T[], requested: number) => mapped.length < requested; |
Explanation (EN)
A dropped hit can falsely signal the end of a page or timestamp group.
Objašnjenje (HR)
Odbačeni rezultat može pogrešno označiti završetak stranice ili grupe timestampova.
Good example
| 1 | const exhausted = (rawCount: number, requested: number) => rawCount < requested; |
Explanation (EN)
The check tracks the query response rather than a lossy projection.
Objašnjenje (HR)
Provjera prati odgovor upita, a ne projekciju koja može odbaciti zapise.
Notes (EN)
Keep cursor boundaries and tie groups consistent with raw pagination. Do not mark a partial backfill complete because projection removed a hit.
Bilješke (HR)
Provjeri potpune podatke i stanje izvora prije odluke o cacheu ili završetku stranice.
Exceptions / Tradeoffs (EN)
If the upstream supplies an authoritative next-page token, prefer that token over inferring completion from counts.
Iznimke / Tradeoffi (HR)
Dodatna provjera nije potrebna ako postojeći ugovor već jamči traženo svojstvo.