-
Notifications
You must be signed in to change notification settings - Fork 2
test: improve unit test coverage toward 80% target #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
f3a5c93
test: improve code coverage from 40% to 52% with 341 new tests
JohnRDOrazio 61e11cb
fix: resolve CI failures in test suite
JohnRDOrazio d43bf93
test: pass from_ref='main' to all create_branch calls in git tests
JohnRDOrazio 5795356
fix: replace deprecated datetime.utcnow() with timezone-aware datetim…
JohnRDOrazio fe6c43c
fix: use async overrides for auth dependencies in authed_client fixture
JohnRDOrazio 9721cc9
test: use assert_awaited assertions for AsyncMock verification
JohnRDOrazio 221d289
test: exercise service.get() in anonymous access test instead of _to_…
JohnRDOrazio b53dd35
test: use ValidationError instead of Exception, remove file-wide noqa
JohnRDOrazio 8ff71eb
test: extract notification service mock into reusable fixture
JohnRDOrazio 4b63ecf
test: wrap dependency overrides in try/finally for reliable cleanup
JohnRDOrazio e18340c
test: rename test_caches_instance to reflect actual behavior
JohnRDOrazio d12ba65
fix: use consistent sort flags for all git history walk paths
JohnRDOrazio 66cb78c
test: move local imports to module level in lint route tests
JohnRDOrazio 7f646e4
test: replace file-wide noqa with targeted per-parameter suppressions
JohnRDOrazio a1d27d1
test: fix setattr return value error in test_user_settings_routes.py
JohnRDOrazio d5bc75f
test: add missing type parameters in test_user_service.py
JohnRDOrazio 28f56aa
test: add missing type parameters in test_github_service.py
JohnRDOrazio d01706a
test: fix dict type in test_join_request_service.py
JohnRDOrazio d3b10d1
test: add missing type parameters in test_worker.py
JohnRDOrazio 93913b8
test: remove unused type: ignore comments in test_beacon_token.py
JohnRDOrazio 9802927
test: fix mypy index errors in test_linter.py
JohnRDOrazio 387bb48
test: fix mypy arg-type errors in test_search.py
JohnRDOrazio 76d8567
test: add missing type annotations in test_auth.py
JohnRDOrazio c3cc74e
test: use sync Mock for verify_webhook_signature fixture
JohnRDOrazio bac5a46
test: assert exact entity count in ontology index reindex test
JohnRDOrazio 8103b0c
test: use assert_awaited_once_with for async mock verification
JohnRDOrazio d14fd57
test: use assert_awaited for async mock verification in project servi…
JohnRDOrazio 1f37c09
test: use distinct admin user in test_cannot_remove_owner
JohnRDOrazio b4af992
test: improve project service test assertions and coverage
JohnRDOrazio 6489a07
test: improve project service test quality and coverage
JohnRDOrazio 6b1a1c7
refactor: migrate Pydantic models from class Config to ConfigDict
JohnRDOrazio 2ec07b8
fix: eliminate all test warnings
JohnRDOrazio 5c22ac1
fix: eliminate RuntimeWarning by using MagicMock for unused DB session
JohnRDOrazio 78a596f
chore: exclude deprecated git/repository.py from coverage
JohnRDOrazio 3a3009e
test: increase coverage from 54% to 65% with 185 new tests
JohnRDOrazio a3cda70
test: add unit tests for routes, services, and git layer
JohnRDOrazio 658f579
test: increase coverage from 72% to 78% with 122 new tests
JohnRDOrazio b66e5e6
fix: address code review findings across tests and routes
JohnRDOrazio 0e56b34
test: add 35 tests for pull_request_service to reach 80% coverage
JohnRDOrazio ea286f9
fix: address second round of code review findings
JohnRDOrazio 154f9e4
fix: strengthen test assertions per code review
JohnRDOrazio 7b9eb89
refactor: extract _simulate_refresh into shared factory and add db.ad…
JohnRDOrazio d1e1387
test: tighten indexed_ontology assertions and add index query failure…
JohnRDOrazio 236e2d9
docs: explain inline-import patch target for get_user_service
JohnRDOrazio 59ccddc
fix: address code review — token literal, exact assertions, serialize…
JohnRDOrazio 9cfca0d
test: add route-level tests for pull_requests, lint, and projects
JohnRDOrazio b221058
test: bring key services and worker to 80%+ coverage
JohnRDOrazio c0d4ea4
test: bring bare_repository and projects routes to 80%+ coverage
JohnRDOrazio f1bf326
fix: address code review findings in extractor and routes tests
JohnRDOrazio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,3 +32,4 @@ repos: | |
| - sentence-transformers>=3.0.0 | ||
| - cryptography>=42.0.0 | ||
| - pytest>=8.0.0 | ||
| - pytest-asyncio>=0.24.0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Test Coverage Plan: 78% → 80% | ||
|
|
||
| **Created:** 2026-04-08 | ||
| **Updated:** 2026-04-08 | ||
| **Baseline:** 78% (7502/9571 statements covered, 983 tests) | ||
| **Target:** 80% (7657 statements covered, ~155 more needed) | ||
|
|
||
| ## Completed | ||
|
|
||
| The following Phase 1 items have been completed: | ||
|
|
||
| | File | Before | After | Tests Added | | ||
| |------|--------|-------|-------------| | ||
| | `services/project_service.py` | 55% | 94% | ~40 | | ||
| | `services/suggestion_service.py` | 39% | 96% | ~51 | | ||
| | `services/embedding_service.py` | 33% | 99% | ~33 | | ||
|
|
||
| ## Phase 1 — Remaining (~170 statements recoverable) | ||
|
|
||
| | File | Current | Missed | Target | To Recover | | ||
| |------|---------|--------|--------|------------| | ||
| | `services/pull_request_service.py` | 56% | 305 | 80% | ~170 | | ||
|
|
||
| ### pull_request_service.py (56% → 80%) | ||
| - [ ] `create_pull_request()` — creation with validation | ||
| - [ ] `merge_pull_request()` — merge strategies | ||
| - [ ] `close_pull_request()`, `reopen_pull_request()` | ||
| - [ ] Review CRUD: `create_review()`, `list_reviews()` | ||
| - [ ] Comment CRUD: `create_comment()`, `list_comments()`, `update_comment()`, `delete_comment()` | ||
| - [ ] Branch management: `list_branches()`, `create_branch()` | ||
| - [ ] GitHub integration: `create_github_integration()`, `update_github_integration()`, `delete_github_integration()` | ||
| - [ ] Webhook handlers: `handle_github_pr_webhook()`, `handle_github_review_webhook()`, `handle_github_push_webhook()` | ||
| - [ ] PR settings: `get_pr_settings()`, `update_pr_settings()` | ||
|
|
||
| Covering ~155 of the 305 missed statements reaches 80% overall. | ||
|
|
||
| ## Phase 2 — Medium Impact (~250 statements) | ||
|
|
||
| | File | Current | Missed | Target | To Recover | | ||
| |------|---------|--------|--------|------------| | ||
| | `git/bare_repository.py` | 70% | 150 | 80% | ~55 | | ||
| | `worker.py` | 70% | 111 | 80% | ~40 | | ||
| | `services/ontology_extractor.py` | 64% | 93 | 80% | ~45 | | ||
| | `services/ontology_index.py` | 75% | 89 | 80% | ~25 | | ||
| | `services/github_sync.py` | 61% | 46 | 80% | ~25 | | ||
| | `services/indexed_ontology.py` | 44% | 50 | 80% | ~30 | | ||
| | `services/normalization_service.py` | 73% | 25 | 80% | ~10 | | ||
| | `services/embedding_providers/*` | 0-75% | ~108 | 80% | ~20 | | ||
|
|
||
| ## Phase 3 — Diminishing Returns | ||
|
|
||
| | File | Current | Notes | | ||
| |------|---------|-------| | ||
| | `main.py` | 54% | Startup/lifespan — hard to unit test | | ||
| | `runner.py` | 0% | 6 lines, CLI entry point | | ||
| | `services/ontology.py` | 82% | Already above target | | ||
| | `services/linter.py` | 80% | Already at target | | ||
|
|
||
| ## Execution Order | ||
|
|
||
| 1. `pull_request_service.py` — the only Phase 1 item remaining; ~155 statements gets us to 80% | ||
| 2. Phase 2 files as needed to build further margin | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reconcile inconsistent statement recovery targets.
Lines 18 and 22 claim "~170 statements recoverable" for the remaining Phase 1 work, but line 35 states "Covering ~155 of the 305 missed statements reaches 80% overall," which aligns with the overall gap of ~155 from line 6. This discrepancy creates ambiguity about the actual work needed.
Please clarify whether:
🧰 Tools
🪛 LanguageTool
[uncategorized] ~31-~31: The official name of this software platform is spelled with a capital “H”.
Context: ...ate_branch()
- [ ] GitHub integration:create_github_integration(),update_github_integrat...(GITHUB)
[uncategorized] ~31-~31: The official name of this software platform is spelled with a capital “H”.
Context: ...gration:
create_github_integration(),update_github_integration(), `delete_github_integrat...(GITHUB)
[uncategorized] ~32-~32: The official name of this software platform is spelled with a capital “H”.
Context: ..._integration()
- [ ] Webhook handlers:handle_github_pr_webhook(),handle_github_review_we...(GITHUB)
[uncategorized] ~32-~32: The official name of this software platform is spelled with a capital “H”.
Context: ...handlers:
handle_github_pr_webhook(),handle_github_review_webhook(), `handle_github_push_...(GITHUB)
🤖 Prompt for AI Agents