Repository navigation
feat(hub): score applied learnings within the evaluation budget #396
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
Draft
nshki
wants to merge
7
commits into
nshki/feat/learning/score-applied-learnings
from
nshki/feat/hub/score-applied-learnings
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a3cab34
feat(hub): store learning score requests and evaluation runs
nshki 50322ec
feat(hub): let opted-in repositories use review comments for evaluation
nshki b4445ea
feat(hub): request scoring for commits agents report usage in
nshki cc5200e
feat(hub): read a commit's diff from GitHub
nshki 21eb5ae
feat(hub): score applied learnings within the monthly budget
nshki fdbd7f5
feat(hub): show this month's evaluation spending
nshki a50a46d
docs(hub): explain how Hub scores applied learnings
nshki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| model LearningEvaluationRun { | ||
| // ID columns | ||
| id String @id @default(uuid()) @db.Uuid | ||
| repositoryId String @map("repository_id") @db.Uuid | ||
| usedLearningId String @map("used_learning_id") @db.VarChar(255) | ||
| operationId String @unique @map("operation_id") @db.Uuid | ||
|
|
||
| // Relations | ||
| repository Repository @relation(fields: [repositoryId], references: [id], onDelete: Cascade) | ||
|
|
||
| // Attribute columns | ||
| state LearningRunState @default(RUNNING) | ||
| copilotRequests Int @default(0) @map("copilot_requests") | ||
| aiCredits Decimal @default(0) @map("ai_credits") @db.Decimal(20, 9) | ||
| scoreId String? @map("score_id") @db.VarChar(255) | ||
| failureCode String? @map("failure_code") @db.VarChar(60) | ||
| finishedAt DateTime? @map("finished_at") @db.Timestamptz(3) | ||
|
|
||
| // Timestamp columns | ||
| createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3) | ||
| updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(3) | ||
|
|
||
| @@unique([repositoryId, usedLearningId]) | ||
| @@index([createdAt]) | ||
| @@map("learning_evaluation_runs") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| model LearningScoreRequest { | ||
| // ID columns | ||
| id String @id @default(uuid()) @db.Uuid | ||
| repositoryId String @map("repository_id") @db.Uuid | ||
|
|
||
| // Relations | ||
| repository Repository @relation(fields: [repositoryId], references: [id], onDelete: Cascade) | ||
|
|
||
| // Attribute columns | ||
| commitSha String @map("commit_sha") @db.VarChar(64) | ||
|
|
||
| // Timestamp columns | ||
| createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3) | ||
| updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(3) | ||
|
|
||
| @@unique([repositoryId, commitSha]) | ||
| @@index([createdAt]) | ||
| @@map("learning_score_requests") | ||
| } |
53 changes: 53 additions & 0 deletions
53
hub/schema/migrations/20261225090000_learning_evaluation_runs/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| -- AlterTable | ||
| ALTER TABLE "repository_evaluation_settings" ADD COLUMN "evaluation_grant_id" VARCHAR(255); | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "learning_evaluation_runs" ( | ||
| "id" UUID NOT NULL, | ||
| "repository_id" UUID NOT NULL, | ||
| "used_learning_id" VARCHAR(255) NOT NULL, | ||
| "operation_id" UUID NOT NULL, | ||
| "state" "LearningRunState" NOT NULL DEFAULT 'RUNNING', | ||
| "copilot_requests" INTEGER NOT NULL DEFAULT 0, | ||
| "ai_credits" DECIMAL(20,9) NOT NULL DEFAULT 0, | ||
| "score_id" VARCHAR(255), | ||
| "failure_code" VARCHAR(60), | ||
| "finished_at" TIMESTAMPTZ(3), | ||
| "created_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| "updated_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
|
||
| CONSTRAINT "learning_evaluation_runs_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "learning_score_requests" ( | ||
| "id" UUID NOT NULL, | ||
| "repository_id" UUID NOT NULL, | ||
| "commit_sha" VARCHAR(64) NOT NULL, | ||
| "created_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| "updated_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
|
||
| CONSTRAINT "learning_score_requests_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- CreateIndex | ||
| CREATE UNIQUE INDEX "learning_evaluation_runs_operation_id_key" ON "learning_evaluation_runs"("operation_id"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "learning_evaluation_runs_created_at_idx" ON "learning_evaluation_runs"("created_at"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE UNIQUE INDEX "learning_evaluation_runs_repository_id_used_learning_id_key" ON "learning_evaluation_runs"("repository_id", "used_learning_id"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "learning_score_requests_created_at_idx" ON "learning_score_requests"("created_at"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE UNIQUE INDEX "learning_score_requests_repository_id_commit_sha_key" ON "learning_score_requests"("repository_id", "commit_sha"); | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "learning_evaluation_runs" ADD CONSTRAINT "learning_evaluation_runs_repository_id_fkey" FOREIGN KEY ("repository_id") REFERENCES "repositories"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "learning_score_requests" ADD CONSTRAINT "learning_score_requests_repository_id_fkey" FOREIGN KEY ("repository_id") REFERENCES "repositories"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.