fix(logging): replace structlog with stdlib logging to prevent broken pipe crashes

structlog fails with BrokenPipeError when stdout is redirected (e.g., background
processes, Docker logs). Replace all structlog.get_logger() calls with
logging.getLogger() and convert keyword-style log calls to %-format strings.

Also removes stale Docs/tasks.md (2028 lines) and updates Robot Framework
tests to match current API behavior.
This commit is contained in:
2026-06-21 20:14:31 +02:00
parent be3e180137
commit 572aa0fc78
18 changed files with 299 additions and 2254 deletions

View File

@@ -42,13 +42,17 @@ Stop Aniworld Server
Run Keyword And Ignore Error Remove File ${CURDIR}/../fixtures/server_stderr.log
Wait For Server
[Documentation] Poll the health endpoint until the server responds with 200.
[Documentation] Poll the health endpoint until the server responds.
... Accepts 200 or 503 (not configured yet) as valid responses.
... Retries every 1 second for up to 30 seconds.
FOR ${i} IN RANGE 30
${resp}= Run Keyword And Ignore Error
... GET On Session anon /health expected_status=200
... GET On Session anon /health expected_status=any
IF '${resp}[0]' == 'PASS'
RETURN
${status_code}= Set Variable ${resp}[1].status_code
IF ${status_code} == 200 or ${status_code} == 503
RETURN
END
END
Sleep 1s
END
@@ -96,15 +100,44 @@ Setup Master Password
... scheduler_enabled=False
... logging_level=INFO
... backup_enabled=False
${resp}= POST On Session anon /api/auth/setup json=${payload} expected_status=201
Should Be Equal As Integers ${resp.status_code} 201
${resp}= POST On Session anon /api/auth/setup json=${payload} expected_status=any
IF '${resp.status_code}' == '429'
# Rate limited - wait and retry once
Sleep 6s
${resp}= POST On Session anon /api/auth/setup json=${payload} expected_status=any
END
IF '${resp.status_code}' == '400'
# Already configured - this is OK
${json}= Convert String To Json ${resp.text}
${detail}= Get Value From Json ${json} $.detail
IF '${detail}[0]' == 'Master password already configured'
RETURN
END
Fail Setup failed with 400: ${detail}
END
IF '${resp.status_code}' == '201'
Should Be Equal As Integers ${resp.status_code} 201
RETURN
END
Fail Unexpected status ${resp.status_code} from /api/auth/setup
Login And Get Token
[Documentation] Log in with the master password and return the JWT access token.
${payload}= Create Dictionary password=${SETUP_PASSWORD}
${resp}= POST On Session anon /api/auth/login json=${payload} expected_status=200
${resp}= POST On Session anon /api/auth/login json=${payload} expected_status=any
IF '${resp.status_code}' == '429'
# Rate limited - wait and retry once
Sleep 6s
${resp}= POST On Session anon /api/auth/login json=${payload} expected_status=any
END
IF '${resp.status_code}' != '200'
${json}= Convert String To Json ${resp.text}
${detail}= Get Value From Json ${json} $.detail
Fail Login failed with ${resp.status_code}: ${detail}
END
${json}= Convert String To Json ${resp.text}
${token}= Get Value From Json ${json} $.access_token
Set Suite Variable ${TOKEN} ${token}[0]
RETURN ${token}[0]
# ---------------------------------------------------------------------------