Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Wire bounded container shutdown to cancellation and owned cleanup
Container signal delivery and application cleanup are separate contracts. Verify both, cancel owned work, and finish within the orchestrator stop budget.
Bad example
| 1 | await runImport(); |
| 2 | process.exit(0); |
Explanation (EN)
Container signal delivery and application cleanup are separate contracts. Verify both, cancel owned work, and finish within the orchestrator stop budget.
Objašnjenje (HR)
Povezi signal s otkazivanjem zahtjeva i cekanja, pa otpusti samo vlastiti lease kad aktivni upisi zavrse. Rok gasenja mora stati unutar vremena koje daje platforma. Provjeri stvarni container.
Good example
| 1 | const stop = new AbortController(); |
| 2 | process.on('SIGTERM', () => stop.abort()); |
| 3 | try { await runImport(stop.signal); } |
| 4 | finally { await releaseOwnedLease(); } |
Explanation (EN)
Use a suitable init process or verified runtime signal wiring. Explicit signal handlers must cancel requests and retry delays, prevent new writes after cancellation, and release only the current owned lease after in-flight writes settle. Add a bounded forced-exit fallback shorter than the orchestrator timeout, with safe diagnostics and a documented lease-expiry recovery path. Test actual signals against the built image. PID 1 behavior depends on installed handlers and runtime behavior, so do not assume every Node PID 1 ignores SIGTERM.
Objašnjenje (HR)
Povezi signal s otkazivanjem zahtjeva i cekanja, pa otpusti samo vlastiti lease kad aktivni upisi zavrse. Rok gasenja mora stati unutar vremena koje daje platforma. Provjeri stvarni container.
Notes (EN)
Use a suitable init process or verified runtime signal wiring. Explicit signal handlers must cancel requests and retry delays, prevent new writes after cancellation, and release only the current owned lease after in-flight writes settle. Add a bounded forced-exit fallback shorter than the orchestrator timeout, with safe diagnostics and a documented lease-expiry recovery path. Test actual signals against the built image. PID 1 behavior depends on installed handlers and runtime behavior, so do not assume every Node PID 1 ignores SIGTERM.
Bilješke (HR)
Povezi signal s otkazivanjem zahtjeva i cekanja, pa otpusti samo vlastiti lease kad aktivni upisi zavrse. Rok gasenja mora stati unutar vremena koje daje platforma. Provjeri stvarni container.
Exceptions / Tradeoffs (EN)
A platform-provided init can replace an image init. Truly stateless one-shot work may need only reliable signal delivery. Never release ownership while delayed writes can still mutate shared state unless fencing makes that safe.
Iznimke / Tradeoffi (HR)
Primijeni u opisanom kontekstu uz navedene iznimke.