Skip to content

Add observability to mock date refresh failures in web client #173

@PhilipWoulfe

Description

@PhilipWoulfe

Summary:
The web mock date service currently clears cached state when refresh fails, but does not emit diagnostics. This makes admin troubleshooting difficult when mock date appears not to apply.

Problem:
When the admin mock date endpoint returns a non-success status, or when HTTP/JSON exceptions occur, the service silently sets state to null and returns. The UI behavior remains safe, but there is no visibility into why the value was not loaded.

Proposed Change:

Inject a logger into the web mock date service
Log warning on non-success responses from the mock date refresh call
Log warning or error for request and deserialization failures
Keep current functional behavior of clearing cached mock date on failure
Keep payload/contract unchanged
Acceptance Criteria:

Service logs include endpoint failure status code and reason phrase for refresh failures
Service logs include exception context for network and JSON parsing failures
No change to current UI behavior when refresh fails (state still resets to null)
Existing tests remain green
Add or update unit tests to validate failure paths are handled and no exceptions leak to UI layer
Out of Scope:

UI error banners or user-facing toast notifications
Retry/backoff policy changes
API contract changes
Why this matters:
Improves supportability and PR quality by making mock-date failures diagnosable without changing user-facing behavior.

Definition of Done:

Logging implemented with appropriate levels
Tests added/updated for non-success, HttpRequestException, and JsonException paths
PR description includes sample log lines for each failure mode

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions