musiclink/docs/reviews/cli-entrypoints.md

1 KiB

Code Review: CLI Entrypoints

Scope

  • cmd/musiclink/main.go
  • cmd/smoketest/main.go

Findings

Strengths

  • Clean startup flow: load config → init handler → choose Matrix vs Matterbridge → run with signal cancellation.
  • Matrix mode cleanly isolated; mxBot.Close() called after run.
  • Smoke test exercises detector/API/resolver end-to-end with clear output.

⚠️ Issues / Opportunities

  1. Matterbridge close on fatal path

    • If mbBot.Run returns a non-canceled error, log.Fatalf exits before mbBot.Close() runs.
    • Low impact (process exits), but consistent cleanup could be improved by deferring close after construction.
  2. Smoke test hard-fails on external API issues

    • Smoke test exits on any API error (expected), but no retries/backoff.
    • Acceptable for manual runs; document that it depends on idonthavespotify uptime.

Notes

  • Signal handling and shutdown behavior are consistent with a long-running service.
  • No CLI flags for selecting mode beyond config; that matches config-first expectations.