Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
fullstack ruleP1universalStack: universal
data-integritybackend-contractcorrectness
Do not silently transform values the backend owns
Do not coerce backend data (e.g. forcing a negative number positive) without an agreed contract; the backend owns data validity, so confirm before altering it.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetypescript
| 1 | display(formatAbbreviation(Math.abs(value))); // hides legitimately negative values |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // Math.abs only for the abbreviation calc, preserve sign for display |
| 2 | const abbreviated = formatAbbreviation(Math.abs(value)); |
| 3 | display(value < 0 ? `-${abbreviated}` : abbreviated); |
Explanation (EN)
Objašnjenje (HR)