## Summary
Lets the brencher UI pre-fill its branch filter from a `?filter=<text>` query
parameter on initial page load.
## Use case
Deep-link filtered views from external tooling (runbooks, Gitea issues,
dashboards). For example:
- `https://brencher.rudolf.keenetic.link/?filter=connectivity_tester` — go straight to the new stack after #65 lands.
- `https://brencher.rudolf.keenetic.link/?filter=hermes_infra%20v0.4.0` — multiple words (current filter does substring match on all).
## Changes
`frontend/app.js`: IIFE on initial load reads `URLSearchParams`, sets
`branchFilter.value`, calls `filterBranches()`. Empty / missing param
leaves the filter empty (no pre-fill, no apply) — same as before.
## Acceptance
- `?filter=foo` pre-fills the input AND applies the filter on initial render.
- Empty `?filter=` is a no-op (param present but empty string).
- No param at all is a no-op (no pre-fill, no apply).
- Existing inline typing behaviour unchanged.
## Resolves
- admin/brencher#66 (brencher UI: support ?filter=<text> GET-param that auto-fills the filter input)
## Related
- admin/brencher#65 (PR feat(configs): add connectivity_tester stack) — once #65 merges, the link `/<brencher-host>/?filter=connectivity_tester` becomes a one-click entry point to the new stack.
---------
Co-authored-by: hermes <hermes@rudolf.keenetic.link>
Reviewed-on: #67
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
## Symptom
Production brencher UI reports constant WebSocket reconnects (see
user observation 2026-09-05, fact #5). Prod logs from
`brencher_brencher-backend` (image `brencher:auto-74bf5aef-…`) show
`WebSocket /ws [accepted]` followed within ~3–10 s by
`KeyError: <starlette.websockets.WebSocket object …>` raised at
`backend/web.py:175`, then `connection closed`. Same UI reconnecting
after the 5 s backoff. The companion `brencher2` instance (one
stack, no `SECONDARY_BRENCHER`) shows 0 errors over the same window,
confirming that the same code on a single-stack single-source path
is race-free.
## Root cause
`ws_connections: Dict[WebSocket, Dict[str, Any]]` is mutated from
two coroutines that race on the asyncio event loop:
- `broadcast()` — invoked via `asyncio.run_coroutine_threadsafe`
from the processing thread on every `onupdate()`. With 7 profiles
on the new brencher this fires ≥10 times per ~100 s cycle, and
the SecondaryManager’s `on_update=lambda: self.broadcast_all()`
layers additional dispatches on top.
- `websocket_endpoint()` — the FastAPI handler running on the
uvicorn loop. Between `await websocket.accept()` and
`self.ws_connections[websocket] = {}`, the handler yields. A
concurrent broadcast that was already iterating
`self.ws_connections.keys()` may include the freshly accepted
socket in `disconnected` (because its own `send_text` raised
earlier and was logged), then `pop` removes it before
`websocket_endpoint` writes back. The handler then hits
`self.ws_connections[websocket]["branches"] = …` and raises
`KeyError`. Starlette’s default error path closes the WS.
## Fix (this PR — variant `setdefault`)
Treat `ws_connections` as a sparse dict: rely on
`dict.setdefault` for atomic insert-or-get, and hold a local
`state` binding throughout the handler so every subsequent write
operates on the same dict object even if a concurrent broadcast
removes and re-adds the entry.
Diff is 12 lines, no API or protocol change:
- `broadcast()`: iterate `ws_connections.items()`; write to the
local `state[event] = message` instead of
`self.ws_connections[websocket][event] = message`.
- `websocket_endpoint()`: replace `ws_connections[websocket] = {}`
with `state = ws_connections.setdefault(websocket, {})`; replace
the two follow-up writes with `state["branches"] = …` /
`state["environments"] = …`.
Properties:
- A broadcast scheduled before `setdefault` runs is a no-op for
the freshly accepted client (its first frame is the handler’s
initial `send_text`, so losing one in-flight broadcast is
benign; the next periodic broadcast at `~10 s` re-sends).
- Stale `state` returned by `setdefault` is overwritten in place
— no lock needed because CPython dict operations are atomic
under the GIL, and we only ever touch the dict’s value binding,
never its key existence.
- Code reads cleaner: there’s one `state = ws_connections[…]`
binding per WS, no `self.ws_connections[websocket]["x"]`
chains.
## Companion PRs (variants 3 and 4 — same race, different shape)
- `fix/ws-asyncio-lock` — explicit `asyncio.Lock` around the
dict; serializes mutation but not `send_text`.
- `fix/ws-writer-loop` — single-writer task consuming an
`asyncio.Queue`; broadcast becomes inherently sequential.
All three solve the same root cause with different trade-offs. The
recommended merge order is this one (smallest diff, lowest review
surface). Promote to `Lock` or `Queue` only if benchmarking shows
setdefault is insufficient under heavier connection concurrency.
## Validation
- `python3 -m py_compile backend/web.py` → OK.
- Diff: 12 lines in one file.
Manual verification on production is the user’s call. The prod
logs already show the pre-fix error pattern (`brencher_brencher-backend`
1.80 WS errors per WS_OPEN), so post-deploy the same log extraction
script (in `prod-ws-error-count` skill) should drop to 0.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: alex <alex@rudenk.local>
Co-authored-by: brencher_bot <brencher_bot@rudolf.keenetic.link>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/58
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
Auto-recovery snapshot of shard auto-6fd59898 from image auto-04d3624a-34caac15-6fd59898-920249ec-afc2de34. Fossil branch. This commit was recovered from refs/pull/26/head (Gitea retains PR-head refs even after merge). PR #26 was merged; mergeable will likely be False.
---------
Co-authored-by: brencher_bot <rudolfss13@gmail.com>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/53
Co-authored-by: brencher_bot (hermes) <rudolfss13+hermes@gmail.com>
Auto-recovery snapshot of shard auto-34caac15 from image auto-04d3624a-34caac15-6fd59898-920249ec-afc2de34. Fossil branch. PR #12 (point immich at gitea admin/hermes ansible repos) was merged into admin/brencher:main; mergeable will likely be False because the content is already in main.
---------
Co-authored-by: hermes <hermes@rudolf.keenetic.link>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/52
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
Auto-recovery snapshot of shard auto-04d3624a from image auto-04d3624a-34caac15-6fd59898-920249ec-afc2de34. Fossil branch. The commit's content already landed in admin/brencher:main via PR #28 (closed) and is part of PR #11 family. Opening this PR is for archival/reference only; mergeable will likely be False because the content is already in main.
---------
Co-authored-by: admin <rudolfss13@gmail.com>
Co-authored-by: brencher_bot <rudolfss13@gmail.com>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/51
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
## Summary
`GitClone`'s top-level `branchNamePrefix` argument was silently ignored when constructed with the explicit `remotes=[...]` form (verified in `backend/steps/git.py:106`):
```python
if remote_name == "origin" and self.branchNamePrefix != "":
# apply refspec
```
The prefix only fires when a remote is named `"origin"`. The `remotes=` form passes names through verbatim, so configs like the open PR #28 set the prefix but never apply it — all branches from all remotes are fetched.
This PR extends the API: each remote entry now optionally accepts a `prefix` field. When set, the fetch refspec for that remote becomes scoped to `<prefix>/*` branches. Backwards-compatible — remotes without `prefix` keep the existing behavior, and `url=` shorthand with `branchNamePrefix` still works.
## API
```python
clone = GitClone(remotes=[
{"name": "github", "url": "...", "prefix": "ansible"},
{"name": "gitea_hermes", "url": "...", "prefix": "ansible"},
{"name": "gitea_admin", "url": "...", "prefix": "ansible"},
])
```
Each remote is independent — some can have `prefix`, others not.
## Changes
### `backend/steps/git.py`
- `__init__` (`remotes=` branch): validate `prefix` (string if set, reject non-string with `ValueError`), persist into the normalized entry. Empty string / None → no prefix applied (existing behavior).
- `progress()` fetch loop: replace the single `if remote_name == "origin"` check with per-entry logic. Effective prefix = `entry["prefix"] or (self.branchNamePrefix if remote_name == "origin" else "")`. Apply refspec per remote when effective prefix is non-empty.
### `tests/test_git_integration.py`
3 new tests in `TestGitIntegration`:
- `test_git_clone_remotes_per_remote_prefix` — both remotes prefixed; only `ansible/*` branches visible, `master` is filtered out.
- `test_git_clone_remotes_mixed_prefix` — one remote prefixed, one not; each behaves independently.
- `test_git_clone_remotes_prefix_validation` — `prefix=123` / `prefix=["ansible"]` raise `ValueError`; `prefix=""` and missing-`prefix` are accepted.
Existing `test_git_clone_named_remotes` continues to pass (verified — no behavior change for unprefixed remotes).
## Test results
```
29 passed in ~13s
```
(18 in `test_git_integration.py`, 11 in `test_dummy.py`/`test_caching_step.py`/`test_cached_env.py`.)
## Migration path
After merge:
- Open migration PRs (#26 gmail_mcp, #28 hermes, planned #19 gitea.py) — switch from `branchNamePrefix="ansible"` to `"prefix": "ansible"` on each remote.
- `hermes_infra.py` after PR #8 already drops `branchNamePrefix`, no change needed.
- Existing `url=` configs (immich, gmail_mcp-old, hermes-old, registry, gitea-old) — unaffected.
## Unblocks
PR #28 — once this lands, hermes.py can drop the (currently misleading) top-level `branchNamePrefix="ansible"` and add `"prefix": "ansible"` per remote.
Refs #30
Blocks #28
Part of #18 (parent migration ticket)
---------
Co-authored-by: admin <rudolfss13@gmail.com>
Co-authored-by: brencher_bot <rudolfss13@gmail.com>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/31
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
## Summary
Updates `backend/configs/gmail_mcp.py` to point at the new `mcps` stack mirrors on gitea instead of the legacy `uber_backup` repo.
Remotes now:
- `gitea_hermes` → `https://gitea.rudolf.keenetic.link/hermes/mcps`
- `gitea_admin` → `https://gitea.rudolf.keenetic.link/admin/mcps`
Uses the `remotes=[{name, url}, …]` form introduced by #3.
## What changed vs the original #26 body
- **Repo switched**: `uber_backup` → `mcps` (the gmail + telegram MCP server repo, now mirrored on gitea under both `admin/` and `hermes/`).
- **GitHub remote dropped**: matches the pattern in `hermes_infra.py` after #8 and `docker_socket_proxy.py` after #23. The brencher container cannot reach `github.com` (squid returns HTTP 403 on CONNECT tunnel), so keeping a `github` remote would hard-fail the clone and trap brencher in the same retry loop that blocked #23 on `admin/reverseproxy` before its mirror was created.
- **`branchNamePrefix="immoscout"` dropped**: the prefix is only applied to remotes named `origin` (see `backend/steps/git.py` ~L104); neither remote qualifies, so the field is a silent no-op. Matches the cleanup done in `hermes_infra.py` / `brencher.py`.
## Diff (vs `main`)
```diff
-clone = GitClone(url="https://github.com/rudolf1/uber_backup.git", branchNamePrefix="immoscout")
+clone = GitClone(remotes=[
+ {"name": "gitea_hermes", "url": "https://gitea.rudolf.keenetic.link/hermes/mcps"},
+ {"name": "gitea_admin", "url": "https://gitea.rudolf.keenetic.link/admin/mcps"},
+])
```
## Prerequisites (already done)
Both target mirrors exist on gitea:
- `admin/mcps` — already present (primary, not a fork).
- `hermes/mcps` — forked in this session (id=10, fork of `admin/mcps`).
## Test plan
1. From the brencher state file for `gmail_mcp`, register `gitea_hermes/feat/migrate-gmail-mcp-to-multi-remote` as the desired branch.
2. Watch brencher logs: `Cloning repositories [...]` should succeed for both `gitea_hermes` and `gitea_admin`.
3. Confirm `gmail_mcp` stack redeploys against the new repo.
Refs #20
Part of #18
---------
Co-authored-by: brencher_bot <rudolfss13@gmail.com>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/26
Co-authored-by: brencher_bot (hermes) <rudolfss13+hermes@gmail.com>
## Summary
Migrates `backend/configs/immich.py` from the legacy `url=` form (pointing at the unreachable `github.com/rudolf1/uber_backup.git`) to the new `remotes=[{name, url}, ...]` form introduced by PR #3 (named-remotes), pointing at the actual gitea repos where the ansible stack lives.
## What's in this PR
- `backend/configs/immich.py` — single file, +22/-1
- `GitClone(url="https://github.com/rudolf1/uber_backup.git"[, branchNamePrefix=...])`
→
`GitClone(remotes=[{"name": "gitea_hermes", "url": "https://gitea.rudolf.keenetic.link/hermes/ansible"}, {"name": "gitea_admin", "url": "https://gitea.rudolf.keenetic.link/admin/ansible"}])`
- `branchNamePrefix` is dropped (it would be a silent no-op: `GitClone` only applies its prefix refspec to a remote named `origin` per `backend/steps/git.py` ~L104, and neither remote here is named `origin`)
## Why migrate
- The old URL never resolved (`uber_backup.git` doesn't exist on gitea anyway) — so the deploy path was broken even though the file looked correct.
- `github.com` returns HTTP 403 on CONNECT tunnel from the brencher container's egress proxy — verified in `admin/brencher#4` (commit `653aee9`).
## Scope decision: only `immich.py`
The other open configs (`registry.py`, `gitea.py`, `hermes.py`, `immich.py`, `gmail_mcp.py`, `torrserv_proxy.py`) are being migrated in **separate PRs**, one per file. Each PR has its own branch + verification.
## Verification (sandbox, no docker daemon)
- `python3 -m py_compile backend/configs/immich.py` — OK
- Real import via `from configs import immich`:
- `clone.remotes` is a 2-entry list `[gitea_hermes, gitea_admin]`, `clone.urls` derived from it
- no `github.com` substring anywhere in the constructed config
- `clone.branchNamePrefix == ''`
- pytest: **26/26** passed on the no-docker / no-playwright suite
- mypy `--no-incremental --follow-imports=silent`: `Success: no issues found in 1 source file`
- **End-to-end smoke test**: built a parallel `GitClone(remotes=[...])` with both URLs pointed at `file:///tmp/ansible-upstream`, ran `clone.progress()`:
- both named remotes created in the temp clone
- 4 branches discovered (`master` + `feat/docker-socket-proxy` × 2 remotes)
- `feat/docker-socket-proxy` visible on both `gitea_admin` and `gitea_hermes`
## What was NOT verified in the sandbox
- HTTPS clone from `gitea.rudolf.keenetic.link` on the live brencher-bot — requires the brencher container's git credentials to have push rights on `admin/ansible`.
- end-to-end `docker stack deploy` — needs a real swarm.
## After merge
After this PR merges into `admin/brencher:main`, the next brencher deploy of this environment will clone from gitea instead of the unreachable github URL.
---------
Co-authored-by: hermes <hermes@rudolf.keenetic.link>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/12
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
## Summary
Migrates `backend/configs/hermes.py` from the legacy `url=` form (pointing at the unreachable `github.com/rudolf1/uber_backup.git`) to the new `remotes=[{name, url}, ...]` form introduced by PR #3 (named-remotes), pointing at the actual gitea repos where the ansible stack lives.
## What's in this PR
- `backend/configs/hermes.py` — single file, +22/-1
- `GitClone(url="https://github.com/rudolf1/uber_backup.git"[, branchNamePrefix=...])`
→
`GitClone(remotes=[{"name": "gitea_hermes", "url": "https://gitea.rudolf.keenetic.link/hermes/ansible"}, {"name": "gitea_admin", "url": "https://gitea.rudolf.keenetic.link/admin/ansible"}])`
- `branchNamePrefix` is dropped (it would be a silent no-op: `GitClone` only applies its prefix refspec to a remote named `origin` per `backend/steps/git.py` ~L104, and neither remote here is named `origin`)
## Why migrate
- The old URL never resolved (`uber_backup.git` doesn't exist on gitea anyway) — so the deploy path was broken even though the file looked correct.
- `github.com` returns HTTP 403 on CONNECT tunnel from the brencher container's egress proxy — verified in `admin/brencher#4` (commit `653aee9`).
## Scope decision: only `hermes.py`
The other open configs (`registry.py`, `gitea.py`, `hermes.py`, `immich.py`, `gmail_mcp.py`, `torrserv_proxy.py`) are being migrated in **separate PRs**, one per file. Each PR has its own branch + verification.
## Verification (sandbox, no docker daemon)
- `python3 -m py_compile backend/configs/hermes.py` — OK
- Real import via `from configs import hermes`:
- `clone.remotes` is a 2-entry list `[gitea_hermes, gitea_admin]`, `clone.urls` derived from it
- no `github.com` substring anywhere in the constructed config
- `clone.branchNamePrefix == ''`
- pytest: **26/26** passed on the no-docker / no-playwright suite
- mypy `--no-incremental --follow-imports=silent`: `Success: no issues found in 1 source file`
- **End-to-end smoke test**: built a parallel `GitClone(remotes=[...])` with both URLs pointed at `file:///tmp/ansible-upstream`, ran `clone.progress()`:
- both named remotes created in the temp clone
- 4 branches discovered (`master` + `feat/docker-socket-proxy` × 2 remotes)
- `feat/docker-socket-proxy` visible on both `gitea_admin` and `gitea_hermes`
## What was NOT verified in the sandbox
- HTTPS clone from `gitea.rudolf.keenetic.link` on the live brencher-bot — requires the brencher container's git credentials to have push rights on `admin/ansible`.
- end-to-end `docker stack deploy` — needs a real swarm.
## After merge
After this PR merges into `admin/brencher:main`, the next brencher deploy of this environment will clone from gitea instead of the unreachable github URL.
---------
Co-authored-by: hermes <hermes@rudolf.keenetic.link>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/11
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
## Summary
Migrates `backend/configs/gitea.py` from the legacy `url=` form (pointing at the unreachable `github.com/rudolf1/uber_backup.git`) to the new `remotes=[{name, url}, ...]` form introduced by PR #3 (named-remotes), pointing at the actual gitea repos where the ansible stack lives.
## What's in this PR
- `backend/configs/gitea.py` — single file, +22/-1
- `GitClone(url="https://github.com/rudolf1/uber_backup.git"[, branchNamePrefix=...])`
→
`GitClone(remotes=[{"name": "gitea_hermes", "url": "https://gitea.rudolf.keenetic.link/hermes/ansible"}, {"name": "gitea_admin", "url": "https://gitea.rudolf.keenetic.link/admin/ansible"}])`
- `branchNamePrefix` is dropped (it would be a silent no-op: `GitClone` only applies its prefix refspec to a remote named `origin` per `backend/steps/git.py` ~L104, and neither remote here is named `origin`)
## Why migrate
- The old URL never resolved (`uber_backup.git` doesn't exist on gitea anyway) — so the deploy path was broken even though the file looked correct.
- `github.com` returns HTTP 403 on CONNECT tunnel from the brencher container's egress proxy — verified in `admin/brencher#4` (commit `653aee9`).
## Scope decision: only `gitea.py`
The other open configs (`registry.py`, `gitea.py`, `hermes.py`, `immich.py`, `gmail_mcp.py`, `torrserv_proxy.py`) are being migrated in **separate PRs**, one per file. Each PR has its own branch + verification.
## Verification (sandbox, no docker daemon)
- `python3 -m py_compile backend/configs/gitea.py` — OK
- Real import via `from configs import gitea`:
- `clone.remotes` is a 2-entry list `[gitea_hermes, gitea_admin]`, `clone.urls` derived from it
- no `github.com` substring anywhere in the constructed config
- `clone.branchNamePrefix == ''`
- pytest: **26/26** passed on the no-docker / no-playwright suite
- mypy `--no-incremental --follow-imports=silent`: `Success: no issues found in 1 source file`
- **End-to-end smoke test**: built a parallel `GitClone(remotes=[...])` with both URLs pointed at `file:///tmp/ansible-upstream`, ran `clone.progress()`:
- both named remotes created in the temp clone
- 4 branches discovered (`master` + `feat/docker-socket-proxy` × 2 remotes)
- `feat/docker-socket-proxy` visible on both `gitea_admin` and `gitea_hermes`
## What was NOT verified in the sandbox
- HTTPS clone from `gitea.rudolf.keenetic.link` on the live brencher-bot — requires the brencher container's git credentials to have push rights on `admin/ansible`.
- end-to-end `docker stack deploy` — needs a real swarm.
## After merge
After this PR merges into `admin/brencher:main`, the next brencher deploy of this environment will clone from gitea instead of the unreachable github URL.
---------
Co-authored-by: hermes <hermes@rudolf.keenetic.link>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/10
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
## Problem
Run #67 of `merge_main.yaml` failed with:
```
fatal: unable to access 'https:///admin/brencher.git/': URL rejected: No host part in the URL
```
The `PUSH_TOKEN` secret is now wired up correctly, but `${GITEA_SERVER_URL}` is empty in this Gitea Actions runtime (the variable the env-prefixed runner is supposed to set), so the substituted URL drops the host.
## Fix
Hardcode `gitea.rudolf.keenetic.link` in both `merge_main.yaml` and `merge_main_and_squash.yaml`. When the runner exposes `GITEA_SERVER_URL` in a future version, this can be replaced back with `${GITEA_SERVER_URL#https://}`.
## Supersedes
This is a follow-up to admin/brencher#46 which already wired `secrets.PUSH_TOKEN` but still had the empty env var.Reviewed-on: http://192.168.1.96/admin/brencher/pulls/47
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
Both workflows were written for github.com and relied on the implicit
secrets.GITHUB_TOKEN + github.repository + a hardcoded github.com URL.
On this self-hosted Gitea instance (ghauth.rudolf.keenetic.link) they fail
with "Invalid username or token. Password authentication is not supported
for Git operations." against https://github.com/admin/brencher.git.
The fix:
- Read the push token from a new repo-level secret GITEA_PUSH_TOKEN
(admin/brencher). Same value is injected into the checkout and into the
rewritten remote URL so push can succeed.
- Build the origin URL from Gitea-injected GITHUB_REPOSITORY and
GITEA_SERVER_URL instead of hardcoding github.com.
- Update git user.email/name for the Gitea Actions identity.
To enable: create secret GITEA_PUSH_TOKEN in admin/brencher (a PAT with
write access to the repo) via the Gitea UI before merging this PR.
## Summary
Optimizes `.github/workflows/python-package.yml` so the build job runs in ~3-4 minutes instead of ~13 minutes (which is what the recent run on PR #5 took — see https://gitea.rudolf.keenetic.link/admin/brencher/actions/runs/14, started 23:52, completed 00:05, **13m 19s wall-clock**).
## Why it was slow
The current matrix has **3 Python versions × 5 checkers = 15 separate CI jobs**, each one:
1. Checking out the repo (~10s)
2. Setting up Python via `actions/setup-python@v3` with **no cache enabled** (~15-30s)
3. Running `pip install -r requirements.txt -r requirements-dev.txt` **from scratch every single time** (~30-90s per job × 15 jobs = 7-22 minutes wasted)
The two debug entries (`python -c 'import sys; print(...)'` and `pip list`) were not real checks — they were noise from the upstream github `build-and-test-python` template, left in place but never reviewed.
## What's in this PR
- `.github/workflows/python-package.yml` — single file, +41/-56
1. **`cache: 'pip'` enabled** with `cache-dependency-path: requirements.txt, requirements-dev.txt` — first run downloads and caches, subsequent runs hit the cache. Drops pip install from ~60s to ~5-15s when requirements don't change.
2. **Two debug-only matrix entries removed** (`python -c ...` and `pip list`) — they were not real checks.
3. **Matrix restructured**: one Python-version axis only, no checker axis. Each Python job runs `install + flake8 + mypy` sequentially. **15 jobs → 3 jobs** (~5x fewer fresh venvs to set up).
4. **`concurrency: cancel-in-progress: true`** added — a new push to the same PR auto-cancels the previous in-flight run, saving runner minutes when iterating on a fix.
5. Bumped `actions/setup-python` from `v3` to `v5` (required for `cache: 'pip'`).
## Verification
- YAML parses via PyYAML — ok
- `jobs` dict contains `['build']` only
- `build.strategy.matrix.python-version` = `['3.12.3', '3.13', '3.14']`
- **total CI jobs: 3** (was 15)
- `setup-python@v5` with `cache: 'pip'` + `cache-dependency-path` pointing at `requirements.txt` and `requirements-dev.txt`
- `concurrency` block correctly scoped to `ci-${{ github.workflow }}-${{ github.ref }}`
## Expected timing
| Scenario | Before | After |
|---|---|---|
| First run (cold cache) | ~13m 19s | ~5-7m |
| Subsequent runs (warm cache, no req changes) | ~13m 19s | ~3-4m |
| Re-run after `requirements.txt` change | ~13m 19s | ~4-5m |
## What was NOT verified
- Actual Gitea Actions runner behaviour with `cache: 'pip'` — the Gitea Actions runner is GitHub Actions-compatible, and `actions/setup-python@v5` with `cache: 'pip'` is a well-known idiom there, but the local Gitea runner config may or may not honour it. If it doesn't, the 15→3 fan-out reduction alone is still a ~5x speedup.
## Note on PR #14
PR #14 ("re-enable the tests job") is still open. If/when it merges, this PR will need a follow-up to re-add the `tests:` job with the same `cache: 'pip'` setup applied — otherwise the playwright install will dominate again.
## Commit history
```
* db3807e (HEAD -> feat/optimize-ci-build-time, origin/feat/optimize-ci-build-time)
ci: speed up python-package.yml from ~13min to ~3-4min
* 70f4a41 ci: comment out the tests job in python-package.yml (#13) (upstream/main tip)
```
---------
Co-authored-by: admin <rudolfss13@gmail.com>
Co-authored-by: hermes <hermes@rudolf.keenetic.link>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/15
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
## What
Since #5 (Fix/show pipeline errors), brencher appends a version tail to every swarm config name so each deploy creates a new config object (swarm configs are immutable). For long base names plus the version string, the resulting prefixed name (stack_name_ + name) can exceed docker swarm's 64-char limit and `docker stack deploy` fails with `InvalidArgument`.
## Repro
```
[2026-08-29 19:38:46,063] failed to create config hermes_infra_brencher_state_proxy_conf_auto-16875f17-4cb8eeae-bfb3c220: Error response from daemon: rpc error: code = InvalidArgument desc = invalid name, only 64 [a-zA-Z0-9-_.] characters allowed
```
`brencher_state_proxy_conf_auto-16875f17-4cb8eeae-bfb3c220` is 57 chars, plus the 13-char `hermes_infra_` stack prefix = 70, over the 64-char limit.
## Fix
When the would-be full prefixed name is longer than 64 chars, replace the suffix with `sha256(full)[:32]`. 32 hex chars is comfortably unique per `(base_name, version)` pair and the prefixed name ends up at 12 + 1 + 32 = 45 chars, well under the limit.
Short names keep the readable `<name>_<version>` form (no change for the common case).
## Verified
Manual sanity check on the four configs currently in `hermes_squid`:
| base | version | compose name | docker name | length |
|---|---|---|---|---|
| squid_conf | auto-4cb8eeae-bfb3c220 | squid_conf_auto-4cb8eeae-bfb3c220 | hermes_infra_squid_conf_auto-4cb8eeae-bfb3c220 | 46 |
| brencher_state_proxy_conf | auto-16875f17-4cb8eeae-bfb3c220 | 7644a2983c7f6c7b09c6ed84bff0096d | hermes_infra_7644a2983c7f6c7b09c6ed84bff0096d | 45 |
| brencher_state_proxy_conf | auto-4cb8eeae-bfb3c220 | brencher_state_proxy_conf_auto-4cb8eeae-bfb3c220 | hermes_infra_brencher_state_proxy_conf_auto-4cb8eeae-bfb3c220 | 61 |
| nginx_hermes_conf | auto-16875f17-4cb8eeae-bfb3c220 | nginx_hermes_conf_auto-16875f17-4cb8eeae-bfb3c220 | hermes_infra_nginx_hermes_conf_auto-16875f17-4cb8eeae-bfb3c220 | 62 |
All under 64 chars; sha256 fallback only kicks in for the long case.
## Impact
- Fixes deploys of stacks that have a config with a long base name (e.g. `brencher_state_proxy_conf` in `hermes_infra`).
- Other stacks (`gitea`, `immich`, `torrserv_proxy`, etc.) are unaffected because their config names are short enough to fit the existing readable form.
- After merge + brencher self-deploy, the failed hermes_infra stack at `brencher-state-proxy` (failed since 2026-08-26) can finally be re-deployed and pick up the new `brencher-state-proxy.conf` with the resolver fix from #5's companion config rename.
## Related
- This unblocks `admin/ansible#21` (feat/stt-voice-faster-whisper) whose deploy was failing on the same length error.
- The companion nginx-side fix in `admin/ansible#21` (`brencher-state-proxy.conf`: `resolver` + `set $upstream`) will start working once this lands and the config object is actually recreated.Reviewed-on: http://192.168.1.96/admin/brencher/pulls/17
Reviewed-by: admin <rudolfss13@gmail.com>
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
## Summary
Switches `backend/configs/hermes_infra.py` from the legacy `url=` form (pointing at the unreachable `github.com/rudolf1/uber_backup.git`) to the new `remotes=[{name, url}, ...]` form introduced by PR #3 (named-remotes), pointing at the actual gitea repos where the ansible stack lives.
## What's in this PR
- `backend/configs/hermes_infra.py` — single file, +22/-1
- `GitClone(url="https://github.com/rudolf1/uber_backup.git", branchNamePrefix="ansible")`
→
`GitClone(remotes=[{"name": "gitea_hermes", "url": "https://gitea.rudolf.keenetic.link/hermes/ansible"}, {"name": "gitea_admin", "url": "https://gitea.rudolf.keenetic.link/admin/ansible"}])`
- `branchNamePrefix` is dropped (it would be a silent no-op: `GitClone` only applies its prefix refspec to a remote named `origin` per `backend/steps/git.py` ~L104, and neither remote here is named `origin`)
## Why this config specifically
- `hermes_infra.py` is the config that **deploys `hermes_squid/stack-compose.yml`** — i.e. it is what brings the sidecars added in `admin/ansible#1` (the docker_socket_proxy + brencher-state-proxy from earlier today) to a running swarm. Pointing its clone at the unreachable github URL meant the deploy path was broken even though the file looked correct.
- `uber_backup.git` doesn't exist on gitea anyway (only `admin/ansible`, `hermes/ansible`, `admin/brencher`, `hermes/brencher` exist) — so the old URL was always wrong, not just unreachable.
- github.com returns HTTP 403 on CONNECT tunnel from the brencher container's egress proxy — verified in `admin/brencher#4` (PR #4 / commit `653aee9`).
## Scope decision: only `hermes_infra.py` was migrated
The other open configs (`registry.py`, `gitea.py`, `hermes.py`, `immich.py`, `gmail_mcp.py`, `torrserv_proxy.py`) still use the legacy form. They're intentionally left untouched — this PR keeps the migration scope narrow on `hermes_infra` only, as requested. A future follow-up PR can migrate them once the upstream uber_backup / reverseproxy mirrors exist on gitea (they don't right now).
## Verification (sandbox, no docker daemon)
- `python3 -m py_compile backend/configs/hermes_infra.py` — OK
- Real import via `from configs import hermes_infra`:
- `clone.remotes` is a 2-entry list `[gitea_hermes, gitea_admin]`, `clone.urls` derived from it
- no `github.com` substring anywhere in the constructed config
- `clone.branchNamePrefix == ''` (not just unset)
- `env.id == "hermes_infra"`, pipeline unchanged
- `deploy step docker_compose_path == "hermes_squid/stack-compose.yml"`
- `deploy step stack_name == "hermes_infra"`
- pytest: **26/26** passed on the no-docker / no-playwright suite (`test_dummy`, `test_caching_step`, `test_cached_env`, `test_git_integration`)
- mypy `--no-incremental --follow-imports=silent`: `Success: no issues found in 1 source file`
- **End-to-end smoke test**: built a parallel `GitClone(remotes=[...])` with both URLs pointed at `file:///tmp/ansible-upstream`, ran `clone.progress()`:
- both named remotes created in the temp clone
- 4 branches discovered (`master` + `feat/docker-socket-proxy` × 2 remotes)
- `feat/docker-socket-proxy` visible on both `gitea_admin` and `gitea_hermes`
- no `github.com` in any remote URL
## What was NOT verified in the sandbox
- HTTPS clone from `gitea.rudolf.keenetic.link` on the live brencher-bot — requires the brencher container's git credentials to have push rights on `admin/ansible` (the live-deploy source). Sandbox can't simulate this.
- end-to-end `docker stack deploy hermes_infra` — needs a real swarm
## After merge
After this PR merges into `admin/brencher:main`, the next brencher deploy of the `hermes_infra` environment will clone from gitea instead of the unreachable github URL. Combined with `admin/ansible#1` (which adds the new services to `hermes_squid/stack-compose.yml`) and `admin/brencher#4` (which registers `docker_socket_proxy` in the PROFILES env var), the full chain is:
1. brencher clones ansible from `gitea.rudolf.keenetic.link/{hermes,admin}/ansible`
2. Checks out a merged branch containing the new sidecars
3. Builds (only `sarg` — `docker_socket_proxy` and `brencher-state-proxy` use upstream images, no build)
4. `docker stack deploy hermes_infra` rolls out the full stack
## Commit history
```
* 9a0cd90 (HEAD -> feat/point-hermes-infra-at-gitea, origin/feat/point-hermes-infra-at-gitea)
feat(configs): point hermes_infra at gitea admin/hermes ansible repos
* e533174 Allow naming each GitClone remote explicitly (#3) (upstream/main tip)
```
---------
Co-authored-by: hermes <hermes@rudolf.keenetic.link>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/8
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
## Summary
Comments out the `tests:` job in `.github/workflows/python-package.yml`. The slow `pytest` matrix (with `playwright install --with-deps chromium`) no longer runs on every push or PR — only the cheap `build` job (lint + mypy) remains.
## Why
- `pytest` requires `playwright install --with-deps chromium` on every run, which dominates the CI time even though pytest is not currently the merge gate.
- The `build` job (flake8 + mypy) still runs and still catches real regressions cheaply.
- `workflow_dispatch` is unchanged — tests can still be triggered manually from the Actions UI when needed.
## What's in this PR
- `.github/workflows/python-package.yml` — single file, +35/-34
- The `tests:` job (33 lines) is now commented with leading `# `
- Everything else (triggers, `build:` job, matrix) is unchanged
- YAML still parses cleanly; `jobs` dict now contains only `build`
## Verification
- `python -c "import yaml; yaml.safe_load(open('.github/workflows/python-package.yml'))"` — OK
- `wf['jobs']` contains `['build']` only (no `tests` key)
- `build.matrix.checker` still has all 5 checkers:
- `python -c "import sys; ..."` (debug)
- `pip list` (debug)
- `flake8 . --select=E9,F63,F7,F82` (syntax errors)
- `flake8 . --exit-zero --max-complexity=10` (complexity)
- `mypy --no-incremental --config-file mypy.ini backend tests`
- triggers unchanged: `workflow_dispatch`, `push`, `pull_request` (all targeting `main`)
## How to re-enable
Remove the leading `# ` from each commented line, or delete the commented block entirely and rely on git history.
## What was NOT verified
- The actual GitHub Actions runner behaviour change — this repo runs on Gitea Actions (the project's primary CI is the brencher pipeline itself, not Gitea-hosted runners for these workflows). Gitea's Actions runner is GitHub Actions–compatible and will see the `tests` job as absent and skip it.
## Commit history
```
* e271b2e (HEAD -> feat/disable-ci-tests, origin/feat/disable-ci-tests)
ci: comment out the tests job in python-package.yml
* e533174 Allow naming each GitClone remote explicitly (#3) (upstream/main tip)
```
---------
Co-authored-by: hermes <hermes@rudolf.keenetic.link>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/13
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
Implements the review comment on #2:
> I would like to give names for remotes
## Summary
Adds a `remotes=[{"name": ..., "url": ...}, ...]` constructor to `GitClone` so the config author controls how each URL maps to a git remote. The existing `url=str` / `url=[str]` shorthand is kept as backward-compatible (positional list still maps to `origin`, `repo1`, `repo2`, ...), so PR #2's `test_git_clone_multiple_urls` continues to pass.
## Changes
- **`backend/steps/git.py`** — `GitClone.__init__` now accepts either `url=` or `remotes=`. With `remotes=`, every entry must carry a non-empty unique `name` and `url`; duplicates and missing fields raise `ValueError`. The constructor rejects passing both or neither. `self.remotes` becomes the source of truth; `self.urls` is a derived list (kept for any introspection). `CheckoutMerged.find_desired_commits` falls back to the configured primary remote instead of the hardcoded `'origin'` when a branch key has no remote prefix, so configs that don't name a remote `origin` still work.
- **`backend/configs/brencher.py`, `brencher2.py`** — switch from positional list to named remotes `github`, `gitea_admin`, `gitea_hermes`.
- **`tests/test_git_integration.py`** — adds `test_git_clone_named_remotes` (asserts the user-chosen names appear verbatim and `origin`/`repo1` do not leak) and `test_git_clone_remotes_validation` (covers every rejection path: empty list, missing/empty name, missing/empty url, duplicate name, both-kwargs, no-kwargs).
## Diff vs #2
```
backend/configs/brencher.py | 8 ++---
backend/configs/brencher2.py | 8 ++---
backend/steps/git.py | 76 +++++++++++++++++++++++++++++++++++++++-------
tests/test_git_integration.py | 75 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 147 insertions(+), 20 deletions(-)
```
Targets `admin/multiple_remotes` so this lands on top of #2. After #2 merges, this is a clean follow-up; if #2 is reworked, this branch will need a rebase.
## Verification
- `python3 -m py_compile` on all 4 changed files: clean.
- AST-driven call-shape check: every `GitClone(...)` in both configs uses the new `remotes=` kwarg with exactly `{github, gitea_admin, gitea_hermes}`; no positional-list leftover in configs.
- Executed the new `__init__` in isolation against a stubbed `super()` and exercised 12 cases: 3 OK shapes (url=str, url=[..], remotes=[valid]) and 9 rejection shapes (empty list, missing/empty name, missing/empty url, duplicate name, both-kwargs, no-kwargs, non-dict entry). All 12 produced the asserted `ValueError`/`TypeError` with the expected message substring.
- Could not run `pytest` in this sandbox (PyPI is blocked by the proxy and no `pytest`/`gitpython` is pre-installed). The two new tests and PR #2's existing test should be run in a real env before merge.
---------
Co-authored-by: hermes <hermes@rudolf.keenetic.link>
Co-authored-by: rudolf <rudolfss13@gmail.com>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/3
Reviewed-by: admin <rudolfss13@gmail.com>
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.