Skip to content

refactor: Phase 2 — slim weather_client_base.py (remove delegation stub batch 2)#456

Merged
Orinks merged 4 commits intodevfrom
refactor/monolith-phase2
Mar 15, 2026
Merged

refactor: Phase 2 — slim weather_client_base.py (remove delegation stub batch 2)#456
Orinks merged 4 commits intodevfrom
refactor/monolith-phase2

Conversation

@Orinks
Copy link
Owner

@Orinks Orinks commented Mar 14, 2026

Summary

Continues the Phase 1 monolith refactor by removing the next batch of delegation stubs from weather_client_base.py.

  • 1,303 → 1,224 lines (79 lines removed, −6%)
  • 18 stubs eliminated across two tasks

Task 1 — Dead-code parse + trend stubs deleted (11 stubs, −43 lines)

Seven _parse_nws_* / _parse_openmeteo_* stubs and four trend stubs (_compute_temperature_trend, _compute_pressure_trend, _trend_descriptor, _period_for_hours_ahead) had zero callers anywhere in the codebase. Pure noise — deleted.

Task 2 — Enrichment + trend stubs inlined (7 stubs, −36 lines)

Replaced self._enrich_with_* / self._populate_environmental_metrics / self._apply_trend_insights calls in _launch_enrichment_tasks and _await_enrichments with direct enrichment.* / trends.* calls, then deleted the now-redundant stub definitions.

Not touched — intentional mock seam points preserved

_get_nws_* and _get_openmeteo_* fetch stubs are kept. They serve as override points detected by _methods_overridden() and are mocked directly in test_nws_afd_notification.py, test_split_notification_timers.py, and test_coverage_gaps.py.

Test plan

  • python3 -m pytest --tb=short -q — 2649 passed, 4 skipped, same 7 pre-existing VC integration failures (require live API keys)
  • ruff check src/accessiweather/weather_client_base.py — no errors
  • All three modules import without circular import errors
  • Zero dead stub call-sites remain in the file

🤖 Generated with Claude Code

Orinks and others added 4 commits March 14, 2026 23:28
…herClient

Deleted 11 never-called delegation stubs from WeatherClient:
- 7 _parse_nws_* / _parse_openmeteo_* stubs (delegated to nws_client/openmeteo_client)
- 4 _compute_*_trend / _trend_descriptor / _period_for_hours_ahead stubs (delegated to trends)

All were dead code — grep confirms zero callers anywhere in src/ or tests/.
Saves ~43 lines (1303 → 1260).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaced 7 self._enrich_with_* / self._populate_environmental_metrics /
self._apply_trend_insights stub calls with direct enrichment.* and trends.*
calls in _launch_enrichment_tasks and _await_enrichments, then deleted the
now-redundant stub method definitions.

The NWS/OpenMeteo fetch stubs (_get_nws_*, _get_openmeteo_*) are intentionally
preserved as mock seam points used by _methods_overridden and test AsyncMocks.

Saves ~36 lines (1260 → 1224).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rage gate

Add two tests to exercise the `if self.data_source == "auto":` branch in
`WeatherClient._launch_enrichment_tasks` (lines 912-924), which were the
uncovered lines identified by diff-cover on refactor/monolith-phase2.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Orinks Orinks merged commit 506a82f into dev Mar 15, 2026
6 checks passed
@Orinks Orinks deleted the refactor/monolith-phase2 branch March 15, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant