# establish-foundation-standards

## AUDIT (2026-02-20)

Pattern: Missing foundation standards — crates not declared, lint not enforced, observability not specified.

Found 5 gaps across 2 files:
1. Cargo.toml: no `thiserror` dependency (guidelines define TidalError enum without it)
2. Cargo.toml: no `tracing` dependency (no observability crate)
3. Cargo.toml: no `unwrap_used = "deny"` lint (guidelines say no unwrap, nothing enforces it)
4. CODING_GUIDELINES.md Section 10: approved deps list missing `thiserror` and `tracing`
5. CODING_GUIDELINES.md: no Observability/Logging section at all

All 12 `unwrap()` occurrences verified to be inside `#[cfg(test)]` blocks — no production debt.
The 1 `expect()` in `Timestamp::now()` is documented with `# Panics` and is acceptable.

## FIX Log

- [x] Cargo.toml: added `thiserror = "2"` and `tracing = "0.1"` to [dependencies]
- [x] Cargo.toml: added `unwrap_used = "deny"` to [lints.clippy]
- [x] CODING_GUIDELINES.md Section 10: added `thiserror` and `tracing` to approved deps list; removed "logging facades" from the do-not-add list
- [x] CODING_GUIDELINES.md: added Section 11 Observability (tracing spans, instrumentation rules, subscriber policy, event levels)

## VERIFY (2026-02-20)

`cargo clippy` clean — 0 violations after lint addition.
All 12 `unwrap()` instances confirmed in `#[cfg(test)]` blocks (clippy's `unwrap_used` is test-aware).

## ENFORCE

`clippy::unwrap_used = "deny"` in Cargo.toml. Pre-commit hook runs `cargo clippy -D warnings` — any future `unwrap()` in production code fails the commit.

## DOCUMENT

CODING_GUIDELINES.md updated:
- Section 10: `thiserror` and `tracing` in approved deps list
- Section 11 (new): full Observability standard with instrumentation rules, subscriber policy, and log level guidance
Old Section 11 renumbered to Section 12.
