Skip to content

feat: group DM conversations — state + search (2/3)#25

Merged
ColonistOne merged 3 commits into
masterfrom
feat/group-dm-state-search
May 27, 2026
Merged

feat: group DM conversations — state + search (2/3)#25
ColonistOne merged 3 commits into
masterfrom
feat/group-dm-state-search

Conversation

@ColonistOne
Copy link
Copy Markdown
Collaborator

Summary

Second of three PRs porting the group-DM surface from colony-sdk Python v1.13.0. Stacked on top of #24 (lifecycle + members) so this PR's diff shows only its own changes — switch the base to master after #24 merges, or merge in order. No version bump.

Methods added (8)

State (per-participant — affects only the caller's notifications):

  • muteGroupConversation(convId, { until? }) — omit until for permanent; tokens "1h" / "8h" / "1d" / "1w" / "forever"
  • unmuteGroupConversation(convId) — idempotent
  • snoozeGroupConversation(convId, duration) — required token: "1h" / "3h" / "until_morning" / "1d" / "1w"
  • unsnoozeGroupConversation(convId) — idempotent
  • setGroupReadReceipts(convId, { show? }) — three-state override: true forces on, false forces off, undefined clears (falls back to user-level preference)

Pins (group-wide, admin-only):

  • pinGroupMessage(convId, msgId)
  • unpinGroupMessage(convId, msgId) — idempotent

Search:

  • searchGroupMessages(convId, q, { limit?, offset? }) — PostgreSQL FTS within a single group; returns {hits, total, has_more} with <mark>…</mark> highlights pre-rendered

New exported types

GroupMuteResponse, GroupSnoozeResponse, GroupReadReceiptsResponse, GroupPinResponse, GroupSearchHit, GroupSearchResponse.

Test plan

The 13 new tests pin:

  • Three-state setGroupReadReceipts (show: true?show=true, show: false?show=false, omitted → no query string at all)
  • FastAPI lowercase-bool quirk with explicit not.toContain("show=False")
  • Bare-POST shape for muteGroupConversation when until is omitted (server reads as forever)
  • R&D query escaping: q=R%26D
  • Default-vs-custom pagination on searchGroupMessages

Per the TheColonyCC/* convention, holding the merge button for human review.

🤖 Generated with Claude Code

Wraps the group-DM surface at /api/v1/messages/groups/* that the
Python SDK shipped in colony-sdk v1.13.0 (#56 over there). First of
three PRs that complete group-DM coverage in the JS SDK; per-message
ops + attachments will follow.

Lifecycle (6 methods):
- createGroupConversation(title, members, options?)
- listGroupTemplates(options?)
- createGroupFromTemplate(template, members, { titleOverride? })
- getGroupConversation(convId, { limit?, offset? })
- updateGroupConversation(convId, { title?, description? })
- sendGroupMessage(convId, body, { replyToMessageId?, idempotencyKey? })

Member management (7 methods):
- listGroupMembers, addGroupMember, removeGroupMember, setGroupAdmin,
  transferGroupCreator, respondToGroupInvite, markGroupAllRead

New exported types: GroupConversation, GroupConversationDetail,
GroupMember, GroupMembersResponse, GroupTemplate,
GroupTemplatesResponse, GroupInviteResponse, MarkGroupReadResponse.

Internal: RequestOptions gains an extraHeaders field so write methods
can set per-request headers like Idempotency-Key cleanly. Booleans on
query-string endpoints use the lowercase "true"/"false" FastAPI
expects, not JavaScript's default capitalised String(true).

19 new unit tests cover request shape, header threading, default-vs-
omitted parameters, the FastAPI lowercase-bool quirk, query-string
escaping (`R&D Lab` → `title=R%26D+Lab`), and the three-state
description contract on update (empty clears, undefined omits).

No version bump per the multi-PR release plan; CHANGELOG entry lands
in Unreleased.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

ColonistOne and others added 2 commits May 27, 2026 16:13
Two branches in the new methods weren't exercised by the original
test set:

- updateGroupConversation with only `title` (not just description) —
  the `if (options.title !== undefined)` true-branch was never hit
- createGroupFromTemplate without `titleOverride` — the optional-
  param branch was only exercised in the override-set case

Adds two focused tests; client.ts branch coverage moves from 97.41
to 98.27. All remaining uncovered branches are pre-existing in
register() and extractItems(), not introduced by this PR.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Mirrors colony-sdk Python PR #57 / v1.13.0 — 8 new methods layered
over the lifecycle methods from the prior PR.

State (per-participant — affects only the caller's notifications):
- muteGroupConversation(convId, { until? })
- unmuteGroupConversation(convId)
- snoozeGroupConversation(convId, duration)
- unsnoozeGroupConversation(convId)
- setGroupReadReceipts(convId, { show? }) — three-state override:
  true/false/undefined (undefined clears, falling back to user pref)

Pins (group-wide, admin-only):
- pinGroupMessage(convId, msgId)
- unpinGroupMessage(convId, msgId) — idempotent

Search:
- searchGroupMessages(convId, q, { limit?, offset? }) — PostgreSQL
  FTS within one group, with <mark>...</mark> highlights pre-rendered

New exported types: GroupMuteResponse, GroupSnoozeResponse,
GroupReadReceiptsResponse, GroupPinResponse, GroupSearchHit,
GroupSearchResponse.

13 new unit tests cover the three-state set-receipts surface
(true/false/undefined), the FastAPI lowercase-bool quirk
(`show=false` not `show=False`), query-string escaping
(`R&D` → `q=R%26D`), default-vs-custom pagination, and the bare-POST
shape for muteGroupConversation when `until` is omitted.

No version bump per the multi-PR release plan; CHANGELOG entry lands
in Unreleased above the lifecycle entry.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@ColonistOne ColonistOne force-pushed the feat/group-dm-state-search branch from 05d8c64 to 18c1bdf Compare May 27, 2026 15:45
@ColonistOne ColonistOne changed the base branch from feat/group-dm-lifecycle to master May 27, 2026 16:28
@ColonistOne ColonistOne merged commit ce005e0 into master May 27, 2026
4 checks passed
@ColonistOne ColonistOne deleted the feat/group-dm-state-search branch May 27, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant