Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

fix: gate networkmock logging

Chiusa
#86 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 17 giorni

@MaxMichel2 ci sta già lavorando.

Dal 22/9/2026.

  • #123 di @MaxMichel2 — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
kotlin
Ambito
devtools

Direzione di ricerca

Start by checking for an existing shared logging convention, then inspect the println call sites in MockConfigRepository.kt, MockStateRepository.kt, and NetworkMockPlugin.kt. Review MockConfigRepositoryTest.kt and NetworkMockPluginTest.kt for output assertions; done means all listed logging is gated, host apps can disable it, and response bodies are never logged.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Summary

devview-networkmock-core and devview-networkmock-ktor emit roughly 65 unconditional println calls covering every step of config loading, request matching, and response serving. These ship straight into any host app's logcat, unconditionally, with no way to turn them off — and several of them log full request URLs and response bodies. This is independent of the OpenAPI migration (tracked in the epic, #72) and can be picked up any time.

Current state

Two hot spots:

  • MockConfigRepository — devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/MockConfigRepository.kt, roughly 25 println calls across loadConfiguration() (:206-252) and findMatchingMock() (:292-377), including per-group and per-environment iteration logging and full path/method/query comparison traces on every single intercepted request.
  • NetworkMockPlugin — devview-networkmock-ktor/src/commonMain/kotlin/com/worldline/devview/networkmock/ktor/plugin/NetworkMockPlugin.kt, roughly 40 println calls (LOG_PREFIX constant at :37) covering plugin install, every intercepted request's host/path/method (:170), full mock-vs-network decision tracing, and — notably — the response file name and status code on every successful mock (:248-249).
  • MockStateRepository also logs on every state write (setGlobalMockingEnabled :240,245, setEndpointMockState :271-273, setAllEndpointStates :334-336, all in devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/MockStateRepository.kt).

None of this is gated behind a log level, a debug flag, or a way to disable it. A host app integrating this library gets this in its logcat/console on every request, all the time, with no opt-out — and depending on mock content, response bodies could contain data a team doesn't want silently duplicated into device logs.

What to build

Introduce a minimal logging abstraction (or reuse one if this repo already has a shared logging convention elsewhere in DevView — check before adding a new one) with at least an on/off gate, defaulting to a sensible state for a developer tool (arguably on-by-default is fine for a dev-only overlay tool, but it must be possible to turn off, and it should not be the current firehose of ~40+ lines per single request).

Suggested minimal shape: a single NetworkMockLogger (or similar) with a enabled: Boolean toggle, injected the same way NetworkMockResourceLoader already is, replacing every println call site. Consider consolidating the current multi-line-per-request tracing into a single structured log line per request (e.g. one line: method path -> MOCK|NETWORK (reason)), which both reduces log volume and reduces sensitive-data exposure (drop full response bodies from logs entirely — the status code and file/example name is enough context).

Acceptance criteria

  • All ~65 println calls across devview-networkmock-core and devview-networkmock-ktor are replaced with a gated logging call.
  • Logging can be disabled entirely by a host app.
  • No response body content is ever logged (status code + example identifier is sufficient).
  • Existing tests that assert on println output (if any — check MockConfigRepositoryTest.kt, NetworkMockPluginTest.kt) are updated accordingly.

Files likely touched

  • devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/MockConfigRepository.kt
  • devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/MockStateRepository.kt
  • devview-networkmock-ktor/src/commonMain/kotlin/com/worldline/devview/networkmock/ktor/plugin/NetworkMockPlugin.kt
  • New shared logging utility, likely in devview-networkmock-core
Lingua principale
Kotlin
Stelle
11
Fork
3
Merge medio
10g 9h
PR unite (30g)
18

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di worldline/devview

Tutte le issue di worldline/devview

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.