Remove markdown test docs and document tests inline

This commit is contained in:
2026-03-24 02:30:38 +08:00
parent fb2b2dc8be
commit fd2b57feaf
257 changed files with 174 additions and 10431 deletions
@@ -6,6 +6,7 @@ import (
"testing"
)
// TestCancelMarksThreadCancelled verifies cancel marks thread cancelled.
func TestCancelMarksThreadCancelled(t *testing.T) {
t.Parallel()
@@ -47,6 +48,7 @@ func TestCancelMarksThreadCancelled(t *testing.T) {
}
}
// TestCancelPersistsReasonAndArtifact verifies cancel persists reason and artifact.
func TestCancelPersistsReasonAndArtifact(t *testing.T) {
t.Parallel()
@@ -127,6 +129,7 @@ func TestCancelPersistsReasonAndArtifact(t *testing.T) {
}
}
// TestCancelRejectsWhenThreadMissing verifies cancel rejects when thread missing.
func TestCancelRejectsWhenThreadMissing(t *testing.T) {
t.Parallel()
@@ -145,4 +148,3 @@ func TestCancelRejectsWhenThreadMissing(t *testing.T) {
}
assertErrorJSON(t, stdout, "not_found")
}
@@ -2,6 +2,7 @@ package inbox
import "testing"
// TestClaimAcquiresThreadLease verifies claim acquires thread lease.
func TestClaimAcquiresThreadLease(t *testing.T) {
t.Parallel()
@@ -34,6 +35,7 @@ func TestClaimAcquiresThreadLease(t *testing.T) {
}
}
// TestClaimRejectsWhenThreadMissing verifies claim rejects when thread missing.
func TestClaimRejectsWhenThreadMissing(t *testing.T) {
t.Parallel()
@@ -51,6 +53,7 @@ func TestClaimRejectsWhenThreadMissing(t *testing.T) {
assertErrorJSON(t, stdout, "not_found")
}
// TestClaimRejectsWhenThreadAlreadyClaimed verifies claim rejects when thread already claimed.
func TestClaimRejectsWhenThreadAlreadyClaimed(t *testing.T) {
t.Parallel()
@@ -79,6 +82,7 @@ func TestClaimRejectsWhenThreadAlreadyClaimed(t *testing.T) {
assertErrorJSON(t, stdout, "lease_conflict")
}
// TestClaimRecordsRequestedLeaseDuration verifies claim records requested lease duration.
func TestClaimRecordsRequestedLeaseDuration(t *testing.T) {
t.Parallel()
@@ -6,6 +6,7 @@ import (
"testing"
)
// TestDoneMarksThreadTerminal verifies done marks thread terminal.
func TestDoneMarksThreadTerminal(t *testing.T) {
t.Parallel()
@@ -33,6 +34,7 @@ func TestDoneMarksThreadTerminal(t *testing.T) {
}
}
// TestDonePersistsResultBodyAndArtifact verifies done persists result body and artifact.
func TestDonePersistsResultBodyAndArtifact(t *testing.T) {
t.Parallel()
@@ -89,6 +91,7 @@ func TestDonePersistsResultBodyAndArtifact(t *testing.T) {
}
}
// TestDoneRejectsNonOwner verifies done rejects non owner.
func TestDoneRejectsNonOwner(t *testing.T) {
t.Parallel()
@@ -109,6 +112,7 @@ func TestDoneRejectsNonOwner(t *testing.T) {
assertErrorJSON(t, stdout, "lease_conflict")
}
// TestDoneRejectsOnTerminalThread verifies done rejects on terminal thread.
func TestDoneRejectsOnTerminalThread(t *testing.T) {
t.Parallel()
@@ -6,6 +6,7 @@ import (
"testing"
)
// TestFailMarksThreadFailed verifies fail marks thread failed.
func TestFailMarksThreadFailed(t *testing.T) {
t.Parallel()
@@ -36,6 +37,7 @@ func TestFailMarksThreadFailed(t *testing.T) {
}
}
// TestFailPersistsFailureBodyAndArtifact verifies fail persists failure body and artifact.
func TestFailPersistsFailureBodyAndArtifact(t *testing.T) {
t.Parallel()
@@ -92,6 +94,7 @@ func TestFailPersistsFailureBodyAndArtifact(t *testing.T) {
}
}
// TestFailRejectsNonOwner verifies fail rejects non owner.
func TestFailRejectsNonOwner(t *testing.T) {
t.Parallel()
@@ -112,6 +115,7 @@ func TestFailRejectsNonOwner(t *testing.T) {
assertErrorJSON(t, stdout, "lease_conflict")
}
// TestFailRejectsOnTerminalThread verifies fail rejects on terminal thread.
func TestFailRejectsOnTerminalThread(t *testing.T) {
t.Parallel()
@@ -2,6 +2,7 @@ package inbox
import "testing"
// TestFetchReturnsPendingThreadForTargetAgent verifies fetch returns pending thread for target agent.
func TestFetchReturnsPendingThreadForTargetAgent(t *testing.T) {
t.Parallel()
@@ -35,6 +36,7 @@ func TestFetchReturnsPendingThreadForTargetAgent(t *testing.T) {
}
}
// TestFetchRespectsStatusAndLimitFilters verifies fetch respects status and limit filters.
func TestFetchRespectsStatusAndLimitFilters(t *testing.T) {
t.Parallel()
@@ -94,6 +96,7 @@ func TestFetchRespectsStatusAndLimitFilters(t *testing.T) {
}
}
// TestFetchUnreadUsesReadCursor verifies fetch unread uses read cursor.
func TestFetchUnreadUsesReadCursor(t *testing.T) {
t.Parallel()
@@ -169,6 +172,7 @@ func TestFetchUnreadUsesReadCursor(t *testing.T) {
}
}
// TestFetchReturnsNoMatchingWorkWhenEmpty verifies fetch returns no matching work when empty.
func TestFetchReturnsNoMatchingWorkWhenEmpty(t *testing.T) {
t.Parallel()
@@ -5,6 +5,7 @@ import (
"testing"
)
// TestInboxRootHelpExplainsWorkerLoop verifies inbox root help explains worker loop.
func TestInboxRootHelpExplainsWorkerLoop(t *testing.T) {
t.Parallel()
@@ -25,6 +26,7 @@ func TestInboxRootHelpExplainsWorkerLoop(t *testing.T) {
}
}
// TestInboxUpdateHelpExplainsBlockedQuestions verifies inbox update help explains blocked questions.
func TestInboxUpdateHelpExplainsBlockedQuestions(t *testing.T) {
t.Parallel()
@@ -45,6 +47,7 @@ func TestInboxUpdateHelpExplainsBlockedQuestions(t *testing.T) {
}
}
// TestInboxWaitReplyHelpExplainsBlockingPrimitive verifies inbox wait reply help explains blocking primitive.
func TestInboxWaitReplyHelpExplainsBlockingPrimitive(t *testing.T) {
t.Parallel()
@@ -62,6 +65,7 @@ func TestInboxWaitReplyHelpExplainsBlockingPrimitive(t *testing.T) {
}
}
// TestInboxListHelpExplainsDifferenceFromFetch verifies inbox list help explains difference from fetch.
func TestInboxListHelpExplainsDifferenceFromFetch(t *testing.T) {
t.Parallel()
@@ -5,6 +5,7 @@ import (
"testing"
)
// TestInitCreatesSchemaOnEmptyDB verifies init creates schema on empty DB.
func TestInitCreatesSchemaOnEmptyDB(t *testing.T) {
t.Parallel()
@@ -28,6 +29,7 @@ func TestInitCreatesSchemaOnEmptyDB(t *testing.T) {
}
}
// TestInitIsIdempotentOnExistingDB verifies init is idempotent on existing DB.
func TestInitIsIdempotentOnExistingDB(t *testing.T) {
t.Parallel()
@@ -7,6 +7,7 @@ import (
"time"
)
// TestInboxLifecycle verifies inbox lifecycle.
func TestInboxLifecycle(t *testing.T) {
t.Parallel()
@@ -171,6 +172,7 @@ func TestInboxLifecycle(t *testing.T) {
}
}
// TestInboxFailLifecycle verifies inbox fail lifecycle.
func TestInboxFailLifecycle(t *testing.T) {
t.Parallel()
@@ -238,6 +240,7 @@ func TestInboxFailLifecycle(t *testing.T) {
}
}
// TestInboxRenewWaitReplyAndCancel verifies inbox renew wait reply and cancel.
func TestInboxRenewWaitReplyAndCancel(t *testing.T) {
t.Parallel()
@@ -387,6 +390,7 @@ func TestInboxRenewWaitReplyAndCancel(t *testing.T) {
}
}
// TestInboxWatchListUnreadAndAppend verifies inbox watch list unread and append.
func TestInboxWatchListUnreadAndAppend(t *testing.T) {
t.Parallel()
@@ -544,6 +548,7 @@ func TestInboxWatchListUnreadAndAppend(t *testing.T) {
}
}
// TestInboxUnreadReadCursor verifies inbox unread read cursor.
func TestInboxUnreadReadCursor(t *testing.T) {
t.Parallel()
@@ -634,6 +639,7 @@ func TestInboxUnreadReadCursor(t *testing.T) {
}
}
// TestInboxJSONErrorsAndExitCodes verifies inbox JSON errors and exit codes.
func TestInboxJSONErrorsAndExitCodes(t *testing.T) {
t.Parallel()
@@ -6,6 +6,7 @@ import (
"time"
)
// TestListFiltersByStatus verifies list returns only threads matching the requested statuses.
func TestListFiltersByStatus(t *testing.T) {
t.Parallel()
@@ -53,6 +54,7 @@ func TestListFiltersByStatus(t *testing.T) {
}
}
// TestListFiltersByCreatedBy verifies list filters threads by creator.
func TestListFiltersByCreatedBy(t *testing.T) {
t.Parallel()
@@ -88,6 +90,7 @@ func TestListFiltersByCreatedBy(t *testing.T) {
}
}
// TestListFiltersByAssignedTo verifies list filters threads by assignee.
func TestListFiltersByAssignedTo(t *testing.T) {
t.Parallel()
@@ -126,6 +129,7 @@ func TestListFiltersByAssignedTo(t *testing.T) {
}
}
// TestListRespectsLimit verifies list returns only the most recent rows up to the requested limit.
func TestListRespectsLimit(t *testing.T) {
t.Parallel()
@@ -180,4 +184,3 @@ func createThreadForList(t *testing.T, dbPath, from, to, subject, summary string
mustDecodeJSON(t, sendOut, &sendResp)
return nestedString(t, sendResp, "data", "thread", "thread_id")
}
@@ -2,6 +2,7 @@ package inbox
import "testing"
// TestRenewExtendsActiveLease verifies renew extends active lease.
func TestRenewExtendsActiveLease(t *testing.T) {
t.Parallel()
@@ -53,6 +54,7 @@ func TestRenewExtendsActiveLease(t *testing.T) {
}
}
// TestRenewRejectsNonOwner verifies renew rejects non owner.
func TestRenewRejectsNonOwner(t *testing.T) {
t.Parallel()
@@ -82,6 +84,7 @@ func TestRenewRejectsNonOwner(t *testing.T) {
assertErrorJSON(t, stdout, "lease_conflict")
}
// TestRenewRejectsWithoutActiveLease verifies renew rejects without active lease.
func TestRenewRejectsWithoutActiveLease(t *testing.T) {
t.Parallel()
@@ -6,6 +6,7 @@ import (
"testing"
)
// TestReplyAddsAnswerMessage verifies reply appends an answer message to the thread.
func TestReplyAddsAnswerMessage(t *testing.T) {
t.Parallel()
@@ -37,6 +38,7 @@ func TestReplyAddsAnswerMessage(t *testing.T) {
}
}
// TestReplySupportsControlKind verifies reply accepts control messages in addition to answers.
func TestReplySupportsControlKind(t *testing.T) {
t.Parallel()
@@ -63,6 +65,7 @@ func TestReplySupportsControlKind(t *testing.T) {
}
}
// TestReplyAttachesArtifact verifies reply persists an attached artifact on the reply message.
func TestReplyAttachesArtifact(t *testing.T) {
t.Parallel()
@@ -115,6 +118,7 @@ func TestReplyAttachesArtifact(t *testing.T) {
}
}
// TestReplyRejectsInvalidPayloadJSON verifies reply returns invalid_input for malformed payload JSON.
func TestReplyRejectsInvalidPayloadJSON(t *testing.T) {
t.Parallel()
@@ -6,6 +6,7 @@ import (
"testing"
)
// TestSendCreatesNewThread verifies send creates a pending thread with the initial task message.
func TestSendCreatesNewThread(t *testing.T) {
t.Parallel()
@@ -45,6 +46,7 @@ func TestSendCreatesNewThread(t *testing.T) {
}
}
// TestSendAppendsMessageToExistingThread verifies send appends a message without creating a new thread.
func TestSendAppendsMessageToExistingThread(t *testing.T) {
t.Parallel()
@@ -88,6 +90,7 @@ func TestSendAppendsMessageToExistingThread(t *testing.T) {
}
}
// TestSendReadsBodyFromBodyFile verifies send loads the message body from a body file.
func TestSendReadsBodyFromBodyFile(t *testing.T) {
t.Parallel()
@@ -139,6 +142,7 @@ func TestSendReadsBodyFromBodyFile(t *testing.T) {
}
}
// TestSendAttachesArtifactWithMetadata verifies send persists an artifact and its metadata on the message.
func TestSendAttachesArtifactWithMetadata(t *testing.T) {
t.Parallel()
@@ -190,6 +194,7 @@ func TestSendAttachesArtifactWithMetadata(t *testing.T) {
}
}
// TestSendRejectsInvalidPayloadJSON verifies send returns invalid_input for malformed payload JSON.
func TestSendRejectsInvalidPayloadJSON(t *testing.T) {
t.Parallel()
@@ -209,6 +214,7 @@ func TestSendRejectsInvalidPayloadJSON(t *testing.T) {
assertErrorJSON(t, stdout, "invalid_input")
}
// TestSendRejectsInvalidArtifactMetadataJSON verifies send returns invalid_input for malformed artifact metadata JSON.
func TestSendRejectsInvalidArtifactMetadataJSON(t *testing.T) {
t.Parallel()
@@ -6,6 +6,7 @@ import (
"testing"
)
// TestShowReturnsThreadAndMessageHistory verifies show returns the thread with ordered message history.
func TestShowReturnsThreadAndMessageHistory(t *testing.T) {
t.Parallel()
@@ -65,6 +66,7 @@ func TestShowReturnsThreadAndMessageHistory(t *testing.T) {
}
}
// TestShowIncludesArtifactsPerMessage verifies show includes message artifacts in the thread payload.
func TestShowIncludesArtifactsPerMessage(t *testing.T) {
t.Parallel()
@@ -122,6 +124,7 @@ func TestShowIncludesArtifactsPerMessage(t *testing.T) {
}
}
// TestShowMarkReadAdvancesReadCursor verifies show --mark-read clears the thread from unread fetch results.
func TestShowMarkReadAdvancesReadCursor(t *testing.T) {
t.Parallel()
@@ -176,6 +179,7 @@ func TestShowMarkReadAdvancesReadCursor(t *testing.T) {
assertErrorJSON(t, stdout, "no_matching_work")
}
// TestShowRejectsWhenThreadMissing verifies show returns not_found for an unknown thread.
func TestShowRejectsWhenThreadMissing(t *testing.T) {
t.Parallel()
@@ -193,4 +197,3 @@ func TestShowRejectsWhenThreadMissing(t *testing.T) {
}
assertErrorJSON(t, stdout, "not_found")
}
@@ -59,6 +59,7 @@ func lastThreadMessageFromShow(t *testing.T, showResp map[string]any) map[string
return lastMessage
}
// TestUpdateMovesThreadToInProgress verifies update moves thread to in progress.
func TestUpdateMovesThreadToInProgress(t *testing.T) {
t.Parallel()
@@ -90,6 +91,7 @@ func TestUpdateMovesThreadToInProgress(t *testing.T) {
}
}
// TestUpdateMovesThreadToBlockedWithPayload verifies update moves thread to blocked with payload.
func TestUpdateMovesThreadToBlockedWithPayload(t *testing.T) {
t.Parallel()
@@ -125,6 +127,7 @@ func TestUpdateMovesThreadToBlockedWithPayload(t *testing.T) {
}
}
// TestUpdateAcceptsBodyFileAndArtifact verifies update accepts body file and artifact.
func TestUpdateAcceptsBodyFileAndArtifact(t *testing.T) {
t.Parallel()
@@ -182,6 +185,7 @@ func TestUpdateAcceptsBodyFileAndArtifact(t *testing.T) {
}
}
// TestUpdateRejectsInvalidPayloadJSON verifies update rejects invalid payload JSON.
func TestUpdateRejectsInvalidPayloadJSON(t *testing.T) {
t.Parallel()
@@ -204,6 +208,7 @@ func TestUpdateRejectsInvalidPayloadJSON(t *testing.T) {
assertErrorJSON(t, stdout, "invalid_input")
}
// TestUpdateRejectsNonOwner verifies update rejects non owner.
func TestUpdateRejectsNonOwner(t *testing.T) {
t.Parallel()
@@ -13,6 +13,7 @@ type waitReplyCommandResult struct {
exit int
}
// TestWaitReplyWakesOnAnswerAfterMessage verifies wait reply wakes on answer after message.
func TestWaitReplyWakesOnAnswerAfterMessage(t *testing.T) {
t.Parallel()
@@ -67,6 +68,7 @@ func TestWaitReplyWakesOnAnswerAfterMessage(t *testing.T) {
}
}
// TestWaitReplyCanStartFromAfterEvent verifies wait reply can start from after event.
func TestWaitReplyCanStartFromAfterEvent(t *testing.T) {
t.Parallel()
@@ -155,6 +157,7 @@ func TestWaitReplyCanStartFromAfterEvent(t *testing.T) {
}
}
// TestWaitReplyTimesOutWhenNoReply verifies wait reply times out when no reply.
func TestWaitReplyTimesOutWhenNoReply(t *testing.T) {
t.Parallel()
@@ -218,4 +221,3 @@ func seedBlockedThreadForWaitReply(t *testing.T, dbPath string) (threadID string
blockedMessageID = nestedString(t, blockedResp, "data", "message", "message_id")
return threadID, blockedMessageID
}
@@ -12,6 +12,7 @@ type watchCommandResult struct {
exit int
}
// TestWatchWakesOnMatchingThread verifies watch wakes on matching thread.
func TestWatchWakesOnMatchingThread(t *testing.T) {
t.Parallel()
@@ -78,6 +79,7 @@ func TestWatchWakesOnMatchingThread(t *testing.T) {
}
}
// TestWatchRespectsStatusFilter verifies watch respects status filter.
func TestWatchRespectsStatusFilter(t *testing.T) {
t.Parallel()
@@ -149,6 +151,7 @@ func TestWatchRespectsStatusFilter(t *testing.T) {
}
}
// TestWatchTimesOutWithNoActivity verifies watch times out with no activity.
func TestWatchTimesOutWithNoActivity(t *testing.T) {
t.Parallel()
@@ -168,4 +171,3 @@ func TestWatchTimesOutWithNoActivity(t *testing.T) {
}
assertErrorJSON(t, stdout, "no_matching_work")
}