Skip to content

refactor(sqlite): classify database failures through the shared provider classifier - #10870

Merged
morluto merged 70 commits into
mainfrom
refactor/sqlite-database-classifier
Nov 15, 2026
Merged

morluto merged 70 commits into
mainfrom
refactor/sqlite-database-classifier

Conversation

@morluto

@morluto morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Summary

The second SQLite slice of W5c. sqliteDatabaseFailure(cause, path, phase, ...), a recursive unknown → AnalysisError classifier, becomes sqliteDatabaseDialect(path, phase, ...) for the shared classifyProviderFailure. The rea/provider-failure-classifier baseline drops src/sqlite/SqliteDatabaseFailures.ts (1 → 0).

Stacked on #10859 (IDA, which now also carries the artifact-resources change from #10867). Refs #10482.

Problem and expected behavior

The classifier re-derived typed pass-through, a failed read's unresolved cleanup, reader cancellation and selected-file access refusals beside the shared owner. Expected: SQLite supplies only its own meaning (snapshot acquisition diagnostics, the database file set's integrity and input refusals, a sharing-violation EBUSY, the owned worker's reports, and its cleanup error). The shared owner does the rest.

Change and scope

  • recognise: snapshot acquisition (classifies the operation cause through the same dialect and keeps the completed members), reader io causes, integrity, path/format/limit input refusals, AbortError, the owned worker (the existing ownedCommandFailure, now taking a typed OwnedCommandFailure), and EBUSY during the artifact read.
  • file (artifact-read phase only): the shared selected-file projection reports EACCES/EPERM and missing or non-regular paths for the "database file set".
  • readCleanup: the SQLite cleanup error with the shared read primary. A plain read failure without a file outcome still reports its physical cause as the primary, as before.
  • Differences, source-derived: a cancelled read uses cancelledBy; the selected-file refusal message ends with a period and covers the shared regular-file codes (adding EISDIR, ENOTFILE, ESTALE to ENOENT, ENOTDIR, ELOOP, ENAMETOOLONG).

Not included, needs a maintainer decision:

  • Moving the worker's outcomes onto classifyProviderOutcome (command/commandCleanup). That would report the diagnostic-capture output-limit as resource_constraint instead of today's unreadable_output (tests/boundary/sqlite/sqliteDatabaseProvider.test.ts pins the current code), and would change the heap-exhaustion message. The worker classification therefore stays in ownedCommandFailure, typed on OwnedCommandFailure.

Contract and boundary impact

  • Semantic owner and earliest changed stage: classifyProviderFailure with the SQLite dialect.
  • CLI and MCP/tool-catalog contract: unchanged apart from the message wording above.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: snapshot acquisition diagnostics are kept.
  • Target selection, authority, upstream behavior, and cleanup details: cleanup error, primary and lease binding unchanged.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Behavior-preserving move; the SQLite boundary suites and SqliteDatabaseSnapshotLimits.test.ts pin the reports and now call classifyProviderFailure(cause, sqliteDatabaseDialect(...)).
  • Remaining proof gaps: two SQLite cases skip on the macOS host used here (Windows EBUSY, one native case) and run in CI.

Validation performed

  • npm run check:fast: pass.
  • npm run test:focused -- with the eight tests/boundary/sqlite/*.test.ts files, src/sqlite/SqliteDatabaseSnapshotLimits.test.ts and tests/evaluation/providerFailureClassifierRule.test.ts: 10 files, 156 passed, 2 skipped.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS only.
  • 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
…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
Base automatically changed from refactor/ida-provider-classifier to refactor/sqlite-capture-classifier November 15, 2026 11:12
# 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.

@morluto
morluto changed the base branch from refactor/sqlite-capture-classifier to main November 15, 2026 12:07
…assifier

# Conflicts:
#	scripts/lint/rules/provider-failure-classifier-baseline.json
@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:
#	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.

@morluto
morluto merged commit c966d6f into main Nov 15, 2026
7 checks passed
@morluto
morluto deleted the refactor/sqlite-database-classifier branch November 15, 2026 13:08
@morluto morluto added area: providers Provider and capability discovery, including provider proposal triage provider: sqlite Analysis provider / engine: sqlite labels 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 provider: sqlite Analysis provider / engine: sqlite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant