refactor: organize pilot packages
Group review, feedback, evaluation, observability, and entrypoint code into packages. Keep thin top-level compatibility shims for existing scripts and imports, and mirror the structure in the tests.
This commit is contained in:
+17
-15
@@ -23,21 +23,22 @@ as a PR comment and does not block CI.
|
||||
|
||||
| Module | Responsibility |
|
||||
|---|---|
|
||||
| `webhook_server.py` | HTTP ingress, signature verification, opt-in gate, concurrency |
|
||||
| `review_config.py` | Trusted base-branch opt-in policy; transport injected for tests |
|
||||
| `gitea_client.py` | HTTP transport adapter and repository-scoped client |
|
||||
| `ai_review.py` | Compatibility facade and review orchestration |
|
||||
| `model_client.py` | Anthropic-compatible model adapter and response text extraction |
|
||||
| `opencode_review.py` | Hostile-checkout containment and agent execution |
|
||||
| `diff_compress.py` | Diff compression and prior-review extraction |
|
||||
| `feedback*.py` | Feedback persistence, harvesting, analysis, and Langfuse scores |
|
||||
| `langfuse_trace.py` | Fail-open Langfuse ingestion and cost metadata |
|
||||
| `cost_model.py` | Provider price catalog and equivalent-cost calculations |
|
||||
| `eval_*.py` | Dataset bootstrap, evaluators, and behavioral scoring |
|
||||
| `entrypoints/webhook.py` | HTTP ingress, signature verification, opt-in gate, concurrency |
|
||||
| `review/config.py` | Trusted base-branch opt-in policy; transport injected for tests |
|
||||
| `entrypoints/gitea.py` | HTTP transport adapter and repository-scoped client |
|
||||
| `review/ai_review.py` | Review orchestration implementation |
|
||||
| `ai_review.py` | Compatibility shim for existing imports and CI execution |
|
||||
| `review/model.py` | Anthropic-compatible model adapter and response text extraction |
|
||||
| `review/opencode.py` | Hostile-checkout containment and agent execution |
|
||||
| `review/diff.py` | Diff compression and prior-review extraction |
|
||||
| `feedback/*.py` | Feedback persistence, harvesting, analysis, and Langfuse scores |
|
||||
| `observability/langfuse.py` | Fail-open Langfuse ingestion and cost metadata |
|
||||
| `observability/cost.py` | Provider price catalog and equivalent-cost calculations |
|
||||
| `evaluation/*.py` | Dataset bootstrap, evaluators, and behavioral scoring |
|
||||
|
||||
`ai_review.py` remains the stable import surface for existing workflow and
|
||||
webhook deployments. New code should put policy, adapters, and pure transforms
|
||||
in the focused modules above rather than adding unrelated functions there.
|
||||
The top-level `.py` files are intentionally thin compatibility shims. They keep
|
||||
existing workflow commands and imports stable while the implementations live in
|
||||
the focused packages above. New code belongs in those packages, not in a shim.
|
||||
|
||||
## Onboard a repository
|
||||
|
||||
@@ -72,5 +73,6 @@ security, and webhook registration details.
|
||||
python3 -m pytest tests -q
|
||||
```
|
||||
|
||||
Tests use mocked transports and local fixtures. They do not require Gitea,
|
||||
Tests are grouped under `tests/pilot/*_tests/`, matching the source domains.
|
||||
They use mocked transports and local fixtures and do not require Gitea,
|
||||
Langfuse, a model endpoint, or network access.
|
||||
|
||||
Reference in New Issue
Block a user