Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Bound time-based feed watermarks to a trusted completed interval
When a feed uses timestamps as incremental cursors, prevent future-dated records or persisted clock skew from moving requests beyond the interval safely observed.
Bad example
| 1 | const watermark = maxTimestamp(records); |
| 2 | await saveWatermark(watermark); |
Explanation (EN)
This makes progress depend on state that is not a safe prerequisite.
Objašnjenje (HR)
Napredak ovisi o stanju koje nije siguran preduvjet.
Good example
| 1 | const upperBound = Math.min(runStartedAt, oldestPageTimestamp); |
| 2 | const watermark = Math.min(maxTimestamp(records), upperBound); |
| 3 | await saveAfterCompleteImport(watermark); |
Explanation (EN)
When a feed uses timestamps as incremental cursors, prevent future-dated records or persisted clock skew from moving requests beyond the interval safely observed.
Objašnjenje (HR)
Za vremenske cursore ogranicavaj buduci watermark prema pouzdanom vremenu dohvatnog intervala. Provjeri i vec spremljeni buduci checkpoint. Zadrzi overlap i spremi checkpoint tek nakon potpunog uspjeha.
Notes (EN)
Apply only to timestamp cursors whose provider semantics allow replay. Bound both saved watermarks and outgoing requests derived from an already future-dated checkpoint. Retain overlap and deterministic deduplication for repeated timestamps. Publish the bounded checkpoint only after the whole traversal and durable write succeed. Test a future record, an existing future checkpoint, stale page timestamps and an empty response. A bounded watermark does not repair future-dated record conflict ordering, which needs its own provider contract.
Bilješke (HR)
Za vremenske cursore ogranicavaj buduci watermark prema pouzdanom vremenu dohvatnog intervala. Provjeri i vec spremljeni buduci checkpoint. Zadrzi overlap i spremi checkpoint tek nakon potpunog uspjeha.
Exceptions / Tradeoffs (EN)
Never numerically clamp opaque sequence tokens or cursors with different provider semantics. Use the provider-defined checkpoint protocol when available. If the trusted time bound or traversal completeness is unknown, report that integration assumption instead of inventing certainty.
Iznimke / Tradeoffi (HR)
Primijeni prema navedenim garancijama izvora i ulozi spremljenog stanja.