Skip to content

ci: run owner pull request checks on the self-hosted mac mini - #38

Merged
agentHits merged 2 commits into
AgentHits-Devfrom
ci/self-hosted-pr-checks
Oct 7, 2026
Merged

agentHits merged 2 commits into
AgentHits-Devfrom
ci/self-hosted-pr-checks

Conversation

@agentHits

Copy link
Copy Markdown
Collaborator

What:

  • PR checks (audit, build, test, typecheck) for the owner's PRs from this
    repository run on self-hosted runners labelled dokploy-ci.
  • Fork PRs and PRs by other authors stay on ubuntu-latest.
  • Nixpacks/Railpack are installed only on GitHub runners; swarm init is
    skipped when the swarm is already active.
  • Added per-PR concurrency and timeout-minutes: 30.
    Why:
  • On GitHub runners the checks take about 5 minutes; on the Mac mini
    install/typecheck/build/test are faster with a warm cache.
    Risks:
  • The repository is public: a fork PR can rewrite runs-on, so the repo now
    requires approval for runs from every outside contributor.
  • Tests share Docker (OrbStack) on the Mac mini with other workloads.
    Checks:
  • Commands and results: on the Mac mini bun install (warm cache) 15 s,
    typecheck 12 s, build 82 s, unit tests 69 s; full run happens in this PR.
  • Limitations: the Docker image build stays on GitHub (amd64 under emulation
    on the Mac mini is slower: 18 min from scratch).

🤖 Generated with Claude Code

agentHits and others added 2 commits October 7, 2026 08:35
Что:
- Проверки PR (audit, build, test, typecheck) для PR владельца из этого
  репозитория идут на self-hosted раннерах с меткой dokploy-ci.
- PR из форков и от других авторов остаются на ubuntu-latest.
- Nixpacks/Railpack ставятся только на GitHub-раннерах; swarm init
  пропускается, если swarm уже активен.
- Добавлены concurrency по номеру PR и timeout-minutes: 30.
Зачем:
- На раннерах GitHub проверки идут около 5 минут; на Mac mini
  install/typecheck/build/test быстрее за счёт тёплого кэша.
Риски:
- Репозиторий публичный: PR из форка может переписать runs-on, поэтому
  в настройках включено одобрение запусков для всех внешних участников.
- Тесты делят Docker (OrbStack) на Mac mini с другими нагрузками.
Проверки:
- Команды и результаты: на Mac mini bun install (тёплый кэш) 15 с,
  typecheck 12 с, build 82 с, unit-тесты 69 с; итоговый прогон - в этом PR.
- Ограничения: сборка Docker-образа остаётся на GitHub (amd64 под
  эмуляцией на Mac mini медленнее: 18 мин с нуля).

What:
- PR checks (audit, build, test, typecheck) for the owner's PRs from this
  repository run on self-hosted runners labelled dokploy-ci.
- Fork PRs and PRs by other authors stay on ubuntu-latest.
- Nixpacks/Railpack are installed only on GitHub runners; swarm init is
  skipped when the swarm is already active.
- Added per-PR concurrency and timeout-minutes: 30.
Why:
- On GitHub runners the checks take about 5 minutes; on the Mac mini
  install/typecheck/build/test are faster with a warm cache.
Risks:
- The repository is public: a fork PR can rewrite runs-on, so the repo now
  requires approval for runs from every outside contributor.
- Tests share Docker (OrbStack) on the Mac mini with other workloads.
Checks:
- Commands and results: on the Mac mini bun install (warm cache) 15 s,
  typecheck 12 s, build 82 s, unit tests 69 s; full run happens in this PR.
- Limitations: the Docker image build stays on GitHub (amd64 under emulation
  on the Mac mini is slower: 18 min from scratch).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Что:
- Тесту "covers every super password event with no secrets in the payloads"
  дан таймаут 30 с вместо стандартных 5 с.
Зачем:
- В тесте около 20 вызовов bcrypt; на Mac mini, когда все ядра заняты
  воркерами vitest и next build, он стабильно не укладывался в 5 с, а
  следующий тест падал каскадом с "duplicate key in super_password".
Риски:
- Не выявлены: меняется только таймаут теста.
Проверки:
- Команды и результаты: bun run test -- --run
  __test__/security/super-password-alerts.test.ts - 10/10; biome check - ок.
- Ограничения: полный прогон - в CI этого PR.

What:
- The test "covers every super password event with no secrets in the
  payloads" gets a 30 s timeout instead of the default 5 s.
Why:
- It runs about 20 bcrypt calls; on the Mac mini, with every core busy with
  vitest workers and next build, it kept missing 5 s, and the next test then
  failed in cascade with "duplicate key in super_password".
Risks:
- None identified: only the test timeout changes.
Checks:
- Commands and results: bun run test -- --run
  __test__/security/super-password-alerts.test.ts - 10/10; biome check - ok.
- Limitations: the full run happens in this PR's CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@agentHits
agentHits merged commit 2cf4483 into AgentHits-Dev Oct 7, 2026
8 checks passed
@agentHits
agentHits deleted the ci/self-hosted-pr-checks branch October 7, 2026 14:17
agentHits added a commit that referenced this pull request Oct 7, 2026
Что:
- __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>
agentHits added a commit that referenced this pull request Oct 7, 2026
#44)

* ci: remove a cancelled run's real-test swarm services

Что:
- Имена приложений в 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: cap bcrypt cost at 4 in the shared test setup

Что:
- __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>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant