Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Allow authoritative rebuilds to replace unreadable snapshots
When a full authoritative refresh can reconstruct all data, failure to read an old derived snapshot for comparison must not permanently block rebuilding it.
Bad example
| 1 | const previous = await readSnapshot(); |
| 2 | const incoming = await fetchCompleteSnapshot(); |
| 3 | await publishIfChanged(previous, incoming); |
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 incoming = await fetchCompleteSnapshot(); |
| 2 | let previous = null; |
| 3 | try { previous = await readSnapshot(); } |
| 4 | catch (error) { logSafeRecovery(error); } |
| 5 | if (previous === null || !equal(previous, incoming)) await publishComplete(incoming); |
Explanation (EN)
When a full authoritative refresh can reconstruct all data, failure to read an old derived snapshot for comparison must not permanently block rebuilding it.
Objašnjenje (HR)
Potpuni autoritativni import mora moci zamijeniti neispravnu prethodnu kopiju. Delta i dalje treba ispravnu bazu. Greske izvora, validacije, vlasnistva i objave ne smiju se ignorirati.
Notes (EN)
Apply when old derived data is read only to avoid an unnecessary rewrite. Restrict recovery to that optional read. Fetch, validation, ownership and publication failures still abort without advancing freshness. An empty authoritative result must also replace the corrupt snapshot. Incremental updates still require a valid base and must fail rather than silently treating missing data as empty. Test both empty and populated full replacements, and an incremental failure.
Bilješke (HR)
Potpuni autoritativni import mora moci zamijeniti neispravnu prethodnu kopiju. Delta i dalje treba ispravnu bazu. Greske izvora, validacije, vlasnistva i objave ne smiju se ignorirati.
Exceptions / Tradeoffs (EN)
Do not discard the old state when it contains irreplaceable user changes, when full traversal is not authoritative, or when a read failure means ownership or safety cannot be established. This does not authorize catching failures around the entire import.
Iznimke / Tradeoffi (HR)
Primijeni prema navedenim garancijama izvora i ulozi spremljenog stanja.