Commit 16132e2
fix: resolve 45 test failures across CLI, services, and assessors (#4)
* fix: resolve quick win test failures (CSV, config, research formatter)
Fixed 5 test failures across 3 categories:
**CSV Reporter Tests (4 errors → 0):**
- Added create_dummy_findings() helper to generate Finding objects
- Updated mock assessments to include required findings matching attributes_total
- Fixed test_csv_empty_batch to expect ValueError during BatchAssessment construction
**Config Model Test (1 failure → 0):**
- Updated test_config_invalid_weights_negative to test for negative weights (current validation)
- Removed outdated test_config_invalid_weights_sum (sum-to-1.0 validation was intentionally removed)
**Research Formatter Tests (2 failures → 0):**
- Fixed format_report() to ensure exactly one trailing newline
- Updated extract_attribute_ids() regex to capture malformed IDs for validation
Test status: 48→43 failures, 737→746 passed
* fix: resolve learning service test failures with proper mocks and validation
Fixed all 9 learning service test failures by addressing three issues:
1. Mock method mismatches (7 tests):
- Tests were mocking `extract_from_findings()` but code calls
`extract_all_patterns()` or `extract_specific_patterns()`
- Updated all mocks to use correct method names based on whether
`attribute_ids` parameter is passed
2. LLMEnricher import path (1 test):
- Test tried to patch `learning_service.LLMEnricher` but it's imported
inside `_enrich_with_llm()` method from `learners.llm_enricher`
- Changed patch path to actual import location
3. Repository validation (4 tests):
- Repository model requires `.git` directory
- Updated `temp_dir` fixture to run `git init`
- Updated tests to create assessment files in `.agentready/` subdirectory
(code expects assessments at `.agentready/assessment-*.json`)
4. Assessment validation (3 tests):
- Assessment requires `len(findings) == attributes_total`
- Added `create_dummy_finding()` helper
- Updated tests to include proper number of findings
All 17 learning service tests now pass.
Test progress: 48 failed → 34 failed (14 tests fixed)
* fix: resolve pattern extractor and LLM enricher test failures (14 tests)
Fixed 2 root causes affecting 14 total tests:
1. PatternExtractor attribute access (10 tests fixed):
- Changed finding.attribute.attribute_id → finding.attribute.id
- Fixed extract_specific_patterns() method
- Added create_dummy_finding() helper for Assessment validation
- Fixed 8 pattern extractor tests + 4 downstream test failures
2. Anthropic API error mocks (2 tests fixed):
- Updated RateLimitError mock with response and body kwargs
- Updated APIError mock with request and body kwargs
- Adapted to evolved Anthropic SDK error class signatures
Test status: 34 failed → 20 failed (14 tests fixed)
Related: ambient-code#178
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix: correct confidence format assertion in skill generator test
Changed assertion from "90%" to "90.0%" to match actual output format.
The SkillGenerator formats confidence as "90.0%" not "90%".
Test status: 20 failed → 19 failed
Related: ambient-code#178
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix: resolve CLI command test failures with path resolution and validation (12 tests)
Fixes 12 failing tests in CLI commands (extract-skills and learn):
CLI Command Fixes (Both Commands):
- Resolve output_dir relative to repo_path instead of cwd
- Fixes isolated_filesystem() test context issues
- Ensures output created in repository, not temp directory
- Add IntRange(min=1) validation for llm_budget parameter
- Prevents negative budget values
- Provides clear Click validation error
Test Assertion Fixes:
- Fix skill_md format tests: glob("*/SKILL.md") not glob("*.md")
- SKILL.md files are created in subdirectories (skill-id/SKILL.md)
- Fix github_issues format tests: glob("skill-*.md") not glob("issue-*.md")
- Issue files are named skill-{id}.md, not issue-*.md
- Add known skill IDs to test fixtures (claude_md_file, type_annotations)
- PatternExtractor requires recognizable attribute IDs to extract skills
Test Progress: 19 failed → 7 failed (12 tests fixed, 63% complete)
Files Modified:
- src/agentready/cli/extract_skills.py (path resolution, validation)
- src/agentready/cli/learn.py (path resolution, validation)
- tests/unit/test_cli_extract_skills.py (glob patterns)
- tests/unit/test_cli_learn.py (glob patterns, fixture data)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix: resolve isolated test failures in code_sampler and fixer_service (2 tests)
Fixes 2 isolated test failures:
Code Sampler Fix (code_sampler.py):
- Add 'path' key check before accessing dict in _format_code_samples()
- Empty dicts in files list were causing KeyError
- Changed: if isinstance(file_item, dict) and "path" in file_item
Fixer Service Test Fix (test_fixer_service.py):
- Add passing finding to test_generate_fix_plan_no_failing_findings
- Assessment validation requires len(findings) == attributes_total
- Test was creating assessment with 0 findings but attributes_total=1
- Now creates a passing finding to satisfy validation
Test Progress: 19 failed → 5 failed (14 tests fixed, 74% complete)
Remaining: 5 GitHub scanner tests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix: resolve GitHub scanner test failures with proper pagination mocking (5 tests)
Fixes 5 GitHub scanner test failures by correctly mocking API pagination:
Root Cause:
- Scanner's pagination loop breaks when response.json() returns empty list
- Original mocks used return_value which returns same repos on every call
- Loop continued until hitting max_repos limit (100), returning duplicates
Fix Applied (All 5 Tests):
- Changed from `mock_get.return_value = mock_response` to:
```python
mock_response_page1 = Mock() # Returns repos
mock_response_page1.json.return_value = [repo1, repo2]
mock_response_page2 = Mock() # Empty - signals end of pagination
mock_response_page2.json.return_value = []
mock_get.side_effect = [mock_response_page1, mock_response_page2]
```
Tests Fixed:
1. test_successful_org_scan - Basic org scanning
2. test_filters_private_repos - Private repo filtering
3. test_includes_private_repos_when_requested - Include private when flagged
4. test_filters_archived_repos - Archived repo filtering
5. test_rate_limit_warning - Rate limit warning logging
Test Progress: 19 failed → 0 failed (19 tests fixed, 100% complete ✅)
Final Status: 789 passed, 2 skipped, 0 failed
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 170979c commit 16132e2
File tree
13 files changed
+357
-262
lines changed- src/agentready
- cli
- learners
- services
- tests/unit
- learners
13 files changed
+357
-262
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | 111 | | |
118 | 112 | | |
119 | 113 | | |
| |||
159 | 153 | | |
160 | 154 | | |
161 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
162 | 161 | | |
163 | 162 | | |
164 | 163 | | |
165 | | - | |
| 164 | + | |
166 | 165 | | |
167 | 166 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | 167 | | |
172 | 168 | | |
173 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | 111 | | |
118 | 112 | | |
119 | 113 | | |
| |||
159 | 153 | | |
160 | 154 | | |
161 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
162 | 161 | | |
163 | 162 | | |
164 | 163 | | |
165 | | - | |
| 164 | + | |
166 | 165 | | |
167 | 166 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | 167 | | |
172 | 168 | | |
173 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 107 | + | |
111 | 108 | | |
112 | 109 | | |
113 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | 279 | | |
283 | 280 | | |
284 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
296 | 295 | | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
| 296 | + | |
| 297 | + | |
301 | 298 | | |
302 | 299 | | |
303 | 300 | | |
| |||
327 | 324 | | |
328 | 325 | | |
329 | 326 | | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | 327 | | |
336 | 328 | | |
337 | 329 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
| 295 | + | |
296 | 296 | | |
297 | 297 | | |
298 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
299 | 301 | | |
300 | 302 | | |
301 | 303 | | |
| |||
325 | 327 | | |
326 | 328 | | |
327 | 329 | | |
328 | | - | |
| 330 | + | |
329 | 331 | | |
| 332 | + | |
330 | 333 | | |
331 | | - | |
| 334 | + | |
332 | 335 | | |
333 | 336 | | |
334 | 337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
12 | 35 | | |
13 | 36 | | |
14 | 37 | | |
| |||
197 | 220 | | |
198 | 221 | | |
199 | 222 | | |
200 | | - | |
| 223 | + | |
201 | 224 | | |
202 | 225 | | |
203 | 226 | | |
| |||
229 | 252 | | |
230 | 253 | | |
231 | 254 | | |
232 | | - | |
| 255 | + | |
233 | 256 | | |
234 | 257 | | |
235 | 258 | | |
| |||
332 | 355 | | |
333 | 356 | | |
334 | 357 | | |
335 | | - | |
336 | | - | |
| 358 | + | |
| 359 | + | |
337 | 360 | | |
338 | 361 | | |
339 | 362 | | |
| |||
373 | 396 | | |
374 | 397 | | |
375 | 398 | | |
376 | | - | |
| 399 | + | |
377 | 400 | | |
378 | 401 | | |
379 | 402 | | |
| |||
394 | 417 | | |
395 | 418 | | |
396 | 419 | | |
397 | | - | |
398 | | - | |
| 420 | + | |
| 421 | + | |
399 | 422 | | |
400 | 423 | | |
401 | 424 | | |
| |||
449 | 472 | | |
450 | 473 | | |
451 | 474 | | |
452 | | - | |
| 475 | + | |
453 | 476 | | |
454 | 477 | | |
455 | 478 | | |
| |||
491 | 514 | | |
492 | 515 | | |
493 | 516 | | |
494 | | - | |
| 517 | + | |
495 | 518 | | |
496 | 519 | | |
497 | 520 | | |
| |||
512 | 535 | | |
513 | 536 | | |
514 | 537 | | |
515 | | - | |
516 | | - | |
| 538 | + | |
| 539 | + | |
517 | 540 | | |
518 | 541 | | |
519 | 542 | | |
| |||
553 | 576 | | |
554 | 577 | | |
555 | 578 | | |
556 | | - | |
557 | | - | |
| 579 | + | |
| 580 | + | |
558 | 581 | | |
559 | 582 | | |
560 | 583 | | |
| |||
573 | 596 | | |
574 | 597 | | |
575 | 598 | | |
576 | | - | |
577 | | - | |
| 599 | + | |
| 600 | + | |
578 | 601 | | |
579 | 602 | | |
580 | 603 | | |
| |||
614 | 637 | | |
615 | 638 | | |
616 | 639 | | |
617 | | - | |
618 | | - | |
| 640 | + | |
| 641 | + | |
619 | 642 | | |
620 | 643 | | |
621 | 644 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
29 | 50 | | |
30 | 51 | | |
31 | 52 | | |
32 | 53 | | |
33 | 54 | | |
34 | 55 | | |
| 56 | + | |
| 57 | + | |
35 | 58 | | |
36 | 59 | | |
37 | 60 | | |
| |||
85 | 108 | | |
86 | 109 | | |
87 | 110 | | |
88 | | - | |
| 111 | + | |
89 | 112 | | |
90 | | - | |
| 113 | + | |
91 | 114 | | |
92 | 115 | | |
93 | 116 | | |
| |||
102 | 125 | | |
103 | 126 | | |
104 | 127 | | |
105 | | - | |
| 128 | + | |
106 | 129 | | |
107 | | - | |
| 130 | + | |
108 | 131 | | |
109 | 132 | | |
110 | 133 | | |
| |||
0 commit comments