Repository navigation
Conversation
`checks a Bitbucket source with the service secret too` went to the real api.bitbucket.org: for a Bitbucket source the deploy webhook asks for the pushed commit's diffstat, with a 10 s timeout, and nothing in the file replaced `fetch`. On a slow answer the test outlasted vitest's 5 s limit and failed `pr-check (unit)` on PRs that did not touch it (again on #273). The file now stubs `fetch` for every test with a one-page diffstat and removes the stub after each test. The Bitbucket test also checks that the handler called it once, for the commit's diffstat URL, and that the request with a wrong signature is refused without a second call. Reproduced on Linux with api.bitbucket.org pointed at an address that never answers: before, both variants (application, compose) time out at 5 s; after, the file passes in 0.3 s, also with no network at all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Закрываю как дубль #277: там та же подмена |
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.
Зачем
Тест
service-webhook-secret > checks a Bitbucket source with the service secret tooходил в настоящийapi.bitbucket.org. Для источника Bitbucket обработчик вебхука деплоя запрашивает diffstat коммита (extractCommittedPathsвpages/api/deploy/[refreshToken].ts) с таймаутом 10 с, аfetchв файле ничем не подменялся. Если Bitbucket отвечал медленно, тест не укладывался в лимит vitest 5 с и ронялpr-check (unit)у PR, которые его не касались (последний раз у #273, повтор прошёл).Что изменилось
Только тест, код панели не менялся.
fetchна каждый тест ответом diffstat из одной страницы и снимает подмену после каждого теста (vi.stubGlobal/vi.unstubAllGlobals).fetchодин раз по адресу diffstat коммита, и что запрос с неверной подписью получает 401, не обращаясь к Bitbucket.Проверки
Linux, Bun 1.4.4, Node 26.13.0 (VM):
api.bitbucket.orgнаправлен на адрес, который не отвечает (--add-host api.bitbucket.org:10.255.255.1). До правки оба варианта теста (application и compose) падают по таймауту 5 с; после правки файл проходит за 0,3 с (92 из 92).--network none): 92 из 92, четыре прогона подряд.bun run server:build,bun run typecheck,biome formatиbiome lintпо файлу проходят.🤖 Generated with Claude Code