Eliminate guaranteed HTTP 500 routes: dead history feature & Sensio Entity (#534)#547
Open
maltehuebner wants to merge 1 commit into
Open
Eliminate guaranteed HTTP 500 routes: dead history feature & Sensio Entity (#534)#547maltehuebner wants to merge 1 commit into
maltehuebner wants to merge 1 commit into
Conversation
…io Entity)
Most of the routes listed in the issue were already fixed on main by the
Elasticsearch/Analysis cleanup (src/Air/Analysis and AnalysisController no
longer exist). Two guaranteed-500 problems remained:
1) POST /api/{citySlug} (CityApiController::postCityAction) relied on
#[Entity('city', expr: ...)] from SensioFrameworkExtraBundle, which is
not installed, so the City argument could not be resolved -> 500.
Replaced with #[MapEntity(expr: 'repository.findOneBySlug(citySlug)')],
matching StationApiController::postStationAction. Removed the dead
`use Sensio\...\Entity` import.
2) GET /{stationCode}/history (StationController::historyAction) used
App\Air\PollutionDataFactory\HistoryDataFactory, which references a
`$dataList` property that exists nowhere in the hierarchy, a
non-existent class App\Util\DateTimeUtil, and calls
DataRetrieverInterface::retrieveDataForCoord() with 4 args (interface
declares 1). This code has never been runnable. As the flagception flag
`station_history` already defaulted to false (feature effectively off),
the broken feature was removed entirely: route, controller action,
HistoryDataFactory + HistoryDataFactoryInterface, the history template,
the station-page link, and the flag.
Removed the corresponding phpstan-baseline.neon entries (baseline shrinks).
Also removed the now-unused Elasticsearch container from docker-compose.yml
and the stale "Elasticsearch for search" references in CLAUDE.md and
README.md; the app queries PostGIS directly and no longer uses Elastica.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Audited against current
main. Most routes from the issue were already fixed by the earlier Elasticsearch/Analysis cleanup:src/Air/Analysis/*andAnalysisControllerno longer exist, so/komfortofen,/analysis/silvesterand/{stationCode}/limitsare gone. Two guaranteed-500 problems remained; this PR resolves both.Changes
1.
POST /api/{citySlug}— SensioFrameworkExtraBundle not installedCityApiController::postCityActionused#[Entity('city', expr: 'repository.findOneBySlug(citySlug)')]fromSensioFrameworkExtraBundle, which is not installed, so theCityargument could never be resolved (500 on every call). Replaced with#[MapEntity(expr: 'repository.findOneBySlug(citySlug)')](exactly the patternStationApiController::postStationActionalready uses) and removed the deaduse Sensio\...\Entityimport.2.
GET /{stationCode}/history— non-functional dead codeStationController::historyActionrelied onHistoryDataFactory, which references:$dataListproperty that exists nowhere in the class hierarchy,App\Util\DateTimeUtil,DataRetrieverInterface::retrieveDataForCoord()called with 4 args (interface declares 1).This has never been runnable. The
station_historyflagception flag already defaulted tofalse, so the feature was effectively off. Removed it in full: route, controller action,HistoryDataFactory+HistoryDataFactoryInterface,templates/Station/history.html.twig, the station-page link, and the flag.Cleanup
phpstan-baseline.neonentries (baseline shrinks:$dataList,DateTimeUtil::getHourStartDateTime, the 4-paramretrieveDataForCoord,HistoryDataFactoryInterface::setStation, the SensioEntityattribute).docker-compose.yml, and the stale "Elasticsearch for search" references inCLAUDE.md/README.md— the app queries PostGIS directly and no longer uses Elastica.Deliberately not implemented
DateTimeUtil, and a matchingDataRetrieversignature). That is a new, DB-dependent feature build I cannot verify here; removal is the option the issue explicitly allows and eliminates the 500./api/{stationCode}/analysis(findForAnalysis) is tracked separately in [Hoch] /api/{stationCode}/analysis wirft HTTP 500 (fehlende Repository-Methode) #524.Verification
vendor/bin/phpstan analyse— No errors (baseline updated).vendor/bin/phpunit --testsuite="Project Test Suite"— 121 tests green.bin/console lint:container --env=prod— OK.bin/console debug:router --env=prod—station_historyroute gone;api_city_poststill registered.bin/console lint:twig— station template valid.Note: full runtime verification of
POST /api/{citySlug}needs a populated PostGIS DB (not available here); the fix mirrors the workingpostStationActionresolver.Closes #534
🤖 Generated with Claude Code