Rules Hub
Coding Rules Library
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Re-attach your own connection lifecycle logging when swapping in a shared client
Replacing a hand-rolled client with a shared library deletes the error, reconnecting, and ready handlers you relied on, and the library default rarely reports the same transitions - so the change quietly removes the signal you triage from.
Bad example
| 1 | // Removed our own handlers and took the library's defaults: |
| 2 | await client.init(); |
| 3 | // Library prints on failure: |
| 4 | // [ERROR] Redis client error: <msg> |
| 5 | // [INFO] Falling back to in-memory cache <- untrue: we only use pub/sub |
Explanation (EN)
The inherited message describes a fallback that applies to the cache API this service never calls, so the logs read as degraded-but-working while nothing is being delivered.
Objašnjenje (HR)
Naslijedena poruka opisuje zamjenu koja vrijedi za cache API koji ovaj servis nikad ne poziva, pa logovi izgledaju kao smanjena funkcionalnost dok se zapravo nista ne isporucuje.
Good example
| 1 | await client.init({ |
| 2 | logger: subscriberLogger, // our wording, our levels |
| 3 | }); |
| 4 | client.on("error", (error) => emitError("[subscriber] connection error", { error })); |
| 5 | client.on("reconnecting", () => emitWarn("[subscriber] reconnecting")); |
| 6 | client.on("ready", () => emitInfo("[subscriber] ready")); |
Explanation (EN)
The messages describe what this service actually does, and the connection lifecycle transitions that aid triage are preserved.
Objašnjenje (HR)
Poruke opisuju sto ovaj servis stvarno radi, a prijelazi u zivotnom ciklusu veze koji pomazu trijazi su sacuvani.
Notes (EN)
Diff the log output before and after, not just the code. A migration that removes event handlers is removing observability even when every line of the replacement compiles.
Bilješke (HR)
Usporedi izlaz logova prije i poslije, a ne samo kod. Migracija koja uklanja rukovatelje dogadajima uklanja i vidljivost, cak i kad se svaka linija zamjene uredno prevodi.