utils/freedays/freedays/tests
Krzysztof kuhy Rudnicki bb0f773b7d
Some checks failed
crdt-sync pre-commit / pre-commit (push) Has been cancelled
crdt-sync tests / test (push) Has been cancelled
dependency freshness / dependencies on newest stable (push) Has been cancelled
file length / file-length (push) Has been cancelled
freedays pre-commit / pre-commit (push) Has been cancelled
freedays tests / test (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
palette drift / palette (push) Has been cancelled
shared gate tests / gate unit tests (push) Has been cancelled
Make sync_quietly's "never fail" contract true by construction
sync_quietly exists so a background timer stays green when the pool
cannot be synced. It caught only SyncUnavailableError, which meant the
contract held only because of an upstream class hierarchy: today
FirebaseAuthError happens to subclass RemoteSyncError, and requests'
JSONDecodeError happens to subclass RequestException, so an expired
refresh token or a malformed payload does get wrapped and caught.

That is a coincidence, not a promise to this package -- and it is exactly
the kind that goes quiet the day upstream reorganises its exceptions. The
symptom would be a unit going red every 15 minutes, which is the outcome
this function's own docstring says the design exists to prevent.

It now also catches anything unexpected and logs it with a traceback, so
a real bug is loud in the journal while the timer stays green. The
narrow handler stays first and stays at debug level: offline is normal
on a laptop and must not fill the journal.

Two tests, neither of which the old suite could have failed on -- the
existing one monkeypatched get_client to raise the one exception already
known to be handled. One raises FirebaseAuthError *mid-sync* (a token
expiring during the tick rather than at client construction, which is the
realistic case per seed_session.py's own docstring), the other raises a
RuntimeError that no hierarchy covers.

111 tests, 100% branch coverage.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-07 16:06:11 +02:00
..
__init__.py Add freedays: one shared pool of days when every gate stands down 2026-09-07 15:08:22 +02:00
conftest.py Add freedays: one shared pool of days when every gate stands down 2026-09-07 15:08:22 +02:00
test_api.py Add freedays: one shared pool of days when every gate stands down 2026-09-07 15:08:22 +02:00
test_audit.py Drop the gatelock dependency, and actually sync the pool 2026-09-07 15:56:42 +02:00
test_cli.py Drop the gatelock dependency, and actually sync the pool 2026-09-07 15:56:42 +02:00
test_day.py Add freedays: one shared pool of days when every gate stands down 2026-09-07 15:08:22 +02:00
test_hmac.py Drop the gatelock dependency, and actually sync the pool 2026-09-07 15:56:42 +02:00
test_model.py Add freedays: one shared pool of days when every gate stands down 2026-09-07 15:08:22 +02:00
test_paths.py Add freedays: one shared pool of days when every gate stands down 2026-09-07 15:08:22 +02:00
test_sync.py Make sync_quietly's "never fail" contract true by construction 2026-09-07 16:06:11 +02:00