refactor: organize pilot modules and tests #16

Merged
masi merged 4 commits from refactor/split-pilot-modules into main 2026-09-01 01:22:12 +00:00
Contributor

Summary

  • group review code under pilot/review/
  • group feedback, evaluation, observability, and entrypoint code by responsibility
  • mirror the source layout under tests/pilot/*_tests/
  • retain thin top-level compatibility shims for existing imports and Docker/CI entrypoints
  • document the new package layout and test organization

Design notes

The public compatibility surface remains unchanged. New code belongs in the focused packages; shims are only for backwards compatibility. The review implementation is now isolated under pilot/review/ai_review.py for a later responsibility-level extraction.

Verification

  • python3 -m compileall -q pilot tests
  • 448 categorized review, entrypoint, observability, and evaluation tests passed
  • 68 feedback tests passed
  • 516 tests passed in total
## Summary - group review code under `pilot/review/` - group feedback, evaluation, observability, and entrypoint code by responsibility - mirror the source layout under `tests/pilot/*_tests/` - retain thin top-level compatibility shims for existing imports and Docker/CI entrypoints - document the new package layout and test organization ## Design notes The public compatibility surface remains unchanged. New code belongs in the focused packages; shims are only for backwards compatibility. The review implementation is now isolated under `pilot/review/ai_review.py` for a later responsibility-level extraction. ## Verification - `python3 -m compileall -q pilot tests` - 448 categorized review, entrypoint, observability, and evaluation tests passed - 68 feedback tests passed - 516 tests passed in total
masi added 1 commit 2026-09-01 01:03:00 +00:00
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.
masi added 1 commit 2026-09-01 01:06:43 +00:00
pragent-bot bot reviewed 2026-09-01 01:06:59 +00:00
pragent-bot bot left a comment

🤖 AI Review · pragent pilot · headroom/MiniMax-M2.7 · 7a510a92 · Merge confidence: 5/5 🟢

PR-Agent pilot on this repo. Comments are LLM-generated; treat as suggestions, not mandates.

Summary of Changes

  • Convert pilot/ai_review.py (2376-line monolith) to a 7-line compatibility shim that redirects to pilot/review/ai_review.py
  • Convert pilot/cost_model.py, pilot/diff_compress.py, pilot/gitea_client.py, pilot/model_client.py, pilot/review_config.py to shims importing from their new package homes
  • Extract pilot/entrypoints/gitea.py (HTTP transport adapter, previously gitea_client.py) and update pilot/entrypoints/webhook.py to import from the new shims
  • Update docs/architecture.md and pilot/README.md to document the new package hierarchy

Key Risks & Concerns

  • If any external consumer imports directly from the renamed sub-package paths (e.g. from pilot.review.diff import compress_diff rather than from pilot.diff_compress import compress_diff), this PR does not establish those as stable interfaces — the compatibility surface is only the top-level shims
  • The entrypoints/__init__.py change is minimal (docstring only); if the prior version contained re-exports or side-effects, they are now absent
  • New test files under tests/pilot/*_tests/ (referenced in PR description) are not listed as changed — their compatibility with the new package structure cannot be confirmed from the diff alone
🔋 AI Usage & Run Details
  • Model / Engine: headroom/MiniMax-M2.7 · opencode · 19 steps · 236.9s
  • Total Tokens: 33,349 (33.3K) in / 9,447 (9.4K) out (0 reasoning, cache 763,765 (763.8K) read / 33,973 (34.0K) write, 840,534 (840.5K) total)
  • Actual: $0.00 (headroom/MiniMax-M2.7 — free tier)
  • Scope: Whole-repo checkout at head sha (agent can read any file + run linters, not just the diff) — input tokens include files read beyond the diff. Per-comment output is attributed (one model pass produces all findings; output split by each finding's body weight).
🤖 **AI Review** · pragent pilot · headroom/MiniMax-M2.7 · `7a510a92` · Merge confidence: 5/5 🟢 > PR-Agent pilot on this repo. Comments are LLM-generated; treat as suggestions, not mandates. ### Summary of Changes - Convert `pilot/ai_review.py` (2376-line monolith) to a 7-line compatibility shim that redirects to `pilot/review/ai_review.py` - Convert `pilot/cost_model.py`, `pilot/diff_compress.py`, `pilot/gitea_client.py`, `pilot/model_client.py`, `pilot/review_config.py` to shims importing from their new package homes - Extract `pilot/entrypoints/gitea.py` (HTTP transport adapter, previously `gitea_client.py`) and update `pilot/entrypoints/webhook.py` to import from the new shims - Update `docs/architecture.md` and `pilot/README.md` to document the new package hierarchy ### Key Risks & Concerns - If any external consumer imports directly from the renamed sub-package paths (e.g. `from pilot.review.diff import compress_diff` rather than `from pilot.diff_compress import compress_diff`), this PR does not establish those as stable interfaces — the compatibility surface is only the top-level shims - The `entrypoints/__init__.py` change is minimal (docstring only); if the prior version contained re-exports or side-effects, they are now absent - New test files under `tests/pilot/*_tests/` (referenced in PR description) are not listed as changed — their compatibility with the new package structure cannot be confirmed from the diff alone <details> <summary>🔋 AI Usage & Run Details</summary> - **Model / Engine**: `headroom/MiniMax-M2.7` · opencode · 19 steps · 236.9s - **Total Tokens**: 33,349 (33.3K) in / 9,447 (9.4K) out (0 reasoning, cache 763,765 (763.8K) read / 33,973 (34.0K) write, 840,534 (840.5K) total) - **Actual**: $0.00 (headroom/MiniMax-M2.7 — free tier) - **Scope**: Whole-repo checkout at head sha (agent can read any file + run linters, not just the diff) — input tokens include files read beyond the diff. Per-comment output is *attributed* (one model pass produces all findings; output split by each finding's body weight). </details> <!-- pragent:sha=7a510a926d74485f2e5fac348580e0b21d447a55 -->
pragent-bot bot reviewed 2026-09-01 01:10:12 +00:00
pragent-bot bot left a comment

🤖 AI Review · pragent pilot · headroom/MiniMax-M2.7 · c948f281 · Merge confidence: 5/5 🟢

PR-Agent pilot on this repo. Comments are LLM-generated; treat as suggestions, not mandates.

Summary of Changes

  • Move ai_review, diff_compress, gitea_client, and webhook_server implementations into review/, entrypoints/, and observability/ packages
  • Replace each original module with a thin <7-line shim that imports from the new location via importlib, preserving all existing import paths
  • Update architecture.md and pilot/README.md to document the new package layout and test organization
  • Create new pilot/entrypoints/ package (gitea.py, webhook.py) and pilot/review/ package (ai_review.py, _legacy.py, config.py, diff.py, model.py, opencode.py, ports.py)

Key Risks & Concerns

  • The review/model.py import chain uses a dead try-block (from .gitea_client always fails since no sibling module exists) that silently falls back to a top-level import — fragile pattern that works but obscures intent
  • The _legacy.py module is marked private (underscore prefix) yet contains the entire active implementation; the PR description says it is 'temporarily isolated' during extraction, so its long-term fate should be tracked
🔋 AI Usage & Run Details
  • Model / Engine: headroom/MiniMax-M2.7 · opencode · 27 steps · 206.7s
  • Total Tokens: 62,897 (62.9K) in / 11,021 (11.0K) out (0 reasoning, cache 1,575,857 (1.6M) read / 148,693 (148.7K) write, 1,798,468 (1.8M) total)
  • Actual: $0.00 (headroom/MiniMax-M2.7 — free tier)
  • Scope: Whole-repo checkout at head sha (agent can read any file + run linters, not just the diff) — input tokens include files read beyond the diff. Per-comment output is attributed (one model pass produces all findings; output split by each finding's body weight).
🤖 **AI Review** · pragent pilot · headroom/MiniMax-M2.7 · `c948f281` · Merge confidence: 5/5 🟢 > PR-Agent pilot on this repo. Comments are LLM-generated; treat as suggestions, not mandates. ### Summary of Changes - Move ai_review, diff_compress, gitea_client, and webhook_server implementations into review/, entrypoints/, and observability/ packages - Replace each original module with a thin <7-line shim that imports from the new location via importlib, preserving all existing import paths - Update architecture.md and pilot/README.md to document the new package layout and test organization - Create new pilot/entrypoints/ package (gitea.py, webhook.py) and pilot/review/ package (ai_review.py, _legacy.py, config.py, diff.py, model.py, opencode.py, ports.py) ### Key Risks & Concerns - The review/model.py import chain uses a dead try-block (from .gitea_client always fails since no sibling module exists) that silently falls back to a top-level import — fragile pattern that works but obscures intent - The _legacy.py module is marked private (underscore prefix) yet contains the entire active implementation; the PR description says it is 'temporarily isolated' during extraction, so its long-term fate should be tracked <details> <summary>🔋 AI Usage & Run Details</summary> - **Model / Engine**: `headroom/MiniMax-M2.7` · opencode · 27 steps · 206.7s - **Total Tokens**: 62,897 (62.9K) in / 11,021 (11.0K) out (0 reasoning, cache 1,575,857 (1.6M) read / 148,693 (148.7K) write, 1,798,468 (1.8M) total) - **Actual**: $0.00 (headroom/MiniMax-M2.7 — free tier) - **Scope**: Whole-repo checkout at head sha (agent can read any file + run linters, not just the diff) — input tokens include files read beyond the diff. Per-comment output is *attributed* (one model pass produces all findings; output split by each finding's body weight). </details> <!-- pragent:sha=c948f2818b36306b8bffb73c9d0a3335fefa9db3 -->
masi added 1 commit 2026-09-01 01:14:52 +00:00
masi added 1 commit 2026-09-01 01:17:14 +00:00
masi merged commit 0c3997db35 into main 2026-09-01 01:22:12 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gitea_admin/pragent#16