Skip to content

Evict cached sync providers when an endpoint is repointed or its data store edited - #4

Merged
adospace merged 1 commit into
mainfrom
fix/invalidate-provider-cache-on-endpoint-repoint
Sep 30, 2026
Merged

adospace merged 1 commit into
mainfrom
fix/invalidate-provider-cache-on-endpoint-repoint

Conversation

@adospace

Copy link
Copy Markdown
Owner

Cached sync providers never expire, and until now only the publish toggle evicted them. Two changes are allowed while an endpoint is published, and neither evicted the cache:

  • Repointing an endpoint to another configuration (PUT api/datastores/{id}/endpoints/{endpointId}/configuration). The endpoint kept serving the previous configuration's tables until the next publish toggle or restart. We hit this on MDC-FINS: after a new table configuration went live, fish tables configured as UploadAndDownload were still served as UploadOnly.
  • Editing a data store (PUT api/datastores/{id}). Changes to the connection string, tracking mode or change retention did not reach any endpoint on that data store.

Both actions now call ISyncProviderCache.Invalidate. Table-rule edits were already safe: they are refused while an endpoint is published.

Tests

SyncProviderCacheInvalidationTests:

  • Repoint: evicts the endpoint's cached provider.
  • Data store update: evicts the cached providers of its endpoints.
  • Repoint of another endpoint: leaves this endpoint cached.
  • Invalidate itself: evicts the endpoint's entry.

Without the controller change, the repoint and data store tests fail. The full suite passes (51/51).

CreateAuthenticatedClient runs a separate WebApplicationFactory with its own singletons. A test that resolved the cache from the fixture's Services was therefore reading a different instance than the one the controller invalidated. The new CreateAuthenticatedFactory exposes that host, and CreateAuthenticatedClient behaves as before.

… store edited

Cached providers never expire and were only evicted by the publish toggle. Repointing an endpoint at another configuration is allowed while published, so the endpoint kept serving the previous configuration's tables until the next toggle or restart. Editing a data store's connection string, tracking mode or change retention had the same effect on every endpoint on it.

Both actions now invalidate. The tests needed the host behind the authenticated client: CreateAuthenticatedClient runs a separate WebApplicationFactory with its own singletons, so CreateAuthenticatedFactory exposes it.
@adospace
adospace merged commit 1b06f14 into main Sep 30, 2026
2 checks passed
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