diff --git a/CLAUDE.md b/CLAUDE.md index e6eb067e..f5d0ab20 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -79,28 +79,14 @@ Key Relationships: - `mix test` - Run all tests (automatically creates and migrates test database) - `mix test test/path/to/specific_test.exs` - Run a specific test file - `mix test --failed` - Re-run only previously failed tests -- `mix test --cover` - Run tests with coverage report (generates HTML report in `cover/` directory) +- `mix test --cover` - Run tests with coverage report (view: `open cover/modules_*.html`) - `mix precommit` - **Run before committing**: compiles with warnings as errors, unlocks unused deps, formats code, and runs tests - -**Coverage Target**: 90% minimum (currently configured threshold) -- Coverage reports show line-by-line coverage in `cover/` directory -- View detailed HTML report: `open cover/modules_*.html` -- Current status: 60.40% overall (as of Jan 12, 2026, 6:35 PM) -- Recent improvements (Session 1): - - Towerops.Snmp: 10.87% → 97.83% (+87%) - - Towerops.Snmp.Profiles.NetSnmp: 56.79% → 92.59% (+35.8%) - - Towerops.Monitoring.Supervisor: 21.21% → 63.64% (+42%) - - Towerops.Snmp.Profiles.Cisco: 20.22% → 57.30% (+37%) - - ToweropsWeb.EquipmentLive.Show: 35.51% → 46.38% (+10.87%) +- `mix dialyzer` - Run static type analysis **Coverage Notes**: +- Target: 90% minimum - Protobuf-generated modules (Towerops.Agent.*) show 0% but don't need tests -- Focus areas for improvement (in priority order): - - Towerops.Monitoring context (33.33%) - - SNMP profiles: NetSnmp (56.79%), Base (69.52%), Mikrotik (77.97%) - - LiveView modules: EquipmentLive.Show (35.51%), EquipmentLive.Form (46.73%) - - Accounts modules: UserCredentialController (33.93%), Accounts context (61.82%) - - 0% coverage modules (Admin, WebAuthn, etc.) - may be intentionally untested +- TimescaleDB aggregate tests should be tagged `@tag :skip` (test DB lacks continuous aggregates) ### Database - `mix ecto.create` - Create the database @@ -116,35 +102,20 @@ Key Relationships: ### Application Structure -The application follows standard Phoenix conventions with clear separation between business logic (`lib/towerops/`) and web interface (`lib/towerops_web/`): - -- **Towerops.Application** - OTP application that supervises: - - Telemetry for metrics - - Repo (Ecto) for database - - DNSCluster for service discovery - - PubSub for pub/sub messaging - - Endpoint (web server) - -- **ToweropsWeb** - Main web module that provides `use` macros for: - - `:router` - Route definitions - - `:controller` - Traditional request/response controllers - - `:live_view` - LiveView modules - - `:live_component` - LiveView component modules - - `:html` - Phoenix.Component modules - -### Key Configuration Details +Standard Phoenix conventions with separation between business logic (`lib/towerops/`) and web interface (`lib/towerops_web/`). +**Key Configuration**: - **Binary IDs**: Generators use binary (UUID) primary keys by default (`binary_id: true`) - **Timestamps**: Use `:utc_datetime` for all timestamps -- **Web server**: Uses Bandit adapter (not Cowboy) -- **HTTP client**: Uses `:req` library (Req module) - this is the only approved HTTP client +- **Web server**: Bandit adapter (not Cowboy) +- **HTTP client**: `:req` library (Req module) - this is the only approved HTTP client - **Ecto repos**: `[Towerops.Repo]` ### Web Layer Patterns All LiveViews, LiveComponents, and HTML modules automatically get these imports/aliases via `html_helpers/0`: - `ToweropsWeb.CoreComponents` - Core UI components (`<.button>`, `<.input>`, `<.form>`, etc.) -- `ToweropsWeb.Layouts` - Layout components (aliased, no need to re-alias) +- `ToweropsWeb.Layouts` - Layout components - `Phoenix.LiveView.JS` - Client-side JS commands - Gettext for translations - Verified routes with `~p` sigil @@ -155,34 +126,17 @@ All LiveViews, LiveComponents, and HTML modules automatically get these imports/ - **esbuild**: Bundles JavaScript from `assets/js/app.js` - All vendor scripts/styles must be imported into app.js/app.css - cannot reference external src/href in layouts - No inline `