fix(whatsapp): preserve outbound document filenames#15594
fix(whatsapp): preserve outbound document filenames#15594steipete merged 4 commits intoopenclaw:mainfrom
Conversation
| vi.mock("../../infra/channel-activity.js", () => ({ | ||
| recordChannelActivity: (...args: unknown[]) => recordChannelActivity(...args), | ||
| })); |
There was a problem hiding this comment.
Broken mock import path
send-api.ts imports recordChannelActivity from "../../infra/channel-activity.js" (relative to src/web/inbound/send-api.ts), but this test mocks "../../infra/channel-activity.js" relative to src/web/inbound/send-api.test.ts, which resolves to src/web/infra/channel-activity.js (non-existent) and won’t stub the real dependency. This will either throw during module resolution or cause the real recordChannelActivity to run.
| vi.mock("../../infra/channel-activity.js", () => ({ | |
| recordChannelActivity: (...args: unknown[]) => recordChannelActivity(...args), | |
| })); | |
| vi.mock("../../../infra/channel-activity.js", () => ({ | |
| recordChannelActivity: (...args: unknown[]) => recordChannelActivity(...args), | |
| })); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/web/inbound/send-api.test.ts
Line: 4:6
Comment:
**Broken mock import path**
`send-api.ts` imports `recordChannelActivity` from `"../../infra/channel-activity.js"` (relative to `src/web/inbound/send-api.ts`), but this test mocks `"../../infra/channel-activity.js"` relative to `src/web/inbound/send-api.test.ts`, which resolves to `src/web/infra/channel-activity.js` (non-existent) and won’t stub the real dependency. This will either throw during module resolution or cause the real `recordChannelActivity` to run.
```suggestion
vi.mock("../../../infra/channel-activity.js", () => ({
recordChannelActivity: (...args: unknown[]) => recordChannelActivity(...args),
}));
```
How can I resolve this? If you propose a fix, please make it concise.|
Addressed, thanks. Updated the mock path to in and pushed commit f34019f. |
|
Follow-up with exact details:
|
|
I investigated the current The failing error is:
I reproduced it by running I will re-run/refresh once the base-branch lint issue is resolved, and keep this PR branch updated. |
|
Follow-up: I opened a focused base-fix PR for the lint regression here: #15610.\n\nIf that merges, this PR's should stop failing for the external blocker. |
|
Correction with exact text:
Tracked/fixed in #15610. |
|
Applied the baseline lint fix directly to this branch. New commit:
This should unblock the |
6a427c8 to
63912bd
Compare
|
Rebased this branch onto latest Current head: |
63912bd to
bd81694
Compare
|
Hey! 👋 CI is all green on this one. Would you have time to take a look? Happy to make changes if needed. Thanks! |
bd81694 to
78e45bd
Compare
78e45bd to
8e0d765
Compare
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 8e0d765 Co-authored-by: TsekaLuk <[email protected]> Co-authored-by: steipete <[email protected]> Reviewed-by: @steipete
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 8e0d765 Co-authored-by: TsekaLuk <[email protected]> Co-authored-by: steipete <[email protected]> Reviewed-by: @steipete
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 8e0d765 Co-authored-by: TsekaLuk <[email protected]> Co-authored-by: steipete <[email protected]> Reviewed-by: @steipete
- Extends fix from openclaw#15594 to preserve filenames for outbound documents - Propagates fileName through the delivery pipeline (infra, adapters, and web) - Resolves issue where PDFs/docs display as 'file' on the recipient device - Added unit test to verify custom filename priority Fixes openclaw#15594
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 8e0d765 Co-authored-by: TsekaLuk <[email protected]> Co-authored-by: steipete <[email protected]> Reviewed-by: @steipete
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 8e0d765 Co-authored-by: TsekaLuk <[email protected]> Co-authored-by: steipete <[email protected]> Reviewed-by: @steipete
Summary
sendOptions.fileNamefor document payloads instead of hardcoding"file""file"when filename is absentWhy
Outbound WhatsApp documents currently always appear as
fileon the receiver side because filename is hardcoded increateWebSendApi().Changes
src/web/outbound.ts: capture documentmedia.fileNameand include it inActiveWebSendOptionssrc/web/active-listener.ts: add optionalfileNametoActiveWebSendOptionssrc/web/inbound/send-api.ts: usesendOptions?.fileName?.trim() || "file"for document payloadssrc/web/outbound.test.ts: assert filename is propagated for document sendssrc/web/inbound/send-api.test.ts(new): verify both propagated filename and default fallback behaviorFixes #15560
Validation
pnpm checkpnpm buildpnpm vitest run src/web/outbound.test.ts src/web/inbound/send-api.test.tspnpm test:fast(fails on existing unrelatedsrc/security/audit.test.tsassertion in local skill-scan fixture; unchanged by this PR)Greptile Overview
Greptile Summary
This PR threads a resolved media filename from WhatsApp outbound media loading into the active web send options, and updates the inbound send API to use that filename for document payloads (falling back to
"file"when absent). Tests were updated/added to assert filename propagation and default behavior.One blocking issue: the new
src/web/inbound/send-api.test.tsmocksrecordChannelActivityusing an incorrect relative path, so the mock won’t apply (and may fail module resolution). Fixing the mock path should make the new tests reliable.Confidence Score: 4/5
Last reviewed commit: e1f7784