Aller au contenu
login
arrow_backRetour aux issues
StayPirate/sentinel #320

test: use RFC 5737 documentation IP ranges instead of RFC 1918 in sanitization tests

ecoDébutant documentation enhancement good first issue

descriptionDescription

## Outcome or problem Several tests use RFC 1918 private-range IP addresses (e.g., `10.0.0.5`) embedded in synthetic broker/Redis connection-error strings to prove that raw exception text is sanitized before being logged, persisted to `FetcherRun.error_detail`, or returned in an API response. These values are never dialed — they only appear as a string literal inside an exception raised synthetically by a test mock — so no live network call is ever attempted. However, an RFC 1918 address is a valid private address that may genuinely be assigned to a real host on whatever network the test suite happens to run on (a CI runner, a contributor's LAN, a corporate network), which is a less rigorous choice than an address IANA/RFC 5737 formally reserves for documentation and example use and guarantees will never be assigned to any real host, anywhere. The same codebase already contains the more rigorous pattern (`203.0.113.5`, `198.51.100.7` in `backend/tests/test_api/test_dependencies.py`), so the two conventions currently coexist inconsistently. `docs/conventions.md` ("Example Data in Documentation") already defines approved fictional placeholders for names, usernames, emails, and external IDs, but does not cover IP addresses, leaving the choice ad hoc. ## Owning specifications N/A — repository test-data/convention change. If a project-wide convention is adopted, it belongs in `docs/conventions.md` ("Example Data in Documentation"). ## Scope - Replace the RFC 1918 occurrences with RFC 5737 documentation-reserved addresses (`192.0.2.0/24` TEST-NET-1, `198.51.100.0/24` TEST-NET-2, or `203.0.113.0/24` TEST-NET-3) in: - `backend/tests/test_services/test_fetcher_operations.py` (`TestListFetchersMergeAndSort::test_redis_error_nulls_all_fetchers_and_logs_safely`, `TestTriggerFetcherBrokerFailure::test_publication_failure_finalizes_run_and_raises_broker_unavailable`) - `backend/tests/test_api/test_fetchers.py` (`TestTriggerFetcherEndpoint::test_broker_unavailable_returns_503_sanitized`) - Evaluate whether to add an explicit "fictional IP address" row to the placeholder table in `docs/conventions.md` ("Example Data in Documentation"), so future tests and docs follow one documented convention instead of ad hoc choices — or record an explicit decision not to formalize it if the existing per-test discretion is judged sufficient. ## Acceptance criteria - [ ] Every test using a fictional IP address to simulate a connection/error string uses an RFC 5737 documentation-reserved range, not an RFC 1918 private range. - [ ] A decision is recorded: either `docs/conventions.md` documents the approved fictional IP address range(s), or an explicit note explains why no project-wide convention is needed. - [ ] No test behavior changes — this is a test-data substitution only, not a functional change. ## Verification - `cd backend && uv run pytest` on the affected test files — same assertions, same outcomes, only the literal IP value changes. - If `docs/conventions.md` is updated: `@docs-placement-reviewer` per `AGENTS.md` Guardrail 21 (cross-cutting convention placement). ## Direct blockers None
codeOuvre sur GitHub