Skip to content

Dirty pr#2131

Closed
JonasVHG wants to merge 6 commits intomasterfrom
dirty-pr
Closed

Dirty pr#2131
JonasVHG wants to merge 6 commits intomasterfrom
dirty-pr

Conversation

@JonasVHG
Copy link
Contributor

@JonasVHG JonasVHG commented Dec 4, 2025

@Developers please ignore.

@JonasVHG
Copy link
Contributor Author

JonasVHG commented Dec 4, 2025

@claude please review

@claude
Copy link
Contributor

claude bot commented Dec 4, 2025

Claude finished @JonasVHG's task —— View job


Code Review Complete

Tasks

  • Check for repository guidelines (CLAUDE.md)
  • Create pending review
  • Analyze PR diff and changes
  • Review code quality
  • Review security considerations
  • Review performance implications
  • Review test coverage
  • Submit review with inline feedback

Review Summary

I've completed the code review for this PR that adds Dutch (NL) street suggestion support. The implementation approach is sound, but there are several critical typos that will cause runtime errors.

Critical Issues Found ⚠️

  1. Configuration typo (app/Address/AddressServiceProvider.php:51): 'doman' should be 'domain' - will cause config lookup failure
  2. Parameter typo (src/Http/Address/GetStreetRequestHandler.php:21): duchtStreetSuggester should be dutchStreetSuggester
  3. Country code inconsistency: Code checks for 'NL' but error message shows 'NLD' - needs standardization
  4. Cache key typo (app/Address/AddressServiceProvider.php:57): 'dutch_streetts' has extra 't'
  5. Test variable typo (tests/Http/Address/GetStreetRequestHandlerTest.php:23): steetSuggester2 missing 'r'

Code Quality Concerns

  • Unconventional service naming: 'Dutch_' . StreetSuggester::class is brittle and should use a more explicit identifier
  • Service should be added to getProvidedServiceNames() if it's a provided service

Missing Test Coverage

No test case for the new Dutch street functionality - only error handling was updated.

Recommendation

Do not merge until critical typos are fixed. I've provided inline comments with GitHub suggestion blocks for all fixes - you can commit them directly from the GitHub UI.


Copy link
Contributor

@claude claude 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 Summary

I've reviewed this PR that adds support for Dutch (NL) street suggestions alongside the existing Belgian (BE) functionality. While the approach is reasonable, there are several critical typos that will cause runtime errors, along with some inconsistencies and missing test coverage.

Critical Issues (Must Fix)

  1. Configuration typo: 'doman' instead of 'domain' in AddressServiceProvider.php:51
  2. Parameter typo: duchtStreetSuggester instead of dutchStreetSuggester in GetStreetRequestHandler.php:21
  3. Country code inconsistency: The code checks for 'NL' but error message shows 'NLD'

Code Quality Issues

  1. Cache key typo: 'dutch_streetts' has an extra 't'
  2. Test variable typo: steetSuggester2 missing 'r'
  3. Unconventional service naming: 'Dutch_' . StreetSuggester::class is brittle

Missing Test Coverage

No test case exists for the new Dutch street functionality. Only the error handling test was updated.

Recommendations

  • Fix all typos before merging (they will cause runtime failures)
  • Standardize on either 'NL' or 'NLD' for the country code
  • Add test coverage for Dutch street suggestions
  • Consider more conventional service naming patterns

I've provided inline comments with suggestion blocks for easy fixes. Please review and apply the suggestions.

fn () => new CachedStreetSuggester(
new BPostStreetSuggester(
new Client(),
$container->get('config')['bpost']['doman'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Critical Typo: doman should be domain. This will cause a configuration lookup error at runtime.

Suggested change
$container->get('config')['bpost']['doman'],
$container->get('config')['bpost']['domain'],

),
CacheFactory::create(
$container->get('app_cache'),
'dutch_streetts',
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: dutch_streetts has an extra 't'. Should be dutch_streets to match the pattern used for Belgium streets.

Suggested change
'dutch_streetts',
'dutch_streets',

);

$container->addShared(
'Dutch_' . StreetSuggester::class,
Copy link
Contributor

Choose a reason for hiding this comment

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

Architectural Concern: The service identifier 'Dutch_' . StreetSuggester::class is unconventional and brittle. Consider using a more explicit service name like 'dutch_street_suggester' or creating a proper interface/class differentiation.

Also, this service should be added to the getProvidedServiceNames() method if it's meant to be a provided service.

public function __construct(StreetSuggester $belgiumStreetSuggester)
private StreetSuggester $dutchStreetSuggester;

public function __construct(StreetSuggester $belgiumStreetSuggester, StreetSuggester $duchtStreetSuggester)
Copy link
Contributor

Choose a reason for hiding this comment

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

Critical Typo: Parameter name duchtStreetSuggester is misspelled (missing 't' in "Dutch"). This will cause issues with parameter naming consistency.

Suggested change
public function __construct(StreetSuggester $belgiumStreetSuggester, StreetSuggester $duchtStreetSuggester)
public function __construct(StreetSuggester $belgiumStreetSuggester, StreetSuggester $dutchStreetSuggester)

'country',
$countryCode,
['BE']
['BE', 'NLD']
Copy link
Contributor

Choose a reason for hiding this comment

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

Inconsistency: The error message shows 'NLD' as a valid country code, but the check on line 52 uses 'NL'. This is confusing - should the country code be 'NL' or 'NLD'?

Suggested change
['BE', 'NLD']
['BE', 'NL']

Or if 'NLD' is the correct code, update line 52 to check for 'NLD' instead of 'NL'.


private StreetSuggester&MockObject $streetSuggester;

private StreetSuggester&MockObject $steetSuggester2;
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: Variable name steetSuggester2 is misspelled (missing 'r' in "street"). Should be streetSuggester2 for consistency.

Also, the variable name streetSuggester2 is not descriptive. Consider naming it dutchStreetSuggester to match the actual usage.

Suggested change
private StreetSuggester&MockObject $steetSuggester2;
private StreetSuggester&MockObject $dutchStreetSuggester;

@@ -98,14 +101,14 @@ public function it_supports_limits(): void
public function it_will_throw_on_unsupported_countries(): void
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing Test Coverage: While the test was updated to handle the new parameter, there's no test case for the new NL (Dutch) functionality. Consider adding a test similar to it_can_handle_a_get_street_request() but for Dutch addresses:

/**
 * @test
 */
public function it_can_handle_a_dutch_get_street_request(): void
{
    $request = (new Psr7RequestBuilder())
        ->withUriFromString('streets?country=NL&postalCode=1012AB&locality=Amsterdam&query=Damrak')
        ->build('GET');

    $this->dutchStreetSuggester->expects($this->once())
        ->method('suggest')
        ->with('1012AB', 'Amsterdam', 'Damrak', 5)
        ->willReturn([
            'Damrak',
            'Damstraat',
        ]);

    $response = $this->getStreetRequestHandler->handle($request);

    $this->assertJsonResponse(
        new JsonResponse([
            'Damrak',
            'Damstraat',
        ]),
        $response
    );
}

@JonasVHG
Copy link
Contributor Author

JonasVHG commented Dec 4, 2025

This was a deliberate bad PR to check code reviews from Claude, so it will be closed instead of merged.

@JonasVHG JonasVHG closed this Dec 4, 2025
@JonasVHG JonasVHG deleted the dirty-pr branch December 5, 2025 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant