Skip to content

Compose Client through DI and plugin Hosting - #4

Merged
AriusII merged 8 commits into
client-fluent-apifrom
client-hosting-and-di
Sep 20, 2026
Merged

AriusII merged 8 commits into
client-fluent-apifrom
client-hosting-and-di

Conversation

@AriusII

@AriusII AriusII commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Context

This stacked PR connects the Core implementation (#2) and Fluent API (#3) to dependency injection and the Cheat Engine plugin lifecycle.

Why this exists

Cheat Engine constructs plugins with a parameterless constructor, but application services still need validated, scoped dependency injection. The Client must also guarantee that SDK-dependent resources are released before Cheat Engine tears down its Lua context.

What changed

  • Adds AddCheatEngineClient and a strongly typed builder for options, codecs, modules, logging, policy, and unsafe-Lua opt-in.
  • Adds activation-bound DI factories for the internal Core services and public ICheatEngineClient facade.
  • Adds CheatEngineClientPlugin, which creates a fresh provider/scope per enable epoch and performs reverse-order module cleanup on disable or rollback.
  • Adds the CheatEngine.Client meta-package as the consumer entry point.
  • Adds CECLIENT001 build-transitive validation for plugin projects that omit their required direct SDK package reference.
  • Adds DI, Hosting, and facade graph tests, PublicAPI baselines, package documentation, and lock files.

Lifecycle guarantee

Disable closes admissions, runs application/module cleanup, drains owned CE resources while the SDK context is still valid, and only then disposes the scoped provider and configuration.

Validation

DI build:      0 warnings, 0 errors
Hosting build: 0 warnings, 0 errors
DI tests:      Passed 20, Failed 0, Skipped 0
Hosting tests: Passed 6, Failed 0, Skipped 0
Facade tests:  Passed 2, Failed 0, Skipped 0

Dependency

Base branch: client-fluent-api / #3. Merge after #3.

Summary by CodeRabbit

  • New Features

    • Added dependency-injection support for configuring and registering Cheat Engine clients.
    • Added fluent client setup with configuration binding, custom modules, memory codecs, and optional unsafe Lua execution.
    • Added configurable scan limits and table-file access policies with validation.
    • Added a plugin hosting base with enable/disable lifecycle management, rollback, cleanup, and failure reporting.
    • Added built-in memory support for common scalar types and addresses.
  • Documentation

    • Added setup, configuration, packaging, and lifecycle guidance.
  • Tests

    • Added coverage for configuration, registration, memory operations, and plugin lifecycle behavior.

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: f7989289-ec2a-4fb1-96c7-983c69e09b2a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 38db5b81-1d85-4668-8830-b248b7f2c79c

📥 Commits

Reviewing files that changed from the base of the PR and between 751fb56 and 12e4ea4.

📒 Files selected for processing (43)
  • libs/CheatEngine.Client.Extensions.DependencyInjection/CheatEngine.Client.Extensions.DependencyInjection.csproj
  • libs/CheatEngine.Client.Extensions.DependencyInjection/CheatEngineClientActivationCleanup.cs
  • libs/CheatEngine.Client.Extensions.DependencyInjection/CheatEngineClientBuilder.cs
  • libs/CheatEngine.Client.Extensions.DependencyInjection/CheatEngineClientOptions.cs
  • libs/CheatEngine.Client.Extensions.DependencyInjection/CheatEngineClientOptionsSemanticValidator.cs
  • libs/CheatEngine.Client.Extensions.DependencyInjection/CheatEngineClientServiceCollectionExtensions.cs
  • libs/CheatEngine.Client.Extensions.DependencyInjection/DefaultMemoryCodecs.cs
  • libs/CheatEngine.Client.Extensions.DependencyInjection/ICheatEngineClientActivationCleanup.cs
  • libs/CheatEngine.Client.Extensions.DependencyInjection/PublicAPI.Shipped.txt
  • libs/CheatEngine.Client.Extensions.DependencyInjection/PublicAPI.Unshipped.txt
  • libs/CheatEngine.Client.Extensions.DependencyInjection/README.md
  • libs/CheatEngine.Client.Extensions.DependencyInjection/ValidateCheatEngineClientOptions.cs
  • libs/CheatEngine.Client.Extensions.DependencyInjection/packages.lock.json
  • libs/CheatEngine.Client.Hosting/CheatEngine.Client.Hosting.csproj
  • libs/CheatEngine.Client.Hosting/CheatEngineClientPlugin.cs
  • libs/CheatEngine.Client.Hosting/CheatEnginePluginBuilder.cs
  • libs/CheatEngine.Client.Hosting/ClientActivationLifecycle.cs
  • libs/CheatEngine.Client.Hosting/ClientHostingLog.cs
  • libs/CheatEngine.Client.Hosting/PublicAPI.Shipped.txt
  • libs/CheatEngine.Client.Hosting/PublicAPI.Unshipped.txt
  • libs/CheatEngine.Client.Hosting/README.md
  • libs/CheatEngine.Client.Hosting/buildTransitive/CheatEngine.Client.Hosting.targets
  • libs/CheatEngine.Client.Hosting/packages.lock.json
  • src/CheatEngine.Client/CheatEngine.Client.csproj
  • src/CheatEngine.Client/PublicAPI.Shipped.txt
  • src/CheatEngine.Client/PublicAPI.Unshipped.txt
  • src/CheatEngine.Client/README.md
  • src/CheatEngine.Client/packages.lock.json
  • tests/CheatEngine.Client.Extensions.DependencyInjection.Tests/CheatEngine.Client.Extensions.DependencyInjection.Tests.csproj
  • tests/CheatEngine.Client.Extensions.DependencyInjection.Tests/CheatEngineClientOptionsSemanticValidatorTests.cs
  • tests/CheatEngine.Client.Extensions.DependencyInjection.Tests/CheatEngineClientServiceCollectionExtensionsTests.cs
  • tests/CheatEngine.Client.Extensions.DependencyInjection.Tests/DefaultMemoryCodecsTests.cs
  • tests/CheatEngine.Client.Extensions.DependencyInjection.Tests/README.md
  • tests/CheatEngine.Client.Extensions.DependencyInjection.Tests/packages.lock.json
  • tests/CheatEngine.Client.Hosting.Tests/CheatEngine.Client.Hosting.Tests.csproj
  • tests/CheatEngine.Client.Hosting.Tests/CheatEngineClientPluginTests.cs
  • tests/CheatEngine.Client.Hosting.Tests/CheatEnginePluginBuilderTests.cs
  • tests/CheatEngine.Client.Hosting.Tests/ClientActivationLifecycleTests.cs
  • tests/CheatEngine.Client.Hosting.Tests/README.md
  • tests/CheatEngine.Client.Hosting.Tests/packages.lock.json
  • tests/CheatEngine.Client.Tests/FacadeGraphSmokeTests.cs
  • tests/CheatEngine.Client.Tests/README.md
  • tests/CheatEngine.Client.Tests/packages.lock.json

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


📝 Walkthrough

Walkthrough

Changes

Client composition and hosting

Layer / File(s) Summary
Dependency-injection composition
libs/CheatEngine.Client.Extensions.DependencyInjection/*, tests/CheatEngine.Client.Extensions.DependencyInjection.Tests/*
Adds client options, validation, service registration, memory codecs, builder extensions, cleanup bridges, documentation, dependency locks, and DI tests.
Activation hosting and lifecycle
libs/CheatEngine.Client.Hosting/*, tests/CheatEngine.Client.Hosting.Tests/*
Adds single-use provider construction, plugin activation, ordered module callbacks, cleanup aggregation, logging, build enforcement, documentation, dependency locks, and hosting tests.
Facade packaging and consumer surface
src/CheatEngine.Client/*, tests/CheatEngine.Client.Tests/*
Changes the client package into a NuGet facade, updates documentation and nullable API metadata, locks dependencies, and adds facade graph smoke tests.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Plugin
  participant Builder
  participant Provider
  participant Lifecycle
  participant Modules
  Plugin->>Builder: Configure activation
  Builder->>Provider: Build validated service provider
  Provider-->>Plugin: Resolve client and lifecycle services
  Plugin->>Lifecycle: Enable activation
  Lifecycle->>Modules: Enable modules in registration order
  Plugin->>Lifecycle: Disable activation
  Lifecycle->>Modules: Disable modules in reverse order
  Lifecycle-->>Plugin: Return cleanup failures
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.66% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 93 functions across 19 files. (24 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 changes: composing the client through dependency injection and adding plugin hosting lifecycle support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 23.66% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 93 functions across 19 files. (24 skipped: 24 unsupported.)

✨ 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 commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Add the activation-scoped composition and plugin hosting layers.

CheatEngineClientBuilder configures explicit codecs, modules, options, logging, trusted table roots, and unsafe-Lua policy. AddCheatEngineClient wires the Core dependencies into one per-activation client. CheatEngineClientPlugin builds a validated scoped provider on enable, enables modules deterministically, rolls back failures, drains owned Cheat Engine resources while the SDK context remains valid, and disposes services on disable.

The aggregate CheatEngine.Client package now re-exports Fluent and Hosting as the consumer entry point. Tests cover options, codec registration, dependency graph composition, module order, activation cleanup, and public SDK-handle boundaries.

Validation:
- dotnet build libs/CheatEngine.Client.Extensions.DependencyInjection/CheatEngine.Client.Extensions.DependencyInjection.csproj --configuration Release --no-restore --warnaserror
- dotnet build libs/CheatEngine.Client.Hosting/CheatEngine.Client.Hosting.csproj --configuration Release --no-restore --warnaserror
- dotnet test --project tests/CheatEngine.Client.Extensions.DependencyInjection.Tests/CheatEngine.Client.Extensions.DependencyInjection.Tests.csproj --configuration Release --no-build --no-restore --fail-skips on
- dotnet test --project tests/CheatEngine.Client.Hosting.Tests/CheatEngine.Client.Hosting.Tests.csproj --configuration Release --no-build --no-restore --fail-skips on
- dotnet test --project tests/CheatEngine.Client.Tests/CheatEngine.Client.Tests.csproj --configuration Release --no-build --no-restore --fail-skips on
Make the nullable allowed-root configuration truthful and keep the service factory defensive after generated option validation.

Restrict the abstract plugin constructor to derived plugins and replace the throwing Client property with an explicit lifecycle-checked method.
AriusII added a commit that referenced this pull request Sep 20, 2026
Resolve the PR #4 DI and Hosting review findings without widening the stacked-branch scope.\n\nRemove unconsumed scan-limit settings and prevent configuration binding from activating unsafe Lua. The explicit builder opt-in now establishes the unsafe facade and Core policy together. Register lifecycle modules in the activation scope so they can consume scoped application services, and classify malformed table-root paths as validation failures.\n\nAdd stable Sonar project identifiers for the DI and Hosting assemblies, clarify lifecycle cleanup documentation, update the shipped API baseline and package guidance, and cover the configuration, scoped-module, malformed-path, and hosting-binding regressions.\n\nValidation:\n- dotnet restore CheatEngine.Client.slnx --locked-mode\n- dotnet build CheatEngine.Client.slnx --configuration Release --no-restore --warnaserror\n- DI tests: 22 passed, 0 failed, 0 skipped\n- Hosting tests: 8 passed, 0 failed, 0 skipped\n- git diff --check
@AriusII
AriusII force-pushed the client-hosting-and-di branch from 12e4ea4 to 6febb6d Compare September 20, 2026 20:39
Resolve the PR #4 DI and Hosting review findings without widening the stacked-branch scope.\n\nRemove unconsumed scan-limit settings and prevent configuration binding from activating unsafe Lua. The explicit builder opt-in now establishes the unsafe facade and Core policy together. Register lifecycle modules in the activation scope so they can consume scoped application services, and classify malformed table-root paths as validation failures.\n\nAdd stable Sonar project identifiers for the DI and Hosting assemblies, clarify lifecycle cleanup documentation, update the shipped API baseline and package guidance, and cover the configuration, scoped-module, malformed-path, and hosting-binding regressions.\n\nValidation:\n- dotnet restore CheatEngine.Client.slnx --locked-mode\n- dotnet build CheatEngine.Client.slnx --configuration Release --no-restore --warnaserror\n- DI tests: 22 passed, 0 failed, 0 skipped\n- Hosting tests: 8 passed, 0 failed, 0 skipped\n- git diff --check
@AriusII
AriusII force-pushed the client-hosting-and-di branch from 6febb6d to 0e70fc2 Compare September 20, 2026 21:07
AriusII and others added 5 commits September 20, 2026 23:08
Complete the release-facing repository shape after the modular client layers are in place.

The solution now replaces the legacy Binding project with Core, publishes the template package and a Native AOT compatibility probe, adds package/template smoke scripts, and updates CI into reusable main and pull-request workflows. The canonical ceplugin template demonstrates explicit JSON configuration, DI modules, safe Lua module registration, direct SDK reference requirements, and managed-plugin deployment.

The root documentation and ADR set now describe the package graph, activation lifecycle, capability gates, delivery policy, and local authorized-process boundary.

Validation:
- dotnet build CheatEngine.Client.slnx --configuration Release --no-restore --warnaserror
- dotnet test --solution CheatEngine.Client.slnx --configuration Release --no-build --no-restore --report-trx --results-directory artifacts/test-results --fail-skips on
- dotnet pack CheatEngine.Client.slnx --configuration Release --no-build --no-restore --output artifacts/packages
- eng/Invoke-PackageSmoke.ps1 -PackageSource artifacts/packages
- eng/Invoke-TemplateSmoke.ps1 -PackageSource artifacts/packages
- dotnet publish tests/CheatEngine.Client.AotProbe/CheatEngine.Client.AotProbe.csproj --configuration Release --runtime win-x64 --no-restore --output artifacts/aot-probe
- artifacts/aot-probe/CheatEngine.Client.AotProbe.exe
Run the scanner around a locked Release build and native-MTP Cobertura test execution, then publish the reports as a retained workflow artifact.

Keep the CECLIENT001 negative package smoke check strict while clearing its expected native-command exit status only after the diagnostic is verified.
Make missing TRX output a hard validation failure and move Sonar's JDK setup to the immutable Node 24-compatible setup-java v6.0.1 revision.

Let generated-plugin Lua lease disposal reach the activation lifecycle for aggregation, document the generated callbacks and exports, correct the Native AOT publish invocation, and restore the façade package guidance for the required direct SDK reference.
Add delivery pipeline and ceplugin template
@sonarqubecloud

Copy link
Copy Markdown

@AriusII
AriusII merged commit b746f7e into client-fluent-api Sep 20, 2026
6 checks passed
@AriusII
AriusII deleted the client-hosting-and-di branch September 20, 2026 21:28
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