Remove dead is_public/public_port check from create_service() - #202
Merged
Conversation
is_public/public_port were never in \$allowedFields or validationRules for this endpoint, so the extraFields check (\"This field is not allowed.\") already rejects any request that includes is_public before this branch is reached; omitting it leaves \$request->is_public null/falsy, so the branch never fires either way. Leftover copy-paste from an application-style controller.
…ead-is-public-check
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
Found via a fresh
/code-reviewpass onapp/Http/Controllers/Api/ServicesController.php(issue #70).create_service()checked$request->is_public/$request->public_port, but neither field is in$allowedFieldsor$validationRulesfor this endpoint. The earlierextraFieldscheck (array_diff(array_keys($request->all()), $allowedFields)) already rejects a request that includesis_publicwith a 422 ("This field is not allowed.") before this branch is ever reached; if it's omitted,$request->is_publicis null/falsy and the branch never fires either way. Leftover copy-paste from an application-style controller with no effect - dead code that misleads a reader into thinkingis_publicis a supported field here.Fix
Removed the dead branch.
Verification
rejects an is_public field as not allowedproves the field really is rejected upstream (making the removed branch provably unreachable, not just apparently unused) - passes identically before and after this change, since it's testing theextraFieldscheck, not the removed code. Full create/actions/index/envs/storages suites pass unchanged (51 tests). Pint/PHPStan clean on the changed file.