Repository navigation
refactor(providers): finalize apktool and shared artifact resources through runOwned - #10653
Merged
Merged
Conversation
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. |
Contributor
[High impact] The reviewed changes appear safe to merge; no actionable failure was established. SummaryMoves
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Run work"] --> B["Record result and any commit"]
B --> C["Close owned resources"]
C --> D["Keep recorded failure or apply cancellation cutoff"]
D --> E{"Cleanup confirmed?"}
E -- Yes --> F["Return completed, cancelled, or failed outcome"]
E -- No --> G["Return cleanup_incomplete with retained facts"]
G -. Retry .-> H["Exact retained owners release"]
H --> I["Clear their bound cleanup state"]
Reviews (6) · Last reviewed commit: "Merge origin/main into refactor/run-owne..." · Reviewed by Greptile |
19 tasks
11 tasks
morluto
force-pushed
the
refactor/finalized-outcome
branch
from
November 15, 2026 00:41
01bdfb1 to
22260c4
Compare
morluto
force-pushed
the
refactor/run-owned-partial-hook
branch
from
November 15, 2026 00:46
dbd3ce7 to
ea649d8
Compare
Merged
22 tasks
morluto
force-pushed
the
refactor/run-owned-partial-hook
branch
3 times, most recently
from
November 15, 2026 07:35
5bdf4e4 to
667d69b
Compare
This was referenced Nov 15, 2026
…hrough runOwned runOwned moves to the provider layer so provider sites can use it without depending on application workflows. It gains a completed-value projection (partial) for values that are not themselves partial observations, an optional signal, and cleanupLeases that bind a close failure to the exact leases whose confirmed release resolves it. ArtifactAnalysisResources.finish is removed; TShark and sigrok finalize through runOwned with the shared release as close. Apktool's hand-written release, cancellation and lease-group composition is replaced by runOwned. A failed primary now keeps a cancellation observed during final cleanup as a secondary failure, as the documented precedence requires. A counted architecture guard refuses new hand-written completed-result abort reclassification outside runOwned.
* refactor(adb): finalize runtime-root work through runOwned The ADB runtime-root finalizer re-derived the precedence by hand and kept its own cancellation-with-cleanup combiner. It now runs through runOwned: the work body maps snapshot failures, close releases the root lease and binds its own cleanup error, and partial projects the completed execution. A cancellation whose cleanup fails is now the shared cleanup composite with the cancellation as its primary, as runOwned produces for every other owner. * refactor(providers): keep completed values as diagnostics in runOwned and migrate four finalizers (#10691) * refactor(providers): keep completed values as diagnostics in runOwned and migrate signature, Ghidra, bundle and LLDB finalization * test(providers): run the lifecycle scenarios over every runOwned adopter shape (#10707) One table of testing.md lifecycle rows runs over partial, diagnostics, publishing and lease adopters, replacing the hand-written precedence cases it covers.
morluto
force-pushed
the
refactor/run-owned-partial-hook
branch
from
November 15, 2026 08:40
667d69b to
77dbbf7
Compare
19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
runOwned(from #10645) required the completed value to be a partial observation and could not bind a close failure to its exact cleanup lease, so provider finalizers kept their ownresult.ok && signal.abortedreclassification and lease-group composition. This adds both hooks, movesrunOwnedto the provider layer, and migrates the first sites: the sharedArtifactAnalysisResources.finish(TShark and sigrok) and Apktool's decode finalizer. A counted architecture guard stops new hand-written reclassifications.Stacked on #10645 (base branch
refactor/finalized-outcome). Refs #4227 #4330Problem and expected behavior
ArtifactAnalysisResources.finishandApktoolProvidereach re-derived the finalization precedence: release, thensignal.abortedreclassification, then a hand-built cleanup composite. Neither kept a cancellation that arrived during final cleanup on an already-recorded failure, which the documented precedence (tool-design.md, "Own the lifecycle") requires.cleanup_incompleteand keeps it (D1). A close failure stays bound to the exact lease whose confirmed release resolves it.Change and scope
src/providers/runOwned.ts(moved fromsrc/application/):docs/architecture/architecture.mermaid; ratchet proposed in test(architecture): ratchet top-level layer direction and mutual imports #10584). It depends only on domain and artifact types.partial: (value) => AnalysisPartialObservationis required. It projects a completed value into what a pre-commit cancellation or retained cleanup keeps.finishAnalysisCommandpasses the identity.cleanupLeasesbinds a close failure to the exact leases (AnalysisCleanupLeaseGroup) whose confirmed release resolves it and attributes its resources.signalis optional.src/process/ArtifactAnalysisResources.ts:finishis removed.TsharkCaptureProviderandSigrokRecordingProvidercallrunOwnedwithclose: () => resources.release().src/apktool/ApktoolProvider.ts: the release, reclassification and lease-group block is replaced byrunOwnedwithcleanupLeases: [lease]. The cleanup error is stillProviderCleanupError("apktool", [root]).scripts/verify/architecture-guards.mjs: new counted guardcompleted-abort-reclassification(.ok && isAborted(/.ok && …signal.aborted) outsiderunOwned. The baseline has 22 files; it can only shrink. The pattern is syntactic, so some baselined matches may be pre-admission or deadline checks that are legitimate; each migration slice re-examines its file.runOwned; only finalization moved.Contract and boundary impact
runOwnedowns finalization precedence for these three providers. The supersededArtifactAnalysisResources.finishand Apktool's local composition are removed.cleanup_incompletecontract), relayed by the coordinator.secondary_failures.createAnalysisExecutionEvidencepartial observation.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
None checked: result composition only.
Evidence and regression coverage
src/providers/runOwned.test.ts: three new cases. A non-partial value keeps its projected partial when cancellation arrives during final cleanup. A close failure bound bycleanupLeasesreports the lease's resources and resolves when the lease later releases. A producer-typed close failure is bound to the leases while the failed work stays primary.src/process/ArtifactAnalysisResources.test.ts: the existingfinishcases now run throughrunOwnedvia a local helper. "keeps an existing physical primary across cleanup-time cancellation" now also asserts the late cancellation is kept as a secondary failure.runOwned, so it behaves like the removedfinish, both parameterizations of that test fail (2 failed | 27 passed). With it enabled they pass.Validation performed
origin/main(conflicts: guard list kept bothcompleted-abort-reclassificationandgdb-mi-record-regex;ArtifactAnalysisResources.finishstays removed, main had only re-spelled its cancellation; baselines merged per file and shrunk):npm run check:fast— passed;node scripts/verify/architecture-guards.mjs— passed;npm run test:local -- src/providers/runOwned.test.ts src/process/ArtifactAnalysisResources.test.ts— 38 passed.npm run typecheck: passed.npm run check:fast: passed (typecheck and lint).node scripts/verify/architecture-guards.mjs: passed across 2791 source files. Before the baseline shrink, it reported the removedAnalysisCancelledErrorconstructions in Apktool and ArtifactAnalysisResources as stale.npm run test:local -- src/providers/runOwned.test.ts src/process/ArtifactAnalysisResources.test.ts src/apktool/ApktoolProvider.test.ts src/apktool/ApktoolDecodeTimeout.test.ts src/apktool/ApktoolCommandRecovery.test.ts src/apktool/ApktoolWorkspace.lifecycle.test.ts: 6 files, 148 tests passed.npm run test:focused -- tests/boundary/captures/captureDescriptorCleanup.test.ts tests/boundary/captures/captureProvider.test.ts tests/boundary/signals/recordingDescriptorCleanup.test.ts tests/boundary/signals/recordingProvider.test.ts tests/boundary/process/artifactProducerCancellation.test.ts: 146 passed, 14 skipped (both descriptor-cleanup files skip on this host).npm run test:focused -- tests/boundary/cli/finishAnalysisCommand.test.ts tests/boundary/cli/wasmLateCancellationCli.test.ts: 14 passed.npx oxfmt --checkon changed files: clean.git push.cleanup-dependency-bindingbaseline from refactor(errors): read cleanup completion from dependencies instead of pushing it to dependents #10744 conflicted with this PR'scompleted-abort-reclassificationsection): kept both sections, moved therunOwned.tsentry tosrc/providers/, shrank stale counts;node scripts/verify/architecture-guards.mjspassed;npm run check:fastpassed;npm run test:focused -- src/providers/runOwned.test.ts src/providers/runOwned.lifecycle.test.ts src/process/ArtifactAnalysisResources.test.ts src/native/SignatureTargetBinding.test.ts tests/boundary/providers/adb/adbInputSnapshotOwnership.test.ts tests/boundary/providers/adb/adbScreenPublicationCancellation.test.ts tests/process-global/bundleComparisonFailures.test.ts: 7 files, 176 passed.architecture-guards.mjs, both guards kept;provider-failure-classifier-baseline.json, main's new{owners, counts}shape kept with therunOwned.tsentry moved tosrc/providers/):node scripts/verify/architecture-guards.mjs --shrink-baselinespassed with no change;npm run check:fastpassed;npm run test:focused -- src/providers/runOwned.test.ts src/process/ArtifactAnalysisResources.test.ts tests/boundary/providers/apktoolDecodeDeadline.test.ts: 39 passed;npm run test:focused -- src/providers/runOwned.lifecycle.test.ts: 34 passed.Compatibility, safety, and release
runOwnedis unreleased (refactor(application): own the finalization precedence in runOwned #10645) and its import path moves with it.Author readiness
Human owner:
Before merge
type(scope): outcome.