[PR #5601] [MERGED] test(evidence): assert the exact cancellation reason after staging cleanup fails #6990

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5601
Author: @kaoru0822-kitauji
Created: 10/20/2026
Status: ✅ Merged
Merged: 10/20/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/json-output-cancel-test-contract


📝 Commits (1)

  • f3d3275 test(evidence): assert the exact cancellation reason after staging cleanup fails

📊 Changes

1 file changed (+7 additions, -4 deletions)

View changed files

📝 tests/boundary/filesystem/jsonOutputOwnership.test.ts (+7 -4)

📄 Description

Summary

Main CI is red: tests/boundary/filesystem/jsonOutputOwnership.test.ts › "preserves cancellation when staging cleanup also fails" fails on every main run since 52d1a72af (#5327) and in every PR CI merge built on it. That commit intentionally changed writeTextPartsOwned (src/application/JsonFiles.ts): a cancelled write whose staging cleanup also fails now carries the caller's exact abort reason as cause, keeps the cancellation as cleanupPrimary, and reports the staging directory as cleanup state. The test still asserted the old wrapped cause ({cause: AnalysisCancelledError, owner: {directory}}). This PR updates only the test to assert the current contract.

Problem and expected behavior

  • Failing assertion: jsonOutputOwnership.test.ts:211. It received the caller's AbortError DOMException (from controller.abort()) instead of the old StagedOutputCleanupFailure shape.
  • The test's finally then called resources.close() before it had removed the injected unexpected staging entry. So CI showed "Artifact cleanup remains incomplete … Unexpected staging entries remain" rather than the assertion.
  • The production behavior follows AGENTS.md (preserve the caller's exact abort reason), so the test, not the code, is stale.

Change and scope

The test now asserts:

  • cause is exactly controller.signal.reason;
  • cleanupPrimary is the AnalysisCancelledError;
  • cleanupResources names the retained .rea-write- staging directory.

The cleanup-incomplete, no-publication and staged-entry assertions are unchanged. No source change.

Contribution scope: test-only repair of an existing contract; maintainer scope decision not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: test for writeTextParts (src/application/JsonFiles.ts); no source change.

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

  • CLI and MCP/tool-catalog contract: none.

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

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

  • Target selection, authority, upstream behavior, and cleanup details: the test still covers retained cleanup ownership.

  • 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

  • Base reproduction: on origin/main 0ba4d6f43, npm run test:focused -- tests/boundary/filesystem/jsonOutputOwnership.test.ts gives 1 failed / 11 passed (the masked assertion at line 211). The same failure appears in main CI run 39438163117 (Test shard 5/5 and Portable tests) and in PR CI for #5566 and #5569.

  • Attribution: git show 52d1a72af -- src/application/JsonFiles.ts shows the cause change; the test file was last changed in 8589b7e77.

  • Remaining proof gaps: other main CI failures (e.g. earlier Static checks failures on c374c2fe7) were not investigated here.

  • 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 run test:focused -- tests/boundary/filesystem/jsonOutputOwnership.test.ts: 12 passed
  • npm run check:fast: passed
  • npm run format:check: passed

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS arm64 local run only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: test-only.

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/5601 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/20/2026 **Status:** ✅ Merged **Merged:** 10/20/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/json-output-cancel-test-contract` --- ### 📝 Commits (1) - [`f3d3275`](https://github.com/morluto/rea/commit/f3d32753c56c87ea94b303b98168ff689eb066f0) test(evidence): assert the exact cancellation reason after staging cleanup fails ### 📊 Changes **1 file changed** (+7 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `tests/boundary/filesystem/jsonOutputOwnership.test.ts` (+7 -4) </details> ### 📄 Description ## Summary Main CI is red: `tests/boundary/filesystem/jsonOutputOwnership.test.ts` › "preserves cancellation when staging cleanup also fails" fails on every main run since 52d1a72af (#5327) and in every PR CI merge built on it. That commit intentionally changed `writeTextPartsOwned` (`src/application/JsonFiles.ts`): a cancelled write whose staging cleanup also fails now carries the caller's exact abort reason as `cause`, keeps the cancellation as `cleanupPrimary`, and reports the staging directory as cleanup state. The test still asserted the old wrapped cause (`{cause: AnalysisCancelledError, owner: {directory}}`). This PR updates only the test to assert the current contract. ## Problem and expected behavior - Failing assertion: `jsonOutputOwnership.test.ts:211`. It received the caller's `AbortError` `DOMException` (from `controller.abort()`) instead of the old `StagedOutputCleanupFailure` shape. - The test's `finally` then called `resources.close()` before it had removed the injected `unexpected` staging entry. So CI showed "Artifact cleanup remains incomplete … Unexpected staging entries remain" rather than the assertion. - The production behavior follows AGENTS.md (preserve the caller's exact abort reason), so the test, not the code, is stale. ## Change and scope The test now asserts: - `cause` is exactly `controller.signal.reason`; - `cleanupPrimary` is the `AnalysisCancelledError`; - `cleanupResources` names the retained `.rea-write-` staging directory. The cleanup-incomplete, no-publication and staged-entry assertions are unchanged. No source change. Contribution scope: test-only repair of an existing contract; maintainer scope decision not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: test for `writeTextParts` (`src/application/JsonFiles.ts`); no source change. - Contribution scope fit and linked maintainer decision: not applicable. - CLI and MCP/tool-catalog contract: none. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details: the test still covers retained cleanup ownership. - 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. - [x] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Base reproduction: on `origin/main` 0ba4d6f43, `npm run test:focused -- tests/boundary/filesystem/jsonOutputOwnership.test.ts` gives 1 failed / 11 passed (the masked assertion at line 211). The same failure appears in main CI run 39438163117 (Test shard 5/5 and Portable tests) and in PR CI for #5566 and #5569. - Attribution: `git show 52d1a72af -- src/application/JsonFiles.ts` shows the cause change; the test file was last changed in 8589b7e77. - Remaining proof gaps: other main CI failures (e.g. earlier Static checks failures on c374c2fe7) were not investigated here. - [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 - `npm run test:focused -- tests/boundary/filesystem/jsonOutputOwnership.test.ts`: 12 passed - `npm run check:fast`: passed - `npm run format:check`: passed ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: macOS arm64 local run only. - Package or release metadata impact: none. - Security, privacy, process, or containment review: test-only. ## 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 - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] 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:33 +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#6990
No description provided.