|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Quick Start for AI Agents |
| 4 | + |
| 5 | +**patchman-engine** is the backend for Red Hat Insights patch management: a REST API and background workers that evaluate which advisories and package updates apply to registered systems. See [README.md](README.md) for user-facing setup. |
| 6 | + |
| 7 | +### Authoritative Documentation |
| 8 | + |
| 9 | +| Topic | Location | |
| 10 | +|--------|----------| |
| 11 | +| Architecture and components | [docs/md/architecture.md](docs/md/architecture.md) | |
| 12 | +| Database layout | [docs/md/database.md](docs/md/database.md) | |
| 13 | +| Local dev, tests, OpenAPI | [README.md](README.md) | |
| 14 | +| Commits, PRs, contribution style | [CONTRIBUTING.md](CONTRIBUTING.md) | |
| 15 | + |
| 16 | +Prefer these sources over guessing when behavior or schema matters. |
| 17 | + |
| 18 | +### Code Discipline |
| 19 | + |
| 20 | +- Match existing **Go style**, package layout, and patterns in the touched area. |
| 21 | +- Keep changes **minimal** and scoped to the task; avoid drive-by refactors. |
| 22 | +- When touching the REST surface or request/response types, consider **OpenAPI** regeneration and any contract consumers. |
| 23 | + |
| 24 | +### Where to Look in the Tree |
| 25 | + |
| 26 | +| Area | Typical paths | |
| 27 | +|------|----------------| |
| 28 | +| HTTP REST API | `manager/` | |
| 29 | +| External messages | `listener/`, topic names in code and `conf/` | |
| 30 | +| Evaluation | `evaluator/`, topic names in code and `conf/` | |
| 31 | +| Advisory sync | `tasks/vmaas_sync/` | |
| 32 | +| Migrations | `database_admin/migrations/` (verify naming against existing migrations) | |
| 33 | +| Database schema and SQL | `database_admin/schema/` | |
| 34 | +| Containers and local orchestration | `docker-compose.yml`, `docker-compose.test.yml`, `Dockerfile*` | |
| 35 | +| Scheduled jobs | `tasks/` | |
| 36 | +| Admin REST API | `turnpike/` | |
| 37 | +| Platform services mock for development and testing | `platform/` | |
| 38 | + |
| 39 | +--- |
| 40 | + |
| 41 | +## Communication Flows |
| 42 | + |
| 43 | +### System Upload Flow |
| 44 | +``` |
| 45 | +Inventory Upload |
| 46 | + ↓ |
| 47 | +[platform.inventory.events] Kafka Topic |
| 48 | + ↓ |
| 49 | +Listener Component |
| 50 | + ↓ (updates system_inventory, system_patch, system_repo) |
| 51 | + ↓ |
| 52 | +[patchman.evaluator.upload] Kafka Topic |
| 53 | + ↓ |
| 54 | +Evaluator-Upload Component |
| 55 | + ↓ (calls VMaaS /updates) |
| 56 | + ↓ (updates system_advisories, advisory_account_data) |
| 57 | + ↓ |
| 58 | +[platform.notifications.ingress] (optional) |
| 59 | +[platform.remediation-updates.patch] (optional) |
| 60 | +[platform.inventory.host-apps] (optional) |
| 61 | +``` |
| 62 | + |
| 63 | +### Advisory Sync Flow |
| 64 | +``` |
| 65 | +Scheduled Job Trigger |
| 66 | + ↓ |
| 67 | +VMaaS Sync Component |
| 68 | + ↓ (calls VMaaS /errata, /pkglist, /repos) |
| 69 | + ↓ (updates advisory_metadata, package, repo) |
| 70 | + ↓ |
| 71 | +[patchman.evaluator.recalc] Kafka Topic |
| 72 | + ↓ |
| 73 | +Evaluator-Recalc Component |
| 74 | + ↓ (bulk re-evaluation of affected systems) |
| 75 | + ↓ |
| 76 | +Database Updates |
| 77 | +``` |
| 78 | + |
| 79 | +### User Query Flow |
| 80 | +``` |
| 81 | +User Request |
| 82 | + ↓ |
| 83 | +Manager Component (REST API) |
| 84 | + ↓ (queries PostgreSQL) |
| 85 | + ↓ |
| 86 | +Response to User |
| 87 | +``` |
0 commit comments