Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 23, 2025

The API/CLI lacked visibility into runtime configuration, making it difficult to debug mode/auth/project issues without inspecting code or environment variables.

Changes

  • Startup banner: Logs MUSIC_GEN_MODE, API key status (yes/no), GCP project/region at API startup. No secrets in logs.

  • GET /config endpoint: Returns safe config snapshot without credentials:

    {
      "mode": "simulate",
      "region": "us-central1",
      "project": "my-project",
      "presets_available": ["rock_anthem", "jazz_smooth", ...],
      "auth_enabled": true
    }
  • Structured validation errors: Pydantic returns field-specific 422 errors with location and constraints for duration/temperature validation.

  • Makefile: Targets for venv, install, test, api, cli-help workflows.

  • UTF-8 logging: Configured stdout reconfigure for emoji/international character support.

  • Updated README: Added Makefile usage, expected CLI outputs, /config endpoint docs.

Technical notes

  • Replaced deprecated @app.on_event("startup") with lifespan context manager
  • Test fixtures refactored to avoid module reload side effects
  • All existing endpoints unchanged (backward compatible)
Original prompt

You are a coding agent working in the repository "github-dev-sandbox" (Music Track Generator).

Goal: make the API/CLI behavior predictable and self-documenting, especially around environment configuration, without changing core features.

Constraints:

  • Keep current endpoints stable.
  • Do not implement a real Vertex AI music model call yet.
  • No silent fallbacks: print clear logs for mode/auth/config at startup.

Tasks:

  1. Add a startup log banner in api.py that prints:
    • MUSIC_GEN_MODE value
    • whether MUSIC_GEN_API_KEY is set (yes/no only)
    • GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_REGION when in gcp mode
  2. Add a /config endpoint (GET) that returns safe config info:
    • mode, region, project (if any), presets available, auth enabled true/false
    • never return secrets
  3. Improve error handling for /tracks/generate:
    • validate duration range and return a structured 422 error with field names
  4. Add a Makefile with targets:
    • venv, install, test, api, cli-help
  5. Update README with exact commands and expected outputs for simulate mode.

Deliver:

  • A single PR with tests updated/added where needed (pytest).
  • Ensure UTF-8 logs and no secrets in logs.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Dec 23, 2025
Copilot AI and others added 3 commits December 23, 2025 17:29
Co-authored-by: kngms <167722266+kngms@users.noreply.github.com>
Co-authored-by: kngms <167722266+kngms@users.noreply.github.com>
Co-authored-by: kngms <167722266+kngms@users.noreply.github.com>
Copilot AI changed the title [WIP] Add startup logs and config endpoint for API Add startup config logging, /config endpoint, and Makefile Dec 23, 2025
Copilot AI requested a review from kngms December 23, 2025 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants