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).
backend ruleP2universalStack: node
side-effectsasyncorderingresilience
Collect side-effect inputs and run them after the main work completes
When firing side effects (like deleting images), accumulate their inputs and execute them after the result/transaction wrapper resolves, not interleaved with it.
PR: vinify-backend · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | for (const v of vintages) { |
| 2 | await update(v); |
| 3 | void s3.delete(v.image); // interleaved with the work |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const urls = []; |
| 2 | await process(() => { for (const v of vintages) { update(v); urls.push(v.image); } }); |
| 3 | urls.forEach(u => void s3.delete(u)); |
Explanation (EN)
Objašnjenje (HR)