Realtime message send + push message send on channel#310
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis PR adds a Changes
Review Notes
|
There was a problem hiding this comment.
Review Summary
The feature is well-scoped: a --message flag for push publish that includes realtime message data alongside the push extras when publishing via --channel. The validation logic is correct (errors if --message used without --channel, warns if a direct recipient overrides --channel). Two issues worth addressing:
1. messageData: true in JSON output omits actual content
File: src/commands/push/publish.ts, lines 293–303
...(flags.message ? { messageData: true } : {}),The JSON result confirms that a message was included (messageData: true) but drops the actual content that was sent. A programmatic consumer using --json for auditing or pipeline verification can't tell what data was published — just that something was.
The fix is straightforward: emit the actual parsed value instead of the boolean sentinel:
...(flags.message ? { messageData: publishMessage.data } : {}),publishMessage.data is already set at this point (lines 283–288), so this costs nothing and makes the JSON output self-describing.
2. Non-standard test describe block
File: test/unit/commands/push/publish.test.ts, line 201
describe("--message flag (realtime message data)", () => {This is a sibling of "functionality" and "error handling" but doesn't match any of the 5 required standard block names. The new test cases belong in the existing describe("functionality" block (happy-path tests) and describe("error handling" block (the "fail without --channel" case). The test coverage itself is solid — it's just the placement that needs adjusting.
Both changes are small. The JSON output issue is the more meaningful one since it affects consumers relying on --json for automation.
92b5eaf to
7280b19
Compare
Allows sending a realtime message and a push message when using push commands targeting a channel.
Opted for a flag instead of a positional arg so it's clearer what the realtime message data is and what the push object is. There are also checks to guard against using the flag where it is incompatible e.g. using the message flag with a client id push.
Fixes #256