Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace "Generate Tests" with "Analyze Test Coverage" in Repository Node #2501

Open
3 tasks
tomsmith8 opened this issue Dec 5, 2024 · 13 comments · May be fixed by #2510
Open
3 tasks

Replace "Generate Tests" with "Analyze Test Coverage" in Repository Node #2501

tomsmith8 opened this issue Dec 5, 2024 · 13 comments · May be fixed by #2510
Assignees
Labels

Comments

@tomsmith8
Copy link
Contributor

tomsmith8 commented Dec 5, 2024

Context

In our current graph interface, the "Generate Tests" action for a selected Repository node is being replaced with "Analyze Test Coverage." This change is necessary to provide users with a more relevant analysis of their codebase, focusing on test coverage. The functionality will allow users to assess the extent of test coverage directly from the graph interface, contributing to better code quality and maintainability. This enhancement fits into our larger system of improving code analysis tools and providing actionable insights to developers.

Task

  1. Update the graph interface to replace the "Generate Tests" action with "Analyze Test Coverage" for the Repository node.
  2. Implement a call to the endpoint /github/analyze?github_repository={repository_name}&analysis=["coverage"] using the selected repository's name.
  3. Update the graph to render nodes based on the functions key from the analysis response.
  4. Display the nodes in the graph interface.

Outcome

The outcome of this ticket is a functional "Analyze Test Coverage" feature that replaces the existing "Generate Tests" action.

Users should be able to trigger a test coverage analysis, view all the nodes in the graph.

Design

  • User Interactions: When a user selects a Repository node in the graph, they should see the "Analyze Test Coverage" option instead of "Generate Tests."
  • API Endpoint: Call the /github/analyze endpoint with the github_repository parameter set to the selected repository's name and the analysis type set to ["coverage"].
  • Graph Rendering: Use the functions key from the API response to render nodes in the graph. Each function node should display whether it has a test associated with it.

Acceptance Criteria

  • The "Generate Tests" action is replaced with "Analyze Test Coverage" for the Repository node.
  • The /github/analyze API is called with the correct repository name and analysis type.
  • Nodes are rendered from the functions key of the analysis response.
@aliraza556
Copy link
Contributor

@tomsmith8 assign me?

@MuhammadUmer44
Copy link
Contributor

MuhammadUmer44 commented Dec 5, 2024

@tomsmith8 Please assign me?

@saithsab877
Copy link
Contributor

saithsab877 commented Dec 5, 2024

@tomsmith8 assign?

@MahtabBukhari
Copy link
Contributor

@tomsmith8 please assign?

@tomsmith8
Copy link
Contributor Author

Who is around to pick this up today?

@MahtabBukhari
Copy link
Contributor

MahtabBukhari commented Dec 5, 2024

@tomsmith8 I am available 😊

@tomsmith8
Copy link
Contributor Author

Note: for testing the endpoint won't work but the sample response should be sufficient to render nodes in the graph like normal from the functions key

@tomsmith8 tomsmith8 changed the title Update Repository Action for Test Coverage Replace "Generate Tests" with "Analyze Test Coverage" in Repository Node Dec 5, 2024
@MahtabBukhari
Copy link
Contributor

@tomsmith8 any UI design ?

@tomsmith8
Copy link
Contributor Author

Replace "generate tests" with what we currently have here:
image

@tomsmith8
Copy link
Contributor Author

These actions only appear node_type Repostiory

@MahtabBukhari
Copy link
Contributor

Note: for testing the endpoint won't work but the sample response should be sufficient to render nodes in the graph like normal from the functions key

@Rassl Could you please guide me in which format we will get response 'functions' key as I have not get any reference endpoint response format ?

  • And to update the graph nodes is there any method available to update the the graph with nodes that we will get from the endpoint

@tomsmith8
Copy link
Contributor Author

tomsmith8 commented Dec 6, 2024

Its the same logic and foramt for how we render nodes from search endpoint /graph/search. We return nodes list. but in this case the key is called functions

@tomsmith8
Copy link
Contributor Author

{
    "data": {
        "analysis": {
            "coverage": {
                "functions": [
                    {
                        "date_added_to_graph": "1733486761.7460475",
                        "has_test": false,
                        "name": "GetAllUserWorkspaces",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "GetAllUserWorkspaces"
                        },
                        "ref_id": "d4952a46-6f94-4c2d-82dd-82976d40ef6a"
                    },
                    {
                        "date_added_to_graph": "1733486760.2894297",
                        "has_test": false,
                        "name": "GetAllUserInvoicesCount",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "GetAllUserInvoicesCount"
                        },
                        "ref_id": "c5feee03-a0b3-4f7d-aea3-1a6649ea42a3"
                    },
                    {
                        "date_added_to_graph": "1733486807.550913",
                        "has_test": false,
                        "name": "ParseSubstackFeed",
                        "node_type": "Function",
                        "properties": {
                            "file": "substack.go",
                            "name": "ParseSubstackFeed"
                        },
                        "ref_id": "fffd955f-fda3-4501-a536-26bc4259f191"
                    },
                    {
                        "date_added_to_graph": "1733486806.8116589",
                        "has_test": false,
                        "name": "BitcoinTVToGeneric",
                        "node_type": "Function",
                        "properties": {
                            "file": "bitcointv.go",
                            "name": "BitcoinTVToGeneric"
                        },
                        "ref_id": "9076b4ab-249a-40c9-a116-79f7bbe79e60"
                    },
                    {
                        "date_added_to_graph": "1733486805.8514748",
                        "has_test": false,
                        "name": "ParseBitcoinTVFeed",
                        "node_type": "Function",
                        "properties": {
                            "file": "bitcointv.go",
                            "name": "ParseBitcoinTVFeed"
                        },
                        "ref_id": "22457cb8-d3da-4dcd-9771-89372fdce27a"
                    },
                    {
                        "date_added_to_graph": "1733486752.7599964",
                        "has_test": false,
                        "name": "PodcastEpisodesByPerson",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "PodcastEpisodesByPerson"
                        },
                        "ref_id": "7e7d4faf-4e26-4b22-a8ee-f78a3be59913"
                    },
                    {
                        "date_added_to_graph": "1733486563.0112169",
                        "has_test": false,
                        "name": "PodcastEpisodes",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "PodcastEpisodes"
                        },
                        "ref_id": "8afe3f68-8507-42eb-b6f5-b3a41661d169"
                    },
                    {
                        "date_added_to_graph": "1733486561.698019",
                        "has_test": false,
                        "name": "PodcastFeed",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "PodcastFeed"
                        },
                        "ref_id": "55d2be68-3b7c-4d65-b1a9-fd2ebd0157ca"
                    },
                    {
                        "date_added_to_graph": "1733486561.4353025",
                        "has_test": false,
                        "name": "ParsePodcastFeed",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "ParsePodcastFeed"
                        },
                        "ref_id": "ee9d86e3-73ee-485f-acb2-0b151cd6eebc"
                    },
                    {
                        "date_added_to_graph": "1733486557.1813326",
                        "has_test": false,
                        "name": "PodcastIndexHeaders",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "PodcastIndexHeaders"
                        },
                        "ref_id": "5c4eb424-4295-477f-b102-11b8e441e8fb"
                    },
                    {
                        "date_added_to_graph": "1733486563.6936193",
                        "has_test": false,
                        "name": "PodcastToGeneric",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "PodcastToGeneric"
                        },
                        "ref_id": "b2cde285-6fcc-4de2-864a-e2ae8d4602a3"
                    },
                    {
                        "date_added_to_graph": "1733486615.2148578",
                        "has_test": false,
                        "name": "append",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "append"
                        },
                        "ref_id": "39d04b2d-84fd-49d9-82e5-d496f6de8500"
                    },
                    {
                        "date_added_to_graph": "1733486606.3637302",
                        "has_test": false,
                        "name": "GetWorkspaceBudget",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "GetWorkspaceBudget"
                        },
                        "ref_id": "4dc69b2b-eb5c-4d60-bda6-5516bedcc779"
                    },
                    {
                        "date_added_to_graph": "1733486605.685625",
                        "has_test": false,
                        "name": "UserHasAccess",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "UserHasAccess"
                        },
                        "ref_id": "25717da0-c5ba-40c4-90e8-5a4866c20273"
                    },
                    {
                        "date_added_to_graph": "1733486605.0260353",
                        "has_test": false,
                        "name": "GetWorkspaceBountyCount",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "GetWorkspaceBountyCount"
                        },
                        "ref_id": "6e4a9761-0901-415c-91d2-8e7d794eb346"
                    },
                    {
                        "date_added_to_graph": "1733486644.2020376",
                        "has_test": false,
                        "name": "GetWorkspaceByUuid",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "GetWorkspaceByUuid"
                        },
                        "ref_id": "7437415a-150b-4a5e-a81b-29e3e2276332"
                    },
                    {
                        "date_added_to_graph": "1733486701.1067495",
                        "has_test": false,
                        "name": "GetUserAssignedWorkspaces",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "GetUserAssignedWorkspaces"
                        },
                        "ref_id": "f56c2f42-92cf-454f-8235-355b6d91f5dc"
                    },
                    {
                        "date_added_to_graph": "1733486604.6783319",
                        "has_test": false,
                        "name": "GetCreatedWorkspaces",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "GetCreatedWorkspaces"
                        },
                        "ref_id": "a46a7447-57b0-4799-be24-c55894f2aa66"
                    },
                    {
                        "date_added_to_graph": "1733486612.731721",
                        "has_test": false,
                        "name": "Encode",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "Encode"
                        },
                        "ref_id": "67d74b3b-c0b3-470d-ae72-3bb2906bd81b"
                    },
                    {
                        "date_added_to_graph": "1733486612.1434941",
                        "has_test": false,
                        "name": "NewEncoder",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "NewEncoder"
                        },
                        "ref_id": "850e0d75-f913-4f18-b4f9-1a5e04eba261"
                    },
                    {
                        "date_added_to_graph": "1733486610.2599046",
                        "has_test": false,
                        "name": "WriteHeader",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "WriteHeader"
                        },
                        "ref_id": "1b57b5f1-7035-4feb-ae6b-7dbfe03b67d0"
                    },
                    {
                        "date_added_to_graph": "1733486774.4922402",
                        "has_test": false,
                        "name": "GetWorkspaceInvoicesCount",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "GetWorkspaceInvoicesCount"
                        },
                        "ref_id": "4e80028e-28ac-4484-a5f8-e737699504ec"
                    },
                    {
                        "date_added_to_graph": "1733486558.4272208",
                        "has_test": false,
                        "name": "New",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "New"
                        },
                        "ref_id": "d07d3c51-ae4d-42f1-b30a-104c18a33452"
                    },
                    {
                        "date_added_to_graph": "1733486569.465393",
                        "has_test": false,
                        "name": "Unmarshal",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "Unmarshal"
                        },
                        "ref_id": "ec4b3b1d-cdad-49e2-a3e2-ffc83cb90722"
                    },
                    {
                        "date_added_to_graph": "1733486568.739371",
                        "has_test": false,
                        "name": "ReadAll",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "ReadAll"
                        },
                        "ref_id": "493c08d1-2c1f-4224-9563-d7c05244d3ce"
                    },
                    {
                        "date_added_to_graph": "1733486568.184212",
                        "has_test": false,
                        "name": "Close",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "Close"
                        },
                        "ref_id": "d970b423-5bc4-4cef-9b11-baa94a60672a"
                    },
                    {
                        "date_added_to_graph": "1733486562.3260362",
                        "has_test": false,
                        "name": "Println",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "Println"
                        },
                        "ref_id": "c051563b-b304-4344-925e-3439e4857dcb"
                    },
                    {
                        "date_added_to_graph": "1733486567.0463254",
                        "has_test": false,
                        "name": "Do",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "Do"
                        },
                        "ref_id": "e2b9d35c-2ae3-4430-9de8-fa0dabc8c62d"
                    },
                    {
                        "date_added_to_graph": "1733486566.4702888",
                        "has_test": false,
                        "name": "Add",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "Add"
                        },
                        "ref_id": "81592cc7-5757-45d8-aa4e-4457933ae009"
                    },
                    {
                        "date_added_to_graph": "1733486564.8166354",
                        "has_test": false,
                        "name": "NewRequest",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "NewRequest"
                        },
                        "ref_id": "a17b0d87-92e0-423b-b86b-7e8c49b50230"
                    },
                    {
                        "date_added_to_graph": "1733486560.8898058",
                        "has_test": false,
                        "name": "Sprintf",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "Sprintf"
                        },
                        "ref_id": "fab15093-3784-42c1-9eb7-35bb55ffc752"
                    },
                    {
                        "date_added_to_graph": "1733486560.0786982",
                        "has_test": false,
                        "name": "Sum",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "Sum"
                        },
                        "ref_id": "aa7d5666-4977-4f2b-b282-dd3046b431a5"
                    },
                    {
                        "date_added_to_graph": "1733486559.266707",
                        "has_test": false,
                        "name": "Write",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "Write"
                        },
                        "ref_id": "fdef9894-a5c2-455e-973d-8abe9288e78f"
                    },
                    {
                        "date_added_to_graph": "1733486557.528718",
                        "has_test": false,
                        "name": "unix",
                        "node_type": "Function",
                        "properties": {
                            "file": "podcastindex.go",
                            "name": "unix"
                        },
                        "ref_id": "8cc515fc-9660-4f09-b6eb-f8db640899de"
                    },
                    {
                        "date_added_to_graph": "1733486653.5637262",
                        "has_test": false,
                        "name": "Count",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "Count"
                        },
                        "ref_id": "bd961783-5fd3-4dd3-9e63-d8bb1c1692cf"
                    },
                    {
                        "date_added_to_graph": "1733486557.579876",
                        "has_test": false,
                        "name": "Where",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "Where"
                        },
                        "ref_id": "53826fd7-3927-4bf8-b4e1-e0cf79c576e0"
                    },
                    {
                        "date_added_to_graph": "1733486561.781209",
                        "has_test": false,
                        "name": "Model",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "Model"
                        },
                        "ref_id": "837320fc-10f3-4a58-8e43-2aa24c12ca01"
                    },
                    {
                        "date_added_to_graph": "1733486645.0591242",
                        "has_test": false,
                        "name": "Find",
                        "node_type": "Function",
                        "properties": {
                            "file": "workspaces.go",
                            "name": "Find"
                        },
                        "ref_id": "d2b2e8d8-863a-40e4-acdb-21939f8b609b"
                    }
                ],
                "summary": {
                    "coverage_percentage": 2.56,
                    "functions_with_tests": 1,
                    "total_functions": 39
                }
            }
        },
        "repository": "stakwork/sphinx-tribes"
    },
    "success": true
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants