1---2name: eng-observability3description: Design every change with traceability, diagnostics, and fast incident triage in mind across mobile, web, and web3 stacks.4---56# Observability and Debugging Discipline78## Intent9- Make it trivial to answer “what is happening” and “why” without attaching a debugger in production.10- Ensure logs, metrics, events, and traces capture user intent, environment, and failure context while protecting sensitive data.1112## Guiding Principles131. Prefer structured logs + correlation IDs over ad-hoc strings.142. Emit signals at every boundary (client, API, worker, contract invocation).153. Include context (user/session/network/chain) necessary to reproduce issues.164. Keep signal cost reasonable—throttle chatty paths, sample intelligently.175. Build fast local debugging loops (trace replay, state inspectors, dev wallets).1819## Workflow201. Identify critical paths affected and define success/error signals per path.212. Add/extend tracing spans or log blocks with consistent field names.223. Validate observability locally by simulating successes, errors, and timeouts; ensure signals reach the sink (console, APM, analytics, chain explorer).234. Document dashboards, queries, or CLI commands useful for post-deploy verification.245. For on-chain logic, emit events with canonical schema so downstream indexers can consume them.2526## Verification27- Run the code with verbose logging/tracing enabled; inspect outputs for clarity and privacy.28- Confirm metrics/counters appear where expected (APM, telemetry pipeline, analytics, chain explorer).29- Dry-run incident response: can you locate a test failure or simulated outage using only emitted signals? If not, iterate.