Skip to content

SDK: finalize runtime ownership and scan contracts - #83

Merged
AriusII merged 1 commit into
mainfrom
sdk/functional-adjustments
Sep 22, 2026
Merged

AriusII merged 1 commit into
mainfrom
sdk/functional-adjustments

Conversation

@AriusII

@AriusII AriusII commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Context

This dependent branch contains the functional source changes that were already present in the SDK worktree after the formatting/CI baseline. It is intentionally isolated from the mechanical reformatting and from the deletion-only cleanup.

Changes

  • Remove the obsolete host-symbol compatibility flag and route host-symbol resolution through the explicit inspection API.
  • Complete symbol-registration hand-off/factory/publisher contracts and lifecycle-safe cleanup.
  • Add explicit memory-scan creation and release outcomes, and align session/session-factory behavior with the ownership model.
  • Harden Address List, Auto Assembler, dispatcher, Lua runtime/state, native bridge, and plugin-host lifecycle paths.
  • Update analyzers, source generators, generated-bridge parity coverage, packaging fixtures, live probes, benchmarks, and focused tests for the new contracts.
  • Update the changelog with the public compatibility removal.

Review notes

This is the behavior/API batch. It should be reviewed after PR #82 and merged after the deletion and formatting/CI baselines. No public SDK handles are leaked by the new ownership paths; the added tests cover managed/native parity and resource hand-off behavior.

Validation

  • git diff --check
  • Release build and test gates are run by the pull-request workflow.
  • Native bridge changes remain covered by the existing packaging and parity fixtures.

Integration order

Merge PR #81, then PR #82, then this PR.

Summary

  • Removed AddressResolutionOptions.UseHostSymbolTable and its compatibility API. Host-symbol resolution now uses EngineInspection.ResolveHostAddress.
  • Added symbol-registration handoff compensation and explicit cleanup outcomes.
  • Added memory-scan creation and release outcomes, target-identity validation, single-use cleanup, and bounded or cancellable result-copy APIs.
  • Hardened dispatcher, Auto Assembler, Address List, Lua callback, and runtime ownership paths.
  • Added native bridge parity checks and updated bridge packaging and reproducibility tests.
  • Expanded analyzer, managed/native ABI, live-probe, and Native AOT packaging coverage.
  • Updated the changelog for the public compatibility removal.

Validation includes git diff --check. Release build and test gates run through the pull-request workflow.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

The pull request updates ownership and cleanup behavior for symbol registration, callbacks, Auto Assembler patches, and memory scans. Memory scans gain target qualification outcomes, release outcomes, bounded result paging, and cancellation support. Address-resolution compatibility members are removed. Native bridge parity and packaged Native AOT consumer tests are expanded. Several files also receive formatting, typing, analyzer-suppression, and test-infrastructure updates.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to 4fbf5

The current Client pin remains compatible, but its test must be migrated when it adopts this SDK. Document the new Adopt failure mode so SDK consumers can handle target-qualification failures correctly.


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

@AriusII
AriusII force-pushed the sdk/functional-adjustments branch 3 times, most recently from 934a576 to b349713 Compare September 22, 2026 13:37
@AriusII
AriusII force-pushed the sdk/reformat-and-ci branch from 2f58c67 to 2d3988e Compare September 22, 2026 13:44
@AriusII
AriusII force-pushed the sdk/functional-adjustments branch from b349713 to de663bf Compare September 22, 2026 13:46
@AriusII
AriusII force-pushed the sdk/reformat-and-ci branch from 2d3988e to 77f7ed9 Compare September 22, 2026 13:56
@AriusII
AriusII force-pushed the sdk/functional-adjustments branch from de663bf to 44ccbd4 Compare September 22, 2026 13:57
@AriusII
AriusII force-pushed the sdk/reformat-and-ci branch from 77f7ed9 to 1240598 Compare September 22, 2026 14:01
@AriusII
AriusII force-pushed the sdk/functional-adjustments branch from 44ccbd4 to 7bdbc0c Compare September 22, 2026 14:01
@AriusII
AriusII force-pushed the sdk/reformat-and-ci branch from 1240598 to 912e826 Compare September 22, 2026 14:12
@AriusII
AriusII force-pushed the sdk/functional-adjustments branch from 7bdbc0c to 0b1782e Compare September 22, 2026 14:13
@AriusII
AriusII force-pushed the sdk/reformat-and-ci branch from 912e826 to de5f204 Compare September 22, 2026 14:31
Carry the prepared runtime, inspection, memory-scan, symbol-registration, Lua, native bridge, analyzer, generator, and packaging/test changes as one functional batch. The changes close ownership hand-offs, expose explicit scan outcomes, harden lifecycle and bridge behavior, and keep the managed tests aligned with the generated/native contracts.
@AriusII
AriusII force-pushed the sdk/functional-adjustments branch from 0b1782e to 4fbf51d Compare September 22, 2026 14:39
@AriusII
AriusII changed the base branch from sdk/reformat-and-ci to main September 22, 2026 14:39

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: CheatEngineNet/CheatEngine.SDK/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 608119e4-fba8-436e-820a-4c7812150ec3

📥 Commits

Reviewing files that changed from the base of the PR and between 2f9bfd1 and 4fbf51d.

⛔ Files ignored due to path filters (1)
  • native/cheatengine-sdk-lua-bridge/runtimes/win-x64/native/cheatengine-sdk-lua-bridge.dll is excluded by !**/*.dll, !**/*.dll
📒 Files selected for processing (44)
  • CHANGELOG.md
  • analyzers/CheatEngine.SDK.Analyzers/Diagnostics/DiagnosticDescriptors.cs
  • libs/CheatEngine.SDK.Abi/Native/ClassicDebugEventDispatcher.cs
  • libs/CheatEngine.SDK.Engine/AddressList/AddressListMutations.cs
  • libs/CheatEngine.SDK.Engine/Assembly/AutoAssemblerPatcher.cs
  • libs/CheatEngine.SDK.Engine/Inspection/AddressResolutionOptions.cs
  • libs/CheatEngine.SDK.Engine/Inspection/EngineInspection.cs
  • libs/CheatEngine.SDK.Engine/Inspection/SymbolRegistrationHandoffException.cs
  • libs/CheatEngine.SDK.Engine/Inspection/SymbolRegistrationLeaseFactory.cs
  • libs/CheatEngine.SDK.Engine/Inspection/SymbolRegistrationLeasePublisher.cs
  • libs/CheatEngine.SDK.Engine/Inspection/SymbolRegistry.cs
  • libs/CheatEngine.SDK.Engine/Scanning/Values/MemoryScanCreationOutcome.cs
  • libs/CheatEngine.SDK.Engine/Scanning/Values/MemoryScanCreationStatus.cs
  • libs/CheatEngine.SDK.Engine/Scanning/Values/MemoryScanMaterializationStatus.cs
  • libs/CheatEngine.SDK.Engine/Scanning/Values/MemoryScanReleaseOutcome.cs
  • libs/CheatEngine.SDK.Engine/Scanning/Values/MemoryScanSession.cs
  • libs/CheatEngine.SDK.Engine/Scanning/Values/MemoryScanSessions.cs
  • libs/CheatEngine.SDK.Lua/Callbacks/LuaCallback.cs
  • libs/CheatEngine.SDK.Lua/Runtime/LuaRuntime.cs
  • libs/CheatEngine.SDK.Lua/State/LuaState.Callbacks.cs
  • native/cheatengine-sdk-lua-bridge/cheatengine_sdk_lua_bridge.c
  • source-generators/CheatEngine.SDK.SourceGenerators.Shared/Shapes/PluginShape.cs
  • tests/CheatEngine.SDK.Abi.Tests/Fixture/NativeAbiFixtureManagedComparisonTests.cs
  • tests/CheatEngine.SDK.Analyzers.Tests/Architecture/LuaDirectApiBoundaryGuardTests.cs
  • tests/CheatEngine.SDK.Benchmarks/CallbackBenchmarks.cs
  • tests/CheatEngine.SDK.Engine.Tests/Assembly/InstructionOperationsTests.cs
  • tests/CheatEngine.SDK.Engine.Tests/Inspection/EngineInspectionTests.cs
  • tests/CheatEngine.SDK.Engine.Tests/Inspection/SymbolRegistryTests.cs
  • tests/CheatEngine.SDK.Engine.Tests/Scanning/MemoryScanSessionFactoryTests.cs
  • tests/CheatEngine.SDK.Engine.Tests/Scanning/MemoryScanSessionTests.cs
  • tests/CheatEngine.SDK.Engine.Tests/Support/FakeHost.cs
  • tests/CheatEngine.SDK.LivePlugin.Coexistence/PluginA/CoexistencePluginA.cs
  • tests/CheatEngine.SDK.LivePlugin.Coexistence/PluginB/CoexistencePluginB.cs
  • tests/CheatEngine.SDK.LivePlugin/CheatEngineSdkLivePlugin.cs
  • tests/CheatEngine.SDK.LiveProbe/LiveProbeAuthorization.cs
  • tests/CheatEngine.SDK.Lua.Interop.Tests/RoundTrips/CallbackTests.cs
  • tests/CheatEngine.SDK.Lua.Tests/Callbacks/LuaCallbackTests.cs
  • tests/CheatEngine.SDK.SourceGenerators.LuaBridgeContract.Tests/CheatEngine.SDK.SourceGenerators.LuaBridgeContract.Tests.csproj
  • tests/CheatEngine.SDK.SourceGenerators.LuaBridgeContract.Tests/Generator/NativeBridgeParityTests.cs
  • tests/CheatEngine.SDK.SourceGenerators.LuaBridgeContract.Tests/Infrastructure/ProductionNativeBridge.cs
  • tests/CheatEngine.SDK.Tests/Infrastructure/PackagedUmbrellaFixture.cs
  • tests/CheatEngine.SDK.Tests/Infrastructure/ThrowawayConsumer.cs
  • tests/CheatEngine.SDK.Tests/Packaging/NativeBridgePeAuditTests.cs
  • tests/CheatEngine.SDK.Tests/Packaging/PackedConsumerBindingTests.cs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • CheatEngineNet/CheatEngine.Client (manual)
💤 Files with no reviewable changes (1)
  • libs/CheatEngine.SDK.Engine/Inspection/EngineInspection.cs

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

Comment on lines +11 to +12
/// <summary>Creates options for the optional CE <c>shallow</c> argument.</summary>
public AddressResolutionOptions(bool Shallow = false)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

rg -n "AddressResolutionOptions|CheatEngine.SDK" ../CheatEngine.Client 2>/dev/null | head -100

Repository: CheatEngineNet/CheatEngine.SDK

Length of output: 168


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- call site and nearby test ---'
sed -n '55,85p' tests/CheatEngine.Client.Core.Tests/Domains/InspectionClientBehaviorTests.cs
printf '%s\n' '--- package pin ---'
sed -n '1,20p' Directory.Packages.props
printf '%s\n' '--- SDK references and AddressResolutionOptions usages ---'
rg -n -C 2 'CheatEngine\.SDK|AddressResolutionOptions' --glob '*.{cs,props,targets,proj}' .

Repository: CheatEngineNet/CheatEngine.Client

Length of output: 41937


Update the linked Client test when it upgrades the SDK.

CheatEngine.Client currently pins CheatEngine.SDK to 1.0.0, so this PR does not break its current dependency selection. When the Client upgrades, new AddressResolutionOptions(true, true) will fail to compile because this SDK exposes only AddressResolutionOptions(bool Shallow = false). Update the test call and record the migration in CHANGELOG.

Comment on lines +275 to +280
MemoryScanSessionContext context = MemoryScanSessionContext.Capture(operation.State);
if (!context.TargetObservation.IsQualified)
{
throw new MemoryScanException(MemoryScanFailureKind.TargetIdentityUnavailable, "MemoryScan.Adopt",
"The memory scan session cannot adopt target-dependent owners without a qualified target incarnation.");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '245,290p' libs/CheatEngine.SDK.Engine/Scanning/Values/MemoryScanSession.cs
find .. -name AGENTS.md -o -name CONTRIBUTING.md -o -name .editorconfig | head -40

Repository: CheatEngineNet/CheatEngine.SDK

Length of output: 2562


🏁 Script executed:

printf '%s\n' '--- AGENTS.md ---'
cat -n AGENTS.md
printf '%s\n' '--- CONTRIBUTING.md relevant documentation rules ---'
rg -n -i -C 3 'document|xml|exception|public|api' CONTRIBUTING.md AGENTS.md .editorconfig
printf '%s\n' '--- MemoryScanSession.Adopt and surrounding public members ---'
cat -n libs/CheatEngine.SDK.Engine/Scanning/Values/MemoryScanSession.cs | sed -n '190,310p'
printf '%s\n' '--- MemoryScanException declarations and usages ---'
rg -n -C 5 'class MemoryScanException|record MemoryScanException|MemoryScanException\\(' libs tests
printf '%s\n' '--- TargetObservation qualification and context capture ---'
rg -n -C 6 'TargetObservation|IsQualified|MemoryScanSessionContext' libs/CheatEngine.SDK.Engine/Scanning/Values

Repository: CheatEngineNet/CheatEngine.SDK

Length of output: 32001


🏁 Script executed:

printf '%s\n' '--- MemoryScanException definitions and public documentation ---'
rg -n -F -C 8 'MemoryScanException' libs/CheatEngine.SDK.Engine libs/CheatEngine.SDK.Annotations tests || true
printf '%s\n' '--- TargetSelectionObservation definition ---'
rg -n -F -C 12 'record struct TargetSelectionObservation' libs || true
rg -n -F -C 8 'struct TargetSelectionObservation' libs || true
printf '%s\n' '--- IsQualified declarations and documentation ---'
rg -n -F -C 8 'IsQualified' libs/CheatEngine.SDK.Engine libs/CheatEngine.SDK.Annotations || true

Repository: CheatEngineNet/CheatEngine.SDK

Length of output: 42386


Document the new MemoryScanException on Adopt.

Adopt can throw MemoryScanException when the current target observation is not qualified. Add the exception to the public XML contract.

📝 Suggested documentation addition
 	/// <exception cref="ArgumentNullException">Either ownership wrapper is <see langword="null" />.</exception>
 	/// <exception cref="ObjectDisposedException">Either ownership wrapper was already released or disposed.</exception>
+	/// <exception cref="MemoryScanException">
+	///     The current target observation is not qualified as a target-process incarnation, so target-dependent owners are not adopted.
+	/// </exception>

@AriusII
AriusII merged commit e5e952f into main Sep 22, 2026
21 of 29 checks passed
@AriusII
AriusII deleted the sdk/functional-adjustments branch September 22, 2026 18:54
AriusII added a commit that referenced this pull request Sep 23, 2026
Add the second required check, "PR policy" (shared-contracts 1.2, 1.12;
audit register PR-CQ-34). The title and CHANGELOG rules were advisory
(CONTRIBUTING, CodeRabbit warning mode) and only the tag run enforced a
CHANGELOG section. pull-request-ci.yml does not run on "edited", so a
title fix would need a full Windows run: the check is a separate, cheap
Ubuntu workflow that also runs on title and description edits, drafts
included, with no path filter and no job condition (a skipped job would
satisfy a required check).

- eng/ci/PullRequestPolicy.psm1 holds pure rules with stable ids:
  TitleLength (1-72 text elements), TitleNoTrailingPeriod,
  TitleNoConventionalPrefix (also rejects "Area:" prefixes),
  TitleStartsUppercase, TitleImperative (-ed/-ing/third-person heuristic
  with an allowlist of real verbs) and ChangelogEntry (libs/, src/,
  analyzers/, source-generators/, native/ changes, lock files excluded,
  unless CHANGELOG.md changes or the description carries
  <!-- changelog: not-needed -->). Matching is ordinal, case-sensitive,
  with regex timeouts. Pull requests authored by dependabot[bot] are
  exempt; the repository-specific values sit in one constants block so
  the CheatEngine.Client twin changes only those lines.
- eng/ci/Test-PullRequestPolicy.ps1 reads the pull request only from
  environment variables, diffs base...head with --no-renames (moving a
  file out of libs/ still counts), writes a rule table to the job
  summary, emits one escaped ::error annotation per failed rule and
  never prints the description.

The repository tests now start pwsh for this: PullRequestPolicyFixture
evaluates 35 vectors (real titles of #10, #83 and #86 included) in one
process through JSON files, and the entry script is run end to end with
the GitHub file-command variables removed from its environment. The
project README and comment record this single exception to "never
starts a process".
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