Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Separate optional side effects from required durable work
Keep optional side-effect failures out of the response path only when execution lifetime and error handling are safe; queue work that must complete.
Bad example
| 1 | await repo.update(record); |
| 2 | await storage.deleteImage(oldImageUrl); |
Explanation (EN)
An optional cleanup failure can fail the response after the main update already committed.
Objašnjenje (HR)
Good example
| 1 | await repo.update(record); |
| 2 | void storage.deleteImage(oldImageUrl).catch(reportCleanupFailure); |
Explanation (EN)
This is suitable only for genuinely best-effort work in a runtime that can continue after the response.
Objašnjenje (HR)
Notes (EN)
Separate best-effort latency from durability. Detach optional work only when the runtime can finish it and failure is observed; use a durable queue/outbox when completion is required.
Exceptions / Tradeoffs (EN)
A request or serverless process can end before detached work finishes. Awaiting a call does not automatically roll back a previous database write; transaction boundaries decide that.