Repository navigation
Description
Summary
The existing CredentialAccessExecutorRegistryTests.AccessBroker_DisposeAsync_ConcurrentAndRepeatedFailureStillCleansLaterExecutorsAndPolicy regression test expects an executor exception directly inside the broker's shutdown aggregate, but the implementation preserves a component-level registry aggregate between them. Its line-75 identity assertion therefore fails before the later cleanup assertions execute. This is a test expectation defect in the incident branch, not evidence that cleanup is skipped or a diagnosis against today's remote features.
Root Cause
Source inspected in C:\dev\Phantom.Workspaces-Skills\worktrees\fix-1505-build-gate-f6cd63a233, HEAD 11e8feeb3b15bf67611458d79bf96db2700cadc7, compared with the local incident baseline 7cb1505c15d2010f2b657271bceb56df00bfa6c6 (the historical local features ref, not current remote features).
Phantom.Workspaces.Tests/Access/CredentialAccessExecutorRegistryTests.cs:37–84constructs its own broker, executor registry, authorization policy and authorization registry. The first executor waits on aTaskCompletionSource, then throws the exactexecutorFailureinstance (InvalidOperationException("Executor cleanup failed."), lines 42–48). A second executor succeeds. The test starts concurrent disposal while the first is blocked, releases it, then observes initial, concurrent and repeated disposal failures.Phantom.Workspaces/Services/Access/CredentialAccessExecutorRegistry.cs:46–75attempts every registered executor, collects exceptions, and createsAggregateException("One or more credential executors could not be disposed.", failures). It stores that aggregate withTrySetExceptionand throws the same instance; subsequent disposal awaits the stored completion task.Phantom.Workspaces/Services/Access/AccessBroker.cs:639–682invokes executor disposal throughCleanupAsync, whose catch adds the registry aggregate unchanged to the component failure list. Cleanup continues through the policy. Lines 663–667 create, store and throwAggregateException("Access shutdown did not complete cleanly.", failures). Concurrent/repeated callers await the broker completion task (lines 641–644).
The resulting hierarchy is:
broker AggregateException ("Access shutdown did not complete cleanly.")
└── registry AggregateException ("One or more credential executors could not be disposed.")
└── exact executorFailure InvalidOperationException instance
The current assertion at test line 75 incorrectly skips the registry layer:
Assert.Same(executorFailure, Assert.Single(failure.InnerExceptions));Causality and version scope
The test and registry were introduced by f730ede58017dbc09108cf912363e79f38af9de4, merged in #1538; this commit is an ancestor of the incident baseline. The three mechanism-bearing files have identical Git blobs at that baseline and incident HEAD:
| File | Blob at both revisions |
|---|---|
CredentialAccessExecutorRegistryTests.cs |
a35c1ae86b06c46a9d6abb3ab09857b41cb4e691 |
CredentialAccessExecutorRegistry.cs |
9df52719212a4a7f3095ddfc1af0fedd79a49aa4 |
AccessBroker.cs |
d8c1dfe1d105d622f11185eece102173997dc54b |
The seven-file incident-baseline-to-HEAD diff concerns #1505 MCP credential-status reporting and other test migrations/synchronization; it does not change this disposal path. This test does not exercise MCP transport or those other fixtures. The source therefore establishes an existing assertion mismatch, unrelated to the #1505 changes.
At investigation time, the separate features checkout is clean at 1b86a98feb52d32a4bbfef82d624117a57b8fdd4; remote features is d2a1a3b0752609321853f409d6fb1654fe17e7ff, 31 commits ahead. Neither revision contains these three access-broker files, and the #1538 introduction commit is not an ancestor of remote features. Apply this diagnosis only to a checkout containing the incident access code; do not substitute the current remote branch for the recorded baseline.
Affected Files
| File | Contribution / intended change |
|---|---|
Phantom.Workspaces.Tests/Access/CredentialAccessExecutorRegistryTests.cs:37–84 |
Incorrect line-75 exception-shape assertion; the only implementation edit needed is to this existing test. |
Phantom.Workspaces/Services/Access/CredentialAccessExecutorRegistry.cs:46–75 |
Preserves executor failures inside a registry aggregate; explanatory context, no production change proposed. |
Phantom.Workspaces/Services/Access/AccessBroker.cs:639–682 |
Preserves component failures inside a broker aggregate and continues cleanup; explanatory context, no production change proposed. |
Design / Fix
Replace the single incorrect assertion with explicit traversal of the existing two aggregate layers:
var registryFailure = Assert.IsType<AggregateException>(Assert.Single(failure.InnerExceptions));
Assert.Same(executorFailure, Assert.Single(registryFailure.InnerExceptions));Preserve the surrounding checks: concurrent disposal waits asynchronously; initial, concurrent and repeated calls observe the same outer exception instance; both executors are disposed exactly once; the policy invalidates authorization and is disposed; and the authorization registry is empty. Do not weaken these lifecycle checks or change production disposal behavior.
Considered / Background: flattening the broker aggregate
Flattening aggregate leaves in AccessBroker.CleanupAsync was considered, but is not the selected fix: the current code deliberately retains component-level exception structure, and this test should assert that structure. A flat broker exception contract would require an explicit, separate contract redesign with coverage for multiple failing components, not a production change merely to satisfy this assertion.
Expected Tests
Use the existing tests in CredentialAccessExecutorRegistryTests; no new tests are needed.
| Test Name | Class | What It Verifies |
|---|---|---|
AccessBroker_DisposeAsync_ConcurrentAndRepeatedFailureStillCleansLaterExecutorsAndPolicy |
CredentialAccessExecutorRegistryTests |
Correct nested aggregate shape and exact leaf identity, same outer failure on concurrent/repeated disposal, asynchronous concurrent waiting, exactly-once executor cleanup, disposed policy and empty authorization registry. |
CredentialAccessExecutorRegistry_DisposeAsync_AttemptsEveryRegistrationAndPreservesFailures |
CredentialAccessExecutorRegistryTests |
All three registrations are attempted exactly once despite two failures; both exact leaf exceptions are retained, and repeated disposal preserves the aggregate instance. |
When implementing, use the existing runner to select only this class, in a checkout that contains the access code, then run the usual gate. No tests were run for this diagnosis and no code was implemented.
Confidence and Evidence Limits
High confidence, source-proven assertion mismatch. The historical issue reported a 23 ms Assert.Same failure at line 75, with the original executor exception expected and a registry aggregate actual; that matches the source-derived hierarchy but is not a fresh reproduction. The incident worktree's current scripts\test-results.log is a later passing run of 16 transport tests, not this failure or evidence of an active broad run. No claim is made that the historical broad run remains active or that the current log confirms the failure. No fresh dump collection or dump analysis was performed.
Activity
JoshuaRowePhantom commentedon Oct 22, 2026
Design
Confirmed at assigned HEAD 11e8fee with the existing runner: 1/2 tests passes, the concurrent/repeated broker test fails its leaf-identity assertion. The broker correctly retains the executor-registry aggregate as a component failure. Change only CredentialAccessExecutorRegistryTests to explicitly traverse both aggregate layers; retain exact leaf identity, same outer instance for concurrent/repeated disposal, asynchronous waiting, exactly-once later executor cleanup, disposed policy and empty authorization registry. No production flattening or lifecycle weakening. Evidence: candidate .scratch\1652-red.log. Run class again after the assertion correction.
JoshuaRowePhantom commentedon Oct 22, 2026
Implementation notes
Commits: f88a241
Deviations from proposed design
None. Explicitly inspect broker then registry aggregates and require the exact original executor exception. All concurrent/repeated exception identity and cleanup assertions remain unchanged; no production code changed.
Scope changes
None.
Files changed
Phantom.Workspaces.Tests/Access/CredentialAccessExecutorRegistryTests.cs
Validation
Existing runner red: 1 passed / 1 failed at original assertion. Solution scripts/build.ps1 passed with 0 warnings/errors. Rebuilt focused class: 2 passed / 0 failed / 0 skipped. Evidence in candidate .scratch/1652-red.log, 1652-build.log, 1652-green.log. Targeted stock stability remains pending with #1653; broad acceptance belongs to coordinator.
JoshuaRowePhantom commentedon Oct 22, 2026
Targeted batch validation follow-up
Fix commit f88a241 remains green in the final combined candidate d358c81: disposal class 2/2 within the focused App 20/20, alongside Data.Core93/93; solution build has zero warnings/errors. Stock ten-run targeted stability was attempted but completed zero passes: after Data.Core93/93, unrelated immutable-wrapper prerequisite republish blocked on the source-proven reader14/writer15 runtime.node contract mismatch filed as #1654. Owned run stopped and logs archived; gate not waived. No production disposal behavior changed, no issues closed, no push/features update. Broad acceptance and independent verification remain coordinator-owned.
JoshuaRowePhantom commentedon Oct 22, 2026
Verification result
Status: Verified locally — fresh independent inspection and test execution.
HEAD:
d358c8140d469abea7f2ab8d01aa6cd09bbbf8c1.Bounded commits checked:
11e8feeb3b15bf67611458d79bf96db2700cadc7..HEAD:f88a241a,d358c814.Outstanding gaps
None for #1652. The sole issue-specific edit traverses the broker and registry aggregates explicitly, retaining exact executor-exception identity. Inspection confirms the registry preserves component failures and the broker continues later cleanup without flattening. Existing assertions still require asynchronous concurrent waiting, identical initial/concurrent/repeated outer failure, exactly-once executor disposal, invalidated/disposed policy and empty authorization registry. No production disposal edit or weakened lifecycle assertion.
Fresh validation
From the assigned worktree:
Build succeeded, 0 warnings / 0 errors. App batch: 19 passed / 0 failed / 0 skipped, including both CredentialAccessExecutorRegistryTests. The final optional selector above matches no method; it is not counted as coverage. The actual existing exactly-once view-model regression was subsequently selected by its correct name and passed separately.
Checkout deviation and limits
As explicitly directed, did not run
checkout-source.ps1because of known shared MXC worktree metadata corruption. Read-only checks before and after execution confirmed clean parent/submodule worktrees, exact parent HEAD, and gitlink/checked-out HEAD equality: MXC29702c3a408462a4e6be0f265328693a0d2169eb; Dock8c8d11f948e10b86f375cf3e4e186e039450c8c9.Evidence: skills
.scratch\unblock1652-1653-independent-verification, including fresh build/logs, raw TRX, saved full issues/comments and bounded diff. No source edits, commits, pushes, feature updates, issue closure or live-app interaction. Broad/stability gates remain coordinator-owned and are not claimed passing here.JoshuaRowePhantom commentedon Oct 27, 2026
Closing as completed per the explicit request to close verified fixes integrated into LOCAL features at
22bca70779858b479a68e3b059bc835a945d7087.Fix commit(s):
f88a241a8dc3bb90e94ddd49b0783edf8b9f5afb.Correct nested aggregate/exception identity assertions while retaining concurrent and repeated disposal guarantees; independently verified with zero gaps.
Evidence: #1652 (comment). At this unchanged local tip: solution build 0 warnings/errors, whole fast 9030/9030, whole full 9263/9263, and 10 consecutive stock combined stability runs, 2788/2788 each; zero failures/skips. Final combined receipt.
Publication boundary: hosted
featuresremainsd2a1a3b0752609321853f409d6fb1654fe17e7ff. Fixes are not pushed/published; no remote integration, release, or external live-provider authentication acceptance is claimed.Fix #1652: assert nested executor cleanup failure topology