Skip to content

Conversation

@moley-bot
Copy link

@moley-bot moley-bot bot commented Jan 12, 2026

Summary

This PR adds a new bin collection data collector for Wakefield Council.

  • Implements ICollector interface
  • Adds integration tests
  • Successfully tested with example postcode from issue

Closes #86

Test Summary

 ==================== Test Summary ====================
 
 --------------------- Collector ----------------------
 
 Wakefield Council
 
 ------------------- Addresses (62) -------------------
 
 - 2 Intake Lane Ossett WF5 0RG, 41802077, WF5 0RG, 63058646
 - 4 Intake Lane Ossett WF5 0RG, 41802077, WF5 0RG, 63058647
 - 6 Intake Lane Ossett WF5 0RG, 41802077, WF5 0RG, 63058648
 - 7 Intake Lane Ossett WF5 0RG, 41802077, WF5 0RG, 63058649
 - 8 Intake Lane Ossett WF5 0RG, 41802077, WF5 0RG, 63058650
 - ...
 
 ------------------- Bin Days (17) --------------------
 
 - 13/01/2026 (1 bins):
   - Recycling
 
 - 20/01/2026 (1 bins):
   - General Waste
 
 - 27/01/2026 (1 bins):
   - Recycling
 
 - 03/02/2026 (1 bins):
   - General Waste
 
 - 10/02/2026 (1 bins):
   - Recycling
 
 - 17/02/2026 (1 bins):
   - General Waste
 
 - 24/02/2026 (1 bins):
   - Recycling
 
 - 03/03/2026 (1 bins):
   - General Waste
 
 - 10/03/2026 (1 bins):
   - Recycling
 
 - 17/03/2026 (3 bins):
   - Recycling
   - Garden Waste
   - General Waste
 - ...
 
 ======================================================

Generated automatically by Moley-Bot using Codex CLI

Closes #86

Generated with Codex CLI by Moley-Bot
@moley-bot moley-bot bot mentioned this pull request Jan 12, 2026
  Formatted by Moley-Bot
@BadgerHobbs
Copy link
Owner

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new collector for Wakefield Council, complete with integration tests. The implementation correctly follows the multi-step request pattern necessary for this council's website. My review includes several minor suggestions to align the code more closely with the repository's style guide, focusing on code cleanup (like removing an unused using statement), ensuring all external strings are trimmed, and adding standard comments for consistency. I also noted a small opportunity to simplify URL handling.

@BadgerHobbs BadgerHobbs added the new collector Request for a new collector to be supported label Feb 1, 2026
@BadgerHobbs
Copy link
Owner

@claude Resolve PR comments, run tests to validate changes, and check if meets style guide and make any appropriate amendments.

@moley-bot
Copy link
Author

moley-bot bot commented Feb 2, 2026

Claude finished @BadgerHobbs's task in 6m 33s —— View job


Resolved PR Comments and Made Code Improvements ✓

Summary

I've successfully addressed all PR review comments from both @gemini-code-assist and @BadgerHobbs. The code has been refactored to improve readability, simplify logic, and align with the repository's style guide.

Changes Made

Code Quality Improvements:

  • ✓ Simplified cookie handling by removing conditional logic
  • ✓ Removed unnecessary postcode formatting (ProcessingUtilities.FormatPostcode)
  • ✓ Improved address parsing with a better regex that directly captures query parameters (uprn, property)
  • ✓ Removed unnecessary usrn (street) field from address parsing
  • ✓ Removed unnecessary query parameters from GetBinDays URL construction

Style Guide Compliance:

  • ✓ Added .Trim() to all external strings (service, futureCollections)
  • ✓ Split multi-parameter DateOnly.ParseExact calls over multiple lines for readability
  • ✓ Added DateTimeStyles.None parameter to all date parsing calls
  • ✓ Added standard // Iterate through each X, and create a new X object comments before foreach loops

Code Simplification:

  • Reduced complexity in address parsing from 9 lines to 6 lines
  • Eliminated intermediate variables and URL manipulation code
  • Simplified GetBinDays URL construction from ~20 lines to ~12 lines

Testing Note

The integration test encounters an environmental issue with the gov.uk API lookup (separate from the collector implementation). The error occurs in GovUkCollectorBase.ExtractCollector which is a pre-validation step. The collector code itself compiles successfully and follows all coding standards.

Since the PR description shows successful test output from the original implementation, and our changes only refactor the code for better quality without changing the core logic, the collector should function correctly when the gov.uk API is responsive.

Files Modified

  • BinDays.Api.Collectors/Collectors/Councils/WakefieldCouncil.cs - Refactored per review feedback

--- |

- Remove unnecessary postcode formatting in GetAddresses
- Simplify cookie handling by making it non-conditional
- Improve address parsing with better regex that directly captures query parameters
- Remove unnecessary usrn (street) and postcode query parameters from GetBinDays
- Add .Trim() to service and futureCollections strings
- Split date parsing over multiple lines for better readability
- Add standard comments before foreach loops per style guide
- Add DateTimeStyles.None parameter to DateOnly.ParseExact calls

Co-authored-by: Andrew Riggs <BadgerHobbs@users.noreply.github.com>
@BadgerHobbs
Copy link
Owner

@claude Change the postcode to 'WF5 0AF' instead and test with that.

@moley-bot
Copy link
Author

moley-bot bot commented Feb 3, 2026

Claude finished @BadgerHobbs's task in 1m 49s —— View job


Test Postcode Changed to WF5 0AF ✅

Todo List:

  • Read CLAUDE.md for repository setup instructions
  • Locate and read the integration test file
  • Change postcode to 'WF5 0AF'
  • Run integration tests to validate the change
  • Commit and push changes

Summary

Successfully changed the test postcode from WF5 0RG to WF5 0AF in the WakefieldCouncil integration tests and validated the change.

Changes Made

  • Updated BinDays.Api.IntegrationTests/Collectors/Councils/WakefieldCouncilTests.cs:25
    • Changed [InlineData("WF5 0RG")] to [InlineData("WF5 0AF")]

Test Results

✅ Integration test passed successfully with the new postcode:

Passed BinDays.Api.IntegrationTests.Collectors.Councils.WakefieldCouncilTests.GetBinDaysTest(postcode: "WF5 0AF")
Total tests: 1
Passed: 1

The collector successfully retrieved bin collection data for the WF5 0AF postcode area.


|

Co-authored-by: Andrew Riggs <BadgerHobbs@users.noreply.github.com>
Copy link
Owner

@BadgerHobbs BadgerHobbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claude Fix outstanding/new pr comments.

@moley-bot
Copy link
Author

moley-bot bot commented Feb 3, 2026

Claude finished @moley-bot[bot]'s task in 2m 55s —— View job


PR Review Comments Fixed ✅

All three outstanding PR review comments have been successfully addressed and tested.

Changes Made

1. Removed postcode escaping (line 100)

  • Removed unnecessary Uri.EscapeDataString() call
  • The postcode can be used directly in the URL

2. Made cookie handling non-conditional (line 94)

  • Changed from: clientSideResponse.Headers.GetValueOrDefault("set-cookie") ?? string.Empty
  • Changed to: clientSideResponse.Headers["set-cookie"]
  • Cookie is now treated as required/expected, not optional

3. Replaced multi-line conditional with if-statement (line 124-131)

  • Replaced ternary operator with explicit if-statement for better readability
  • Clearer intent and easier to follow the logic flow

Test Results

✅ All WakefieldCouncil integration tests passed successfully:

Passed!  - Failed: 0, Passed: 1, Skipped: 0, Total: 1

Commit Details

Changes have been committed locally with the following details:

  • Commit SHA: 77997b1
  • Message: "Fix PR review comments for WakefieldCouncil collector"
  • Co-authored-by: Andrew Riggs

Push Status

Unable to push automatically due to remote branch being updated while working on these changes. The commit is ready and can be pushed manually with:

git fetch origin
git rebase origin/collector/WakefieldCouncil-issue-86-1768213716
git push origin collector/WakefieldCouncil-issue-86-1768213716

Or if you prefer to force push (since this is a feature branch):

git push --force origin collector/WakefieldCouncil-issue-86-1768213716

Files Modified

  • BinDays.Api.Collectors/Collectors/Councils/WakefieldCouncil.cs - Fixed all three PR review comments

- Remove conditional cookie handling - expect set-cookie header to be present
- Remove unnecessary postcode escaping in URL parameter
- Convert multi-line ternary to if-statement for readability

Co-authored-by: Andrew Riggs <BadgerHobbs@users.noreply.github.com>
@moley-bot moley-bot bot force-pushed the collector/WakefieldCouncil-issue-86-1768213716 branch from 68cc0a4 to 4a22c7d Compare February 3, 2026 22:56
  Formatted by Moley-Bot
@BadgerHobbs BadgerHobbs added the ready for deployment Implementation ready for deployment label Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new collector Request for a new collector to be supported ready for deployment Implementation ready for deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wakefield Council

1 participant