Skip to content

MF White List: DependencyInjection package #263

Closed

Description

@milten89

Step 8 of the MF White List provider (#212, ADR-0023). Copies OpenUrzednik.Nbp.DependencyInjection.

Scope

  • src/OpenUrzednik.MF.WhiteList.DependencyInjection: AddOpenUrzednikMFWhiteList() and AddKeyedOpenUrzednikMFWhiteList(key) (one named HttpClient, typed clients, validated options, returns the IHttpClientBuilder), the linked ResilienceRejection.cs, AddOpenUrzednikMFWhiteListRejectionHandler().
  • Each registration, default and keyed, passes one OpenUrzednikTelemetry per client: the client's logger, ActivityTraceSource.GetShared(WhiteListTelemetry.SourceName) and the container's metrics: one singleton per container, MeterMetrics.Create(<the container's IMeterFactory>, WhiteListTelemetry.SourceName) when it has a factory, else MeterMetrics.GetShared(WhiteListTelemetry.SourceName) (ADR-0025, Metrics: an IMeterFactory path for the DI packages #333, as AddOpenUrzednikNbp() does); tests that a default and a keyed client record on the OpenUrzednik.MF.WhiteList meter, on the factory's meter when the container has one (one instrument shared by its clients), and on the shared meter without one (net472).
  • DependencyInjection/DependencyInjection.props with AddOpenUrzednikDisplayPathLogging() on the named client, and a test that IHttpClientFactory's log entries carry no identifier (ADR-0017).
  • The retry filter of ADR-0023, WhiteListRetry.ShouldRetryAsync(HttpResponseMessage, CancellationToken), in the base package (BCL types only, no Polly): yes for 400 WL-195/196, 408 and 5xx; no for 429, 500 WL-197 and anything else; it buffers the body so the error mapping can still read it. The README snippet plugs it into an app's AddStandardResilienceHandler() (options.Retry.ShouldHandle, next to HttpClientResiliencePredicates.IsTransient); neither package references Microsoft.Extensions.Http.Resilience. Tests for each case.
  • A mf-white-list-di mutation shard, slnx/slnf entries, an AotSmoke DI check.

Done when

  • An app registers the White List clients in one line, its logs carry no identifiers, and the resilience helper is tested.

Context for the implementing agent

Where this fits. Milestone 1.1.0 ships the MF White List provider (OpenUrzednik.MF.WhiteList and OpenUrzednik.MF.WhiteList.DependencyInjection), the first new provider after NBP. Its provider ADR comes from #212; the implementation is split into one issue per PR, in this order: #257 (shared dates) → #258 (skeleton) → #259 (search by one identifier) → #260 (batch search) and #261 (check) → #262 (WL2 status) → #263 (DI package) → #264 (ship it). Each step waits for the one before it (blockedBy), except where an issue says otherwise.

Read first. CLAUDE.md (the binding summary of the rules), ADR-0023 (the MF White List provider, from #212), and the ADRs this issue names. ADRs follow ADR-0022: an accepted ADR that no release has shipped is corrected in place through /adr (with a dated line); a released one is superseded. Never work around an ADR. The reference implementation is OpenUrzednik.Nbp / OpenUrzednik.Nbp.DependencyInjection: copy its structure, conventions and tests (ADR-0016).

Workflow (CLAUDE.md, "Workflow" and "Issues and the project"):

  • Start only when this issue's Status is Ready and gh issue view <n> --json blockedBy lists no open blocker; then set Status In progress (the only project field an agent changes).
  • Branch from origin/develop (feature/…, fix/…, docs/…, chore/…); stage explicit paths only; stage and commit as two separate commands (a hook scans the staged changes); never --no-verify.
  • One issue per PR into develop; the PR body starts with Closes #<n>; give it a release label from .github/release.yml (the label on this issue is the forecast).
  • Before the PR: run the reviewer agent on the diff. After it: check the PR's CodeQL alerts (gh api "repos/milten89/OpenUrzednik.NET/code-scanning/alerts?ref=refs/pull/<pr>/merge&state=open").

Checks to run and report: dotnet build OpenUrzednik.slnx; tests per project (dotnet test tests/<Project> -f net10.0, and -f net472 on Windows); dotnet format OpenUrzednik.slnx --verify-no-changes (after a clean build); the mutation shard of the code you changed (uv run tests/Mutation/run.py <shard>, ADR-0020). If public API, a target or packaging changes: dotnet pack OpenUrzednik.Packages.slnf -c Release (package validation). From the skeleton on: dotnet publish tests/OpenUrzednik.AotSmoke -f net10.0, then run the binary (ADR-0014).

API facts (spec v1.6.2 of 05.11.2026 and its error-code table, live probes on 2026-11-08; details in the provider ADR):

  • GET only, no auth. Production https://wykazpodatnikowvat.mf.gov.pl/api/ and /api2/; test https://wykazpodatnikowvat-test.mf.gov.pl/…. The old wl-api.mf.gov.pl works only until 2026-12-01.
  • date (yyyy-MM-dd) is required on /api; not in the future, not before 1 January five years back (2021-01-01 on 2026-11-08; earlier → WL-118).
  • Answers carry requestId (proof of the check for the tax authorities) and requestDateTime (dd-MM-yyyy HH:mm:ss, Warsaw time).
  • Errors: {"message", "code": "WL-1xx"}; WL-191 is the daily per-IP limit (429), WL-195/196 ask to repeat the query (400). Quotas (search 100 a day of up to 30 subjects, check 5,000 entities, WL2 50,000 a day) weren't enforced on 2026-11-08 (the test host answered 130 single searches; production 160 single searches and 120 batches of 30 from one IP, all 200).
  • Requests carry NIP, REGON and account numbers in the path (display paths, ADR-0019/0017); responses carry personal data of sole traders. Fixtures come from the test host's official test data or legal-person records, with any remaining personal field replaced by a fake value of the same format.

Leak tests (added 2026-11-18, #299): TestCommon's RecordingTelemetry and ShouldNotLeak don't see what IHttpClientFactory logs through Microsoft's ILogger (ADR-0017). This package's tests cover it: register a recording ILoggerProvider, send a request with a NIP in the path through the named client, and assert no logged message, scope or property contains the NIP (as given, or any 5 of its digits).

Activity

  1. added this to the 1.1.0 milestone on Nov 8, 2026
  2. added
    enhancement
    on Nov 8, 2026
  3. moved this from Triage to Ready in OpenUrzednik.NETon Nov 8, 2026
  4. added
    provider:white-list
    on Nov 20, 2026
  5. moved this from Ready to In progress in OpenUrzednik.NETon Nov 21, 2026
  6. moved this from In progress to Done in OpenUrzednik.NETon Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementprovider:white-list

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions