Skip to content

Commit 469e912

Browse files
richlanderCopilot
andauthored
Resolve implementation types in PlatformHouse (#8313)
* Resolve implementation types in PlatformHouse Co-authored-by: Copilot <[email protected]> Copilot-Session: 18659f18-292f-4b89-a871-b0ff41b3cfd6 * Fix PlatformHouse type resolution boundaries Co-authored-by: Copilot <[email protected]> Copilot-Session: 18659f18-292f-4b89-a871-b0ff41b3cfd6 * Detach PlatformHouse type resolution results Project Metadata type-resolution outcomes into a resource-free PlatformHouse contract before retiring population authorities, and run the execution gates in required CI. Co-authored-by: Copilot <[email protected]> * Project Platform type results before retirement Keep raw Metadata outcomes inside the live context/catalog scope and classify cleanup-inclusive budget exhaustion as typed incomplete work. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Copilot-Session: 18659f18-292f-4b89-a871-b0ff41b3cfd6
1 parent a6ca8a2 commit 469e912

15 files changed

Lines changed: 3149 additions & 92 deletions

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,10 @@ jobs:
11631163
if: matrix.shard == 'contracts'
11641164
run: dotnet run --project tests/DotnetInspector.PlatformHouse.Tests -c Release
11651165

1166+
- name: Run PlatformHouse execution tests
1167+
if: matrix.shard == 'contracts'
1168+
run: dotnet run --project tests/DotnetInspector.PlatformHouse.Execution.Tests -c Release
1169+
11661170
- name: Run installed PlatformHouse adapter tests
11671171
if: matrix.shard == 'contracts'
11681172
run: dotnet run --project tests/DotnetInspector.PlatformHouse.Installed.Tests -c Release

‎docs/design/platform-house-reference-processing.md‎

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ collapsed into strings, optional parameters, or nullable tuples.
649649
| --- | --- | --- |
650650
| **Realize** | One library identity or complete population demand | One owning Library realization or one platform population of owning Library realizations, each with resource-free source and view correspondence |
651651
| **Resolve assembly reference** | One exact Metadata `AssemblyBindingRequest` and platform-route prerequisites | Metadata-owned binding decision plus the platform contribution used by the ladder |
652-
| **Resolve type definition** | One exact Metadata `TypeResolutionRequest`, starting candidate with its owner-issued view, and required view | Metadata-owned `TypeResolutionOutcome` plus reference/implementation correspondence when the required view differs from the starting view |
652+
| **Resolve type definition** | One exact Metadata `TypeResolutionRequest`, starting candidate with its owner-issued view, and required view | One resource-free Platform projection of the exact Metadata terminal arm and forwarding evidence, plus reference/implementation correspondence when the required view differs from the starting view |
653653

654654
`Realize` supports direct platform browsing and supplies source candidates for
655655
the other operations. The two reference-resolution operations are the only
@@ -675,6 +675,16 @@ work. The completed value and receipt preserve whether the operation returned
675675
one reference outcome, one implementation outcome, or the existing paired
676676
reference-and-implementation outcomes.
677677

678+
The live `TypeResolutionOutcome` remains inside execution while its Metadata
679+
catalog and copied Library images are available. Before those authorities are
680+
retired, PlatformHouse projects its exact terminal arm, ordered forwarding
681+
hops, terminal assembly identity, physical definition address and supplier
682+
when resolved, and typed non-success evidence into a detached
683+
`PlatformTypeDefinitionResolutionResult`. The projection retains
684+
owner-issued Metadata names, tokens, identities, provenance, and failure
685+
values, but no `ResolvedAssemblyReference`, opener, candidate, context,
686+
catalog, stream, or disposal obligation.
687+
678688
### View and population demand
679689

680690
View demand is closed:
@@ -1546,7 +1556,8 @@ When a platform operation begins from a .NET Standard facade:
15461556
3. the House supplies those candidates through an explicit Metadata binding
15471557
policy;
15481558
4. Metadata follows any exact `ExportedType` and `AssemblyRef` evidence and
1549-
returns its unchanged reference-view outcome;
1559+
returns its reference-view outcome, which the House projects without
1560+
changing its terminal arm or forwarding evidence;
15501561
5. when implementation demand remains, the House requires an explicit
15511562
reference-to-implementation view correspondence for the resolved contract
15521563
definition and starts a second Metadata resolution in the authorized
@@ -1972,7 +1983,8 @@ one exact .NET runtime target. The starting and required views are both
19721983
Implementation. Metadata follows the exact `System.Xml` and
19731984
`System.Xml.ReaderWriter` forwarding declarations to the physical
19741985
`System.Private.Xml` definition under the House-supplied implementation
1975-
policy. The House retains one Metadata outcome and every forwarding hop. It
1986+
policy. The House retains the outcome's exact terminal arm, physical
1987+
definition identity, and every forwarding hop in one resource-free result. It
19761988
does not introduce a reference resolution or view-correspondence transition.
19771989

19781990
### .NET Standard facade resolves to runtime implementation
@@ -2129,11 +2141,11 @@ rejected outcomes. The stage-7a population operation does not expose catalog
21292141
semantics or change CLI or Inspect Web routing. Step 9a, tracked by
21302142
[#8164](https://github.com/richlander/dotnet-inspect/issues/8164), adopts the
21312143
family-default population and catalog query for versionless bare CLI type and
2132-
member routing. Browser/Wasm adoption, exact-demand Metadata binding, and
2133-
Services-era resolver retirement remain later focused slices.
2134-
Issue #8298 owns the first exact-demand Metadata binding slice: one
2135-
implementation-view start and required implementation result. It does not
2136-
implement the reference-to-implementation bridge.
2144+
member routing. Browser/Wasm adoption and Services-era resolver retirement remain later
2145+
focused slices. The first exact-demand Metadata binding slice, implemented
2146+
under [#8298](https://github.com/richlander/dotnet-inspect/issues/8298),
2147+
supports one implementation-view start and required implementation result. It
2148+
does not implement the reference-to-implementation bridge.
21372149

21382150
The step-6 ownership correction was designed under
21392151
[#6984](https://github.com/richlander/dotnet-inspect/issues/6984). It adopts
@@ -2358,13 +2370,13 @@ The implementation and adoption slices own these Release gates:
23582370
| Package-backed reference population ownership | One authoritative package-backed reference population produces one source-ordered reference-only Library owner per distinct managed identity and one source settlement after Package Source detaches. Every content item retains source-issued package provenance. Completion transfers every Library owner beside one Artifact session; terminal, cancellation, duplicate identity, foreign contribution, and incomplete work transfer neither authority. |
23592371
| Package-backed implementation population ownership | One authoritative package-backed runtime population produces one source-ordered implementation-only Library owner per distinct managed identity, assigns each exact runtime content both mandatory roles under Platform-owned declaration-surface evidence, and records one source settlement after Package Source detaches. Every content item retains source-issued package and runtime-support provenance. Completion transfers every Library owner beside one Artifact session; terminal, cancellation, duplicate identity, foreign contribution, and incomplete work transfer neither authority. |
23602372
| Selected reference population | One family-default, reference-only complete-population operation freezes one exact target, applies the authorized Reference source policy, and publishes one non-empty authoritative population. Installed success suppresses package work; package fallback uses only the exact selected discovery association; failure or work exhaustion cannot publish a shortened population. Completion preserves the original request, selected target and discovery evidence, source-generation settlements, and cumulative work while transferring all Library owners beside the separate Artifact session. Every terminal path cleans up before projection and retains no live authority. |
2361-
| Resource-free House boundary | Focused contract tests over contributions, completed House values, receipts, requests, and cache entries prove that they retain no live source handle or content obligation, Artifact owner or lease, Library owner or lease, callback, opener, stream, or disposal delegate. |
2373+
| Resource-free House boundary | Focused contract tests over contributions, completed House values, type-definition resolution results, receipts, requests, and cache entries prove that they retain no live source handle or content obligation, Artifact owner or lease, Library owner or lease, Metadata context or catalog, candidate, callback, opener, stream, or disposal delegate. |
23622374
| Internal Library access | PlatformHouse Metadata work reads exact content only through a fresh internal `LibraryOperationLease`; every borrow ends before `await`, and the lease settles before completion. |
23632375
| Terminal owner disposition | Completed non-owning operations, unavailability, ambiguity, rejection, failure, incomplete completion, and cancellation retire every constructed owner the House does not return, including partially constructed multi-Library population work; only a completed owning `Realize` result transfers owners, and retirement failure remains visible. |
23642376
| Failure precedence | A superseded source fault may remain evidence in another terminal outcome; construction, borrow, lease-settlement, retirement, or child-release failure produces `Failed`, including when cleanup fails after cancellation. |
23652377
| Permissive Workspace admission | A participant targeting a newer platform remains admissible and usable for same-participant inspection without realizing a matching complete platform. |
23662378
| Exact traversal compatibility | Under an owner-classified unsupported downgrade, an exact Metadata member-signature match succeeds with downgrade context; a missing or changed signature returns the attributed compatibility failure without blocking unrelated work. Supported upward compatibility does not warn merely because targets differ. |
2367-
| Metadata ownership | Platform type resolution invokes the structured Metadata API and preserves its exact outcome and forwarding hops. |
2379+
| Metadata ownership | Platform type resolution invokes the structured Metadata API and projects its exact terminal arm, owner-issued facts, and ordered forwarding hops before retiring the live resolution context. |
23682380
| Direct implementation start | An implementation-view `System.Xml.XmlReader` request resolves through `System.Xml.ReaderWriter` to the physical `System.Private.Xml` definition in one Metadata outcome, with no fabricated reference outcome or view correspondence. |
23692381
| Transparent .NET Standard | A `.NET Standard` facade can resolve through an exact runtime target without constructing a `NetStandard` family or implementation population. |
23702382
| Physical supplier retention | A resolved implementation type or assembly retains its physical supplier rather than being relabeled as the reference facade. |

‎src/DotnetInspector.PlatformHouse.Execution/PlatformPopulationArtifactMaterialization.cs‎

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ is PlatformPopulationArtifactMaterializationOutcome.Completed
105105
completed)
106106
{
107107
PlatformHouseFailureKind[] failures =
108-
await RetireCompletedAsync(completed).ConfigureAwait(false);
108+
[.. (await PlatformPopulationAuthorityRetirement
109+
.RetireAsync(completed)
110+
.ConfigureAwait(false)).FailureKinds];
109111
if (failures.Length != 0)
110112
{
111113
return Failed(
@@ -810,35 +812,6 @@ static PlatformPopulationArtifactMaterializationOutcome.Terminal Terminal(
810812
PlatformPopulationRealizationResult result) =>
811813
new((PlatformPopulationRealizationResult.Terminal)result);
812814

813-
static async ValueTask<PlatformHouseFailureKind[]> RetireCompletedAsync(
814-
PlatformPopulationArtifactMaterializationOutcome.Completed completed)
815-
{
816-
var failures = new List<PlatformHouseFailureKind>();
817-
foreach (LibraryContentOwner owner in completed.Population.Owners)
818-
{
819-
try
820-
{
821-
await owner.DisposeAsync().ConfigureAwait(false);
822-
}
823-
catch
824-
{
825-
failures.Add(PlatformHouseFailureKind.LibraryRetirement);
826-
}
827-
}
828-
try
829-
{
830-
await completed.Artifacts.DisposeAsync().ConfigureAwait(false);
831-
}
832-
catch
833-
{
834-
failures.Add(PlatformHouseFailureKind.ArtifactRetirement);
835-
}
836-
if (completed.Artifacts.CleanupFailures.Count != 0)
837-
failures.Add(PlatformHouseFailureKind.ArtifactRetirement);
838-
839-
return [.. failures.Distinct()];
840-
}
841-
842815
static PlatformPopulationArtifactMaterializationOutcome Rejected(
843816
PlatformHouseReceipt priorReceipt,
844817
PlatformHouseRejectionKind kind,
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
using DotnetInspector.Libraries;
2+
3+
namespace DotnetInspector.PlatformHouse;
4+
5+
internal sealed class PlatformPopulationAuthorityRetirementResult
6+
{
7+
internal PlatformPopulationAuthorityRetirementResult(
8+
IReadOnlyList<PlatformHouseFailureKind> failureKinds,
9+
IReadOnlyList<Exception> failures)
10+
{
11+
FailureKinds = failureKinds;
12+
Failures = failures;
13+
}
14+
15+
internal IReadOnlyList<PlatformHouseFailureKind> FailureKinds { get; }
16+
internal IReadOnlyList<Exception> Failures { get; }
17+
}
18+
19+
internal static class PlatformPopulationAuthorityRetirement
20+
{
21+
internal static async ValueTask<
22+
PlatformPopulationAuthorityRetirementResult> RetireAsync(
23+
PlatformPopulationArtifactMaterializationOutcome.Completed
24+
completed)
25+
{
26+
ArgumentNullException.ThrowIfNull(completed);
27+
var kinds = new List<PlatformHouseFailureKind>();
28+
var failures = new List<Exception>();
29+
30+
foreach (LibraryContentOwner owner in completed.Population.Owners)
31+
{
32+
try
33+
{
34+
await owner.DisposeAsync().ConfigureAwait(false);
35+
}
36+
catch (Exception failure)
37+
{
38+
kinds.Add(
39+
owner.ReleaseFailures.Count == 0
40+
? PlatformHouseFailureKind.LibraryRetirement
41+
: PlatformHouseFailureKind.LibraryChildRelease);
42+
failures.Add(failure);
43+
}
44+
45+
foreach (Exception failure in owner.CleanupFailures)
46+
{
47+
if (!failures.Contains(failure))
48+
failures.Add(failure);
49+
}
50+
if (owner.CleanupFailures.Count != 0)
51+
{
52+
kinds.Add(
53+
owner.ReleaseFailures.Count == 0
54+
? PlatformHouseFailureKind.LibraryRetirement
55+
: PlatformHouseFailureKind.LibraryChildRelease);
56+
}
57+
}
58+
59+
try
60+
{
61+
await completed.Artifacts.DisposeAsync().ConfigureAwait(false);
62+
}
63+
catch (Exception failure)
64+
{
65+
kinds.Add(PlatformHouseFailureKind.ArtifactRetirement);
66+
failures.Add(failure);
67+
}
68+
foreach (Exception failure in completed.Artifacts.CleanupFailures)
69+
{
70+
if (!failures.Contains(failure))
71+
failures.Add(failure);
72+
}
73+
if (completed.Artifacts.CleanupFailures.Count != 0)
74+
kinds.Add(PlatformHouseFailureKind.ArtifactRetirement);
75+
76+
return new(
77+
[.. kinds.Distinct()],
78+
failures.AsReadOnly());
79+
}
80+
}

0 commit comments

Comments
 (0)