RepoPulse: update backend/app and dependencies (+3 areas)

Public changes compared with the previous published export:
26 files changed.

Affected areas:
- backend/app: 11 files
- dependencies: 5 files
- deployment and CI: 3 files
- documentation: 2 files
- tests: 5 files

Changed files:
- Updated: "Dockerfile.unraid"
- Updated: "README.md"
- Updated: "backend/Dockerfile"
- Updated: "backend/app/acquisition.py"
- Updated: "backend/app/architecture.py"
- Updated: "backend/app/git_analysis.py"
- Updated: "backend/app/gitea.py"
- Updated: "backend/app/jobs.py"
- Updated: "backend/app/main.py"
- Added: "backend/app/processes.py"
- Updated: "backend/app/rules.py"
- Updated: "backend/app/scanner.py"
- Updated: "backend/app/signals.py"
- Updated: "backend/app/store.py"
- Updated: "backend/pyproject.toml"
- Added: "backend/tests/test_api_responsiveness.py"
- Added: "backend/tests/test_processes.py"
- Updated: "backend/tests/test_scanner.py"
- Updated: "backend/tests/test_signals_v11.py"
- Updated: "backend/tests/test_store.py"
- Updated: "docker-compose.yml"
- Updated: "docs/ARCHITECTURE.md"
- Updated: "frontend/package-lock.json"
- Updated: "frontend/package.json"
- Updated: "package-lock.json"
- Updated: "package.json"

Export provenance/manifests refreshed; excluded from the change summary.

Publish curated RepoPulse source from a251f826238908b156485299061da76482780ed2
This commit is contained in:
Public Source Publisher committed 2026-11-17 21:10:30 +00:00
1 parent 23a4a721f1
commit 61ae49f9d0
28 files changed
+1083 -408

No files matched your search

+101
View File
@@ -0,0 +1,101 @@
from __future__ import annotations
import os
import sqlite3
import subprocess
import sys
import time
from pathlib import Path
import pytest
from app.gitea import GiteaClient
from app.jobs import ScanJobRunner
from app.processes import git_environment, run_bounded
from app.store import ScanStore
def test_git_environment_forces_foreground_housekeeping_and_keeps_extra_config() -> None:
env = git_environment({}, extra_config=[("http.extraHeader", "Authorization: token t")])
pairs = {
env[f"GIT_CONFIG_KEY_{index}"]: env[f"GIT_CONFIG_VALUE_{index}"]
for index in range(int(env["GIT_CONFIG_COUNT"]))
}
assert pairs == {
"gc.autoDetach": "false",
"maintenance.autoDetach": "false",
"http.extraHeader": "Authorization: token t",
}
def test_run_bounded_returns_output_and_raises_on_failure() -> None:
ok = run_bounded([sys.executable, "-c", "print('hi')"], timeout=10)
assert ok.stdout.strip() == b"hi"
with pytest.raises(subprocess.CalledProcessError):
run_bounded([sys.executable, "-c", "raise SystemExit(3)"], timeout=10)
@pytest.mark.skipif(os.name != "posix", reason="process groups are POSIX-only")
def test_run_bounded_timeout_kills_grandchildren(tmp_path: Path) -> None:
marker = tmp_path / "grandchild.pid"
script = (
"import subprocess, sys, time\n"
"child = subprocess.Popen([sys.executable, '-c', 'import time; time.sleep(60)'])\n"
f"open({str(marker)!r}, 'w').write(str(child.pid))\n"
"time.sleep(60)\n"
)
with pytest.raises(subprocess.TimeoutExpired):
run_bounded([sys.executable, "-c", script], timeout=2)
grandchild = int(marker.read_text())
deadline = time.monotonic() + 5
while time.monotonic() < deadline:
if _process_gone_or_zombie(grandchild):
return
time.sleep(0.05)
pytest.fail("grandchild survived the timeout kill")
def _process_gone_or_zombie(pid: int) -> bool:
"""A killed orphan stays a zombie until PID 1 reaps it (tini does in production).
Inside a CI job container PID 1 may not reap, so a zombie counts as killed.
"""
try:
stat = Path(f"/proc/{pid}/stat").read_text()
except (FileNotFoundError, ProcessLookupError):
return True
# Field 3, after the parenthesised command name, is the process state.
return stat.rsplit(")", 1)[1].split()[0] in {"Z", "X"}
def test_idle_claim_never_takes_the_write_lock(tmp_path: Path) -> None:
store = ScanStore(str(tmp_path / "repopulse.db"))
writer = sqlite3.connect(tmp_path / "repopulse.db", timeout=0)
try:
writer.execute("BEGIN IMMEDIATE")
started = time.monotonic()
assert store.claim_next_job() is None
# Without the read-only probe this would block on busy_timeout (5 s).
assert time.monotonic() - started < 2
finally:
writer.rollback()
writer.close()
def test_idle_worker_backs_off_and_enqueue_wakes_it(tmp_path: Path) -> None:
runner = ScanJobRunner(ScanStore(str(tmp_path / "repopulse.db")), gitea=GiteaClient())
runner.poll_seconds = 0.5
runner.idle_poll_seconds = 5.0
delays = []
for iterations in range(1, 7):
runner._idle_iterations = iterations
delays.append(runner._idle_delay())
assert delays == [0.5, 1.0, 2.0, 4.0, 5.0, 5.0]
runner.wake()
started = time.monotonic()
assert runner._wake.wait(1)
assert time.monotonic() - started < 0.5