Skip to content

refactor(providers): keep a cancelled read's partial observation and provider diagnostics - #10872

Merged
morluto merged 74 commits into
mainfrom
refactor/cancelled-read-facts
Nov 15, 2026
Merged

morluto merged 74 commits into
mainfrom
refactor/cancelled-read-facts

Conversation

@morluto

@morluto morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Summary

The shared owner's cancelled-read path keeps what the read had established and the provider's facts about it, on both cancelled-read routes. This is the step the Ghidra slice (#10836) named as needed before ghidraFileFailure can move.

Stacked on #10870 (SQLite). Refs #10482.

Problem and expected behavior

classifyProviderFailure reports a cancelled selected-file read in two places. The plain cancelled read kept the reader's partial observation, but the primary of a cancelled read whose cleanup failed (readPrimary) did not. Neither could carry provider diagnostics such as the path Ghidra reports today. Expected: one readCancellation that always keeps the read's partial observation, a finished command's output, and the dialect's diagnostics.

Change and scope

  • ProviderFailureDialect.diagnostics?: facts the provider reports with a cancelled read.
  • readCancellation(reason, read, dialect, details) now takes the reader failure and adds its partial observation, the dialect's observedOutput and diagnostics, for both the plain and the cleanup-failed route. The producing phase's interruption hook receives the same facts.
  • Difference: a cancelled read whose cleanup failed now keeps the reader's partial observation on its primary, as the plain route already did. Source-derived; no current dialect sets diagnostics.

Contract and boundary impact

  • Semantic owner and earliest changed stage: classifyProviderFailure.
  • CLI and MCP/tool-catalog contract: unchanged apart from the retained partial observation above.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: more partial Evidence is retained, never less.
  • Target selection, authority, upstream behavior, and cleanup details: unchanged.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • src/providers/classifyProviderFailure.test.ts: two new cases. A cancelled read keeps its partial observation and the dialect's diagnostics; a cancelled read whose cleanup failed passes both to readCleanup on its primary.

Validation performed

  • npm run check:fast: pass.
  • npm run test:local -- src/providers/classifyProviderFailure.test.ts: 4 passed.
  • npm run test:focused -- with the readCleanup and cancellation consumers: tests/boundary/firmware/firmwareReportFiles.test.ts, tests/process-global/firmwareFileLifetime.test.ts, tests/process-global/firmwarePublicationDeadline.test.ts, src/ida/IdaSessionClient.test.ts, tests/boundary/sqlite/sqliteDatabaseDescriptorCleanup.test.ts, tests/boundary/captures/captureDescriptorCleanup.test.ts, src/process/ArtifactAnalysisResources.test.ts: 5 passed, 2 skipped on this host; ten tests/boundary/providers/kuna/* files (hash owner, run ownership, project concurrency/cache/files, command failures/cancellation, reader/query cancellation, publication cleanup): 118 passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: none.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

When a capture read's tool launch was refused with EPERM, pcap reported it
as unreadable tool output (AnalysisProtocolError) instead of an unavailable
tool. Pcap also never told "not executable" apart from "missing".

Add classifyLaunchFailure in src/process as the one owner of which spawn
errnos mean missing (ENOENT, ENOTDIR) and which mean present but not
executable (EACCES, EPERM, ENOEXEC, EISDIR). Pcap, apktool and gdb used three
different errno lists; all three now use it.
Add ProviderOutcome, read once from the supervisor's facts, and classifyProviderOutcome, the one mapping from an outcome to a typed error. Migrate pcap and the shared artifact producer command failure (TShark, sigrok). Add the rea/provider-failure-classifier lint rule with a shrink-only baseline of per-site (cause: unknown) => AnalysisError functions.
…red owner (#10598)

The Ghidra and JADX Java probes and adb's version probe now take
missing-versus-not-executable from classifyLaunchFailure instead of their
own errno checks. ELOOP and ENAMETOOLONG join the owner's missing set, so
adb keeps its existing classification and both Java probes now treat a
non-directory path component as a missing runtime.
Add ProviderOutcome, read once from the supervisor's facts, and classifyProviderOutcome, the one mapping from an outcome to a typed error. Migrate pcap and the shared artifact producer command failure (TShark, sigrok). Add the rea/provider-failure-classifier lint rule with a shrink-only baseline of per-site (cause: unknown) => AnalysisError functions.
…nto HEAD

# Conflicts:
#	src/pcap/PcapCommand.ts
… a target refusal

The supervisor now watches for a managed runtime's out-of-memory report while output streams (JVM java.lang.OutOfMemoryError, V8 'JavaScript heap out of memory'), so a retention budget cannot hide it. ProviderOutcome gains a runtime-exhausted kind and classifyProviderOutcome maps it once. Apktool decode opts in and moves to the shared classifier; Ghidra's single-purpose output token becomes the JVM runtime option and its area matching reuses the shared table.
…HEAD

# Conflicts:
#	src/pcap/PcapCommand.ts
#	tests/evaluation/providerFailureClassifierRule.test.ts
…nto refactor/provider-outcome

# Conflicts:
#	src/pcap/PcapCommand.ts
Name the executable on errnos Node throws synchronously from spawn
(ENOEXEC, ENOTDIR, ...) and read the Windows native launcher's
executable-launch constraint, so pcap attributes those refusals to the
selected tool or limiter instead of an unknown stage.
…nto w5/provider-outcome

# Conflicts:
#	src/pcap/PcapCommand.ts
…t retained stderr (#10724)

The SQLite worker and the Node capture decoders now declare runtime: "v8", so the supervisor observes V8's heap report as output streams. Both classifiers read the runtime-exhausted outcome instead of matching retained stderr, so a report beyond the retention budget, or one whose process then overflowed its output budget, is still reported as memory exhaustion.
# Conflicts:
#	.oxlintrc.json
#	scripts/lint/index.mjs
#	src/pcap/PcapCommand.ts
…vider classifier (#10716)

* refactor(evm): classify EVMole worker outcomes through the shared provider classifier

The EVMole worker's cancellation, deadline, output budget and CPU/file-size signals now go through classifyProviderOutcome; only the prlimit launch refusal and the reserved EFBIG exit remain in its dialect. The worker is opted into V8 exhaustion scanning so a heap report names its fixed 256 MiB heap. providerOutcomeOf now reads a launch refusal only from a spawn errno, so a private-storage or carrier read errno is no longer reported as a limiter launch failure.

* fix(evm): keep a stream failure's exit status and update Linux worker expectations

* refactor(process): read launch refusals through the launcher identity owner

* refactor(wasm): classify WABT command outcomes through the shared provider classifier (#10727)

* refactor(wasm): classify WABT command outcomes through the shared provider classifier

WABT's cancellation, command deadline, output budget, and inherited-limit signals now go through classifyProviderOutcome; its dialect keeps only the configuration-probe and launch-refusal unavailability and the unclassified-exit output error. A tool ended by SIGXCPU/SIGXFSZ or the memory limit is now a resource constraint instead of an output error, and a refused launch in the producer phase is reported as unavailable. The shared timeout context gains the analysis setting that selected the deadline, and the output-limit context may name its exceeded budget.

* fix(wasm): keep setup guidance when a WABT version probe's output cannot be collected
…w5-10634

# Conflicts:
#	src/apktool/ApktoolProvider.ts
#	src/ghidra/GhidraDiagnostics.ts
@morluto
morluto force-pushed the refactor/cancelled-read-facts branch from e3f3bb1 to 9f79531 Compare November 15, 2026 07:48
@morluto
morluto force-pushed the refactor/sqlite-database-classifier branch from ec20d0b to 075dc37 Compare November 15, 2026 07:48
…r classifier (#10836)

* refactor(ghidra): classify Ghidra failures through the shared provider classifier

PSP extension inspection reports through classifyProviderFailure with a
Ghidra dialect. The startup deadline decides at abort time whether the shared
startup owner closed it, so Ghidra and Hopper no longer compare the abort
reason with the owner's sentinel, and Ghidra's startup no longer compares a
producer cancellation's reason with the deadline's. Three helpers that only
construct one error kind now name that kind instead of AnalysisError.

* refactor(hopper): classify original-source read failures through the shared provider classifier (#10838)

* test(ghidra): pin the aborted startup deadline over a producer cancellation

* refactor(kuna): classify Kuna failures through the shared provider classifier (#10843)

Session operations, the workspace copy and the project export report raw
failures through classifyProviderFailure with Kuna dialects; the copy and
export keep their cleanup report shapes through the readCleanup hook.
…' into w5/ccd

# Conflicts:
#	src/pcap/PcapProvider.ts
#	src/process/ArtifactAnalysisResources.ts
#	src/signals/SigrokRecordingProvider.ts
# Conflicts:
#	scripts/verify/architecture-guard-baselines.json
#	src/captures/TsharkCaptureProvider.ts
#	src/providers/classifyProviderFailure.ts
…vider classifier (#10859)

* refactor(ida): classify IDA operation failures through the shared provider classifier

* refactor(process): let artifact-resource consumers classify through the shared provider classifier (#10867)

* test(providers): pin attribution of a cleanup-failed read's typed primary
# Conflicts:
#	src/ghidra/GhidraClient.ts
#	src/hopper/HopperClient.ts
…' into refactor/adb-provider-classifier

# Conflicts:
#	src/ghidra/GhidraClient.ts
#	src/hopper/HopperClient.ts
#	tests/boundary/providers/ghidra/ghidraClient.test.ts
…capture-classifier

# Conflicts:
#	src/process/ArtifactAnalysisResources.ts
#	src/sqlite/SqliteDatabaseWorkerExecution.ts
…er' into refactor/sqlite-database-classifier

# Conflicts:
#	scripts/lint/rules/provider-failure-classifier-baseline.json
#	src/process/ArtifactAnalysisResources.ts
#	src/sqlite/SqliteDatabaseFailures.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

…assifier

# Conflicts:
#	scripts/lint/rules/provider-failure-classifier-baseline.json
…assifier

# Conflicts:
#	src/sqlite/SqliteDatabaseFailures.ts
…ier' into w5/cancelled-read-facts

# Conflicts:
#	src/providers/classifyProviderFailure.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto changed the base branch from refactor/sqlite-database-classifier to main November 15, 2026 13:08
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto merged commit a401001 into main Nov 15, 2026
7 checks passed
@morluto
morluto deleted the refactor/cancelled-read-facts branch November 15, 2026 13:32
@morluto morluto added the area: providers Provider and capability discovery, including provider proposal triage label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: providers Provider and capability discovery, including provider proposal triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant