Backend - A run's outcome write sits outside the job's own try: a database blip after a run that succeeded no longer records it as failed (the row waits for the next start's sweep). - An interrupted run keeps what it spent (the sweep sums its quota rows, as finish does). - The Scheduler's ad-hoc row says running while any backfill runs, not only the newest. - recent_runs reads each job's last runs off its index instead of ranking the whole table. - An interval change is stored with its audit row in one transaction, then rescheduled. - One API instance per database is the stated contract (.env.example, jobruns). - Turning full history on for a channel already complete records no run. - Migration 0109 round-trips interrupted and ad-hoc runs; the run words' DB CHECKs are test-held to the enums; the account filter is one helper for the four activity reads. - An audit row says how many of its request's log lines are still kept. Frontend - An "All" period reaches every row still kept (runs and admin actions outlive 90 days). - Back/Forward is followed in place by the server log: a closing dialog no longer turns Live off; a pivot still opens a fresh log. - Runs moved over from the audit log read their one-liner in the reader's language. - Filter choices or accounts that failed to load say so beside the filters, with a retry. - An old server-log link keeps its account, text and range; a remembered retired page opens its tab. - A request whose lines are gone says so instead of linking to an empty list. - The log lines and the history rows share one row frame, and the server log one list frame with the other tabs; an empty list is announced; each day's quota is readable.
31 lines
1.3 KiB
Python
31 lines
1.3 KiB
Python
"""An admin action that counts something keeps the count as data in its audit row's `after`, under
|
|
the key the audit log names in the reader's language (`scheduler.result.<key>`, frontend
|
|
lib/jobResult.ts, called from lib/auditText.ts) — not only in the English `summary`. A renamed key would fall back to the raw word.
|
|
DB lane (Postgres).
|
|
"""
|
|
|
|
from sqlalchemy import select
|
|
|
|
from app.models import AuditLog
|
|
|
|
|
|
def _after(db, action: str) -> dict:
|
|
db.expire_all()
|
|
return db.execute(select(AuditLog.after).where(AuditLog.action == action)).scalar_one()
|
|
|
|
|
|
def test_clearing_the_audit_log_keeps_the_count_as_data(as_user, db, make_user):
|
|
admin = make_user(email="boss@example.com", role="admin")
|
|
db.add_all([AuditLog(action="sync_pause"), AuditLog(action="sync_resume")])
|
|
db.commit()
|
|
assert as_user(admin).delete("/api/admin/audit").json()["cleared"] == 2
|
|
assert _after(db, "audit_clear") == {"cleared": 2}
|
|
|
|
|
|
def test_a_discovery_purge_keeps_its_counts_as_data(as_user, db, make_user):
|
|
admin = make_user(email="boss@example.com", role="admin")
|
|
body = as_user(admin).post("/api/admin/purge-discovery").json()
|
|
body.pop("ok")
|
|
assert _after(db, "discovery_purge") == body
|
|
assert {"videos_deleted", "channels_deleted", "search_videos_deleted"} <= set(body)
|