mirror of
https://github.com/morluto/rea.git
synced 2026-11-29 09:56:23 +00:00
* feat(errors)!: add the TargetFailure model, its projection table and conformance registry Introduce one domain-owned TargetFailure value whose kind alone derives the public code, category, retryability, recovery and details, for CLI and MCP alike. Selected-file malformed and truncated refusals are the first area on it: AnalysisMalformedTargetError is replaced by AnalysisTargetFailureError, and ParseFailure's byte-structure variants are TargetFailure variants rather than a parallel type. The shared stableArtifactParserFailureCli loop is replaced by a declarative registry (tests/support/targetFailure/readers/*.ts) and one generated suite that runs every registered case through the CLI and MCP. BREAKING CHANGE: selected-file malformed and truncated refusals add details.failure_kind, and a truncated target's remediation now says to re-acquire the complete file instead of choosing another target. Codes are unchanged. Affected operations: every operation that refuses a selected file's malformed or truncated bytes, including the ELF, PE, Mach-O, DWARF, Go, Rust, BEAM, pyc, devicetree, Apple IPS, kernel module, binary hardening, managed PE/CLI and IL2CPP readers. * test(managed): name the target failure error in the merged status test * docs(reference): name the error CSV instead of linking a non-page file * fix(tests): expect the path reason for non-regular dyld inputs #14225 refuses a non-regular dyld input as ArtifactReaderFailure("path"); dylibFileLifetime still expected "format" and fails on main's shard 9. * fix(tests): expect io, invariant and path where #14225 reclassified stableArtifact expected "format" for an impossible descriptor byte count (now io) and an invalid chunk size (now InternalInvariantError); directoryArtifactReaderOpen expected "format" for a non-file entry (now path, the same change as #14238). All three fail on main. * fix(errors)!: raise container reader byte faults as malformed or truncated targets Delete the ambiguous `format` reason from ArtifactReaderFailure and ArtifactOperationError. Each container reader now raises its owner's fact once, through malformedArtifact / truncatedArtifact, with format, offset, field and measured extents. Short reads inside a measured extent are read-coverage integrity failures, path-kind refusals are `path`, foreign or recovery-requiring inputs are `unsupported`, host tool output is `io`, and REA defects are InternalInvariantError. The trace, NTFS journal, release exposure, web capture, native macOS and web artifact adapters project the reader's parsed facts as AnalysisTargetFailureError instead of invalid_request. Inventory malformed, truncated, unsupported and cancelled reasons take their code from the TargetFailure projection table, so a truncated container is unsupported_target with failure_kind "truncated" on both paths. BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact, analyze_javascript_application, inspect_desktop_application, inspect_keyed_archive, inspect_asset_catalog, inspect_nuget_nupkg, trace_dylib_resolution, trace_web_module_imports and trace_web_source_location report damaged container bytes as unsupported_target (details.reason "malformed" or "truncated", with failure_kind and format) instead of artifact_operation_failed with reason "format", and a truncated container as unsupported_target instead of truncated. inspect_playwright_trace, inspect_ntfs_journal, audit_release_exposure, the web capture inspection operations and the caller-selected import and source maps report damaged selected bytes as unsupported_target instead of invalid_request. The `format` reason no longer appears in details.reason. * test(artifacts): expect target failure codes in compiled CLI and MCP suites * fix(errors): give the integrity kind a schema-valid code and list the reference page artifact_integrity_mismatch's projection schema requires declared and calculated digests, which a TargetFailure of kind integrity does not carry, so the kind now projects artifact_operation_failed with category integrity_mismatch. The model test validates every kind's projection against analysisErrorProjectionSchema. The reference page joins the documentation sidebar. * fix(artifacts): report a short carrier read as a changed file and keep unsupported desktop probes local A Bun or Node SEA short read inside a range already checked against the measured size meant the file changed, not that it was truncated. The carrier range reader and Bun's readExact now raise read-coverage integrity for it, and keep 'outside the file' as the truncated case. DesktopFileInspection records an unsupported managed-metadata probe as a row issue again, so later file checks still run. * test(errors): register PE DOS-signature and truncated IPS refusals and drop their per-command copies The non-MZ PE imports and load-config cases (PE32/PE32+, ZZ and high-bit signatures) and the truncated Apple IPS body move into the conformance registry, which runs them through the CLI and MCP and now also checks that a refusal leaves the selected file unchanged. The per-command tests keep only their valid-image controls. * feat(errors)!: make failure_kind the identifier and derive code and retry from it Apply the owner review on #14239 to the TargetFailure model: - remove details.format_failure; failure_kind is the only identifier; - give integrity, conflict and io their own codes (target_integrity_mismatch, input_conflict, host_io_failed) and derive inventory malformed, truncated and unsupported codes from the same table; - add a retry hint (none, backoff, after_change) derived from the kind, with io refined by its transient errno fact; retryable stays the unchanged-retry flag and is true exactly for backoff; - rename the limit-cut result code and category truncated to partial; - drop cancelled and resource from the target kinds and spell identifiers in American English (unrecognized); - return a target failure a tool handler throws as a projected isError result instead of letting the SDK flatten it to text. BREAKING CHANGE: details.format_failure is removed (read details.failure_kind). The truncated result code and category are now partial. Target integrity failures report target_integrity_mismatch, host read failures host_io_failed and disagreeing inputs input_conflict. Inventory operations (inventory_artifact, inspect_artifact, extract_artifact and the other inventory callers) report truncated container bytes as unsupported_target. Every target failure carries a top-level retry hint. * fix(artifacts): keep changed-file short reads, invalid offsets and EOF declarations apart PyInstaller reads inside the measured size, and .NET bundle manifest refills, now raise read-coverage integrity on a zero-byte read instead of truncated. A .NET bundle field and a Godot PCK directory entry that extend past the file are truncated (with offset and extents) instead of malformed. An absent or invalid ASAR packed offset is malformed; only a valid range past the archive is truncated. The .NET manifest string offset is reported in file coordinates. * fix(artifacts): verify the carrier before blaming a short read on the bytes The NTFS $MFT decoder, positional members (FIT, uImage, Bun, Deno) and .NET bundle members now re-verify the source before reporting a short stream as malformed, so a file that changed during the read reports the change. The truncation site builds the model's measured extent. * docs(android): name unsupported_target for truncated boot image structures * fix(errors)!: report a target that changed during the read as failure_kind changed Inventory integrity failures whose check means the target moved under the read (container, member and unpacked-entry identity, read coverage, traversal coverage) now take the model's changed projection: code artifact_changed, retry backoff and details.failure_kind changed. A selected target that no longer matches the one the session admitted gets its own admitted-identity check and keeps its reopen recovery. BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact and the other inventory operations report a target that changed during the read as artifact_changed (retryable, failure_kind changed) instead of artifact_operation_failed. Admission-identity refusals report integrity_check admitted-identity instead of container-identity. * test(artifacts): expect admitted-identity for selections replaced before admission A selected source replaced before admission fails the admitted-identity check rather than container-identity since the changed/admitted split. * test(go): name the fixture and result when an MZ carrier is not refused through MCP * test(web): expect the partial code for a refused source-map admission The limit-cut code is partial; this Windows-lane test arrived from main with the old truncated spelling. * test(errors): check the MCP target failure as the text clients receive The stdio transport removes the private structured carrier from every isError result, so the conformance suite asserted a field that never reaches clients and failed every case. The projected diagnostic is checked from the JSON text instead. * test(artifacts): expect artifact_changed when selected bytes change after inventory Bundle resources replaced after open and unselected JavaScript sources rewritten after inventory now fail a change check, so they report artifact_changed with retry backoff rather than artifact_operation_failed. * fix(errors): report a session digest mismatch as admitted-identity The digest the session admitted does not change when the same request is repeated, so targetDigestChangedFailure was inviting a backoff retry that fails the same way. It now names admitted-identity, which stays artifact_operation_failed and not retryable, and tells the caller to reopen. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(artifacts): classify unused PyInstaller compressed input as layout zlib stops at the first complete stream, so a declared span that arrives intact but is not fully consumed is trailing junk or a second stream, not a file that changed. A source that ends before that span stays read-coverage. The cached-carrier test replaces the file with a different size so a shared timestamp cannot hide the rewrite. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(applications): expect unsupported_target for a damaged trace stream A trace member whose CRC fails is a malformed zip target. The partial Evidence assertion now checks that code, failure_kind and format. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(dylib): expect admitted-identity when the opened target is replaced The session keeps the digest it admitted, so replacing the executable and repeating trace_dylib_resolution is not a retryable container change. Co-authored-by: morluto <morluto@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: morluto <morluto@users.noreply.github.com>
9.5 KiB
9.5 KiB
| 1 | tag | discriminant | code | category | retryable_by_default |
|---|---|---|---|---|---|
| 2 | AnalysisProtocolError | unreadable_output | execution_failure | false | |
| 3 | AnalysisOutputError | unreadable_output | execution_failure | false | |
| 4 | AnalysisInputError | invalid_request | invalid_input | false | |
| 5 | AnalysisAccessDeniedError | access_denied | unavailable | false | |
| 6 | AnalysisArtifactChangedError | artifact_changed | integrity_mismatch | true | |
| 7 | AnalysisCapabilityUnavailableError | capability_unavailable | unsupported_provider | false | |
| 8 | AnalysisUnsupportedTargetError | unsupported_target | unsupported_target | false | |
| 9 | AnalysisCancelledError | cancelled | cancelled | true | |
| 10 | AnalysisTimeoutError | provider_timeout | timeout | true | |
| 11 | AnalysisResourceConstraintError | resource_constraint | resource_constraint | false | |
| 12 | ConfigurationError | configuration_invalid | invalid_input | false | |
| 13 | NoBinaryOpenError | target_unavailable | unavailable | false | |
| 14 | EvidenceIntegrityError | evidence_integrity_mismatch | integrity_mismatch | false | |
| 15 | ProviderAdapterError | execution_failure | execution_failure | false | |
| 16 | AnalysisCapabilityUnavailableError | retryable=true | capability_unavailable | unavailable | true |
| 17 | AnalysisTargetFailureError | kind=selection | invalid_request | invalid_input | false |
| 18 | AnalysisTargetFailureError | kind=unrecognized | unsupported_target | unsupported_target | false |
| 19 | AnalysisTargetFailureError | kind=unsupported | unsupported_target | unsupported_target | false |
| 20 | AnalysisTargetFailureError | kind=malformed | unsupported_target | unsupported_target | false |
| 21 | AnalysisTargetFailureError | kind=truncated | unsupported_target | unsupported_target | false |
| 22 | AnalysisTargetFailureError | kind=integrity | target_integrity_mismatch | integrity_mismatch | false |
| 23 | AnalysisTargetFailureError | kind=conflict | input_conflict | invalid_input | false |
| 24 | AnalysisTargetFailureError | kind=changed | artifact_changed | integrity_mismatch | true |
| 25 | AnalysisTargetFailureError | kind=access | access_denied | unavailable | false |
| 26 | AnalysisTargetFailureError | kind=io | host_io_failed | execution_failure | false |
| 27 | ArtifactOperationError | reason=cancelled | cancelled | cancelled | true |
| 28 | ArtifactOperationError | reason=malformed | unsupported_target | unsupported_target | false |
| 29 | ArtifactOperationError | reason=truncated | unsupported_target | unsupported_target | false |
| 30 | ArtifactOperationError | reason=unsupported | unsupported_target | unsupported_target | false |
| 31 | ArtifactOperationError | reason=integrity | artifact_operation_failed | integrity_mismatch | false |
| 32 | ArtifactOperationError | reason=limit | partial | partial | false |
| 33 | ArtifactOperationError | reason=path | artifact_operation_failed | execution_failure | false |
| 34 | ArtifactOperationError | reason=unavailable | artifact_operation_failed | unavailable | false |
| 35 | ArtifactOperationError | reason=io | artifact_operation_failed | execution_failure | false |
| 36 | ArtifactOperationError | reason=integrity; artifact identity reported | artifact_integrity_mismatch | integrity_mismatch | false |
| 37 | ArtifactOperationError | reason=integrity; target changed during the read | artifact_changed | integrity_mismatch | true |
| 38 | BinaryTargetError | constraint=unconstrained | target_unavailable | unavailable | false |
| 39 | BinaryTargetError | constraint=unconstrained; read permission denied | access_denied | unavailable | false |
| 40 | BinaryTargetError | constraint=directory_requires_file | target_unavailable | unavailable | false |
| 41 | BinaryTargetError | constraint=directory_requires_file; read permission denied | access_denied | unavailable | false |
| 42 | BinaryTargetError | constraint=wasm_requires_static_inspection | target_unavailable | unsupported_target | false |
| 43 | BinaryTargetError | constraint=wasm_requires_static_inspection; read permission denied | access_denied | unsupported_target | false |
| 44 | BinaryTargetError | constraint=file_format_rejected | target_unavailable | unsupported_target | false |
| 45 | BinaryTargetError | constraint=file_format_rejected; read permission denied | access_denied | unsupported_target | false |
| 46 | BinaryTargetError | constraint=load_selection_rejected | invalid_request | invalid_input | false |
| 47 | BinaryTargetError | constraint=bundle_type_unsupported | target_unavailable | unsupported_target | false |
| 48 | BinaryTargetError | constraint=bundle_type_unsupported; read permission denied | access_denied | unsupported_target | false |
| 49 | BinaryTargetError | constraint=bundle_info_plist_decode_budget_exceeded | target_unavailable | unavailable | false |
| 50 | BinaryTargetError | constraint=bundle_info_plist_decode_budget_exceeded; read permission denied | access_denied | unavailable | false |
| 51 | BinaryTargetError | constraint=bundle_info_plist_missing | target_unavailable | unavailable | false |
| 52 | BinaryTargetError | constraint=bundle_info_plist_missing; read permission denied | access_denied | unavailable | false |
| 53 | BinaryTargetError | constraint=bundle_layout_ambiguous | target_unavailable | unavailable | false |
| 54 | BinaryTargetError | constraint=bundle_layout_ambiguous; read permission denied | access_denied | unavailable | false |
| 55 | BinaryTargetError | constraint=bundle_executable_undeclared | target_unavailable | unavailable | false |
| 56 | BinaryTargetError | constraint=bundle_executable_undeclared; read permission denied | access_denied | unavailable | false |
| 57 | BinaryTargetError | constraint=bundle_program_missing | target_unavailable | unavailable | false |
| 58 | BinaryTargetError | constraint=bundle_program_missing; read permission denied | access_denied | unavailable | false |
| 59 | BinaryTargetError | constraint=bundle_current_version_missing | target_unavailable | unavailable | false |
| 60 | BinaryTargetError | constraint=bundle_current_version_missing; read permission denied | access_denied | unavailable | false |
| 61 | BinaryTargetError | constraint=bundle_path_escapes | target_unavailable | unavailable | false |
| 62 | BinaryTargetError | constraint=bundle_path_escapes; read permission denied | access_denied | unavailable | false |
| 63 | BrowserObservationError | reason=endpoint_unreachable | provider_unavailable | unavailable | true |
| 64 | BrowserObservationError | reason=invalid_endpoint_response | unreadable_output | execution_failure | false |
| 65 | BrowserObservationError | reason=target_not_found | target_unavailable | unavailable | false |
| 66 | BrowserObservationError | reason=target_not_allowed | target_unavailable | unavailable | false |
| 67 | BrowserObservationError | reason=application_already_running | target_unavailable | unavailable | false |
| 68 | BrowserObservationError | reason=service_worker_blocked | target_unavailable | unavailable | false |
| 69 | BrowserObservationError | reason=target_changed | target_unavailable | unavailable | false |
| 70 | BrowserObservationError | reason=target_session_detached | target_unavailable | unavailable | false |
| 71 | BrowserObservationError | reason=protocol_error | unreadable_output | execution_failure | false |
| 72 | BrowserObservationError | reason=disconnected | provider_unavailable | unavailable | true |
| 73 | BrowserObservationError | reason=payload_limit | partial | partial | false |
| 74 | BrowserObservationError | reason=window_not_found | unreadable_output | execution_failure | false |
| 75 | BrowserObservationError | reason=window_metadata_missing | unreadable_output | execution_failure | false |
| 76 | BrowserObservationError | reason=process_ownership_unavailable | unreadable_output | execution_failure | false |
| 77 | BrowserObservationError | reason=cleanup_failed | execution_failure | execution_failure | false |
| 78 | BrowserObservationError | reason=cancelled | cancelled | cancelled | true |
| 79 | BrowserObservationError | reason=timeout | provider_timeout | timeout | true |
| 80 | BrowserObservationError | caused by cancellation | cancelled | cancelled | true |
| 81 | EvidenceFileError | reason=not-file | invalid_request | invalid_input | false |
| 82 | EvidenceFileError | reason=exists | invalid_request | invalid_input | false |
| 83 | EvidenceFileError | reason=wrong-kind | invalid_request | invalid_input | false |
| 84 | EvidenceFileError | reason=missing | invalid_request | invalid_input | false |
| 85 | EvidenceFileError | reason=symlink-traversal | invalid_request | invalid_input | false |
| 86 | EvidenceFileError | reason=invalid-json | evidence_integrity_mismatch | execution_failure | false |
| 87 | EvidenceFileError | reason=path-limit | resource_constraint | resource_constraint | false |
| 88 | EvidenceFileError | reason=storage-limit | resource_constraint | resource_constraint | false |
| 89 | EvidenceFileError | reason=io | execution_failure | execution_failure | false |
| 90 | ProcessCaptureError | process_capture_failed | execution_failure | false | |
| 91 | ProcessCaptureError | caused by cancellation | cancelled | cancelled | true |
| 92 | ProviderSelectionError | reason=unknown_provider | capability_unavailable | unsupported_provider | false |
| 93 | ProviderSelectionError | reason=provider_unavailable | provider_unavailable | unavailable | true |
| 94 | ProviderSelectionError | reason=target_unsupported | capability_unavailable | unsupported_provider | false |
| 95 | ProviderSelectionError | reason=ambiguous | capability_unavailable | unsupported_provider | false |
| 96 | ProviderSelectionError | reason=invalid_options | capability_unavailable | unsupported_provider | false |
| 97 | UnknownRegistryError | reason=not-found | execution_failure | execution_failure | false |
| 98 | UnknownRegistryError | reason=already-exists | invalid_request | invalid_input | false |
| 99 | UnknownRegistryError | reason=revision-conflict | revision_conflict | execution_failure | true |
| 100 | UnknownRegistryError | reason=invalid-transition | execution_failure | execution_failure | false |
| 101 | UnknownRegistryError | reason=integrity | evidence_integrity_mismatch | execution_failure | false |
| 102 | UnknownRegistryError | reason=limit | partial | execution_failure | false |
| 103 | UnknownRegistryError | reason=constraint | invalid_request | invalid_input | false |
| 104 | HopperTimeoutError | provider_timeout | timeout | true | |
| 105 | HopperCancelledError | cancelled | cancelled | true | |
| 106 | HopperProtocolError | unreadable_output | execution_failure | false | |
| 107 | HopperRemoteError | diagnostic_type=remote | execution_failure | execution_failure | false |
| 108 | HopperRemoteError | diagnostic_type=authorization | execution_failure | unavailable | false |
| 109 | HopperRemoteError | diagnostic_type=invalid_request | invalid_request | invalid_input | false |
| 110 | HopperRemoteError | diagnostic_type=selector_not_found | invalid_request | invalid_input | false |
| 111 | HopperRemoteError | diagnostic_type=capability_unavailable | execution_failure | execution_failure | false |
| 112 | HopperRemoteError | diagnostic_type=bridge_exception | execution_failure | execution_failure | false |
| 113 | HopperProcessError | provider_unavailable | unavailable | true | |
| 114 | HopperStartError | provider_unavailable | unavailable | true | |
| 115 | HopperStartError | Apple Events authorization denied | provider_unavailable | unavailable | false |