diff --git a/CLAUDE.md b/CLAUDE.md index 96cce3a..93987c0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -106,10 +106,15 @@ Tests use comprehensive mocking to prevent external connections: - Write descriptive test names that explain behavior ### Pre-Commit Checklist +**CRITICAL**: NEVER commit or push code with syntax errors or compilation failures. Always validate before committing. + 1. Run `mix format` - ALWAYS do this first -2. Run `mix compile --warnings-as-errors` - ensure no warnings -3. Run `mix test` - ensure all tests pass -4. Only then commit and push your changes +2. Run `mix compile --warnings-as-errors` - ensure no warnings or compilation errors +3. Run `mix test` - ensure all tests pass (at minimum, ensure no syntax/compilation errors) +4. **MANDATORY**: If any step fails, fix the issues before proceeding +5. Only after ALL checks pass should you commit and push your changes + +**NEVER PUSH BROKEN CODE**: Syntax errors, compilation failures, or basic test failures should be fixed immediately before any git operations. Pushing broken code breaks CI/CD pipelines and wastes deployment resources. ## Important Documentation Updates diff --git a/config/test.exs b/config/test.exs index ebea06f..039e77a 100644 --- a/config/test.exs +++ b/config/test.exs @@ -27,6 +27,9 @@ config :aprsme, AprsmeWeb.Endpoint, secret_key_base: "IV9+ENaw9i8xjReRk4sULRvRgsmFVTGQwQGGrf4G+Q/SFMeHBCNWRlPXQ2YvT36R", server: false +# Disable Prometheus telemetry in test mode to avoid port conflicts +config :aprsme, AprsmeWeb.Telemetry, enabled: false + # Disable cleanup scheduler in test environment config :aprsme, :cleanup_scheduler, enabled: false @@ -56,10 +59,6 @@ config :exq, start_on_application: false, mode: :inline -# Disable Prometheus telemetry in test mode to avoid port conflicts -config :aprsme, AprsmeWeb.Telemetry, - enabled: false - # Configure ExVCR config :exvcr, vcr_cassette_library_dir: "test/fixtures/vcr_cassettes", diff --git a/lib/aprsme_web/live/status_live/index.ex b/lib/aprsme_web/live/status_live/index.ex index acaff08..c2af04b 100644 --- a/lib/aprsme_web/live/status_live/index.ex +++ b/lib/aprsme_web/live/status_live/index.ex @@ -324,7 +324,10 @@ defmodule AprsmeWeb.StatusLive.Index do <%= for node_name <- @aprs_status.cluster_info.all_nodes do %>
<%= if node_name == @aprs_status.cluster_info.leader_node do %>
diff --git a/lib/aprsme_web/telemetry.ex b/lib/aprsme_web/telemetry.ex index c371fde..760925a 100644 --- a/lib/aprsme_web/telemetry.ex +++ b/lib/aprsme_web/telemetry.ex @@ -10,21 +10,22 @@ defmodule AprsmeWeb.Telemetry do @impl true def init(_arg) do - children = - if Application.get_env(:aprsme, AprsmeWeb.Telemetry)[:enabled] != false do + children = + if Application.get_env(:aprsme, AprsmeWeb.Telemetry)[:enabled] == false do + [ + # Only telemetry poller in test mode + {:telemetry_poller, measurements: periodic_measurements(), period: 10_000} + ] + + # Telemetry poller will execute the given period measurements + # every 10_000ms. Learn more here: https://hexdocs.pm/telemetry_metrics + else [ - # Telemetry poller will execute the given period measurements - # every 10_000ms. Learn more here: https://hexdocs.pm/telemetry_metrics {:telemetry_poller, measurements: periodic_measurements(), period: 10_000}, # Add reporters as children of your supervision tree. # {Telemetry.Metrics.ConsoleReporter, metrics: metrics()} {TelemetryMetricsPrometheus, [metrics: metrics()]} ] - else - [ - # Only telemetry poller in test mode - {:telemetry_poller, measurements: periodic_measurements(), period: 10_000} - ] end Supervisor.init(children, strategy: :one_for_one)