Skip to content

feat!: replace strategy interfaces with abstract base classes - #1178

Merged
vbreuss merged 1 commit into
mainfrom
feat/strategy-base-classes
Nov 1, 2026
Merged

vbreuss merged 1 commit into
mainfrom
feat/strategy-base-classes

Conversation

@vbreuss

@vbreuss vbreuss commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

A strategy interface cannot gain members without breaking every implementer, which already forced a wrapper for IAccessControlStrategy to pass the AccessRequest. Abstract base classes can grow with virtual members, so the next major version replaces the file system strategy interfaces with abstract base classes.

Key changes

  • Replaced the strategy interfaces with abstract base classes
    • IAccessControlStrategy is removed; AccessControlStrategy no longer implements it and WithAccessControlStrategy takes an AccessControlStrategy
    • IUnixFileModeStrategy became UnixFileModeStrategy; OnSetUnixFileMode is virtual and does nothing by default
    • ISafeFileHandleStrategy became SafeFileHandleStrategy
  • UnixFileModeStrategy.IsAccessGranted receives an AccessRequest instead of the FileAccess, so it can grow consistently with the access control strategy; deleting is still not checked by this strategy
  • Removed the constructor of DefaultAccessControlStrategy with a two-argument callback, to keep a single way to configure it
  • Updated the documentation, the design goals and the API snapshots

Breaking changes

  • Custom strategies derive from AccessControlStrategy, UnixFileModeStrategy or SafeFileHandleStrategy and override their members instead of implementing an interface
  • A custom UnixFileModeStrategy reads the requested access from request.Access
  • new DefaultAccessControlStrategy((path, extensibility) => ...) becomes new DefaultAccessControlStrategy((path, extensibility, _) => ...)

@vbreuss vbreuss self-assigned this Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Test Results

     80 files  ± 0       80 suites  ±0   1h 39m 35s ⏱️ -11s
 87 871 tests  -  2   83 181 ✅ + 2   4 690 💤  - 4  0 ❌ ±0 
202 670 runs   - 40  182 964 ✅  - 36  19 706 💤  - 4  0 ❌ ±0 

Results for commit b3624db. ± Comparison against base commit 8feb783.

This pull request removes 84598 and adds 84595 tests. Note that renamed tests count towards both.
  )
)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(01c30b0f-4f39-4d7d-97ed-f4f5290c3a54)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(0eb0d7ea-c3e3-46e3-a069-7a0c80541dae)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(1b1776e1-432d-4eda-be14-8ef58ffb395d)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(1c49f18e-7e26-46f7-b28f-1b02c3264a71)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(1d704df9-4111-4247-88e3-68c8acf3c722)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(28421a67-9dc9-4414-8476-be99e99941e6)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(2d343a76-0bad-4555-a205-c9bf132116ac)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(495541db-cc26-47cc-a7a2-ed4a6ce07639)
…
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(09d1a5ea-a471-46dc-a65d-0c9635ec95a2)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(2c31f7e6-db11-49de-a939-a1ddecadc0bf)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(30064edc-de92-4d83-9a46-b55019ef4326)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(3f51b6ef-7a88-4d46-9dc6-99bcda2b5e55)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(4238760a-9ed5-4de8-964d-59124ae9cbfc)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(49b5d3d5-60b7-464d-8680-ff4245279762)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(641cac39-d907-4cc0-aeb0-46f5b697b3bf)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(6acf9854-5e35-4fea-90ba-55c7c0141054)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(8390fdd6-3934-43a4-b433-c2fa981c6eba)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(89172290-74a0-4448-9a73-8762ddf58962)
…
This pull request removes 4666 skipped tests and adds 4662 skipped tests. Note that renamed tests count towards both.
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(0988093d-4062-4825-b3e6-ba62d56601ef)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(1a797241-1718-4d37-a806-439888b8bd38)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(349bf2ab-8af5-4728-a0c4-9e8e5b81611e)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(3c9e8b42-49eb-433f-af8d-77c9b816cf9c)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(84ebc167-f4aa-4722-87ca-761949f5171e)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(92273374-8d64-4056-a628-d09f7a691e79)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(bf427bfd-8679-4a48-9ace-9915f78478bc)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(d7ec4bb9-edd4-4adb-bd3d-d14d2a1a2ece)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ SetUnixFileMode_SafeFileHandle_ShouldUpdateValue(18b03d33-3744-4316-931a-d3295960b5fa, None)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ SetUnixFileMode_SafeFileHandle_ShouldUpdateValue(1e6ae414-12c6-47de-a84f-d573b146eb98, None)
…
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(00147e86-40e7-4296-92d9-d2ec0da6afeb)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(2527addd-614a-4341-9d12-c7e98e4128b8)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(479e4adb-b20e-4ec1-afa3-31644804cc28)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(707abd5a-0073-4b3d-8989-6dda1b075b8e)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(9215bbf2-48f0-437b-b0cd-2cd49e3e036c)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(b60210af-54cc-4d3f-9a87-096e8d3caa96)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(dc8e5c10-5d00-4fa7-8fd9-bd871f83c352)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(e27aa796-99c6-4069-abef-dd0588f73f87)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ SetUnixFileMode_SafeFileHandle_ShouldUpdateValue(1ca8ce84-1411-46cf-b188-6716050290dc, None)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ SetUnixFileMode_SafeFileHandle_ShouldUpdateValue(3950bdb7-6b91-4e2f-82d1-71f2e961f454, None)
…

♻️ This comment has been updated with latest results.

@mergify

mergify Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

This pull request is merged.

@vbreuss
vbreuss marked this pull request as draft November 1, 2026 16:14
@vbreuss
vbreuss force-pushed the feat/strategy-base-classes branch from 8bb7db2 to 329eaf8 Compare November 1, 2026 19:01
@vbreuss
vbreuss marked this pull request as ready for review November 1, 2026 19:01
@vbreuss
vbreuss enabled auto-merge (squash) November 1, 2026 19:06
A strategy interface cannot gain members without breaking every implementer, which already forced a wrapper for `IAccessControlStrategy` to pass the `AccessRequest`. Abstract base classes can grow with virtual members, so the next major version replaces `IAccessControlStrategy`, `IUnixFileModeStrategy` and `ISafeFileHandleStrategy` with `AccessControlStrategy`, `UnixFileModeStrategy` and `SafeFileHandleStrategy`.

The Unix file mode strategy now also receives the `AccessRequest`, so it can grow consistently with the access control strategy. The two-argument callback of `DefaultAccessControlStrategy` is removed to keep a single way to configure it.
@vbreuss
vbreuss force-pushed the feat/strategy-base-classes branch from 329eaf8 to b3624db Compare November 1, 2026 20:09
@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

@vbreuss
vbreuss merged commit 6a90189 into main Nov 1, 2026
14 checks passed
@vbreuss
vbreuss deleted the feat/strategy-base-classes branch November 1, 2026 21:01
@github-actions

Copy link
Copy Markdown

This is addressed in release v8.0.0.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant