Skip to content

Onboard repository to Copilot cloud agent#30

Draft
Copilot wants to merge 1 commit into
mainfrom
copilot/add-copilot-instructions-md
Draft

Onboard repository to Copilot cloud agent#30
Copilot wants to merge 1 commit into
mainfrom
copilot/add-copilot-instructions-md

Conversation

Copy link
Copy Markdown

Copilot AI commented May 26, 2026

Adds the two files needed to make the Copilot cloud agent productive on first contact with this repo.

.github/copilot-instructions.md

Comprehensive reference the agent reads before every session:

  • Architecture — Django 5.2 API + React 19 SPA structure, FeatureStore singleton (features_and_index.npz not in git, mocked in tests), PostgreSQL pg_trgm requirement, URL/serializer conventions
  • Environment variables — table of which vars are required for tests vs production (YOUTUBE_API_KEY is exempt during manage.py test)
  • Commands — backend (coverage run manage.py test, min 80%), frontend (npm run build/lint), migrations
  • Testing conventionsAPITestCase + factory_boy, mock targets (rec.recommend, FeatureStore), reset_sequence in tearDownClass
  • Endpoint addition checklist — model → serializer → view → url → test → @extend_schema
  • Common errors & workarounds — missing .npz, missing pg_trgm extension, FeatureStore reinitialization error, missing YOUTUBE_API_KEY

.github/workflows/copilot-setup-steps.yml

Pre-warms the agent's environment so it can run tests immediately without trial-and-error dependency discovery:

  • postgres:17 service container with health check
  • Python 3.13.13 + requirements-test.txt (pip-cached)
  • CREATE EXTENSION IF NOT EXISTS pg_trgm via psql
  • python manage.py migrate
  • Node 24 + npm ci in frontend/ (npm-cached)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds initial onboarding assets so the Copilot cloud agent can understand the repo structure/conventions and pre-warm a runnable dev/test environment (PostgreSQL + Python + Node) on first contact.

Changes:

  • Add .github/copilot-instructions.md with architecture notes, env vars, commands, and testing/endpoint conventions.
  • Add .github/workflows/copilot-setup-steps.yml to provision Postgres, install backend/frontend deps, enable pg_trgm, and run migrations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
.github/copilot-instructions.md Adds a repo-specific reference for architecture, env vars, commands, and conventions for agent sessions.
.github/workflows/copilot-setup-steps.yml Adds a GitHub Actions workflow to pre-install dependencies and prepare Postgres/migrations for quick agent test runs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- **Not committed to git.** Required for `/api/v1/recommend/` and `/api/v1/tracks/<mbid>/features/` endpoints.
- Loaded once as a singleton (`FeatureStore` in `recommend_api/services/recommender.py`) using `mmap_mode="r"` for efficiency.
- Contains: `feature_matrix`, `feature_matrix_raw` (debug only), `feature_names`, `mbids` (V16 UUID bytes), `years`, `genre_dortmund`, `genre_rosamerica`.
- If the file is missing at startup, the service logs a warning and raises `FileNotFoundError` on the first recommendation request (returns HTTP 503).

### Database
- PostgreSQL 17 with the `pg_trgm` extension (required for `GinIndex`/`GistIndex` trigram search on track/artist/album names).
- Full-text search uses Django's `SearchVectorField` (populated during ingest and updated via `update search_vector` on track create).
DJANGO_DEBUG=True
```

CI uses a `postgres:17` service container. The `django` user must have `CREATEDB` permission for Django's test DB creation.
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.

Make AI code reviews more insightful by defining custom instructions

3 participants