Skip to content

refactor(cache)!: move implementation classes out of the abstractions package - #216

Open
cosmin-staicu wants to merge 1 commit into
mainfrom
refactor/abstractions-implementations
Open

cosmin-staicu wants to merge 1 commit into
mainfrom
refactor/abstractions-implementations

Conversation

@cosmin-staicu

@cosmin-staicu cosmin-staicu commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Stacked on #215; its base is perf/breaking-hot-path. Review and merge that one first.

Moves the implementation classes from UiPath.Caching.Abstractions to UiPath.Caching, so the abstractions package keeps to interfaces, null implementations, DTOs and the extensions over them:

  • SystemJsonByteSerializerProxy and RawByteSerializerProxy

  • Cache<T>, HashCache<T> and CacheFactoryExtensions, which constructs them

  • CacheExpiration, CacheKeyComparer and TelemetryTags

  • BatchGetOrAdd, now public

Namespaces are unchanged, so code that references UiPath.Caching compiles as before. AddCaching already registers ICache<T> and IHashCache<T>, so a library that references only the abstractions package can inject typed caches without CreateCache<T>.

Batch GetOrAdd

  • ICache's three batch GetOrAddAsync<T, TState> overloads lose their default bodies, which called BatchGetOrAdd.

  • RedisCache and MultilayerCache already implement them. An implementation outside the library forwards to the public BatchGetOrAdd.RunAsync, which validates all four reference arguments synchronously, before the cache is touched.

  • NullCache implements them with the result BatchGetOrAdd gives over a cache that never hits: the generator answers each key's first state, and states on the same key share that answer. A test checks that the two agree.

What stays

  • Disposable: NullCacheChangeToken and NullTopic<T> return Disposable.Empty.

  • The other extension classes: CacheExtensions, CacheSyncExtensions, HashCacheExtensions, HashCacheSyncExtensions and TimeProviderExtensions.

Breaking

  • Code that references only UiPath.Caching.Abstractions and uses a moved class must add a UiPath.Caching reference, or inject ICache<T> and IHashCache<T> instead of calling CreateCache<T>.

  • An ICache implementation outside the library must implement the three batch overloads.

  • Binaries compiled against the old location or the old interface fail with TypeLoadException. The abstractions package cannot forward types to UiPath.Caching, which depends on it.

Verification

  • dotnet build -c Release -warnaserror

  • dotnet test: 4075 passed on net8.0 and net10.0, with the Redis integration tests on.

@github-actions github-actions Bot added the needs-cla-review A maintainer should assess whether a signed CLA is required (see CONTRIBUTING.md) label Sep 26, 2026
@github-actions

Copy link
Copy Markdown

🔎 Maintainer heads-up: automated triage flagged this PR as potentially material, so it may need a signed CLA in addition to the DCO sign-off.

Strong signals

  • adds public API surface (PublicAPI.Unshipped.txt in src/UiPath.Caching.Abstractions, src/UiPath.Caching)

This is advisory only — the bot does not decide. Please judge against the CLA criteria (material, product-critical, patent-sensitive, corporate contributor, broad commercial use). Note that thresholds can be gamed by splitting PRs, so use your judgement.

  • If a CLA is needed → add the cla-required label (a contributor comment with signing steps is posted automatically).
  • If it is not needed → replace needs-cla-review with cla-not-required so later pushes don't re-flag it.

@cosmin-staicu
cosmin-staicu force-pushed the refactor/abstractions-implementations branch 2 times, most recently from 249a2a7 to e23125b Compare September 26, 2026 12:22
@cosmin-staicu
cosmin-staicu force-pushed the refactor/abstractions-implementations branch from e23125b to bffb69e Compare September 26, 2026 12:35
@cosmin-staicu
cosmin-staicu force-pushed the refactor/abstractions-implementations branch from bffb69e to cbf41cd Compare September 26, 2026 15:00
@cosmin-staicu
cosmin-staicu requested a balanced review from Copilot September 26, 2026 15:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The public batch helper lacks consistent argument validation, and the interface documentation still shows removed default implementations.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Moves concrete cache implementations from UiPath.Caching.Abstractions into UiPath.Caching, preserving namespaces while enforcing a cleaner package boundary.

Changes:

  • Relocates serializers, typed-cache wrappers, comparers, expiration helpers, and telemetry utilities.
  • Makes BatchGetOrAdd public and requires external ICache implementations to provide batch overloads.
  • Updates null-cache behavior, tests, API baselines, documentation, and migration notes.
File Description
tests/​UiPath.Caching.Tests/​Fakes/​DictionaryCache.cs Implements required batch overloads.
tests/​UiPath.Caching.Tests/​BatchGetOrAddTests.cs Verifies null-cache batch equivalence.
src/​UiPath.Caching/​Telemetry/​TelemetryTags.cs Moves telemetry tag conversion helper.
src/​UiPath.Caching/​SystemJsonByteSerializerProxy.cs Moves the default JSON serializer.
src/​UiPath.Caching/​RawByteSerializerProxy.cs Moves the raw-byte serializer.
src/​UiPath.Caching/​PublicAPI.Unshipped.txt Records newly exposed core APIs.
src/​UiPath.Caching/​HashCacheOfT.cs Moves the typed hash-cache wrapper.
src/​UiPath.Caching/​CacheOfT.cs Moves the typed cache wrapper.
src/​UiPath.Caching/​CacheKeyComparer.cs Moves cached key comparers.
src/​UiPath.Caching/​CacheFactoryExtensions.cs Moves typed factory extensions.
src/​UiPath.Caching/​CacheExpiration.cs Moves expiration validation helpers.
src/​UiPath.Caching/​BatchGetOrAdd.cs Makes the batch helper public.
src/​UiPath.Caching.Abstractions/​PublicAPI.Unshipped.txt Records removed and required APIs.
src/​UiPath.Caching.Abstractions/​NullCache.cs Implements required batch operations.
src/​UiPath.Caching.Abstractions/​IHashCache.cs Removes cross-package documentation reference.
src/​UiPath.Caching.Abstractions/​ICache.cs Removes batch default implementations.
docs/​reference/​interfaces.md Documents required batch methods and typed injection.
docs/​how-to/​extending.md Documents serializer package ownership.
CHANGELOG.md Records package and interface breaking changes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/reference/interfaces.md
@cosmin-staicu
cosmin-staicu force-pushed the refactor/abstractions-implementations branch 2 times, most recently from cbf41cd to eb358d0 Compare September 26, 2026 15:41
@cosmin-staicu
cosmin-staicu requested a balanced review from Copilot September 26, 2026 15:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The newly public BatchGetOrAdd.RunAsync lacks deterministic validation for two required reference parameters.

Review effort: Balanced
Findings: None

Resolved since last review (1)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The broad assembly relocation and intentional binary-breaking interface changes warrant final human validation, especially because the PR is stacked on #215.

Review effort: Balanced
Findings: None

@cosmin-staicu
cosmin-staicu force-pushed the refactor/abstractions-implementations branch 2 times, most recently from 555c8cb to 7287a4a Compare September 28, 2026 14:27
@cosmin-staicu
cosmin-staicu force-pushed the perf/breaking-hot-path branch 2 times, most recently from ceafb35 to ce4cbe4 Compare September 28, 2026 15:11
@cosmin-staicu
cosmin-staicu force-pushed the perf/breaking-hot-path branch 2 times, most recently from a80cae6 to 51fdd9b Compare September 28, 2026 17:07
@cosmin-staicu
cosmin-staicu force-pushed the refactor/abstractions-implementations branch from 0b74a70 to 95a3364 Compare September 28, 2026 17:10
@cosmin-staicu
cosmin-staicu force-pushed the perf/breaking-hot-path branch 2 times, most recently from 95ae7db to db70dcb Compare September 28, 2026 17:25
@cosmin-staicu
cosmin-staicu force-pushed the refactor/abstractions-implementations branch from 95a3364 to 6905a0f Compare September 28, 2026 17:28
@cosmin-staicu
cosmin-staicu force-pushed the refactor/abstractions-implementations branch from 6905a0f to d53fd00 Compare September 28, 2026 17:42
@cosmin-staicu
cosmin-staicu force-pushed the refactor/abstractions-implementations branch from d53fd00 to c9ad742 Compare September 28, 2026 17:57
@cosmin-staicu
cosmin-staicu force-pushed the refactor/abstractions-implementations branch from c9ad742 to 947655f Compare September 28, 2026 18:24
Base automatically changed from perf/breaking-hot-path to main September 29, 2026 11:08
@cosmin-staicu
cosmin-staicu force-pushed the refactor/abstractions-implementations branch from 947655f to c0305ee Compare September 29, 2026 11:13
@cosmin-staicu cosmin-staicu self-assigned this Sep 29, 2026
@cosmin-staicu cosmin-staicu added cla-not-required Maintainer reviewed: no CLA required for this contribution and removed needs-cla-review A maintainer should assess whether a signed CLA is required (see CONTRIBUTING.md) labels Sep 29, 2026
@cosmin-staicu
cosmin-staicu requested a balanced review from Copilot September 29, 2026 11:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Interface documentation still incorrectly states that only ICache<T> lacks batch default implementations.

Review effort: Balanced
Findings: 1 Low severity

Open (1)

Comment thread docs/reference/interfaces.md

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The deliberate binary-breaking assembly and interface changes, combined with its stacked dependency on PR #215, warrant final human validation.

Review effort: Balanced
Findings: None

Resolved since last review (1)

… package

SystemJsonByteSerializerProxy, RawByteSerializerProxy, Cache<T>,
HashCache<T>, CacheFactoryExtensions, CacheExpiration, CacheKeyComparer,
TelemetryTags and BatchGetOrAdd move to UiPath.Caching, so
UiPath.Caching.Abstractions keeps to interfaces, null implementations,
DTOs and the extensions over them. Namespaces are unchanged.

ICache's three batch GetOrAddAsync overloads lose their default bodies,
which called BatchGetOrAdd. BatchGetOrAdd becomes public, so an
implementation outside the library can forward to it. NullCache
implements them with the result BatchGetOrAdd gives over a cache that
never hits: the generator answers each key's first state, and states on
the same key share that answer.

Disposable stays, since the null implementations return Disposable.Empty.

BREAKING CHANGE: code that references only UiPath.Caching.Abstractions
and uses one of the moved classes must reference UiPath.Caching, or
inject ICache<T> and IHashCache<T> instead of calling CreateCache<T>. An
ICache implementation outside the library must implement the batch
GetOrAddAsync overloads. Binaries compiled against the old location or
the old interface fail with TypeLoadException.

Signed-off-by: Cosmin Staicu <cosmin.staicu@uipath.com>
@cosmin-staicu
cosmin-staicu force-pushed the refactor/abstractions-implementations branch from ae13f6f to 2649eba Compare September 29, 2026 11:54
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The relocation preserves the public surface, and the intentional interface break is consistently implemented, tested, and documented.

Review effort: Balanced
Findings: None

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-not-required Maintainer reviewed: no CLA required for this contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants