MCPcopy Create free account
hub / github.com/compozy/agh / sampleTaskRunRecord

Function sampleTaskRunRecord

internal/cli/task_test.go:2899–2948  ·  view source on GitHub ↗
(status taskpkg.RunStatus)

Source from the content-addressed store, hash-verified

2897}
2898
2899func sampleTaskRunRecord(status taskpkg.RunStatus) TaskRunRecord {
2900 record := TaskRunRecord{
2901 ID: "run-1",
2902 TaskID: "task-1",
2903 Status: status,
2904 Origin: taskpkg.Origin{Kind: taskpkg.OriginKindCLI, Ref: "tasks.run.start"},
2905 Attempt: 1,
2906 IdempotencyKey: "idem-run",
2907 NetworkChannel: "builders",
2908 QueuedAt: fixedTestNow,
2909 }
2910
2911 claimedAt := fixedTestNow.Add(time.Minute)
2912 startedAt := fixedTestNow.Add(2 * time.Minute)
2913 endedAt := fixedTestNow.Add(3 * time.Minute)
2914 claimedBy := &taskpkg.ActorIdentity{Kind: taskpkg.ActorKindHuman, Ref: "local-user"}
2915
2916 switch status {
2917 case taskpkg.TaskRunStatusClaimed:
2918 record.ClaimedBy = claimedBy
2919 record.ClaimedAt = timePointer(claimedAt)
2920 case taskpkg.TaskRunStatusStarting:
2921 record.ClaimedBy = claimedBy
2922 record.SessionID = "sess-1"
2923 record.ClaimedAt = timePointer(claimedAt)
2924 case taskpkg.TaskRunStatusRunning:
2925 record.ClaimedBy = claimedBy
2926 record.SessionID = "sess-1"
2927 record.ClaimedAt = timePointer(claimedAt)
2928 record.StartedAt = timePointer(startedAt)
2929 case taskpkg.TaskRunStatusCompleted:
2930 record.ClaimedBy = claimedBy
2931 record.SessionID = "sess-1"
2932 record.ClaimedAt = timePointer(claimedAt)
2933 record.StartedAt = timePointer(startedAt)
2934 record.EndedAt = timePointer(endedAt)
2935 record.Result = json.RawMessage(`{"ok":true}`)
2936 case taskpkg.TaskRunStatusFailed:
2937 record.ClaimedBy = claimedBy
2938 record.SessionID = "sess-1"
2939 record.ClaimedAt = timePointer(claimedAt)
2940 record.StartedAt = timePointer(startedAt)
2941 record.EndedAt = timePointer(endedAt)
2942 record.Error = "boom"
2943 case taskpkg.TaskRunStatusCanceled:
2944 record.EndedAt = timePointer(endedAt)
2945 }
2946
2947 return record
2948}
2949
2950func sampleTaskRunDetailRecord(status taskpkg.RunStatus) TaskRunDetailRecord {
2951 toolCallCount := int64(3)

Calls 2

timePointerFunction · 0.70
AddMethod · 0.45

Tested by

no test coverage detected