Skip to content

Complete all activation rollback stages and preserve original errors - #42

Merged
AriusII merged 1 commit into
mainfrom
fix/cli-006-activation-rollback
Sep 21, 2026
Merged

AriusII merged 1 commit into
mainfrom
fix/cli-006-activation-rollback

Conversation

@AriusII

@AriusII AriusII commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Completes the activation-construction rollback gap identified by architecture finding R04 / qualification scenarios T007–T008.

  • tracks the provider and scope until a complete activation is published;
  • rolls back each acquired pre-publication stage independently in reverse construction order: scope, provider, configuration;
  • preserves the original configure/build/resolution exception as the primary failure and reports cleanup failures after it;
  • never invokes lifecycle hooks or Client-resource cleanup for an unpublished activation;
  • keeps the existing published-activation cleanup order intact.

Validation matrix

Stage / case Evidence
Client resolution + failing scoped/provider/configuration disposal FailedConstructionCleansEveryAcquiredStageAndAllowsANewEnableEpoch asserts all three cleanup attempts, exception order, inactive state, and a later successful enable.
Configure failure + configuration disposal failure ConfigureFailureRemainsPrimaryWhenConfigurationReleaseAlsoFails retains the configure failure as primary.
Module enable failure + re-enable FailedModuleEnableRollsBackAndTheSamePluginCanEnableAgain validates compensation and a clean next epoch.
Normal disable and idempotence Existing Hosting lifecycle tests remain green.

Commands

  • dotnet restore CheatEngine.Client.slnx --locked-mode — passed.
  • dotnet build CheatEngine.Client.slnx --configuration Release --no-restore --warnaserror — passed (0 warnings, 0 errors).
  • dotnet test --project tests/CheatEngine.Client.Hosting.Tests/CheatEngine.Client.Hosting.Tests.csproj --configuration Release — passed (18/18).
  • dotnet test --solution CheatEngine.Client.slnx --configuration Release --no-build — 512 passed, 1 unrelated pre-existing failure: Lua generator snapshot expects CRLF while generated output is LF. This is outside #22 and unchanged by this PR.

Scope and limits

The change is managed-only, synchronous, and AOT-compatible; it does not alter SDK ownership, native cleanup, capabilities, or package contents. Hosting continues to own its manually created ConfigurationManager, while the DI container owns services it creates.

Closes #22

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of activation failures during client startup.
    • Partially created resources are now cleaned up in reverse order, even when cleanup steps encounter errors.
    • Original startup failures remain the primary error, with cleanup issues reported as additional diagnostics.
    • Plugins can be enabled again after a failed activation attempt.
  • Documentation

    • Clarified activation rollback behavior and ownership of configuration cleanup.

Track provider and scope ownership until activation publication so partial construction cleanup independently releases scope, provider, and host-created configuration in reverse order. Preserve the original activation failure and retain cleanup diagnostics without invoking hooks for unpublished activations.

Add fault-injection coverage for DI scope, provider, and configuration disposal, configure failures, and module rollback followed by successful re-enable. Document the construction ownership boundary and synchronous DI disposal responsibilities.
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 70ae290f-0c86-40db-86b1-e7374e9394a8

📥 Commits

Reviewing files that changed from the base of the PR and between 5a40f3e and 334a1c5.

📒 Files selected for processing (4)
  • docs/adr/0002-plugin-activation-lifecycle.md
  • libs/CheatEngine.Client.Hosting/CheatEngineClientPlugin.cs
  • libs/CheatEngine.Client.Hosting/README.md
  • tests/CheatEngine.Client.Hosting.Tests/CheatEngineClientPluginTests.cs

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The plugin now tracks activation construction resources before publication. Failed construction performs reverse-order cleanup for acquired stages, preserves the original error, and records cleanup failures. Documentation and tests cover ownership, disposal failures, and retry after module-enable failure.

Changes

Activation rollback

Layer / File(s) Summary
Rollback contract and ownership
docs/adr/0002-plugin-activation-lifecycle.md, libs/CheatEngine.Client.Hosting/README.md
The lifecycle documentation defines pre-publication cleanup order, error precedence, callback gating, and ownership of ConfigurationManager.
Unpublished activation cleanup
libs/CheatEngine.Client.Hosting/CheatEngineClientPlugin.cs
ActivationConstruction tracks acquired resources. Failed construction disposes each acquired stage in reverse order and aggregates cleanup failures without replacing the original error.
Rollback and retry validation
tests/CheatEngine.Client.Hosting.Tests/CheatEngineClientPluginTests.cs
Tests cover cleanup-stage failures, configuration disposal failures, failure ordering, and successful re-enable after a first module-enable failure.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant CheatEngineClientPlugin
  participant ActivationConstruction
  participant ConfigurationManager
  participant Module
  CheatEngineClientPlugin->>ActivationConstruction: construct and track activation resources
  ActivationConstruction->>ConfigurationManager: retain host-created configuration
  ActivationConstruction-->>CheatEngineClientPlugin: construction failure
  CheatEngineClientPlugin->>ActivationConstruction: clean unpublished activation
  ActivationConstruction->>ConfigurationManager: dispose configuration
  CheatEngineClientPlugin->>Module: skip callbacks before publication
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.04% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 2 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: completing activation rollback stages while preserving the original error.
Linked Issues check ✅ Passed Issue #22 coding requirements are met. CheatEngineClientPlugin records provider and scope ownership before publication. CleanupUnpublishedActivation attempts scope, provider, and configuration cle…
Out of Scope Changes check ✅ Passed The reviewed changes are limited to Client hosting policy, lifecycle documentation, and focused hosting tests. The implementation remains synchronous and managed-only. The change does not modify SDK o…
Full details: Docstring Coverage

Explanation

Docstring coverage is 13.04% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 2 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@AriusII
AriusII merged commit edaf95b into main Sep 21, 2026
5 checks passed
@AriusII
AriusII deleted the fix/cli-006-activation-rollback branch September 21, 2026 21:16
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