fix(api): HTTP 401/429 для auth и rate-limit в Web API#434
Open
Ibochkarev wants to merge 2 commits into
Open
Conversation
Ibochkarev
force-pushed
the
fix/issue-414-web-api-auth-status
branch
from
July 23, 2026 16:09
826fda7 to
b936cdd
Compare
16 tasks
Clients could not distinguish unauthenticated, bad credentials, and throttle responses because routes always mapped processor failures to HTTP 400. Pass HttpStatus via processor failure objects and Response helpers so profile/email unauth → 401, invalid login → 401, rate limits → 429.
PHPCS requires a space after the function keyword in closures; also clear blank lines before closing braces and wrap a long line.
Ibochkarev
force-pushed
the
fix/issue-414-web-api-auth-status
branch
from
July 24, 2026 02:16
b936cdd to
00b6474
Compare
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.
Описание
Web API больше не отдаёт HTTP 400 на unauthenticated / invalid login / throttle. Клиенты могут отличать эти случаи для retry и UX.
Response::error, как в AddressController)web.php→Response::fromProcessor()(читаетcodeиз failure object)Response::statusFromProcessorObjectТип изменений
Связанные Issues
Closes #414
Как это было протестировано?
Gate E (эта сессия):
php -ltouched PHP — OKphp tests/ResponseFromProcessorTest.php— OKcomposer ci:php/bash scripts/ci-php.sh— OK (exit 0)Vue не затронут — lint/build n/a
Ручное тестирование
Автоматические тесты (
composer ci:php,npm run lint:ci/ GitHub Actions CI)Тестирование на разных версиях PHP/MODX
Конфигурация тестирования:
fix/issue-414-web-api-auth-statusСкриншоты (если применимо)
n/a
Чеклист
npm run lint:ciдля Vue) — n/aДополнительные заметки
Контракт для клиентов (ожидаемо по #414): ошибки, которые раньше всегда были HTTP 400, теперь 401/429. Validation / missing fields остаются 400.
Соседние правки в том же PR: Register
createTokenfailure → 500 (симметрия с Login); email verification cooldown/send_failed → 429/500.Review: code-reviewer, thermo-nuclear, security-review, silent-failure-hunter; 1 fix-loop (маппинг перенесён в
Response, убран отдельный helper).