Checklist runs

Patch a checklist run item

Summary

Update a checklist item.

PATCH api/v11/reviews/{reviewid}/checkListRuns/{id}/items/{name}

Description

Update a checklist item.

Parameters

Parameter Description Type Parameter Type Required

status

The new value to use for the update.

string

body

Yes

Example usage

Update the status an item.

curl -X PATCH -H "Content-Type: application/json" -u "username:ticket" -d "@mybodyfilename.txt" "https://myswarm-url/api/v11/reviews/12251/checkListRuns/44/items/coding-standards"

The mybodyfilename.txt file contains the field to update:

Copy
{
"status": "pass"
}

JSON Response shows the updated status on line 15:

Copy
{
    "error": null,
    "messages": [],
    "data": {
        "item": {
            "id": "coding-standards",
            "checkListId": 7,
            "name": "Coding Standards",
            "type": "AI",
            "aiModel": "gpt-4o-mini",
            "startTime": 1776414532,
            "uuid": "42004D56-4535-DCAC-3484-ED6BAF6183B3.v1",
            "aiResponse": "//jam/main/src/command.h: The file adheres to the coding standards.",
            "commentIds": [],
            "status": "pass",
            "completedTime": 1776414545
        },
        "activityLog": {
            "id": 130,
            "topic": "reviews/12251",
            "context": {
                "checklistRunId": "44",
                "checklistItemId": "coding-standards",
                "checklistFromStatus": "warning",
                "checklistToStatus": "pass",
                "checklistItemName": "Coding Standards",
                "checklistIsStatusChange": true,
                "version": 1
            },
            "attachments": [],
            "flags": [],
            "taskState": "comment",
            "likes": [],
            "user": "swarm",
            "time": 1777282900,
            "updated": 1777282900,
            "edited": null,
            "body": "updated Coding Standards status from warning to pass",
            "readBy": []
        }
    }
}

Get runs by review id

Summary

Get the details of checklist runs associated with specified review.

GET /api/v11/reviews/{reviewID}/checkListRuns

Description

Retrieve the details of the checklist runs associated with the specified review.

Example usage

curl -X GET "{HOST}/api/v11/reviews/12259/checkListRuns"

JSON Response:

Copy
{
    "error": null,
    "messages": [],
    "data": {
        "checkListsRuns": [
            {
                "id": 47,
                "change": 12259,
                "version": 1,
                "items": [
                    {
                        "id": "security-standards",
                        "checkListId": 2,
                        "name": "Security standards",
                        "type": "AI",
                        "aiModel": "gpt-4o-mini",
                        "startTime": 1776681832,
                        "uuid": "0D2BE715-ED88-2FC8-87F3-1CAA7AC11264.v1",
                        "aiResponse": "//jam/main/src/command.h: The code in command.h lacks sufficient input validation and error handling, which could be potential security risks.\n\n//jam/main/src/compile.c: The compile.c file follows security best practices, proper input validation and error handling is implemented.\n\n//jam/main/src/execmac.c: The execmac.c file has potential vulnerabilities due to lack of safe execution functions.\n\n//jam/main/src/execunix.c: The code does not sufficiently handle unexpected inputs, which can lead to security issues.\n\n//jam/main/src/execvms.c: execvms.c adheres to security standards with appropriate measures in place.",
                        "commentIds": [],
                        "status": "fail",
                        "completedTime": 1776681845
                    },
                    {
                        "id": "code-readability",
                        "checkListId": 2,
                        "name": "Code Readability",
                        "type": "AI",
                        "aiModel": "gpt-4o-mini",
                        "startTime": 1776681832,
                        "uuid": "0D2BE715-ED88-2FC8-87F3-1CAA7AC11264.v1",
                        "aiResponse": "//jam/main/src/command.h: The code is well-structured and adheres to naming conventions, making it easy to read.\n\n//jam/main/src/compile.c: The compile.c file is clear and well-commented, facilitating easy understanding.\n\n//jam/main/src/execmac.c: execmac.c lacks comments and has convoluted logic that may confuse readers.\n\n//jam/main/src/execunix.c: The code readability is average, with some variable names being less descriptive.\n\n//jam/main/src/execvms.c: execvms.c is clearly written with well-defined functions and variable names.",
                        "commentIds": [],
                        "status": "fail",
                        "completedTime": 1776681845
                    },
                    {
                        "id": "check-all-test-manually",
                        "checkListId": 2,
                        "name": "Check All Test Manually",
                        "type": "Manual",
                        "aiModel": "",
                        "startTime": 1776681832,
                        "uuid": "0D2BE715-ED88-2FC8-87F3-1CAA7AC11264.v1",
                        "aiResponse": "",
                        "commentIds": [],
                        "status": "pending"
                    },
                    {
                        "id": "performance-measure",
                        "checkListId": 2,
                        "name": "Performance Measure",
                        "type": "AI",
                        "aiModel": "gpt-4o-mini",
                        "startTime": 1776681832,
                        "uuid": "0D2BE715-ED88-2FC8-87F3-1CAA7AC11264.v1",
                        "aiResponse": "//jam/main/src/command.h: The addition is straightforward and contributes positively to performance analysis.\n\n//jam/main/src/compile.c: The updates enhance performance logging, compliant with performance measurement standards.\n\n//jam/main/src/execmac.c: The new functionality aligns with performance measurement and shows good improvements.\n\n//jam/main/src/execunix.c: The adjustments made are relevant for performance tracking and yield no issues.\n\n//jam/main/src/execvms.c: This file update is appropriate for performance assessment and integrates well.",
                        "commentIds": [],
                        "status": "pass",
                        "completedTime": 1776682275
                    }
                ],
                "title": "NewCheckList123",
                "status": "running",
                "startTime": 1776681832
            },
            {
                "id": 48,
                "change": 12259,
                "version": 1,
                "items": [
                    {
                        "id": "coding-standards",
                        "checkListId": 7,
                        "name": "Coding Standards",
                        "type": "AI",
                        "aiModel": "gpt-4o-mini",
                        "startTime": 1776681832,
                        "uuid": "0D2BE715-ED88-2FC8-87F3-1CAA7AC11264.v1",
                        "aiResponse": "//jam/main/src/command.h: File adheres to coding standards.\n\n//jam/main/src/compile.c: File adheres to coding standards.\n\n//jam/main/src/execmac.c: File adheres to coding standards.\n\n//jam/main/src/execunix.c: File adheres to coding standards.\n\n//jam/main/src/execvms.c: File adheres to coding standards.",
                        "commentIds": [],
                        "status": "pass",
                        "completedTime": 1776681852
                    }
                ],
                "title": "Another Checklist",
                "status": "running",
                "startTime": 1776681832
            }
        ]
    }
}

Manually trigger a checklist item

Summary

Manually trigger the run of the specified checklist item in the specified review.

POST api/v11/reviews/{reviewID}/{checkListRunId}/items/{name}/run

Description

Manually triggers the checklist item run for review 12259.

Example usage

curl -X POST "{HOST}/api/v11/reviews/12259/checkListRuns/48/items/coding-standards/run"

JSON Response:

Copy
{
    "error": null,
    "messages": [],
    "data": {
        "checkListsRuns": [
            {
                "id": 48,
                "change": 12259,
                "version": 1,
                "items": [
                    {
                        "id": "coding-standards",
                        "checkListId": 7,
                        "name": "Coding Standards",
                        "type": "AI",
                        "aiModel": "gemini-flash-latest",
                        "startTime": 1776681832,
                        "uuid": "0D2BE715-ED88-2FC8-87F3-1CAA7AC11264.v1",
                        "aiResponse": "",
                        "commentIds": [],
                        "status": "warning",
                        "completedTime": 1776838446
                    }
                ],
                "title": "Another Checklist",
                "status": "running",
                "startTime": 1776681832
            }
        ],
        "triggerLog": {
            "id": 124,
            "topic": "reviews/12259",
            "context": {
                "checklistRunId": "48",
                "checklistItemId": "coding-standards",
                "checklistIsTrigger": true,
                "version": 1
            },
            "attachments": [],
            "flags": [],
            "taskState": "comment",
            "likes": [],
            "user": "swarm",
            "time": 1776838411,
            "updated": 1776838411,
            "edited": null,
            "body": "triggered AI review for checklist item coding-standards",
            "readBy": []
        },
        "aiRecommendLog": {
            "id": 125,
            "topic": "reviews/12259",
            "context": {
                "checklistRunId": "48",
                "checklistItemId": "coding-standards",
                "checklistItemName": "Coding Standards",
                "checklistIsAIRecommendation": true,
                "checklistAIRecommendStatus": "warning",
                "checklistAIModel": "gemini-flash-latest",
                "version": 1
            },
            "attachments": [],
            "flags": [],
            "taskState": "comment",
            "likes": [],
            "user": "AI",
            "time": 1776838446,
            "updated": 1776838446,
            "edited": null,
            "body": "gemini-flash-latest recommended status of Coding Standards as warning",
            "readBy": []
        }
    }
}

Add a comment to an item

Summary

Create a comment to a checklist item.

POST api/v11/comments/reviews/{reviewid}

Description

Add a comment to a checklist item.

Parameters

Parameter Description Type Parameter Type Required

body

Text of the comment.

string

body

Yes

taskState

Indicates that the body is meant to populate a comment.

string

body

Yes

attachments Whether the comment has attachments. null body Yes
context Array that contains the checklistRunId and checklistItemId array body Yes
checklistRunId Identifier of the checklist. string body Yes
checklistItemId Identifier of the checklist item. string body Yes

Example usage

Add a comment to review 12259

curl -X POST -H "Content-Type: application/json" -u "username:ticket" -d "@mybodyfilename.txt" "https://myswarm-url/api/v11/comments/reviews/12259"

The mybodyfilename.txt file contains the following:

Copy
{
    "body": "This is the added comment",
    "taskState": "comment",
    "attachments": null,
    "context": {
        "checklistRunId": "47",
        "checklistItemId": "code-readability"
    }
}

JSON Response shows the comment on line 22:

Copy
{
    "error": null,
    "messages": [],
    "data": {
        "comments": [
            {
                "id": 121,
                "topic": "reviews/12259",
                "context": {
                    "checklistRunId": "47",
                    "checklistItemId": "code-readability",
                    "version": 1
                },
                "attachments": [],
                "flags": [],
                "taskState": "comment",
                "likes": [],
                "user": "swarm",
                "time": 1776837897,
                "updated": 1776837897,
                "edited": null,
                "body": "This is the added comment",
                "readBy": [],
                "notify": "delayed"
            }
        ],
        "userDelayedNotificationCount": 1
    }
}

Create a checkListRun when a review is created

Summary

Create a checklist run for the specified review ID.

POST /api/v11/reviews/{reviewId}/checkListRuns

Description

Creates a checklist run associated with a specific code review. This endpoint is triggered when a review is created, initializing a set of checklist items to be evaluated against the review's code changes.

Parameters

Parameter Description Type Parameter Type Required
change Changelist number integer body Yes
version Version of the review integer body Yes
title Checklist title string body Yes
items List of checklist items array (object) body Yes (can be a blank array)

items[] object structure

Parameter Description Type Parameter Type Required
checkListId Checklist identifier integer body Yes
name Name of the checklist item string body Yes
type Execution type (AI or Manual) string (enum) body Yes
aiModel AI model name (required if type = AI) string body Conditional
startTime Start time (epoch timestamp) integer body Yes
completedTime Completion time (epoch timestamp) integer body No
aiResponse AI-generated response string body No
messages Conversation/messages related to AI array body No
status Current status (such as InProgress, Completed) string (enum) body Yes
uuid Unique identifier with version string body Yes

Example usage

Create a checklist run for the specified review 12856.

curl -X POST -H "Content-Type: application/json" -u "username:ticket" -d "@mybodyfilename.txt" "https://myswarm-url/api/v11/comments/reviews/12856/checkListRuns"

The mybodyfilename.txt file contains the following:

Copy
{
    "change" : 12856,
    "version" : 1,
    "title": "CheckList of Code Readability and Standard",
    "items": [
         {
        "checkListId": 11,    
        "name": "Security",
        "type": "AI",
        "aiModel": "OpenAI GPT4",
        "startTime": 1772614989,
        "completedTime": null,
        "aiResponse": "",
        "messages": [],
        "status": "InProgress",
        "uuid": "B3860EB4-3E5E-0597-4A15-0B812ADDC170.v1"
      },
       {
        "checkListId": 11,    
        "name": "Functionality",
        "type": "AI",
        "aiModel": "OpenAI GPT4",
        "startTime": 1772614989,
        "completedTime": null,
        "aiResponse": "",
        "messages": [],
        "status": "InProgress",
        "uuid": "B3860EB4-3E5E-0597-4A15-0B812ADDC171.v1"
      },
      {
    "checkListId": 11,    
        "name": "Error Handling",
        "type": "Manual",
        "aiModel": "",
        "startTime": 1772614989,
        "completedTime": null,
        "aiResponse": "",
        "messages": [],
        "status": "InProgress",
        "uuid": "B3860EB4-3E5E-0597-4A15-0B812ADDC172.v1"
      },
       {
        "checkListId": 11,    
        "name": "Maintainability",
        "type": "Manual",
        "aiModel": "",
        "startTime": 1772614989,
        "completedTime": null,
        "aiResponse": "",
        "messages": [],
        "status": "InProgress",
        "uuid": "B3860EB4-3E5E-0597-4A15-0B812ADDC173.v1"
      },
       {
       "checkListId": 11,    
        "name": "Code dependancy tree",
        "type": "AI",
        "aiModel": "OpenAI GPT4",
        "startTime": 1772614989,
        "completedTime": null,
        "aiResponse": "",
        "messages": [],
        "status": "InProgress",
        "uuid": "B3860EB4-3E5E-0597-4A15-0B812ADDC174.v1"
      }
    ]   
}

 

JSON Response:

Copy
{
    "error": null,
    "messages": [],
    "data": {
        "checkListsRuns": [
            {
                "id": 1,
                "change": 12856,
                "version": 1,
                "items": [
                    {
                        "name": "Security",
                        "type": "AI",
                        "aiModel": "OpenAI GPT4",
                        "startTime": 1772614989,
                        "completedTime": null,
                        "aiResponse": "",
                        "messages": [],
                        "status": "InProgress",
                        "uuid": "B3860EB4-3E5E-0597-4A15-0B812ADDC170.v1",
                        "id": "security"
                    },
                    {
                        "name": "Functionality",
                        "type": "AI",
                        "aiModel": "OpenAI GPT4",
                        "startTime": 1772614989,
                        "completedTime": null,
                        "aiResponse": "",
                        "messages": [],
                        "status": "InProgress",
                        "uuid": "B3860EB4-3E5E-0597-4A15-0B812ADDC171.v1",
                        "id": "functionality"
                    },
                    {
                        "name": "Error Handling",
                        "type": "Manual",
                        "aiModel": "",
                        "startTime": 1772614989,
                        "completedTime": null,
                        "aiResponse": "",
                        "messages": [],
                        "status": "InProgress",
                        "uuid": "B3860EB4-3E5E-0597-4A15-0B812ADDC172.v1",
                        "id": "error-handling"
                    },
                    {
                        "name": "Maintainability",
                        "type": "Manual",
                        "aiModel": "",
                        "startTime": 1772614989,
                        "completedTime": null,
                        "aiResponse": "",
                        "messages": [],
                        "status": "InProgress",
                        "uuid": "B3860EB4-3E5E-0597-4A15-0B812ADDC173.v1",
                        "id": "maintability"
                    },
                    {
                        "name": "Code dependancy tree",
                        "type": "AI",
                        "aiModel": "OpenAI GPT4",
                        "startTime": 1772614989,
                        "completedTime": null,
                        "aiResponse": "",
                        "messages": [],
                        "status": "InProgress",
                        "uuid": "B3860EB4-3E5E-0597-4A15-0B812ADDC174.v1",
                        "id": "code-dependancy-tree"
                    }
                ],
                "title": "CheckList of Code Readability and Standard",
                "branches": ""
            }
        ]
    }
}