Skip to content

fix: separate Lancaster red and yellow recycling streams - #2324

Open
craiggraham wants to merge 2 commits into
robbrad:masterfrom
craiggraham:fix/lancaster-recycling-streams
Open

craiggraham wants to merge 2 commits into
robbrad:masterfrom
craiggraham:fix/lancaster-recycling-streams

Conversation

@craiggraham

@craiggraham craiggraham commented Oct 29, 2026 •

Copy link
Copy Markdown

Lancaster's portal lists Recycling Red Collection Service and Recycling Yellow Collection Service, but prefix matching against "Recycling" collapsed both into a single Recycling bin, so it was impossible to tell which stream is due.

This matches the specific streams first and keeps Recycling as the fallback for the "refer to calendar for stream" wording.

Impact: Lancaster only. Existing Lancaster users will see the Recycling sensor replaced by Recycling Red and Recycling Yellow, so automations using the old sensor will need updating.

Testing

  • Live run against a Lancaster address: Red and Yellow now returned separately.
  • pytest uk_bin_collection/tests/step_defs/ -k LancasterCityCouncil passes.
  • New offline unit tests in uk_bin_collection/tests/test_lancaster_city_council.py.

Summary by CodeRabbit

  • Bug Fixes
    • Lancaster City Council collection schedules now distinguish red and yellow recycling from general recycling. Recycling entries without a color designation are categorized as Recycling. Domestic waste and food waste remain listed as distinct bin types, alongside the separate recycling categories. These updates clarify how collection information is presented for Lancaster City Council.

Lancaster's portal lists "Recycling Red Collection Service" and "Recycling Yellow Collection Service", but prefix matching against "Recycling" collapsed both into a single Recycling bin. Match the specific streams first, keeping "Recycling" as the fallback for the unspecified-stream wording.
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

Lancaster’s bin type list now places red and yellow recycling before generic recycling. New mocked parser tests cover those streams and unspecified recycling.

Changes: Lancaster bin type parsing

Layer / File(s) Summary
Prioritize and test recycling types
uk_bin_collection/uk_bin_collection/councils/LancasterCityCouncil.py, uk_bin_collection/tests/test_lancaster_city_council.py
BIN_TYPES lists red and yellow recycling before generic recycling. Mocked parser tests check separate bin types, collection dates, and unspecified recycling. The parse_data docstring describes the scraping and return behavior.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: robbrad

Merge Risk: Minimal · up to 2fddd

The change separates Lancaster’s red and yellow recycling collections while retaining the generic fallback. Automations using the previous Recycling sensor need updating; no merge-blocking defect is identified.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: separating Lancaster red and yellow recycling streams.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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