Giter Site home page Giter Site logo

vishesh-baghel / glide Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 729 KB

You can see how Glidee-bot works by installing it from here

Home Page: https://github.com/apps/glidee-bot

License: ISC License

Dockerfile 0.31% JavaScript 0.44% TypeScript 94.88% HTML 4.37%
ai githubapp hookdeck mindsdb mindsdb-js-sdk mongodb mongoose nodejs octokit probot typescript webhook

glide's People

Contributors

vishesh-baghel avatar

Watchers

 avatar

glide's Issues

Hit the heap memory limit

INFO (probot): Total 37602 files fetched from repository: vishesh-baghel/Chat-app for installation id: 45484616
INFO (probot): Received Total 37602 files for processing from repository: vishesh-baghel/Chat-app with installation id: 45484616

<--- Last few GCs --->

[109427:0x5b03790] 116166 ms: Scavenge 1967.3 (2068.1) -> 1966.9 (2078.6) MB, 4.93 / 0.00 ms (average mu = 0.882, current mu = 0.440) allocation failure;
[109427:0x5b03790] 116175 ms: Scavenge 1973.7 (2078.6) -> 1972.7 (2079.6) MB, 5.18 / 0.00 ms (average mu = 0.882, current mu = 0.440) allocation failure;
[109427:0x5b03790] 116184 ms: Scavenge 1974.6 (2079.6) -> 1973.8 (2101.4) MB, 8.34 / 0.00 ms (average mu = 0.882, current mu = 0.440) allocation failure;

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
1: 0xc9e850 node::Abort() [/home/vishesh.baghel/Documents/workspace/personal-projects/glide/node_modules/node/bin/node]
2: 0xb720ff [/home/vishesh.baghel/Documents/workspace/personal-projects/glide/node_modules/node/bin/node]
3: 0xec1a70 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/home/vishesh.baghel/Documents/workspace/personal-projects/glide/node_modules/node/bin/node]

Add pull request event listener to make a comment on every pull request

On adding this event listener, the bot will follow the below-given steps:

  • From the event payload, the bot will get the installation ID and the affected file paths.
  • The bot will query the DB to get the risk scores using query parameters such as filePath, repoName, owner, etc.
  • Then, the bot will construct a good-looking comment to create on the PR
  • After commenting, the bot will get to the terminal stage of its lifecycle.

Risk score optimisation

Feature: risk scores would be more refined: The bot will follow these steps after every new installation

It needs to prepare all the files with associated risk scores beforehand to react to PR events.
To do so, it needs to fetch all repositories on which the bot has been installed.
Then, iterate on each repository and get all files.
For each file, first calculate the risk score and then save it.
Now, the bot can give the files with their respective scores in every PR.

Add a scheduler to fetch and update all the predicted risk scores in the 'File' model

This scheduler will be responsible for all the retraining of the predictor model. This scheduler will run every 10 minutes to update any residual job in the DB.
The jobs collection schema would be like this:
{
installationId,
owner,
repoName,
filePath,
status: completed, not-completed.
}

Every 10 minutes, the scheduler will query the DB with the jobs with the status as not-completed. It will fetch the mindsDB with parameters given in the schema to get the unique filePath predicted score and then finally it will update the predicted risk score in the File model.

Batch query on mindsDB is returning the same set of files again and again

Currently on executing a batch query on mindsDB with only installationId as a parameter is returning the same set of files which is expected behaviour from the DB point of view.

But, the bot is overriding the updated predicted scores on the files which is unexpected behaviour. Their should be something to identify in the mindsDB table to make sure the bot gets new rows.

Check if pagination feature is present in mindsdb javascript sdk to solve this issue

Not able to calculate risk score due to error while sorting the commit list

WARN (probot): Commit date not specified
ERROR (probot): a.date.getTime is not a function
TypeError: a.date.getTime is not a function
at /home/vishesh.baghel/Documents/workspace/personal-projects/glide/lib/services/riskScoreService.js:7:54
at Array.sort ()
at calculateRiskScore (/home/vishesh.baghel/Documents/workspace/personal-projects/glide/lib/services/riskScoreService.js:7:17)
at /home/vishesh.baghel/Documents/workspace/personal-projects/glide/lib/services/repositoryService.js:129:98
at Array.map ()
at /home/vishesh.baghel/Documents/workspace/personal-projects/glide/lib/services/repositoryService.js:121:60
at step (/home/vishesh.baghel/Documents/workspace/personal-projects/glide/lib/services/repositoryService.js:33:23)
at Object.next (/home/vishesh.baghel/Documents/workspace/personal-projects/glide/lib/services/repositoryService.js:14:53)
at fulfilled (/home/vishesh.baghel/Documents/workspace/personal-projects/glide/lib/services/repositoryService.js:5:58)

Not able to find the files on the tree

ERROR (probot): Error while fetching resource details for resource url: GET /repos/{owner}/{repo}/git/trees/{tree_sha}
ERROR (probot): Error occurred while fetching all files for vishesh-baghel/codespace-demo and installation id: 45484616
ERROR (HttpError): Not Found
HttpError: Not Found
at /home/vishesh.baghel/Documents/workspace/personal-projects/glide/node_modules/octokit/node_modules/@octokit/request/dist-node/index.js:124:21
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async sendRequestWithRetries (/home/vishesh.baghel/Documents/workspace/personal-projects/glide/node_modules/@octokit/auth-app/dist-node/index.js:398:12)
at async requestWithGraphqlErrorHandling (/home/vishesh.baghel/Documents/workspace/personal-projects/glide/node_modules/octokit/node_modules/@octokit/plugin-retry/dist-node/index.js:71:20)
at async Job.doExecute (/home/vishesh.baghel/Documents/workspace/personal-projects/glide/node_modules/bottleneck/light.js:405:18)
status: 404
request: {
method: "GET"
url: "https://api.github.com/repos/vishesh-baghel/codespace-demo/git/trees/main?recursive=true"
headers: {
"accept": "application/vnd.github.v3+json",
"user-agent": "octokit.js/3.1.2 octokit-core.js/5.0.2 Node.js/20.10.0 (linux; x64)",
"authorization": "token [REDACTED]"
}
request: {}
}

Add a new data model for training the predictor model

This is needed because the native query in the mindsdb editor is not working as expected. I am continuously getting errors while training the model. Fortunately I understood the reason why I was getting the errors.

I was trying to run the MongoDB native query as db.collection.find({}, {commits: 0}) but the commits array was not being excluded. I finally decided to keep the query as db.collection.find({}) and to make a new model which doesn't have the commits array.

The model's training completed successfully. I think the mindsdb's lightwood ai model doesn't process the dictionaries or arrays as a datatype for a column while training a regression model.

Make demo video

Tasks:

  • record the video
  • edit it
  • add the video on the github readme

Add installation_repositories.added listener to process newly added or removed repositories

It is important to handle removed repositories because it may happen that the bot won't be able to fetch the details of the removed repository.
use response.repositories_added to get the list. same for removed repos.
`
"repositories_added": [
{
"id": 732309770,
"node_id": "R_kgDOK6YpCg",
"name": "lombok",
"full_name": "vishesh-baghel/lombok",
"private": false
}
],
"repositories_removed": [

],
`

Add langchain api

Todo:

  • remove demo only comment generation code
  • turn off scheduled jobs for now
  • turn off predicted score for now
  • add basic langchain api integration

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.