Repository navigation
ci: clean up cancelled real-test services and cap bcrypt cost in tests - #44
Merged
Merged
Conversation
Что: - Имена приложений в application.real.test.ts содержат CHECKOUT_ID - первые 8 символов sha256 от process.cwd(): real-<вид>-<id>-<время> и real-nixpacks-<id>. - В pull-request.yml у задачи test добавлен шаг с if: always(), который считает тот же id из пути apps/dokploy и удаляет только swarm-сервисы real-*-<id>. Зачем: - Тесты удаляют свои сервисы сами, но при отмене прогона (новый push, таймаут) уборка не выполняется, и на Mac mini копятся сервисы 0/1, которые swarm безуспешно пытается запустить. - Docker на Mac mini общий для всех раннеров, поэтому удалять все real-* нельзя: это сломало бы тесты соседнего PR. Риски: - Если тесты поменяют рабочую папку vitest, id в шаге и в тестах разойдутся, и шаг просто ничего не удалит. Проверки: - Команды и результаты: printf <путь apps/dokploy раннера 2> | shasum -a 256 даёт 6b7e0626 - совпадает с real-nixpacks-6b7e0626 из лога CI; grep выбирает только имена с этим id; xargs -r на пустом вводе ничего не запускает; biome, tsc по файлу и разбор YAML - без ошибок. - Ограничения: отмена прогона посреди тестов вручную не проверялась. What: - App names in application.real.test.ts carry CHECKOUT_ID, the first 8 chars of sha256(process.cwd()): real-<kind>-<id>-<time> and real-nixpacks-<id>. - pull-request.yml adds an if: always() step to the test job that derives the same id from the apps/dokploy path and removes only the real-*-<id> swarm services. Why: - Tests remove their own services, but a cancelled run (new push, timeout) skips that, and 0/1 services pile up on the Mac mini while swarm keeps trying to start them. - Docker on the Mac mini is shared by all runners, so removing every real-* service would break a neighbouring PR's tests. Risks: - If the tests ever change vitest's working directory, the ids diverge and the step simply removes nothing. Checks: - Commands and results: printf <runner 2 apps/dokploy path> | shasum -a 256 gives 6b7e0626, matching real-nixpacks-6b7e0626 from the CI log; grep picks only names with that id; xargs -r runs nothing on empty input; biome, tsc on the file and YAML parsing are clean. - Limitations: cancelling a run mid-test was not exercised by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Что: - __test__/setup.ts подменяет bcrypt.hash: числовой cost ограничен 4, алгоритм и формат хэша остаются настоящими. Код сервиса не меняется (в продакшене по-прежнему cost 12). - Убран таймаут 30 с у теста "covers every super password event" из PR #38: тест теперь идёт ~0,25 с. Зачем: - Супер-пароль хэшируется с cost 12 (~0,25 с на свободном ядре), а тесты делают десятки хэшей. На загруженном Mac mini тесты "locks for 15 minutes after 5 wrong attempts" и "still locks when no channel has the super password toggle on" упали по таймауту 5 с в CI этого PR. Подмена в общем setup закрывает все 6 таких файлов разом, а не по одному таймауту. Риски: - Ни один тест не проверяет сам cost; если такой появится, ему нужно будет обойти подмену. Проверки: - Команды и результаты: bun run test -- --run --exclude "**/*.real.test.ts" локально - 267 файлов, 2389 тестов, 53 с; тесты __test__/security и terminal-super-session - 168/168; "covers every super password event" - 248 мс; biome и tsc по изменённым файлам - без ошибок. - Ограничения: real-тесты - в CI этого PR. What: - __test__/setup.ts wraps bcrypt.hash so a numeric cost is capped at 4; the algorithm and hash format stay real. Service code is unchanged (production still uses cost 12). - Dropped the 30 s timeout that PR #38 gave "covers every super password event": the test now runs in ~0.25 s. Why: - The super password is hashed at cost 12 (~0.25 s on an idle core) and the tests hash dozens of times. On the busy Mac mini, "locks for 15 minutes after 5 wrong attempts" and "still locks when no channel has the super password toggle on" hit the 5 s timeout in this PR's CI. Capping it in the shared setup covers all 6 such files at once instead of one timeout at a time. Risks: - No test checks the cost itself; one that does would need to bypass this. Checks: - Commands and results: bun run test -- --run --exclude "**/*.real.test.ts" locally - 267 files, 2389 tests, 53 s; __test__/security and terminal-super-session - 168/168; "covers every super password event" - 248 ms; biome and tsc on the changed files - clean. - Limitations: the real tests run in this PR's CI. Co-Authored-By: Claude Opus 5.5 <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.
What:
of sha256(process.cwd()): real--- and real-nixpacks-.
the same id from the apps/dokploy path and removes only the real-*-
swarm services.
Why:
skips that, and 0/1 services pile up on the Mac mini while swarm keeps
trying to start them.
service would break a neighbouring PR's tests.
Risks:
the step simply removes nothing.
Checks:
gives 6b7e0626, matching real-nixpacks-6b7e0626 from the CI log; grep picks
only names with that id; xargs -r runs nothing on empty input; biome, tsc
on the file and YAML parsing are clean.
🤖 Generated with Claude Code