Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/buzz-help.md
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ revokes all of them, and a pairing unused for 30 days expires.
**Settings → Shortcuts → Sending messages → Send with ⌘ Enter** (Ctrl+Enter
outside Apple platforms) swaps that on this device: Enter adds a line and
⌘/Ctrl+Enter sends. It starts off.
- If a message can't be sent, **Retry** appears under it right away. If its
delivery is only unconfirmed, Buzz waits about ten seconds before saying so.
- A plugin can require a recipient for a new conversation. Its default recipient
also applies to a saved draft with no recipients. Your text and formatting stay.
A recipient you select takes priority.
Expand Down
9 changes: 5 additions & 4 deletions docs/shell-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,11 @@ and their retry controls remain visible.
The composer preserves the session's text sending and keyboard behavior. Its
rounded input and lavender send arrow follow the reference; unsupported upload,
mention, and rich-formatting actions are not presented as working controls.
Delivery renders like an ordinary message immediately. After ten seconds from the
message timestamp, unsuccessful/unconfirmed sends show a small notice. Confirmed
messages never show a success label. Retry remains available for failed/unknown
operations. `delivery.test.ts` covers the timing boundary and terminal states.
Delivery renders like an ordinary message immediately. A failed send shows a
small notice as soon as it fails; an unconfirmed send shows one only after ten
seconds from the message timestamp. Confirmed messages never show a success
label. Retry remains available for failed/unknown operations. `delivery.test.ts`
covers the timing boundary and terminal states.

The shared conversation layer now supplies bounded thread reading/replies and
[session-owned unread indicators](unread.md). These are separate from this styling
Expand Down
26 changes: 25 additions & 1 deletion src/features/messages/DeliveryNotice.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { afterEach, expect, it, vi } from "vitest";
import { DeliveryNotice } from "./DeliveryNotice";
import type { ChannelMessage } from "../relay/contracts";

afterEach(cleanup);
afterEach(() => {
cleanup();
vi.useRealTimers();
});
const row: ChannelMessage = {
id: "message",
channelId: "channel",
Expand Down Expand Up @@ -41,3 +44,24 @@ it.each(["sending", "accepted", "unknown", "failed"] as const)(
expect(!!screen.queryByRole("button", { name: "Retry" })).toBe(canRetry);
},
);

it("offers Retry as soon as a pending send fails, and stays quiet while unconfirmed", () => {
vi.useFakeTimers({ now: 100_050 });
const pending = { ...row, createdAt: 100 };
const retry = vi.fn();
const view = render(
<DeliveryNotice row={{ ...pending, delivery: "sending" }} retry={retry} />,
);
expect(screen.queryByRole("status")).not.toBeInTheDocument();
view.rerender(
<DeliveryNotice row={{ ...pending, delivery: "failed" }} retry={retry} />,
);
expect(screen.getByRole("status")).toHaveTextContent(
"Couldn’t send this message.",
);
expect(screen.getByRole("button", { name: "Retry" })).toBeInTheDocument();
view.rerender(
<DeliveryNotice row={{ ...pending, delivery: "unknown" }} retry={retry} />,
);
expect(screen.queryByRole("status")).not.toBeInTheDocument();
});
14 changes: 7 additions & 7 deletions src/features/messages/delivery.test.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { expect, it } from "vitest";
import { deliveryFeedback } from "./delivery";

it("keeps pending and rejected optimistic messages quiet for ten seconds", () => {
for (const delivery of [
"sending",
"accepted",
"unknown",
"failed",
] as const) {
it("keeps unconfirmed optimistic messages quiet for ten seconds", () => {
for (const delivery of ["sending", "accepted", "unknown"] as const) {
expect(
deliveryFeedback({ delivery, createdAt: 100 }, 109999),
).toBeUndefined();
expect(deliveryFeedback({ delivery, createdAt: 100 }, 110000)).toBeTruthy();
}
});
it("shows a failed send at once, inside the grace", () => {
expect(
deliveryFeedback({ delivery: "failed", createdAt: 100 }, 100_000),
).toBe("Couldn’t send this message.");
});
it("never adds success labels to confirmed or remote messages", () => {
expect(
deliveryFeedback({ delivery: "seen", createdAt: 100 }, 999999),
Expand Down
4 changes: 3 additions & 1 deletion src/features/messages/delivery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export function deliveryFeedback(
if (
!row.delivery ||
row.delivery === "seen" ||
now < row.createdAt * 1000 + DELIVERY_GRACE_MS
// Only an unconfirmed send waits; a failed one is already known.
(row.delivery !== "failed" &&
now < row.createdAt * 1000 + DELIVERY_GRACE_MS)
)
return undefined;
if (row.delivery === "failed") return "Couldn’t send this message.";
Expand Down
Loading