Skip to content

test(feishu): drop the stale never-iterated assertion on storage failure - #207000

Merged
obviyus merged 1 commit into
mainfrom
fix/feishu-media-download-ownership
Nov 27, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/feishu-media-download-ownership

Conversation

@obviyus

@obviyus obviyus commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Problem

extensions/feishu/src/media-download.test.ts › "closes an acquired stream on storage failure even when teardown throws" fails on main: expected "Mock" to not be called at all, but actually been called 1 times. Every PR that changes package.json runs this lane, so each one needs a CI override.

Root cause

#206815 (d1a11af0, "keep the Gateway running when a WhatsApp attachment fails to decrypt") made the shared sink saveMediaStream (src/media/store.ts:557-588) start reading its source on entry, before directory and temp-file setup, so a hot source that fails early rejects the save instead of crashing the Gateway. Its body names Feishu as a caller that gets the same guarantee. When staging then fails, the sink closes the source.

The Feishu test still asserted that the stream is never iterated when storage fails, which contradicts that intended contract.

Fix

Drop the stale "never iterated" assertion and its spy. The test keeps what it is about: on a storage failure the download rejects with the storage error, the stream is destroyed even though destroy() throws, and the server sees the connection close. No production change.

Impact

Contributors only. The extension lane no longer fails on main.

Evidence

  • Main de4d1cc8: 1 failed / 1 (iterate called once).
  • This branch: 1 passed / 1.
  • Adversarial review: the remaining assertions still catch the failure the test exists for. Remove teardownSource() from the outer catch in media-chunk-idle.ts and stream.destroyed and the server close both fail; remove its try/catch and the rejection becomes the teardown error.

- #206815 made saveMediaStream read its source on entry so an early source failure rejects the save; the stream is then closed.
- The test keeps its contract: rejects with the storage error, destroys the stream although destroy() throws, and the server sees the close.
@clawsweeper

clawsweeper Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: XS labels Nov 27, 2026
@clawsweeper clawsweeper Bot added the P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. label Nov 27, 2026
@obviyus
obviyus merged commit 09d25c4 into main Nov 27, 2026
96 checks passed
@obviyus
obviyus deleted the fix/feishu-media-download-ownership branch November 27, 2026 23:16
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
…ure (openclaw#207000)

## Problem

`extensions/feishu/src/media-download.test.ts` › "closes an acquired stream on storage failure even when teardown throws" fails on main: `expected "Mock" to not be called at all, but actually been called 1 times`. Every PR that changes `package.json` runs this lane, so each one needs a CI override.

## Root cause

openclaw#206815 (`92a7a47e`, "keep the Gateway running when a WhatsApp attachment fails to decrypt") made the shared sink `saveMediaStream` (`src/media/store.ts:557-588`) start reading its source on entry, before directory and temp-file setup, so a hot source that fails early rejects the save instead of crashing the Gateway. Its body names Feishu as a caller that gets the same guarantee. When staging then fails, the sink closes the source.

The Feishu test still asserted that the stream is never iterated when storage fails, which contradicts that intended contract.

## Fix

Drop the stale "never iterated" assertion and its spy. The test keeps what it is about: on a storage failure the download rejects with the storage error, the stream is destroyed even though `destroy()` throws, and the server sees the connection close. No production change.

## Impact

Contributors only. The extension lane no longer fails on main.

## Evidence

- Main `2afe305c`: 1 failed / 1 (`iterate` called once).
- This branch: 1 passed / 1.
- Adversarial review: the remaining assertions still catch the failure the test exists for. Remove `teardownSource()` from the outer catch in `media-chunk-idle.ts` and `stream.destroyed` and the server close both fail; remove its try/catch and the rejection becomes the teardown error.
- Local review on this head: patch is correct, 0 findings.

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 28, 2026
Adapt upstream #207000 (09d25c4) for the release. The shared sink starts iterating hot input before staging after #206815. Replace the obsolete no-iteration expectation with an explicit teardown-attempt assertion, retaining the storage-error identity, destroyed stream, and socket-close checks.

Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 28, 2026
…ure (#207000)

## Problem

`extensions/feishu/src/media-download.test.ts` › "closes an acquired stream on storage failure even when teardown throws" fails on main: `expected "Mock" to not be called at all, but actually been called 1 times`. Every PR that changes `package.json` runs this lane, so each one needs a CI override.

## Root cause

#206815 (`d1a11af0`, "keep the Gateway running when a WhatsApp attachment fails to decrypt") made the shared sink `saveMediaStream` (`src/media/store.ts:557-588`) start reading its source on entry, before directory and temp-file setup, so a hot source that fails early rejects the save instead of crashing the Gateway. Its body names Feishu as a caller that gets the same guarantee. When staging then fails, the sink closes the source.

The Feishu test still asserted that the stream is never iterated when storage fails, which contradicts that intended contract.

## Fix

Drop the stale "never iterated" assertion and its spy. The test keeps what it is about: on a storage failure the download rejects with the storage error, the stream is destroyed even though `destroy()` throws, and the server sees the connection close. No production change.

## Impact

Contributors only. The extension lane no longer fails on main.

## Evidence

- Main `de4d1cc8`: 1 failed / 1 (`iterate` called once).
- This branch: 1 passed / 1.
- Adversarial review: the remaining assertions still catch the failure the test exists for. Remove `teardownSource()` from the outer catch in `media-chunk-idle.ts` and `stream.destroyed` and the server close both fail; remove its try/catch and the rejection becomes the teardown error.
- Local review on this head: patch is correct, 0 findings.

Co-authored-by: Ayaan Zaidi <[email protected]>

(cherry picked from commit 09d25c4)

Release adaptation: None; source patch applied unchanged.

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant