2d73a3d1db
* fix: keep completed office comments editable Keep the office task detail composer editable after completed sessions load, including projectless office tasks. Update verification tests for SHA-pinned GitHub actions. Extract the dockview main area to satisfy the existing max-lines lint rule. * fix: preserve upload artifact version guard * fix: clarify upload artifact pin check * fix: wake completed office sessions on comments * fix: queue completed office comment runs * fix: preserve dispatcher session lookup errors * fix: resolve office comment wake review issues * fix: stabilize comment wake idempotency * fix: salt custom comment wake keys * fix: address comment wake review cleanup * fix: avoid comment payload allocation overflow pattern * fix: salt comment wake action variants * fix: resolve cross-task primary by target step * fix: resolve cross-task participant roles * fix: surface cross-task comment run status * fix: use target steps for cross-task queue runs * fix: avoid comment run lookup scan regression * fix: cover cross-task queue run edge cases * fix: index comment payload run lookup * fix: support postgres comment run index * fix: tighten queue run target test coverage * fix: route source comment run updates * fix: preserve cross-task comment wakes * fix: tighten comment wake identity * fix: align comment wake routing * fix: remove stale primary resolver * fix: dedupe comment run status * fix: tighten legacy comment wake dedupe * fix: remove unreachable comment wake guard * fix: skip duplicate comment reactivity wakes * fix: route comment wakes synchronously * fix: share comment engine dispatch contracts * fix: preserve comment wake fallbacks * fix: preserve done comment runner * fix: guard empty task runner fallback * fix: handle empty task runner fallback * fix: stabilize completed comment wakes * fix: index comment runner fallback --------- Co-authored-by: root <root@kandev.ts.net>
82 lines
2.0 KiB
Go
82 lines
2.0 KiB
Go
package commentkeys
|
|
|
|
import "testing"
|
|
|
|
func TestIdentityFromPayload(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
payload string
|
|
wantTask string
|
|
wantComment string
|
|
}{
|
|
{
|
|
name: "task and comment",
|
|
payload: `{"task_id":"target-task","comment_id":"cm-1"}`,
|
|
wantTask: "target-task",
|
|
wantComment: "cm-1",
|
|
},
|
|
{
|
|
name: "source task overrides task",
|
|
payload: `{"task_id":"target-task","source_task_id":"source-task","comment_id":"cm-1"}`,
|
|
wantTask: "source-task",
|
|
wantComment: "cm-1",
|
|
},
|
|
{
|
|
name: "comment id only",
|
|
payload: `{"comment_id":"cm-1"}`,
|
|
wantComment: "cm-1",
|
|
},
|
|
{
|
|
name: "source task without comment",
|
|
payload: `{"task_id":"target-task","source_task_id":"source-task"}`,
|
|
wantTask: "source-task",
|
|
},
|
|
{
|
|
name: "malformed",
|
|
payload: `{`,
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
gotTask, gotComment := IdentityFromPayload(tt.payload)
|
|
if gotTask != tt.wantTask || gotComment != tt.wantComment {
|
|
t.Fatalf("IdentityFromPayload() = (%q, %q), want (%q, %q)",
|
|
gotTask, gotComment, tt.wantTask, tt.wantComment)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestCommentIDFromKey(t *testing.T) {
|
|
tests := []struct {
|
|
key string
|
|
want string
|
|
}{
|
|
{key: "task_comment:cm-1", want: "cm-1"},
|
|
{key: "task_comment:cm-1:step-1:task-1:agent-1:abcd", want: "cm-1"},
|
|
{key: "other:cm-1", want: ""},
|
|
}
|
|
for _, tt := range tests {
|
|
if got := CommentIDFromKey(tt.key); got != tt.want {
|
|
t.Fatalf("CommentIDFromKey(%q) = %q, want %q", tt.key, got, tt.want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestIsSaltedTaskCommentKey(t *testing.T) {
|
|
tests := []struct {
|
|
key string
|
|
want bool
|
|
}{
|
|
{key: "task_comment:cm-1", want: false},
|
|
{key: "task_comment:cm-1:step-1:task-1:agent-1:abcd", want: true},
|
|
{key: "other:cm-1:step-1", want: false},
|
|
}
|
|
for _, tt := range tests {
|
|
if got := IsSaltedTaskCommentKey(tt.key); got != tt.want {
|
|
t.Fatalf("IsSaltedTaskCommentKey(%q) = %v, want %v", tt.key, got, tt.want)
|
|
}
|
|
}
|
|
}
|