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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

- Build with Go 1.27.4 to fix the reachable HTTP/1 header race (GO-2026-6859), retaining the Go 1.26.6 module minimum.

- Reject new posts and thread replies to archived channels with a clear HTTP 409 error, and document restoring a channel without changing its ID. Thanks @tre1d.

- List the commands in `clickclack help`, `-h`, and `--help` instead of only the client flags; `clickclack help` no longer fails with `unknown command "help"`. Thanks @KrasimirKralev.

## 0.9.4 - 2026-11-05
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ COPY packages packages
COPY scripts scripts
RUN pnpm build

FROM golang:1.27.3-alpine@sha256:f2c872bcee949b7be9c490efd02b48a8a2fbf947cdf533f1c58525ec9d8170fd AS api
FROM golang:1.27.4-alpine@sha256:0a5f7fe796599ff487605987432e7619ae45beeb2fba4c2ce0b907879932aebf AS api
RUN apk add --no-cache --upgrade ca-certificates=20261020-r0 ca-certificates-bundle=20261020-r0
WORKDIR /src
COPY go.mod go.sum ./
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.cloudflare
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ COPY packages packages
COPY scripts scripts
RUN pnpm build

FROM golang:1.27.3-alpine@sha256:f2c872bcee949b7be9c490efd02b48a8a2fbf947cdf533f1c58525ec9d8170fd AS api
FROM golang:1.27.4-alpine@sha256:0a5f7fe796599ff487605987432e7619ae45beeb2fba4c2ce0b907879932aebf AS api
RUN apk add --no-cache --upgrade ca-certificates=20261020-r0 ca-certificates-bundle=20261020-r0
WORKDIR /src
COPY go.mod go.sum ./
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ The complete documentation is at **[docs.clickclack.chat](https://docs.clickclac

## Development

Source builds use Go 1.27.3, Node.js 24 or newer, and pnpm 12.15.0. The module minimum remains Go 1.26.6 so managed CodeQL can build with its preinstalled compiler; the `toolchain` directive selects Go 1.27.3 for normal builds.
Source builds use Go 1.27.4, Node.js 24 or newer, and pnpm 12.15.0. The module minimum remains Go 1.26.6 so managed CodeQL can build with its preinstalled compiler; the `toolchain` directive selects Go 1.27.4 for normal builds.

```sh
pnpm install --frozen-lockfile
Expand Down
2 changes: 2 additions & 0 deletions apps/api/internal/httpapi/message_routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net/http"
"net/http/httptest"
"path/filepath"
"strings"
"testing"

"github.com/openclaw/clickclack/apps/api/internal/realtime"
Expand Down Expand Up @@ -132,6 +133,7 @@ func TestEnsureMessageRouteEndpointIsLazyBoundedAndPermissionChecked(t *testing.
patchJSON[struct {
Channel store.Channel `json:"channel"`
}](t, server.URL+"/api/channels/"+channel.ID, map[string]bool{"archived": true})
expectStatusAsUser(t, member.ID, http.MethodPost, server.URL+"/api/channels/"+channel.ID+"/messages", strings.NewReader(`{"body":"archived"}`), http.StatusConflict)
archived := postJSONAsUser[struct {
Message store.Message `json:"message"`
}](t, member.ID, server.URL+"/api/messages/"+archivedRoot.ID+"/route", struct{}{})
Expand Down
2 changes: 2 additions & 0 deletions apps/api/internal/httpapi/responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ func writeStoreError(w http.ResponseWriter, err error) {
writeError(w, http.StatusNotFound, err)
case errors.Is(err, store.ErrModerationRestricted):
writeError(w, http.StatusForbidden, err)
case errors.Is(err, store.ErrChannelArchived):
writeError(w, http.StatusConflict, err)
case errors.Is(err, store.ErrNotWorkspaceManager):
writeError(w, http.StatusForbidden, err)
case errors.Is(err, store.ErrNotWorkspaceMember):
Expand Down
7 changes: 7 additions & 0 deletions apps/api/internal/store/postgres/moderation.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ func requireCanPostTx(ctx context.Context, tx *sql.Tx, workspaceID, channelID, u
if err := requireNoModerationBlockTx(ctx, tx, workspaceID, userID); err != nil {
return err
}
channel, err := storedb.New(tx).GetChannel(ctx, channelID)
if err != nil {
return err
}
if channel.ArchivedAt.Valid {
return store.ErrChannelArchived
}
if role != store.WorkspaceRoleGuest {
return nil
}
Expand Down
50 changes: 50 additions & 0 deletions apps/api/internal/store/postgres/moderation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,53 @@ func TestModerationHydrationFailureRollsBack(t *testing.T) {
t.Fatalf("failed moderation committed an event: before=%s after=%s error=%v", before, after, err)
}
}

func TestCreateMessageRejectsArchivedChannel(t *testing.T) {
ctx := t.Context()
st := newIsolatedPostgresTestStore(t)
if err := st.Migrate(ctx); err != nil {
t.Fatal(err)
}
owner, err := st.EnsureBootstrap(ctx, "Owner", "archived-owner@example.com")
if err != nil {
t.Fatal(err)
}
workspaces, err := st.ListWorkspaces(ctx, owner.ID)
if err != nil {
t.Fatal(err)
}
if len(workspaces) == 0 {
t.Fatal("expected a workspace")
}
workspace := workspaces[0]
channels, err := st.ListChannels(ctx, workspace.ID, owner.ID)
if err != nil {
t.Fatal(err)
}
if len(channels) == 0 {
t.Fatal("expected a channel")
}
channel := channels[0]
root, _, err := st.CreateMessage(ctx, store.CreateMessageInput{ChannelID: channel.ID, AuthorID: owner.ID, Body: "before archive"})
if err != nil {
t.Fatal(err)
}
archived := true
if _, _, err := st.UpdateChannel(ctx, store.UpdateChannelInput{ChannelID: channel.ID, UserID: owner.ID, Archived: &archived}); err != nil {
t.Fatal(err)
}
if _, _, err := st.CreateMessage(ctx, store.CreateMessageInput{ChannelID: channel.ID, AuthorID: owner.ID, Body: "blocked"}); !errors.Is(err, store.ErrChannelArchived) {
t.Fatalf("expected ErrChannelArchived, got %v", err)
}
if _, _, _, err := st.CreateThreadReply(ctx, store.CreateThreadReplyInput{RootMessageID: root.ID, AuthorID: owner.ID, Body: "blocked reply"}); !errors.Is(err, store.ErrChannelArchived) {
t.Fatalf("expected archived reply rejection, got %v", err)
}
archived = false
restored, _, err := st.UpdateChannel(ctx, store.UpdateChannelInput{ChannelID: channel.ID, UserID: owner.ID, Archived: &archived})
if err != nil || restored.ID != channel.ID {
t.Fatalf("restore must preserve channel ID: channel=%+v err=%v", restored, err)
}
if _, _, err := st.CreateMessage(ctx, store.CreateMessageInput{ChannelID: channel.ID, AuthorID: owner.ID, Body: "restored"}); err != nil {
t.Fatalf("restored channel must accept messages: %v", err)
}
}
7 changes: 7 additions & 0 deletions apps/api/internal/store/sqlite/moderation.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ func requireCanPostTx(ctx context.Context, tx *sql.Tx, workspaceID, channelID, u
if err := requireNoModerationBlockTx(ctx, tx, workspaceID, userID); err != nil {
return err
}
channel, err := storedb.New(tx).GetChannel(ctx, channelID)
if err != nil {
return err
}
if channel.ArchivedAt.Valid {
return store.ErrChannelArchived
}
if role != store.WorkspaceRoleGuest {
return nil
}
Expand Down
50 changes: 50 additions & 0 deletions apps/api/internal/store/sqlite/moderation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,3 +666,53 @@ func TestModerationHydrationFailureRollsBack(t *testing.T) {
t.Fatalf("failed moderation committed an event: before=%s after=%s error=%v", before, after, err)
}
}

func TestCreateMessageRejectsArchivedChannel(t *testing.T) {
ctx := t.Context()
st := newTestStore(t)
if err := st.Migrate(ctx); err != nil {
t.Fatal(err)
}
owner, err := st.EnsureBootstrap(ctx, "Owner", "archived-owner@example.com")
if err != nil {
t.Fatal(err)
}
workspaces, err := st.ListWorkspaces(ctx, owner.ID)
if err != nil {
t.Fatal(err)
}
if len(workspaces) == 0 {
t.Fatal("expected a workspace")
}
workspace := workspaces[0]
channels, err := st.ListChannels(ctx, workspace.ID, owner.ID)
if err != nil {
t.Fatal(err)
}
if len(channels) == 0 {
t.Fatal("expected a channel")
}
channel := channels[0]
root, _, err := st.CreateMessage(ctx, store.CreateMessageInput{ChannelID: channel.ID, AuthorID: owner.ID, Body: "before archive"})
if err != nil {
t.Fatal(err)
}
archived := true
if _, _, err := st.UpdateChannel(ctx, store.UpdateChannelInput{ChannelID: channel.ID, UserID: owner.ID, Archived: &archived}); err != nil {
t.Fatal(err)
}
if _, _, err := st.CreateMessage(ctx, store.CreateMessageInput{ChannelID: channel.ID, AuthorID: owner.ID, Body: "blocked"}); !errors.Is(err, store.ErrChannelArchived) {
t.Fatalf("expected ErrChannelArchived, got %v", err)
}
if _, _, _, err := st.CreateThreadReply(ctx, store.CreateThreadReplyInput{RootMessageID: root.ID, AuthorID: owner.ID, Body: "blocked reply"}); !errors.Is(err, store.ErrChannelArchived) {
t.Fatalf("expected archived reply rejection, got %v", err)
}
archived = false
restored, _, err := st.UpdateChannel(ctx, store.UpdateChannelInput{ChannelID: channel.ID, UserID: owner.ID, Archived: &archived})
if err != nil || restored.ID != channel.ID {
t.Fatalf("restore must preserve channel ID: channel=%+v err=%v", restored, err)
}
if _, _, err := st.CreateMessage(ctx, store.CreateMessageInput{ChannelID: channel.ID, AuthorID: owner.ID, Body: "restored"}); err != nil {
t.Fatalf("restored channel must accept messages: %v", err)
}
}
3 changes: 3 additions & 0 deletions apps/api/internal/store/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ var ErrInvalidEventDeliveryCursor = errors.New("invalid or stale event delivery
// a write. HTTP callers surface it as a 403 or 429 depending on the rule.
var ErrModerationRestricted = errors.New("moderation restriction")

// ErrChannelArchived is returned when a post targets an archived channel.
var ErrChannelArchived = errors.New("channel is archived; choose an active channel or ask a workspace owner to restore it")

// ErrMessageNotWritable is returned when a user can read a message but cannot
// mutate it.
var ErrMessageNotWritable = errors.New("message is not writable")
Expand Down
2 changes: 1 addition & 1 deletion docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ docker run --rm -p 8080:8080 -v clickclack-data:/app/data clickclack
Stages:

1. `node:26-alpine` — installs pnpm dependencies and runs `pnpm build`.
2. `golang:1.27.3-alpine` — builds the Go binary, importing the SPA dist.
2. `golang:1.27.4-alpine` — builds the Go binary, importing the SPA dist.
3. `alpine:3.24` — runtime image, runs as the `clickclack` user, exposes
`8080`, mounts `/app/data` as a volume.

Expand Down
7 changes: 7 additions & 0 deletions docs/features/workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ the nullable display, external, or sidebar fields clears that field.
Omitted fields retain their current values, including changes committed by
concurrent updates.

Archived channels retain their history and identity, but reject new messages,
thread replies, and other posting activity with HTTP `409` and a clear
`channel is archived` error. Restore one with `PATCH /api/channels/{channel_id}`
and `{"archived": false}`; it keeps the same ID and links. Creating another
channel is a separate operation and allocates a new ID. There is no channel
purge endpoint.

Channel updates require a workspace owner or an appropriately scoped bot.
The web app only offers channel settings to owners; other people receive
`403 workspace owner permission required` if they call the update API directly.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/openclaw/clickclack

go 1.26.6

toolchain go1.27.3
toolchain go1.27.4

require (
github.com/coder/websocket v1.8.15
Expand Down
Loading