Repository navigation
refactor(errors): inherit live cleanup ownership through shared domain helper - #12077
Conversation
[Medium impact] The reviewed code appears safe to merge. SummaryThis refactor moves repeated cleanup-owner checks into
No actionable correctness or security issues found. Tests were not run during this review. Live PR history was unavailable, so supersession could not be confirmed. Reviews (1) · Last reviewed commit: "refactor(errors): inherit live cleanup o..." · Reviewed by Greptile |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Addresses one slice of #11859. Introduces
withInheritedCleanupOwnershipinsrc/domain/analysisErrorCleanup.tsfor wrapper errors that conditionally inherit live cleanup ownership from a sourceAnalysisError, and migrates 4 independent files (5 baseline sites) onto it.Note: Open PRs #12000 (
desktopCaptureCommands.ts) and #12002 (browser/Frida providers) cover other baseline files; this PR deliberately avoids those files.Problem and expected behavior
Several wrapper sites (
DirectAnalysisCleanup.ts,EvidenceBundleCommands.ts,HopperClient.ts,CdpTargetSessionOwner.ts) inlineowner.cleanupIncomplete ? failure.bindCleanupDependencies([owner]) : failuredirectly, duplicating cleanup-ownership inheritance rules and keeping 4 files inscripts/verify/baselines/cleanup-dependency-binding.json. Moving the rule intosrc/domain/analysisErrorCleanup.tspreserves the exact invariant—including keepingcleanupunset when!owner.cleanupIncompleteso unowned close-rejection semantics remain unknown—while shrinking the baseline.Change and scope
src/domain/analysisErrorCleanup.ts&src/domain/analysisErrorCleanup.test.ts: AddwithInheritedCleanupOwnershipand unit coverage for live owner inheritance, unowned cleanup retention, and clean owner cases.src/application/DirectAnalysisCleanup.ts(1 site): UsewithInheritedCleanupOwnership(failure, error).src/application/EvidenceBundleCommands.ts(1 site): Conditionally passcleanuponly whenoriginal.cleanupIncompleteand bind viawithInheritedCleanupOwnership.src/hopper/HopperClient.ts(1 site): UsewithInheritedCleanupOwnership(failure, source).src/browser/CdpTargetSessionOwner.ts(2 sites): UsewithInheritedCleanupOwnership.scripts/verify/baselines/cleanup-dependency-binding.json: Shrunk vianode scripts/verify/architecture-guards.mjs --shrink-baselines, removing those 4 files.Contract and boundary impact
src/domain/analysisErrorCleanup.ts(withInheritedCleanupOwnership), consumed across application/provider/browser wrappers.tests/composition/directAnalysisCleanup.test.tsunowned close-rejection semantics (!owner.cleanupIncomplete).docs/public/product-catalog.json), package, or installation impact: None.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
src/domain/analysisErrorCleanup.test.ts(+41 lines) testswithInheritedCleanupOwnershipacross live cleanup owners, released owners, unowned cleanup wrappers, and clean owners.verify:architecture-guards(cleanup-dependency-binding) counted 4 files / 5 directbindCleanupDependenciessites prior to migration and removed all 4 files after--shrink-baselines.Validation performed
npm run test:local -- src/domain/analysisErrorCleanup.test.ts— 25/25 passed.npm run test:focused -- tests/composition/directAnalysisCleanup.test.ts tests/boundary/filesystem/evidenceBundleFiles.test.ts tests/boundary/providers/hopper/hopperClient.cleanup.test.ts— 83/83 passed (5 + 42 + 36).npm run test:focused -- tests/boundary/browser/cdpTargetSessionOwner.test.ts tests/boundary/browser/cdpBrowserProvider.browserSocket.test.ts— 31/31 passed.npm run check:fast— passed (typecheck,lint,verify:architecture-guardsacross 2873 source files).Compatibility, safety, and release
Author readiness
Human owner: @clark970417-eng
Before merge
type(scope): outcome.