Skip to content

Add collector for Mansfield#108

Open
BadgerHobbs wants to merge 5 commits intomainfrom
collector/Mansfield-issue-84-1768126761
Open

Add collector for Mansfield#108
BadgerHobbs wants to merge 5 commits intomainfrom
collector/Mansfield-issue-84-1768126761

Conversation

@BadgerHobbs
Copy link
Owner

Summary

This PR adds a new bin collection data collector for Mansfield.

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

Closes #84

Test Summary

 ==================== Test Summary ====================
 
 --------------------- Collector ----------------------
 
 Mansfield
 
 ------------------- Addresses (29) -------------------
 
 - 1 Eastleigh Drive, Mansfield Woodhouse, NG19 8PL, NG19 8PL, 100031400677
 - 2 Eastleigh Drive, Mansfield Woodhouse, NG19 8PL, NG19 8PL, 100031400678
 - 3 Eastleigh Drive, Mansfield Woodhouse, NG19 8PL, NG19 8PL, 100031400679
 - 4 Eastleigh Drive, Mansfield Woodhouse, NG19 8PL, NG19 8PL, 100031400680
 - 5 Eastleigh Drive, Mansfield Woodhouse, NG19 8PL, NG19 8PL, 100031400681
 - ...
 
 ------------------- Bin Days (81) --------------------
 
 - 15/01/2026 (1 bins):
   - General Waste
 
 - 16/01/2026 (1 bins):
   - Glass
 
 - 22/01/2026 (1 bins):
   - Recycling
 
 - 29/01/2026 (1 bins):
   - General Waste
 
 - 05/02/2026 (1 bins):
   - Recycling
 
 - 12/02/2026 (1 bins):
   - General Waste
 
 - 19/02/2026 (1 bins):
   - Recycling
 
 - 26/02/2026 (1 bins):
   - General Waste
 
 - 05/03/2026 (1 bins):
   - Recycling
 
 - 10/03/2026 (1 bins):
   - Garden Waste
 - ...
 
 ======================================================

Generated automatically by Codex CLI

Closes #84

Generated with Codex CLI
@BadgerHobbs BadgerHobbs mentioned this pull request Jan 11, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @BadgerHobbs, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new data collector specifically designed for Mansfield Council, integrating its bin collection schedule into the existing system. The implementation involves a multi-step client-side request process to first obtain an authentication token and then retrieve address options, followed by an API call to fetch detailed bin collection dates. This enhancement expands the coverage of supported councils, allowing users in Mansfield to access their bin collection information.

Highlights

  • New Collector Added: A new data collector has been implemented for Mansfield Council's bin collection service.
  • Interface Implementation: The new Mansfield collector correctly implements the ICollector interface, ensuring compatibility with the existing system.
  • Integration Tests: Comprehensive integration tests have been added to validate the functionality of the Mansfield collector.
  • Successful Data Retrieval: The collector has been successfully tested with an example postcode, demonstrating accurate retrieval of address and bin collection schedules.
  • Issue Closure: This pull request closes issue Mansfield #84, addressing the request for Mansfield bin collection data.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

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 adds a new collector for Mansfield council. The implementation is well-structured and follows the multi-step request pattern required for this collector. The integration tests are also included and look correct.

I've identified a critical security vulnerability related to a hardcoded API key. While the style guide seems to permit this, it's a significant risk and should be addressed by using a secure secret management solution.

Additionally, I've left a few minor comments to align the code more closely with the repository's style guide regarding member ordering, object initialization patterns, and code comments.

Overall, great work on the new collector. Addressing the security issue is the highest priority.

/// <inheritdoc/>
public override string GovUkId => "mansfield";

private const string FormUrl = "https://www.mansfield.gov.uk/xfp/form/1339";
Copy link
Owner Author

Choose a reason for hiding this comment

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

private fields should have summary docstrings. Also naming convention is wrong, run dotnet format info severity.

private const string FormUrl = "https://www.mansfield.gov.uk/xfp/form/1339";
private const string FormPage = "2615";
private const string FormId = "1339";
private const string ApiUrl = "https://portal.mansfield.gov.uk/mdcwhitespacewebservice/WhiteSpaceWS.asmx/GetCollectionByUPRNAndDatePlus";
Copy link
Owner Author

Choose a reason for hiding this comment

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

remove constants with just on reference.

{"locale", "en_GB"},
{"injectedParams", $"{{\"formID\":\"{FormId}\"}}"},
{"q3fc8e993e4e89b244317c1f13b6d65c0b0ef1ad2_0_0", formattedPostcode},
{"callback", "{\"action\":\"ic\",\"element\":\"q3fc8e993e4e89b244317c1f13b6d65c0b0ef1ad2\",\"data\":0,\"tableRow\":-1}"},
Copy link
Owner Author

Choose a reason for hiding this comment

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

the value being escaped json string isn't great for readability.

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

/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 Mansfield council. While the implementation is well-structured, it has critical security concerns regarding a hardcoded API key and potential URL injection in the GetBinDays method that need immediate attention. Additionally, there are several style and convention improvements needed, including correct postcode handling, member ordering, and avoiding single-use constants, to align with the BinDays-API Collector Style Guide.

@BadgerHobbs
Copy link
Owner Author

@claude Resolve the PR comments, making sure to validate/test the changes and check against style guide.

@moley-bot
Copy link

moley-bot bot commented Feb 1, 2026

Claude finished @BadgerHobbs's task in 3m 58s —— View job


Resolving PR Review Comments ✓

I've successfully addressed all the PR review comments and validated the changes against the style guide.

Changes Made

Style Guide Compliance:

  • Fixed postcode handling: Removed FormatPostcode() call since the postcode parameter is already formatted
  • Reordered class members: Moved _binTypes field before const fields per style guide (Configuration section ordering)
  • Inlined single-use constants: Removed FormPage, FormId, and ApiUrl constants that were only used once
  • Added trailing commas: Added trailing commas to all multi-line object initializers
  • Separate variable declarations: Changed all inline returns to use separate variable declarations
  • Added standard comments: Added iteration comments before each foreach loop
  • Used TryGetValue: Changed header access from direct indexer to TryGetValue with null-forgiving operator
  • Added XML documentation: Added <summary> tags for private fields and regex methods

Note on Items NOT Changed:

  • API key remains as a const field (marked as "fine as is" by maintainer)
  • URL construction with query string remains unchanged (marked as "fine as is" by maintainer)
  • DateTime.ParseExact formatting kept on single line for consistency with existing patterns in codebase

Validation

Formatting: Ran dotnet format successfully
Tests: All Mansfield integration tests pass (1/1 passed in 7.4s)
Functionality: Collector successfully retrieves 29 addresses and 82 bin collection dates

Files Modified

  • BinDays.Api.Collectors/Collectors/Councils/Mansfield.cs

--- | Branch

- Remove FormatPostcode call (postcode is already formatted)
- Reorder class members (_binTypes before const fields)
- Inline single-use constants (FormPage, FormId, ApiUrl)
- Add trailing commas to multi-line initializers
- Use separate variable declarations instead of inline returns
- Add standard comments before foreach loops
- Use TryGetValue for header access instead of direct indexer
- Add XML documentation comments for private fields and regex methods

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

@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 Resolve my new pr comments

@moley-bot
Copy link

moley-bot bot commented Feb 1, 2026

Claude finished @BadgerHobbs's task —— View job


Resolving PR Comments ✓

I've successfully addressed all the PR review comments.

Changes Made:

  1. Added XML summary docstring for _formUrl const field (line 56)
  2. Removed single-use _apiKey const and inlined the value at its single usage point (line 178)
  3. TryGetValue usage at line 98 was already correct per style guide - no changes needed

Validation:

  • ✅ Code formatting verified with dotnet format --verify-no-changes
  • ✅ All Mansfield integration tests pass (1/1 passed in 3s)
  • ✅ Changes committed and pushed to branch

Files Modified:

  • BinDays.Api.Collectors/Collectors/Councils/Mansfield.cs

--- | Branch

github-actions bot and others added 2 commits February 1, 2026 23:21
- Add XML summary docstring for _formUrl const field
- Remove single-use _apiKey const and inline the value
- TryGetValue usage confirmed correct per style guide

Co-authored-by: Andrew Riggs <BadgerHobbs@users.noreply.github.com>
Changed from TryGetValue pattern to direct indexer access with ! operator
since the set-cookie header is required for this collector.

Co-authored-by: Andrew Riggs <BadgerHobbs@users.noreply.github.com>
@BadgerHobbs BadgerHobbs added the ready for deployment Implementation ready for deployment label Feb 1, 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.

Mansfield

2 participants