|
22 | 22 |
|
23 | 23 | ## Staged Approach |
24 | 24 |
|
25 | | -### Stage 0: Format All Test Files (Pre-work) |
| 25 | +### Stage 0: Format All Test Files (Pre-work) ✅ COMPLETED |
26 | 26 |
|
27 | 27 | **Goal**: Handle all formatting issues upfront before type annotations |
28 | 28 |
|
29 | 29 | **Tasks**: |
30 | 30 |
|
31 | | -1. Run `ruff format tests/` to auto-format all test files |
32 | | -2. Review and commit formatting changes |
33 | | -3. Verify tests still pass after formatting |
| 31 | +1. ✅ Run `ruff format tests/` - 19 files reformatted |
| 32 | +2. ✅ Updated configuration to use specific directory exclusions |
| 33 | +3. ✅ Verified tests still pass after formatting |
34 | 34 |
|
35 | 35 | **Rationale**: Separating formatting from type annotation work makes it easier to review changes and ensures we start from a clean, consistent base. |
36 | 36 |
|
37 | | -**Estimated Effort**: ~15-30 minutes |
| 37 | +**Actual Effort**: ~30 minutes |
38 | 38 |
|
39 | | -### Stage 1: Infrastructure & Smallest Modules (8 files) |
| 39 | +### Stage 1: Infrastructure & Smallest Modules (8 files) ✅ COMPLETED |
40 | 40 |
|
41 | 41 | **Goal**: Validate the approach and establish patterns |
42 | 42 |
|
43 | 43 | **Tasks**: |
44 | 44 |
|
45 | | -1. ✅ **COMPLETED**: Updated ruff configuration to match pyright (specific directory exclusions) |
46 | | -2. Run `ruff check --fix` on Stage 1 files for auto-fixable issues |
47 | | -3. Fix **test_core** (4 files) - Core functionality tests |
48 | | -4. Fix **test_disposables** (2 files) - Disposable tests |
49 | | -5. Fix **test_testing** (2 files) - Testing utilities tests |
50 | | -6. Document common patterns and solutions |
| 45 | +1. ✅ Updated ruff configuration to match pyright (specific directory exclusions) |
| 46 | +2. ✅ Ran `ruff check --fix --unsafe-fixes` - auto-fixed 16 errors |
| 47 | +3. ✅ Fixed **test_core/test_priorityqueue.py** - 0 errors |
| 48 | +4. ✅ Fixed **test_core/test_observer.py** - 0 errors |
| 49 | +5. ✅ Fixed **test_core/test_notification.py** - 0 errors (largest file, most complex) |
| 50 | +6. ✅ Fixed **test_disposables/test_disposable.py** - 0 errors (auto-fixed) |
| 51 | +7. ✅ Fixed **test_testing/test_marbles.py** - 0 errors |
| 52 | +8. ✅ All 75 Stage 1 tests pass |
| 53 | + |
| 54 | +**Patterns Discovered**: |
| 55 | + |
| 56 | +- Add `-> None` return types to all test functions |
| 57 | +- Use explicit type parameters for generics (e.g., `OnError[int]`, `OnCompleted[int]`) |
| 58 | +- Convert string exceptions to `Exception("message")` objects |
| 59 | +- Use `cast()` with documented justifications for test patterns that go beyond public API |
| 60 | +- Replace `== None` with `is not None` or `is None` |
| 61 | +- Add type annotations to all observer classes and helper functions |
51 | 62 |
|
52 | 63 | **Rationale**: These are likely the simplest and will help identify common patterns and issues. |
53 | 64 |
|
54 | | -**Estimated Effort**: ~2-4 hours (includes setup) |
| 65 | +**Actual Effort**: ~3 hours |
55 | 66 |
|
56 | | -### Stage 2: Medium Modules (9 files) |
| 67 | +### Stage 2: Medium Modules (9 files) ⚠️ PARTIAL - test_integration COMPLETE |
57 | 68 |
|
58 | 69 | **Goal**: Build confidence with isolated modules |
59 | 70 |
|
| 71 | +**Status**: test_integration complete, test_subject deferred to preserve commit checkpoint |
| 72 | + |
60 | 73 | **Tasks**: |
61 | 74 |
|
62 | | -1. Fix **test_subject** (5 files) - Subject tests |
63 | | -2. Fix **test_integration** (2 files) - Integration tests |
64 | | -3. Run full test suite to ensure no regressions |
65 | | -4. Update pattern documentation |
| 75 | +1. ⏳ Fix **test_subject** (5 files) - Deferred (requires ~2000 lines of fixes) |
| 76 | +2. ✅ Fix **test_integration** (2 files) - COMPLETE |
| 77 | + - ✅ **test_integration/test_concat_repeat.py** - 0 errors |
| 78 | + - ✅ **test_integration/test_group_reduce.py** - 0 errors |
| 79 | + - ✅ All 3 integration tests pass |
| 80 | +3. ✅ Excluded test_subject from pyproject.toml for pre-commit checkpoint |
| 81 | +4. ✅ Verified all enabled tests pass (78 tests total) |
66 | 82 |
|
67 | | -**Rationale**: Still manageable size, builds confidence before tackling large modules. |
| 83 | +**Additional Patterns Discovered**: |
68 | 84 |
|
69 | | -**Estimated Effort**: ~1-2 hours |
| 85 | +- Marble testing requires `None, None` parameters for value_lookup and error_lookup |
| 86 | +- Complex operator chains (group_by, flat_map): Extract helper function with explicit `Callable[[Observable[Any]], Observable[Any]]` type |
| 87 | +- Integration tests validate runtime behavior, so `Any` types with documented justification are acceptable |
| 88 | +- GroupedObservable type inference issues: Use helper functions instead of inline lambdas |
| 89 | + |
| 90 | +**Rationale**: Still manageable size, builds confidence before tackling large modules. Split to allow checkpoint commit. |
| 91 | + |
| 92 | +**Actual Effort**: ~1 hour (test_integration only) |
70 | 93 |
|
71 | 94 | ### Stage 3: Scheduler Module (27 files) |
72 | 95 |
|
@@ -271,21 +294,23 @@ typeCheckingMode = "strict" |
271 | 294 | - [x] Run `ruff format tests/` (19 files reformatted) |
272 | 295 | - [x] Review and commit formatting changes (commit: 73495f83) |
273 | 296 | - [x] Verify tests still pass |
274 | | - - [x] Update ruff config to use specific directory exclusions (commit: pending) |
| 297 | + - [x] Update ruff config to use specific directory exclusions (commit: ecf450ee) |
275 | 298 |
|
276 | 299 | **Note**: Formatting worked even with blanket "tests" exclusion because explicitly passing paths to ruff overrides excludes by default. |
277 | 300 |
|
278 | | -- [ ] Stage 1: Infrastructure & Smallest Modules (8 files) |
279 | | - - [ ] Update configuration files |
280 | | - - [ ] Fix test_core (4 files) |
281 | | - - [ ] Fix test_disposables (2 files) |
282 | | - - [ ] Fix test_testing (2 files) |
283 | | - - [ ] Document patterns |
284 | | - |
285 | | -- [ ] Stage 2: Medium Modules (9 files) |
286 | | - - [ ] Fix test_subject (5 files) |
287 | | - - [ ] Fix test_integration (2 files) |
288 | | - - [ ] Run full test suite |
| 301 | +- [x] Stage 1: Infrastructure & Smallest Modules (8 files) ✅ |
| 302 | + - [x] Update configuration files |
| 303 | + - [x] Fix test_core (4 files) - 0 errors |
| 304 | + - [x] Fix test_disposables (2 files) - 0 errors |
| 305 | + - [x] Fix test_testing (2 files) - 0 errors |
| 306 | + - [x] Document patterns |
| 307 | + - [x] All 75 tests pass |
| 308 | + |
| 309 | +- [x] Stage 2: Medium Modules (9 files) ⚠️ PARTIAL |
| 310 | + - [ ] Fix test_subject (5 files) - Deferred |
| 311 | + - [x] Fix test_integration (2 files) - 0 errors, 3 tests pass |
| 312 | + - [x] Exclude test_subject from pyproject.toml |
| 313 | + - [x] Run enabled tests (78 tests total) |
289 | 314 |
|
290 | 315 | - [ ] Stage 3: Scheduler Module (27 files) |
291 | 316 | - [ ] Fix test_scheduler files |
|
0 commit comments