Skip to content

feat(shims): hand-bridge DelegateDisposable, document non-bridgeable types (#69 session 5)#142

Merged
ChrisonSimtian merged 1 commit into
mainfrom
feature/69-session-5-delegatedisposable
May 24, 2026
Merged

feat(shims): hand-bridge DelegateDisposable, document non-bridgeable types (#69 session 5)#142
ChrisonSimtian merged 1 commit into
mainfrom
feature/69-session-5-delegatedisposable

Conversation

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

Summary

Closes out the remaining no-accessible-ctor SHIM001 bucket honestly.

What ships as a bridge:

  • Nuke.Common.Utilities.DelegateDisposablestatic class re-exposing CreateBracket(Action, Action), CreateBracket<T>(Func<T>, Action<T>), and SetAndRestore<T>. All three return canonical IDisposable, so consumer calls flow through naturally.

What ships as docs (not bridge):

  • Fallout.Common.IO.AbsolutePath
  • Fallout.Common.Tools.AzureKeyVault.AzureKeyVault
  • Fallout.Common.Tools.MSBuild.MSBuildProject

These three are documented as fallout-migrate rename targets in a new "What's NOT covered (and won't be)" README section.

Why those three aren't bridged

Type Public statics Why a hand-bridge wouldn't help
AbsolutePath Create() + 5 const strings Dominant consumer syntax is AbsolutePath path = "/foo" (implicit conversion) and parent / "child" (operator/). A static class shim can't carry implicit operators, and a subclass shim can't be assignment-compatible with the framework-returned canonical instances. The bridge would be decorative — AbsolutePath.Create(...) is rarely how consumers write it.
AzureKeyVault none Internal ctor, framework-constructed only. Zero surface to re-expose.
MSBuildProject none Internal ctor, framework-returned only. Zero surface to re-expose.

The fallout-migrate rewrite (Nuke.Common.X.YFallout.Common.X.Y) is the right tool for these — same conclusion as enums, delegates, and structs.

Live impact

Kind Before (#141) After
enum 76 76
no-accessible-ctor 8 6 (DelegateDisposable × 2 paths removed)
delegate 14 14
struct 4 4
ambiguous-across-assemblies 4 4
sealed-class 2 2

The 3 remaining unique no-accessible-ctor types match the 3 documented fallout-migrate targets exactly.

Verification

#69 roadmap status after this

  • session 1: ✅ Easy-tier generator + Nuke.Common shim
  • session 2: ✅ Static-class method delegation
  • session 2b: ⏸️ Sealed-class wrappers — deferred (1 unique attribute, low ROI)
  • session 3: ✅ Nuke.Build + Nuke.Components shims
  • session 4: ✅ CI host singletons (10 vendors)
  • session 4b: ✅ SHIM001 suppression for consumer-bridged types (feat(shims): suppress SHIM001 for consumer-bridged types (#69 follow-up) #141)
  • session 5 (this PR): ✅ DelegateDisposable bridge + non-bridgeable docs

The no-accessible-ctor line of attack is now closed — what remains (AbsolutePath, AzureKeyVault, MSBuildProject) is documented fallout-migrate territory.

Test plan

  • CI green
  • Live shim build: kind: no-accessible-ctor count is 6 (down from 8)
  • Consumer trial: using Nuke.Common.Utilities; + DelegateDisposable.CreateBracket(...) compiles

🤖 Generated with Claude Code

…types (#69 session 5)

DelegateDisposable falls in the no-accessible-ctor bucket (private ctor), but
unlike the other 3 candidates it exposes its full surface via public static
factories (CreateBracket × 2, SetAndRestore). A static-class shim re-exposing
those factories actually helps real consumers — the factories return the
canonical IDisposable, so calls flow through naturally.

For the other 3 no-accessible-ctor types, hand-bridges would be empty or
decorative:
- AbsolutePath: dominant consumer usage is implicit string/AbsolutePath
  conversion and operator/ — neither can be carried by a static-class shim
- AzureKeyVault, MSBuildProject: zero public statics, framework-constructed
  only; nothing to re-expose

These three are documented as fallout-migrate rename targets in a new
"What's NOT covered (and won't be)" README section.

Drops 2 SHIM001 warnings (DelegateDisposable × 2 referenced-assembly paths)
via the suppression mechanism from #141. Remaining no-accessible-ctor types
in the live build (AbsolutePath, AzureKeyVault, MSBuildProject) are exactly
the three documented fallout-migrate targets.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ChrisonSimtian
ChrisonSimtian merged commit 155016e into main May 24, 2026
1 check passed
@ChrisonSimtian
ChrisonSimtian deleted the feature/69-session-5-delegatedisposable branch May 24, 2026 06:42
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