Skip to content

feat(diagnostics): anonymous connection test in Diagnostics (#984) - #1669

Merged
XaaT merged 4 commits into
devfrom
feat/984-p2b-network-test
Nov 16, 2026
Merged

XaaT merged 4 commits into
devfrom
feat/984-p2b-network-test

Conversation

@XaaT

@XaaT XaaT commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Part of #984 (flags refresh failing on cellular). Stacked on #1668 (P2a telemetry). Adds a "Tester la connexion" button in Diagnostics to measure a tester's connection with the same kind of requests the flags refresh makes.

What it does

  • Sends 36 anonymous requests to the public REST catalogue, in waves of 1, 5, 10 and 20; each wave finishes before the next and is capped at 12 s.
  • Dedicated client: HTTP/1.1, no cookie jar, no auth header, no cache, no interceptors, a fresh connection per call, no application retry. A network-level guard allows one HTTP exchange per call and strips Retry-After from 503 responses, so OkHttp's own follow-ups (408, 503) can never exceed 36 exchanges or 36 connections.
  • DNS is resolved on a dedicated executor bounded by the wave deadline: cancellation or the deadline releases the refresh lease even if a native resolver stays blocked.
  • Per request: TCP (proxy CONNECT included, stated in the export), TLS, headers received, first body byte available, total, outcome, errno class (P2a classifier) or a closed category (dns_error, exchange_limit).
  • Refused while a flags refresh runs; one run at a time; at most one per minute through a persisted reservation (survives rotation, process restart and clock changes); cancelled when the screen closes.
  • Concurrent HFR traffic, image downloads from forum.hardware.fr included, marks the measure as disturbed (no URL exported).
  • Export: one structured entry per wave plus a summary.
  • No control host yet: the extension point exists, disabled, with no visible string.

No new Android permission. Strings in resources, formal "vous".

Validation

  • Full validation on socadisc, 5a738547d: GREEN, 7 649 tests, 0 failure; after the UI pass, b3b67d4cf: 7 656 tests, only the known flaky MessageCardReadingParityTest (Test instable : MessageCardReadingParityTest > body stays selectable after a full width toggle #1646, outside this diff) failed.
  • Seen on an emulator (Pixel 8, light and dark): one real run, 36/36 successes, median connect 624 / 936 / 712 / 136 ms by wave, not disturbed. The UI pass fixed plurals, non-breaking units, the result order and the Diagnostics header ("Ferme/r").
  • Gates: Astra NO GO on the first version (OkHttp internal follow-ups past 36, blocked DNS holding the lease, a wrong MockWebServer test, image traffic not counted) → fixed → Fable GO with reservations → second pass (missing activity-compose declaration, 503 reconnection, closed DNS/limit categories) → Fable GO with reservations.
  • Open minor points: forum-images.hardware.fr (smileys, avatars) is not counted as concurrent traffic; a native resolver that never returns can leave up to 36 daemon threads per run.

Rebased on the socle and P2a

  • DefaultFlagRepository: the socle reads (bounded category fetch and sticky sweep) now run inside refreshDiagnostics.withRefresh, as the pre-socle reads did. A refresh started while a connection test runs waits for the test to end, and that wait counts against the 12 s collection deadline.
  • Full validation of the whole stack (socle + P2a + P2b + P2c) on a build box: see feat(flags): experimental refresh strategies in Diagnostics (#984) #1670.

PR générée par Claude (Opus 5.5) à la demande de @xatrix.

🤖 Generated with Claude Code

https://claude.ai/code/session_01X7pvomKHW15zFqZ5T6WA6a

@XaaT XaaT added this to the Infra & dette milestone Nov 16, 2026
@XaaT
XaaT force-pushed the feat/984-p2b-network-test branch from b3b67d4 to d7b46e8 Compare November 16, 2026 20:29
@XaaT
XaaT force-pushed the feat/984-p2a-telemetry branch from 3110602 to 89a5605 Compare November 16, 2026 20:29
@XaaT
XaaT force-pushed the feat/984-p2b-network-test branch from d7b46e8 to e5784f9 Compare November 16, 2026 20:30
@XaaT
XaaT force-pushed the feat/984-p2a-telemetry branch from 89a5605 to 4ecfdaa Compare November 16, 2026 20:30
@XaaT
XaaT force-pushed the feat/984-p2b-network-test branch 2 times, most recently from b79dddd to d248554 Compare November 16, 2026 20:34
@XaaT
XaaT force-pushed the feat/984-p2a-telemetry branch from d0a74e7 to a25a8fd Compare November 16, 2026 20:48
@XaaT
XaaT force-pushed the feat/984-p2b-network-test branch 2 times, most recently from f857c8c to 38e2a59 Compare November 16, 2026 21:00
@XaaT
XaaT force-pushed the feat/984-p2a-telemetry branch from a25a8fd to 08bd4e1 Compare November 16, 2026 21:00
Base automatically changed from feat/984-p2a-telemetry to dev November 16, 2026 21:15
XaaT and others added 4 commits November 16, 2026 22:15
… 20 (#984)

Diagnostics gets a "Tester la connexion" button that sends 36 anonymous
requests to the public REST catalogue, in waves of 1, 5, 10 and 20, each wave
finished before the next and capped at 12 s, to measure the user's connection
without any account data.

- Dedicated client: HTTP/1.1, no cookie jar, no auth, no cache, no
  interceptors, fresh connection per call, no application retry.
- Per request: TCP, TLS, headers received, first body byte available, total,
  outcome and errno class (P2a classifier).
- Refused while a flags refresh runs; one run at a time; at most one per
  minute through a persisted reservation that survives rotation, process
  restart and clock changes; cancelled when the screen closes.
- Concurrent HFR traffic marks the measure as disturbed.
- Export: one structured entry per wave plus a summary.
- No control host yet (extension point only, disabled).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X7pvomKHW15zFqZ5T6WA6a
…ed DNS, count image traffic (#984)

Fixes from the P2b gate:
- A network-level guard allows one HTTP exchange per probe call, so OkHttp's
  own follow-ups (408, 503 with Retry-After: 0) can no longer exceed 36.
- The probe resolves DNS on a dedicated executor bounded by the wave
  deadline; cancellation or the deadline releases the refresh lease even if a
  native resolver stays blocked.
- The probe client drops its read and call timeouts: the 12 s wave owns the
  deadline, so no response is reported as DEADLINE.
- Image downloads from HFR now count as concurrent traffic for the
  "disturbed" flag (no URL exported, image telemetry unchanged).
- The export states that tcpMs includes a proxy CONNECT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X7pvomKHW15zFqZ5T6WA6a
…ollow-up, closed DNS and limit categories (#984)

- feature:flags declares activity-compose (LocalActivity was only reachable
  through an old transitive version).
- The probe's network interceptor strips Retry-After from 503 responses, so
  OkHttp never reopens a connection for a follow-up (36 connections, not 37).
- DNS failures and the exchange-limit guard export closed categories
  (dns_error, exchange_limit) instead of errno=other.
- The wave cap is injectable for tests (production stays 12 s).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X7pvomKHW15zFqZ5T6WA6a
… in the connection test (#984)

Seen on the emulator:
- Plurals for requests, successes and failures ("1 réussite").
- Non-breaking spaces keep "médiane : 624 ms" together.
- Order: test state, wave results, warning, then the next-test countdown.
- Diagnostics header: title on its own line, actions in resources, no word
  split ("Ferme/r").
- Button text aligned with the screen's paragraphs.
- diagnostics_empty wording shared with the strategies branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X7pvomKHW15zFqZ5T6WA6a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant