[PR #5643] [CLOSED] fix(analysis): preserve cancellation with partial observations #7008

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5643
Author: @charan-143
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: charan-143-preserve-cancelled-partial-observations


📝 Commits (3)

  • 5bee864 fix(analysis): preserve cancellation with partial observations
  • 5035834 Merge branch 'morluto:main' into charan-143-preserve-cancelled-partial-observations
  • 57679e1 fix(errors): omit non-JSON partial observations

📊 Changes

12 files changed (+252 additions, -58 deletions)

View changed files

📝 src/application/BrowserObservationService.test.ts (+57 -1)
📝 src/application/BrowserObservationService.ts (+1 -8)
📝 src/application/BrowserScenarioCaptureService.test.ts (+49 -1)
📝 src/application/BrowserScenarioCaptureService.ts (+0 -8)
📝 src/application/WebRuntimeService.test.ts (+54 -2)
📝 src/application/WebRuntimeService.ts (+2 -16)
📝 src/application/javascript/ElectronObservationService.test.ts (+25 -0)
📝 src/application/javascript/ElectronObservationService.ts (+0 -8)
📝 src/application/javascript/JavaScriptRuntimeObservationService.test.ts (+35 -0)
📝 src/application/javascript/JavaScriptRuntimeObservationService.ts (+0 -8)
📝 src/domain/analysisErrorProjection.test.ts (+22 -0)
📝 src/domain/analysisErrorProjection.ts (+7 -6)

📄 Description

Summary

When an observation workflow is cancelled, preserve the original AnalysisCancelledError and expose schema-valid JSON partial observations. Omit invalid JSON partials from caller projection with an explicit omission marker rather than throwing.

Problem and expected behavior

Cancellation can arrive after analysis has collected partial observations, including malformed or non-JSON values. Cancellation remains primary; valid JSON partials are retained and invalid ones are explicitly omitted at the CLI/MCP projection boundary.

Change and scope

Affected services keep cancellation primary and preserve raw partial observations internally. The shared error projector uses JSON-safe parsing, includes only valid JSON partials, and identifies omitted non-JSON data. This is an existing-boundary fix; it does not add target authority or new provider behavior.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: application observation services, where cancellation and collected observations are returned together.
  • Contribution scope fit and linked maintainer decision: ordinary fix within existing boundaries; not applicable.
  • CLI and MCP/tool-catalog contract: no contract or catalog changes.
  • Provider, bridge, target-format, or platform compatibility: source-level browser and JavaScript/Electron observation paths; real-provider compatibility was not exercised.
  • Evidence, artifact, provenance, or reconstruction contract: preserve raw partials on typed errors; expose only JSON-safe partial observations, marking invalid JSON partials as omitted.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): no target selection, authority, upstream behavior, or cleanup changes.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • 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: cancellation regressions across browser, scenario-capture, web-runtime, Electron, and JavaScript-runtime services, plus error-projection coverage for non-JSON partial observations.
  • Base reproduction or other evidence: focused source tests exercise cancellation after partial observations; the projection regression verifies a NaN partial remains a cancellation, is omitted with a marker, and satisfies the canonical JSON output schema.
  • User-visible CLI/MCP output (if applicable): no CLI/MCP output contract changes.
  • Remaining proof gaps: no live browser, Electron, CDP, or Inspector workflow was run.

For evidence-bearing changes:

  • 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

  • npm.cmd run test:local -- src/domain/analysisErrorProjection.test.ts src/application/BrowserObservationService.test.ts src/application/BrowserScenarioCaptureService.test.ts src/application/WebRuntimeService.test.ts src/application/javascript/ElectronObservationService.test.ts src/application/javascript/JavaScriptRuntimeObservationService.test.ts — passed (6 files, 96 tests).
  • npm.cmd run typecheck — passed.
  • npx.cmd oxfmt --check src/domain/analysisErrorProjection.ts src/domain/analysisErrorProjection.test.ts — passed.
  • git --no-pager diff --check — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: no live browser, Electron, CDP, or Inspector workflow ran; no Hopper/Ghidra workflow applies.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no change to target authority, process control, privacy handling, or containment.

Author readiness

Human owner: @charan-143

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

🔄 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/5643 **Author:** [@charan-143](https://github.com/charan-143) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `charan-143-preserve-cancelled-partial-observations` --- ### 📝 Commits (3) - [`5bee864`](https://github.com/morluto/rea/commit/5bee8642a13bb60e3de736e417fd88834ad3513f) fix(analysis): preserve cancellation with partial observations - [`5035834`](https://github.com/morluto/rea/commit/5035834003379f4ce8a92501a1b656440a4967a5) Merge branch 'morluto:main' into charan-143-preserve-cancelled-partial-observations - [`57679e1`](https://github.com/morluto/rea/commit/57679e1ba59c36dc578f6e6a0a0f6d90f609a05a) fix(errors): omit non-JSON partial observations ### 📊 Changes **12 files changed** (+252 additions, -58 deletions) <details> <summary>View changed files</summary> 📝 `src/application/BrowserObservationService.test.ts` (+57 -1) 📝 `src/application/BrowserObservationService.ts` (+1 -8) 📝 `src/application/BrowserScenarioCaptureService.test.ts` (+49 -1) 📝 `src/application/BrowserScenarioCaptureService.ts` (+0 -8) 📝 `src/application/WebRuntimeService.test.ts` (+54 -2) 📝 `src/application/WebRuntimeService.ts` (+2 -16) 📝 `src/application/javascript/ElectronObservationService.test.ts` (+25 -0) 📝 `src/application/javascript/ElectronObservationService.ts` (+0 -8) 📝 `src/application/javascript/JavaScriptRuntimeObservationService.test.ts` (+35 -0) 📝 `src/application/javascript/JavaScriptRuntimeObservationService.ts` (+0 -8) 📝 `src/domain/analysisErrorProjection.test.ts` (+22 -0) 📝 `src/domain/analysisErrorProjection.ts` (+7 -6) </details> ### 📄 Description <!-- PR title: type(optional-scope): imperative outcome The title becomes the squash-merge commit subject and generated changelog entry. --> ## Summary <!-- What user, agent, or maintainer problem does this solve? Link the issue with "Fixes #123" when applicable. Keep the prior behavior, expected contract, and new behavior understandable without private context. --> When an observation workflow is cancelled, preserve the original AnalysisCancelledError and expose schema-valid JSON partial observations. Omit invalid JSON partials from caller projection with an explicit omission marker rather than throwing. ## Problem and expected behavior <!-- For fixes, give the smallest trigger and violated invariant. For features, describe the use case and observable outcome. --> Cancellation can arrive after analysis has collected partial observations, including malformed or non-JSON values. Cancellation remains primary; valid JSON partials are retained and invalid ones are explicitly omitted at the CLI/MCP projection boundary. ## Change and scope <!-- Explain the chosen approach, why it fits REA's architecture, and what is intentionally not included. --> Affected services keep cancellation primary and preserve raw partial observations internally. The shared error projector uses JSON-safe parsing, includes only valid JSON partials, and identifies omitted non-JSON data. This is an existing-boundary fix; it does not add target authority or new provider behavior. Follow the [contribution scope](https://github.com/morluto/rea/blob/main/CONTRIBUTING.md#contribution-scope). Unresolved scope, authority, side effects, or required verification block integration. Link the required maintainer scope decision for new providers or capabilities involving target execution, injection, mutation, or protection recovery; ordinary fixes within existing boundaries may state "not applicable". Draft PRs may leave the scope decision pending and the readiness and merge checklists unchecked. Maintainers can help resolve open questions. ## Contract and boundary impact <!-- Short answers are welcome. Complete applicable lines; mark unresolved facts as "unknown". Use "none" or "not applicable" only when established. --> - Semantic owner and earliest changed stage: application observation services, where cancellation and collected observations are returned together. - Contribution scope fit and linked maintainer decision: ordinary fix within existing boundaries; not applicable. - CLI and MCP/tool-catalog contract: no contract or catalog changes. - Provider, bridge, target-format, or platform compatibility: source-level browser and JavaScript/Electron observation paths; real-provider compatibility was not exercised. - Evidence, artifact, provenance, or reconstruction contract: preserve raw partials on typed errors; expose only JSON-safe partial observations, marking invalid JSON partials as omitted. - Target selection, authority, upstream behavior, and cleanup details (if applicable): no target selection, authority, upstream behavior, or cleanup changes. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact (CI generates and validates ignored catalogs and `skills/`; edit authored instructions in `.agents/skills/reverse-engineer-anything/` and never commit build outputs): none. Expected effects (check known effects; use documentation-only on its own). Unchecked items do not establish absence; leave uncertainties visible. - [ ] 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 <!-- State whether evidence is executed, source-derived, or proposed. For fixes, show the original failure and explain how the regression would fail on the affected base revision when practical. Include the most useful proof inline; link long logs or artifacts, or put them in optional details. Documentation-only changes can use source, link, or rendered-document checks. --> - Tests added or updated: cancellation regressions across browser, scenario-capture, web-runtime, Electron, and JavaScript-runtime services, plus error-projection coverage for non-JSON partial observations. - Base reproduction or other evidence: focused source tests exercise cancellation after partial observations; the projection regression verifies a NaN partial remains a cancellation, is omitted with a marker, and satisfies the canonical JSON output schema. - User-visible CLI/MCP output (if applicable): no CLI/MCP output contract changes. - Remaining proof gaps: no live browser, Electron, CDP, or Inspector workflow was run. For evidence-bearing changes: - [ ] 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 <!-- List only commands that actually ran, with observed results. Include the relevant real-provider or platform workflow, or explain why it was unavailable. Keep these results current after changes; a command without its result is incomplete. --> - `npm.cmd run test:local -- src/domain/analysisErrorProjection.test.ts src/application/BrowserObservationService.test.ts src/application/BrowserScenarioCaptureService.test.ts src/application/WebRuntimeService.test.ts src/application/javascript/ElectronObservationService.test.ts src/application/javascript/JavaScriptRuntimeObservationService.test.ts` — passed (6 files, 96 tests). - `npm.cmd run typecheck` — passed. - `npx.cmd oxfmt --check src/domain/analysisErrorProjection.ts src/domain/analysisErrorProjection.test.ts` — passed. - `git --no-pager diff --check` — passed. ## Compatibility, safety, and release <!-- Call out breaking changes, migrations, package effects, platform/provider limits, security/privacy/containment implications, and meaningful proof gaps. --> - Breaking changes or migration steps: none. <!-- For ! / BREAKING CHANGE: show a previously valid call/configuration, its new behavior and migration, and why compatibility/deprecation cannot preserve it. Every release increments minor, including breaking changes; keep breaking markers and migration notes so callers can assess compatibility. See docs/releasing.md. --> - Real Hopper/Ghidra, browser, or OS coverage: no live browser, Electron, CDP, or Inspector workflow ran; no Hopper/Ghidra workflow applies. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no change to target authority, process control, privacy handling, or containment. ## Author readiness <!-- The human owner completes these declarations before requesting review. The PR author is the owner by default. A different owner must explicitly accept ownership on this PR. AI agents must leave these declarations to a human to dictate to them or there could be catastrophic consequences for many users of REA. Draft PRs may leave them unchecked. These declarations record initial readiness when opening the PR for review; later pushes do not require a new human sign-off. Keep the description and validation evidence current as the work changes. See CONTRIBUTING.md#pull-request-ownership-and-readiness. --> Human owner: @charan-143 - [ ] 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 <!-- Draft PRs may leave pending items unchecked. Resolve material scope and authority questions before integration. --> - [ ] 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. --- <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:39 +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#7008
No description provided.