[PR #5588] [CLOSED] fix(diagnostics): name fixed inspection budgets in refusal recovery #6980

Closed
opened 2026-11-01 21:44:28 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5588
Author: @kaoru0822-kitauji
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: fix/fixed-budget-refusal-advice


📝 Commits (2)

  • 7d97187 fix(diagnostics): name fixed inspection budgets in refusal recovery
  • beaf404 Merge origin/main into fix/fixed-budget-refusal-advice

📊 Changes

14 files changed (+191 additions, -17 deletions)

View changed files

📝 docs/binary-diagnostics.md (+2 -1)
📝 src/dotnet/ManagedSnapshot.ts (+7 -0)
📝 src/flutter/FlutterBuildProvider.ts (+7 -0)
📝 src/go/GoBinaryProvider.ts (+8 -1)
📝 src/native/AppleDispatchMetadata.test.ts (+41 -1)
📝 src/native/AppleDispatchMetadata.ts (+7 -0)
📝 src/native/pe/PeResourceParser.ts (+9 -4)
📝 src/native/pe/PeResourcesProvider.test.ts (+32 -0)
📝 src/native/pe/PeResourcesProvider.ts (+14 -8)
📝 src/rust/RustBinaryProvider.ts (+12 -1)
📝 tests/acceptance/rustBinaryCli.test.ts (+32 -0)
📝 tests/boundary/filesystem/flutterBuildProvider.test.ts (+9 -1)
📝 tests/boundary/go/goBinaryProvider.test.ts (+6 -0)
📝 tests/boundary/providers/managed/managedMemberComparison.test.ts (+5 -0)

📄 Description

Summary

Fixes #5556. Seven fixed-budget refusals across six inspection commands returned resource_constraint with details.resource: "memory" and no producer-specific recovery, so projection fell back to "Retry with sufficient memory or a smaller artifact" — worker limits and host memory cannot admit the unchanged input. The PE resource metadata refusal also omitted its exceeded 8 MiB allowance from reported_limits.

Problem and expected behavior

Trigger: any input exceeding one of these fixed bounds (Go build-info 1 MiB / structure 16 MiB / header search 256 MiB, Rust dependency section 1 MiB compressed or inflated limit, PE resource metadata 8 MiB, managed snapshot 128 MiB, Flutter 32 ABIs / 1024-byte library paths, Apple dispatch snapshot 64 MiB). Expected: keep the refusal and retryable: false, and name the fixed limit in recovery without pointing at worker or host memory.

Change and scope

Each producer (the owning boundary that knows the bound is fixed) now passes retryable: false and a remediationAction naming its reported_limits key, following the pattern already used by src/native/pe/PeResourcesProvider.ts and PR #5567. The PE memory boundary now reports max_metadata_bytes (the parser constant is exported as PE_RESOURCE_METADATA_BYTES), documented in docs/binary-diagnostics.md. The shared fallback in analysisErrorPresentation.ts is unchanged so genuine worker/OS memory diagnostics keep their advice. Go's search boundary (resource cpu) goes through the same mapping and is also fixed, so it gets the same treatment. Scope: not applicable (ordinary fix within existing boundaries).

Not included: the Flutter APK metadata-read limit (max_metadata_read_bytes) uses the same fallback but is not in the issue; Rust capacity/transport refusals are covered by #5504/#5505 (PR #5550). src/electron/ is owned by #5567.

Contract and boundary impact

  • Semantic owner and earliest changed stage: provider failure mapping at each producer.

  • Contribution scope fit and linked maintainer decision: not applicable.

  • CLI and MCP/tool-catalog contract: remediation.action text changes for the listed refusals; PE memory refusal adds details.reported_limits.max_metadata_bytes. retryable was already false for these memory cases and stays so; Go search (cpu) is now explicitly non-retryable (projection already returned false for cpu).

  • Provider, bridge, target-format, or platform compatibility: none.

  • Evidence, artifact, provenance, or reconstruction contract: none.

  • Target selection, authority, upstream behavior, and cleanup details: not applicable.

  • Generated metadata, package, or installation impact: none.

  • Read existing files or captured data.

  • Launch or attach to a process.

  • Inject instrumentation or run scripts/code.

  • Change process memory, registers, files, or configuration.

  • Contact network services.

  • Recover protected code or work around protections.

  • Documentation or usability only; no target interaction.

  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated (each asserts the projectAnalysisError/CLI JSON retryable: false, the limit key in remediation.action, and absence of "sufficient memory"):

    • tests/acceptance/rustBinaryCli.test.ts — new CLI test for a dependency section above 1 MiB.
    • tests/boundary/go/goBinaryProvider.test.ts — build-info guard.
    • src/native/pe/PeResourcesProvider.test.ts — new metadata-budget test (6000 long-named entries), also asserts max_metadata_bytes.
    • tests/boundary/providers/managed/managedMemberComparison.test.ts — sparse oversized snapshot.
    • tests/boundary/filesystem/flutterBuildProvider.test.ts — 33-ABI inventory (both operations).
    • src/native/AppleDispatchMetadata.test.ts — new sparse 64 MiB + 1 Mach-O through the native provider client.
  • Base reproduction: with the source changes reverted and the new tests kept, npm run test:focused on the six files failed 7 tests (all the new/updated assertions) and passed 193.

  • Remaining proof gaps: Go structural-table refusal shares the asserted mapping but has no dedicated test; live MCP was not exercised separately (same projection).

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

After merging latest origin/main (merge commit beaf4040b; only conflict was the import block of src/native/AppleDispatchMetadata.test.ts, keeping both main's objcRecordBudgetMacho and this PR's createTestTempDirectory imports):

  • npm run test:focused -- src/native/AppleDispatchMetadata.test.ts src/native/pe/PeResourcesProvider.test.ts tests/acceptance/rustBinaryCli.test.ts tests/boundary/go/goBinaryProvider.test.ts tests/boundary/providers/managed/managedMemberComparison.test.ts tests/boundary/filesystem/flutterBuildProvider.test.ts — 6 files, 207 tests passed.
  • npm run check:fast — typecheck and lint passed.
  • npm run format:check — passed.
  • npm run docs:check — passed.

Before the merge: the same focused command passed 200 tests; with the source fix reverted it failed 7 and passed 193 (not re-run after the merge).

Compatibility, safety, and release

  • Breaking changes or migration steps: none (additive reported_limits key; recovery wording only).
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; static built-in readers on macOS only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new side effects.

Author readiness

Human owner: @kaoru0822-kitauji

  • 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.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/5588 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/fixed-budget-refusal-advice` --- ### 📝 Commits (2) - [`7d97187`](https://github.com/morluto/rea/commit/7d97187ec40651852fca965a2d868ed6f3a7561a) fix(diagnostics): name fixed inspection budgets in refusal recovery - [`beaf404`](https://github.com/morluto/rea/commit/beaf4040bc06cde788b0eb121d9be355b4c2b1ff) Merge origin/main into fix/fixed-budget-refusal-advice ### 📊 Changes **14 files changed** (+191 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `docs/binary-diagnostics.md` (+2 -1) 📝 `src/dotnet/ManagedSnapshot.ts` (+7 -0) 📝 `src/flutter/FlutterBuildProvider.ts` (+7 -0) 📝 `src/go/GoBinaryProvider.ts` (+8 -1) 📝 `src/native/AppleDispatchMetadata.test.ts` (+41 -1) 📝 `src/native/AppleDispatchMetadata.ts` (+7 -0) 📝 `src/native/pe/PeResourceParser.ts` (+9 -4) 📝 `src/native/pe/PeResourcesProvider.test.ts` (+32 -0) 📝 `src/native/pe/PeResourcesProvider.ts` (+14 -8) 📝 `src/rust/RustBinaryProvider.ts` (+12 -1) 📝 `tests/acceptance/rustBinaryCli.test.ts` (+32 -0) 📝 `tests/boundary/filesystem/flutterBuildProvider.test.ts` (+9 -1) 📝 `tests/boundary/go/goBinaryProvider.test.ts` (+6 -0) 📝 `tests/boundary/providers/managed/managedMemberComparison.test.ts` (+5 -0) </details> ### 📄 Description ## Summary Fixes #5556. Seven fixed-budget refusals across six inspection commands returned `resource_constraint` with `details.resource: "memory"` and no producer-specific recovery, so projection fell back to "Retry with sufficient memory or a smaller artifact" — worker limits and host memory cannot admit the unchanged input. The PE resource metadata refusal also omitted its exceeded 8 MiB allowance from `reported_limits`. ## Problem and expected behavior Trigger: any input exceeding one of these fixed bounds (Go build-info 1 MiB / structure 16 MiB / header search 256 MiB, Rust dependency section 1 MiB compressed or inflated limit, PE resource metadata 8 MiB, managed snapshot 128 MiB, Flutter 32 ABIs / 1024-byte library paths, Apple dispatch snapshot 64 MiB). Expected: keep the refusal and `retryable: false`, and name the fixed limit in recovery without pointing at worker or host memory. ## Change and scope Each producer (the owning boundary that knows the bound is fixed) now passes `retryable: false` and a `remediationAction` naming its `reported_limits` key, following the pattern already used by `src/native/pe/PeResourcesProvider.ts` and PR #5567. The PE memory boundary now reports `max_metadata_bytes` (the parser constant is exported as `PE_RESOURCE_METADATA_BYTES`), documented in `docs/binary-diagnostics.md`. The shared fallback in `analysisErrorPresentation.ts` is unchanged so genuine worker/OS memory diagnostics keep their advice. Go's `search` boundary (resource `cpu`) goes through the same mapping and is also fixed, so it gets the same treatment. Scope: not applicable (ordinary fix within existing boundaries). Not included: the Flutter APK metadata-read limit (`max_metadata_read_bytes`) uses the same fallback but is not in the issue; Rust `capacity`/`transport` refusals are covered by #5504/#5505 (PR #5550). `src/electron/` is owned by #5567. ## Contract and boundary impact - Semantic owner and earliest changed stage: provider failure mapping at each producer. - Contribution scope fit and linked maintainer decision: not applicable. - CLI and MCP/tool-catalog contract: `remediation.action` text changes for the listed refusals; PE memory refusal adds `details.reported_limits.max_metadata_bytes`. `retryable` was already `false` for these memory cases and stays so; Go `search` (cpu) is now explicitly non-retryable (projection already returned false for cpu). - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details: not applicable. - Generated metadata, package, or installation impact: none. - [ ] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated (each asserts the `projectAnalysisError`/CLI JSON `retryable: false`, the limit key in `remediation.action`, and absence of "sufficient memory"): - `tests/acceptance/rustBinaryCli.test.ts` — new CLI test for a dependency section above 1 MiB. - `tests/boundary/go/goBinaryProvider.test.ts` — build-info guard. - `src/native/pe/PeResourcesProvider.test.ts` — new metadata-budget test (6000 long-named entries), also asserts `max_metadata_bytes`. - `tests/boundary/providers/managed/managedMemberComparison.test.ts` — sparse oversized snapshot. - `tests/boundary/filesystem/flutterBuildProvider.test.ts` — 33-ABI inventory (both operations). - `src/native/AppleDispatchMetadata.test.ts` — new sparse 64 MiB + 1 Mach-O through the native provider client. - Base reproduction: with the source changes reverted and the new tests kept, `npm run test:focused` on the six files failed 7 tests (all the new/updated assertions) and passed 193. - Remaining proof gaps: Go structural-table refusal shares the asserted mapping but has no dedicated test; live MCP was not exercised separately (same projection). - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed After merging latest `origin/main` (merge commit `beaf4040b`; only conflict was the import block of `src/native/AppleDispatchMetadata.test.ts`, keeping both main's `objcRecordBudgetMacho` and this PR's `createTestTempDirectory` imports): - `npm run test:focused -- src/native/AppleDispatchMetadata.test.ts src/native/pe/PeResourcesProvider.test.ts tests/acceptance/rustBinaryCli.test.ts tests/boundary/go/goBinaryProvider.test.ts tests/boundary/providers/managed/managedMemberComparison.test.ts tests/boundary/filesystem/flutterBuildProvider.test.ts` — 6 files, 207 tests passed. - `npm run check:fast` — typecheck and lint passed. - `npm run format:check` — passed. - `npm run docs:check` — passed. Before the merge: the same focused command passed 200 tests; with the source fix reverted it failed 7 and passed 193 (not re-run after the merge). ## Compatibility, safety, and release - Breaking changes or migration steps: none (additive `reported_limits` key; recovery wording only). - Real Hopper/Ghidra, browser, or OS coverage: not applicable; static built-in readers on macOS only. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no new side effects. ## Author readiness Human owner: @kaoru0822-kitauji - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] 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. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:44:28 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6980
No description provided.