From 2e7e86e2ce5af641f427c1a371611345f1e3ae06 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Mon, 16 Sep 2024 18:07:11 +0900 Subject: [PATCH 01/61] chore(WIP): element score --- src/parser/formatting-evaluator-module.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/parser/formatting-evaluator-module.ts b/src/parser/formatting-evaluator-module.ts index 35eb83ab..3f1f9396 100644 --- a/src/parser/formatting-evaluator-module.ts +++ b/src/parser/formatting-evaluator-module.ts @@ -138,6 +138,7 @@ export class FormattingEvaluatorModule implements Module { { symbols: { [p: string]: { count: number; multiplier: number } }; score: number } > = {}; const elements = htmlElement.getElementsByTagName("*"); + const tagCount: Record = {}; for (const element of elements) { const tagName = element.tagName.toLowerCase(); @@ -155,6 +156,12 @@ export class FormattingEvaluatorModule implements Module { logger.error(`Could not find multiplier for comment [${commentType}], <${tagName}>`); } logger.debug("Tag content results", { tagName, symbols, text: element.textContent }); + + // TODO + tagCount[tagName] = tagCount[tagName] + ? { ...tagCount[tagName], count: tagCount[tagName].count + 1 } + : { count: 1, score }; + // If we already had that tag included in the result, merge them and update total count if (Object.keys(tagWordCount).includes(tagName)) { for (const [k, v] of Object.entries(symbols)) { @@ -173,6 +180,8 @@ export class FormattingEvaluatorModule implements Module { } } + logger.info("tag count", { tagCount }); + return tagWordCount; } } From 6911a5d0586cfbb415e3653d3ddaf15d5dc311ea Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Wed, 18 Sep 2024 16:52:24 +0900 Subject: [PATCH 02/61] feat: changed word count and introduced elementCount --- README.md | 138 +++++++++--------- src/parser/formatting-evaluator-module.ts | 51 +++---- src/parser/github-comment-module.ts | 1 + src/parser/processor.ts | 6 +- .../results/valid-configuration.json | 4 +- 5 files changed, 98 insertions(+), 102 deletions(-) diff --git a/README.md b/README.md index b6f7b83c..d284dc59 100644 --- a/README.md +++ b/README.md @@ -80,75 +80,75 @@ with: dataPurge: {} formattingEvaluator: multipliers: - - role: [ ISSUE_SPECIFICATION ] - multiplier: 1 - rewards: - regex: - "\\b\\w+\\b": 0.1 - scores: # Scores can be set for each item differently - br: 0 - code: 1 - p: 1 - em: 0 - img: 0 - strong: 0 - blockquote: 0 - h1: 1 - h2: 1 - h3: 1 - h4: 1 - h5: 1 - h6: 1 - a: 1 - li: 1 - ul: 1 - td: 1 - hr: 0 - - role: [ISSUE_AUTHOR] - multiplier: 1 - rewards: - regex: - "\\b\\w+\\b": 0.2 - - role: [ISSUE_ASSIGNEE] - multiplier: 0 - rewards: - regex: - "\\b\\w+\\b": 0 - - role: [ISSUE_COLLABORATOR] - multiplier: 1 - rewards: - regex: - "\\b\\w+\\b": 0.1 - - role: [ISSUE_CONTRIBUTOR] - multiplier: 0.25 - rewards: - regex: - "\\b\\w+\\b": 0.1 - - role: [PULL_SPECIFICATION] - multiplier: 0 - rewards: - regex: - "\\b\\w+\\b": 0 - - role: [PULL_AUTHOR] - multiplier: 2 - rewards: - regex: - "\\b\\w+\\b": 0.2 - - role: [PULL_ASSIGNEE] - multiplier: 1 - rewards: - regex: - "\\b\\w+\\b": 0.1 - - role: [PULL_COLLABORATOR] - multiplier: 1 - rewards: - regex: - "\\b\\w+\\b": 0.1 - - role: [PULL_CONTRIBUTOR] - multiplier: 0.25 - rewards: - regex: - "\\b\\w+\\b": 0.1 + - role: [ ISSUE_SPECIFICATION ] + multiplier: 1 + rewards: + regex: + "\\b\\w+\\b": 0.1 + scores: # Scores can be set for each item differently + br: 0 + code: 1 + p: 1 + em: 0 + img: 0 + strong: 0 + blockquote: 0 + h1: 1 + h2: 1 + h3: 1 + h4: 1 + h5: 1 + h6: 1 + a: 1 + li: 1 + ul: 1 + td: 1 + hr: 0 + - role: [ISSUE_AUTHOR] + multiplier: 1 + rewards: + regex: + "\\b\\w+\\b": 0.2 + - role: [ISSUE_ASSIGNEE] + multiplier: 0 + rewards: + regex: + "\\b\\w+\\b": 0 + - role: [ISSUE_COLLABORATOR] + multiplier: 1 + rewards: + regex: + "\\b\\w+\\b": 0.1 + - role: [ISSUE_CONTRIBUTOR] + multiplier: 0.25 + rewards: + regex: + "\\b\\w+\\b": 0.1 + - role: [PULL_SPECIFICATION] + multiplier: 0 + rewards: + regex: + "\\b\\w+\\b": 0 + - role: [PULL_AUTHOR] + multiplier: 2 + rewards: + regex: + "\\b\\w+\\b": 0.2 + - role: [PULL_ASSIGNEE] + multiplier: 1 + rewards: + regex: + "\\b\\w+\\b": 0.1 + - role: [PULL_COLLABORATOR] + multiplier: 1 + rewards: + regex: + "\\b\\w+\\b": 0.1 + - role: [PULL_CONTRIBUTOR] + multiplier: 0.25 + rewards: + regex: + "\\b\\w+\\b": 0.1 permitGeneration: {} githubComment: post: true diff --git a/src/parser/formatting-evaluator-module.ts b/src/parser/formatting-evaluator-module.ts index 3f1f9396..d0e7acd8 100644 --- a/src/parser/formatting-evaluator-module.ts +++ b/src/parser/formatting-evaluator-module.ts @@ -10,7 +10,7 @@ import { } from "../configuration/formatting-evaluator-config"; import logger from "../helpers/logger"; import { IssueActivity } from "../issue-activity"; -import { GithubCommentScore, Module, Result } from "./processor"; +import { GithubCommentScore, Module, RegexCount, Result } from "./processor"; interface Multiplier { multiplier: number; @@ -81,9 +81,9 @@ export class FormattingEvaluatorModule implements Module { return Object.values(formatting).reduce((acc, curr) => { let sum = new Decimal(0); - for (const symbol of Object.keys(curr.symbols)) { - const count = new Decimal(curr.symbols[symbol].count); - const symbolMultiplier = new Decimal(curr.symbols[symbol].multiplier); + for (const symbol of Object.keys(curr.regex)) { + const count = new Decimal(curr.regex[symbol].wordCount); + const symbolMultiplier = new Decimal(curr.regex[symbol].wordValue); const formattingElementScore = new Decimal(curr.score); const exponent = this._wordCountExponent; @@ -113,7 +113,7 @@ export class FormattingEvaluatorModule implements Module { logger.debug("Will analyze formatting for the current content", { comment: comment.content, html }); const temp = new JSDOM(html); if (temp.window.document.body) { - const res = this.classifyTagsWithWordCount(temp.window.document.body, comment.type); + const res = this._classifyTagsWithWordCount(temp.window.document.body, comment.type); return { formatting: res }; } else { throw new Error(`Could not create DOM for comment [${comment}]`); @@ -121,27 +121,24 @@ export class FormattingEvaluatorModule implements Module { } _countSymbols(regexes: FormattingEvaluatorConfiguration["multipliers"][0]["rewards"]["regex"], text: string) { - const counts: { [p: string]: { count: number; multiplier: number } } = {}; + const counts: RegexCount = {}; for (const [regex, multiplier] of Object.entries(regexes)) { const match = text.trim().match(new RegExp(regex, "g")); counts[regex] = { - count: match?.length || 1, - multiplier, + wordCount: match?.length || 1, + wordValue: multiplier, }; } return counts; } - classifyTagsWithWordCount(htmlElement: HTMLElement, commentType: GithubCommentScore["type"]) { - const tagWordCount: Record< - string, - { symbols: { [p: string]: { count: number; multiplier: number } }; score: number } - > = {}; + _classifyTagsWithWordCount(htmlElement: HTMLElement, commentType: GithubCommentScore["type"]) { + const tagCount: Record = {}; const elements = htmlElement.getElementsByTagName("*"); - const tagCount: Record = {}; for (const element of elements) { const tagName = element.tagName.toLowerCase(); + // We cannot use textContent otherwise we would duplicate counts, so instead we extract text nodes const textNodes = Array.from(element?.childNodes || []).filter((node) => node.nodeType === 3); const innerText = textNodes @@ -155,33 +152,27 @@ export class FormattingEvaluatorModule implements Module { } else { logger.error(`Could not find multiplier for comment [${commentType}], <${tagName}>`); } - logger.debug("Tag content results", { tagName, symbols, text: element.textContent }); - - // TODO - tagCount[tagName] = tagCount[tagName] - ? { ...tagCount[tagName], count: tagCount[tagName].count + 1 } - : { count: 1, score }; // If we already had that tag included in the result, merge them and update total count - if (Object.keys(tagWordCount).includes(tagName)) { + if (Object.keys(tagCount).includes(tagName)) { for (const [k, v] of Object.entries(symbols)) { - if (Object.keys(tagWordCount[tagName].symbols).includes(k)) { - tagWordCount[tagName].symbols[k] = { - ...tagWordCount[tagName].symbols[k], - count: tagWordCount[tagName].symbols[k].count + v.count, + if (Object.keys(tagCount[tagName].regex).includes(k)) { + tagCount[tagName].regex[k] = { + ...tagCount[tagName].regex[k], + wordCount: tagCount[tagName].regex[k].wordCount + v.wordCount, }; + tagCount[tagName].elementCount += 1; } } } else { - tagWordCount[tagName] = { - symbols: symbols, + tagCount[tagName] = { + regex: symbols, score, + elementCount: 1, }; } } - logger.info("tag count", { tagCount }); - - return tagWordCount; + return tagCount; } } diff --git a/src/parser/github-comment-module.ts b/src/parser/github-comment-module.ts index e080d8a4..1bb94825 100644 --- a/src/parser/github-comment-module.ts +++ b/src/parser/github-comment-module.ts @@ -52,6 +52,7 @@ export class GithubCommentModule implements Module { result[key].evaluationCommentHtml = await this._generateHtml(key, value, true); strippedBody.push(result[key].evaluationCommentHtml); } + strippedBody.push(this._encodeHTML(`\n`)); return strippedBody.join(""); } diff --git a/src/parser/processor.ts b/src/parser/processor.ts index 9a95b3df..245fbb7a 100644 --- a/src/parser/processor.ts +++ b/src/parser/processor.ts @@ -89,6 +89,10 @@ export interface Result { }; } +export interface RegexCount { + [p: string]: { wordCount: number; wordValue: number }; +} + export interface GithubCommentScore { id: number; content: string; @@ -96,7 +100,7 @@ export interface GithubCommentScore { type: CommentKind | CommentAssociation; score?: { formatting?: { - content: Record; + content: Record; multiplier: number; }; relevance?: number; diff --git a/tests/__mocks__/results/valid-configuration.json b/tests/__mocks__/results/valid-configuration.json index 1a8e723d..5e974479 100644 --- a/tests/__mocks__/results/valid-configuration.json +++ b/tests/__mocks__/results/valid-configuration.json @@ -113,7 +113,7 @@ ] }, { - "multiplier": 0, + "multiplier": 1, "rewards": { "html": { "a": 1, @@ -137,7 +137,7 @@ "ul": 1 }, "regex": { - "\\b\\w+\\b": 0 + "\\b\\w+\\b": 0.1 } }, "role": [ From 7ba0fc5009b2df27ef359c3d07535daf2dfa3b49 Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Wed, 18 Sep 2024 18:53:58 +0900 Subject: [PATCH 03/61] chore: renamed values to match the configuration --- src/parser/formatting-evaluator-module.ts | 27 +++++++++++------------ 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/parser/formatting-evaluator-module.ts b/src/parser/formatting-evaluator-module.ts index d0e7acd8..7ad7ed51 100644 --- a/src/parser/formatting-evaluator-module.ts +++ b/src/parser/formatting-evaluator-module.ts @@ -82,20 +82,19 @@ export class FormattingEvaluatorModule implements Module { let sum = new Decimal(0); for (const symbol of Object.keys(curr.regex)) { - const count = new Decimal(curr.regex[symbol].wordCount); - const symbolMultiplier = new Decimal(curr.regex[symbol].wordValue); - const formattingElementScore = new Decimal(curr.score); + const wordCount = new Decimal(curr.regex[symbol].wordCount); + const wordValue = new Decimal(curr.regex[symbol].wordValue); + const score = new Decimal(curr.score); const exponent = this._wordCountExponent; - sum = sum.add( - count - .pow(exponent) // (count^exponent) - .mul(symbolMultiplier) // symbol multiplier - .mul(formattingElementScore) // comment type multiplier - .mul(multiplierFactor.multiplier) // formatting element score - ); + const wordTotalValue = wordCount + .pow(exponent) // (count^exponent) + .mul(wordValue); // symbol multiplier + const elementTotalValue = score.mul(curr.elementCount); // comment type multiplier + + sum = sum.add(wordTotalValue.add(elementTotalValue)); } - return acc.add(sum); + return acc.add(sum.mul(multiplierFactor.multiplier)); // formatting element score }, new Decimal(0)); } @@ -122,11 +121,11 @@ export class FormattingEvaluatorModule implements Module { _countSymbols(regexes: FormattingEvaluatorConfiguration["multipliers"][0]["rewards"]["regex"], text: string) { const counts: RegexCount = {}; - for (const [regex, multiplier] of Object.entries(regexes)) { + for (const [regex, wordValue] of Object.entries(regexes)) { const match = text.trim().match(new RegExp(regex, "g")); counts[regex] = { - wordCount: match?.length || 1, - wordValue: multiplier, + wordCount: match?.length || 0, + wordValue: wordValue, }; } return counts; From 207d47dabf358f40738dcf84bf3a843e8869726e Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:30:11 +0900 Subject: [PATCH 04/61] chore: fixed run comment --- src/parser/github-comment-module.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/parser/github-comment-module.ts b/src/parser/github-comment-module.ts index 1bb94825..72e8c464 100644 --- a/src/parser/github-comment-module.ts +++ b/src/parser/github-comment-module.ts @@ -52,7 +52,9 @@ export class GithubCommentModule implements Module { result[key].evaluationCommentHtml = await this._generateHtml(key, value, true); strippedBody.push(result[key].evaluationCommentHtml); } - strippedBody.push(this._encodeHTML(`\n`)); + strippedBody.push("\n"); return strippedBody.join(""); } From 3d6db3d1b8762a00d89900a978f50ad9d11bb54e Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Wed, 18 Sep 2024 23:02:48 +0900 Subject: [PATCH 05/61] chore: added proper count --- src/parser/formatting-evaluator-module.ts | 71 +++++--- .../results/output-reward-split.html | 134 ++++++++------- tests/__mocks__/results/reward-split.json | 160 ++++++++++-------- .../results/valid-configuration.json | 20 +-- 4 files changed, 213 insertions(+), 172 deletions(-) diff --git a/src/parser/formatting-evaluator-module.ts b/src/parser/formatting-evaluator-module.ts index 7ad7ed51..bfba7e37 100644 --- a/src/parser/formatting-evaluator-module.ts +++ b/src/parser/formatting-evaluator-module.ts @@ -119,7 +119,10 @@ export class FormattingEvaluatorModule implements Module { } } - _countSymbols(regexes: FormattingEvaluatorConfiguration["multipliers"][0]["rewards"]["regex"], text: string) { + _countSymbolsFromRegex( + regexes: FormattingEvaluatorConfiguration["multipliers"][0]["rewards"]["regex"], + text: string + ) { const counts: RegexCount = {}; for (const [regex, wordValue] of Object.entries(regexes)) { const match = text.trim().match(new RegExp(regex, "g")); @@ -131,12 +134,50 @@ export class FormattingEvaluatorModule implements Module { return counts; } + _updateTagCount( + tagCount: Record, + tagName: string, + regexCount: RegexCount, + score: number + ) { + // If we already had that tag included in the result, merge them and update total count + if (Object.keys(tagCount).includes(tagName)) { + for (const [k, v] of Object.entries(regexCount)) { + if (Object.keys(tagCount[tagName].regex).includes(k)) { + tagCount[tagName].regex[k] = { + ...tagCount[tagName].regex[k], + wordCount: tagCount[tagName].regex[k].wordCount + v.wordCount, + }; + tagCount[tagName].elementCount += 1; + } + } + } else { + tagCount[tagName] = { + regex: regexCount, + score, + elementCount: 1, + }; + } + } + _classifyTagsWithWordCount(htmlElement: HTMLElement, commentType: GithubCommentScore["type"]) { const tagCount: Record = {}; const elements = htmlElement.getElementsByTagName("*"); for (const element of elements) { const tagName = element.tagName.toLowerCase(); + let score = 0; + if (this._multipliers[commentType]?.html[tagName] !== undefined) { + score = this._multipliers[commentType].html[tagName]; + if (score === 0) { + element.remove(); + continue; + } + } else { + logger.error(`Could not find multiplier for comment [${commentType}], <${tagName}>`); + element.remove(); + continue; + } // We cannot use textContent otherwise we would duplicate counts, so instead we extract text nodes const textNodes = Array.from(element?.childNodes || []).filter((node) => node.nodeType === 3); @@ -144,34 +185,10 @@ export class FormattingEvaluatorModule implements Module { .map((node) => node.nodeValue?.trim()) .join(" ") .trim(); - const symbols = this._countSymbols(this._multipliers[commentType].regex, innerText); - let score = 0; - if (this._multipliers[commentType]?.html[tagName] !== undefined) { - score = this._multipliers[commentType].html[tagName]; - } else { - logger.error(`Could not find multiplier for comment [${commentType}], <${tagName}>`); - } + const regexCount = this._countSymbolsFromRegex(this._multipliers[commentType].regex, innerText); - // If we already had that tag included in the result, merge them and update total count - if (Object.keys(tagCount).includes(tagName)) { - for (const [k, v] of Object.entries(symbols)) { - if (Object.keys(tagCount[tagName].regex).includes(k)) { - tagCount[tagName].regex[k] = { - ...tagCount[tagName].regex[k], - wordCount: tagCount[tagName].regex[k].wordCount + v.wordCount, - }; - tagCount[tagName].elementCount += 1; - } - } - } else { - tagCount[tagName] = { - regex: symbols, - score, - elementCount: 1, - }; - } + this._updateTagCount(tagCount, tagName, regexCount, score); } - return tagCount; } } diff --git a/tests/__mocks__/results/output-reward-split.html b/tests/__mocks__/results/output-reward-split.html index 96ef4789..3c6ebba8 100644 --- a/tests/__mocks__/results/output-reward-split.html +++ b/tests/__mocks__/results/output-reward-split.html @@ -1,10 +1,10 @@ -

[ 42.914 WXDAI ]

@0x4007
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Specification 1 2.73
Issue Comment 2 3.544
Review Comment 3 11.64
Conversation Incentives
Comment Formatting Relevance Reward
Looks like the filters are barely useable now that we have the s…
2.73
content:
  p:
    symbols:
      \b\w+\b:
        count: 49
        multiplier: 0.1
    score: 1
  img:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.1
    score: 0
multiplier: 1
1 2.73
Okay both bots are broken @gentlementlegen We should have spli…
1.77
content:
  p:
    symbols:
      \b\w+\b:
        count: 13
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 1.416
Actually, looks like it did the right thing for your reward on v…
2.66
content:
  p:
    symbols:
      \b\w+\b:
        count: 21
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 2.128
Resolves https://github.com/ubiquity/work.ubq.fi/issues/69
0
content:
  p:
    symbols:
      \b\w+\b:
        count: 10
        multiplier: 0
    score: 1
multiplier: 0
0.8 -
I always struggle with Cypress
1.57
content:
  p:
    symbols:
      \b\w+\b:
        count: 5
        multiplier: 0.2
    score: 1
multiplier: 2
1 1.57
Only doesn't work on my local, the guess is token expiration aft…
10.07
content:
  p:
    symbols:
      \b\w+\b:
        count: 29
        multiplier: 0.2
    score: 1
  a:
    symbols:
      \b\w+\b:
        count: 11
        multiplier: 0.2
    score: 1
multiplier: 2
1 10.07

[ 29.474 WXDAI ]

@gentlementlegen
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Comment 2 2.224
Review Comment 1 2.25
Conversation Incentives
Comment Formatting Relevance Reward
@0x4007 So it should be 25 each? I can confirm this is not handl…
1.54
content:
  p:
    symbols:
      \b\w+\b:
        count: 25
        multiplier: 0.1
    score: 1
multiplier: 1
0.8 1.232
Ah yes because it doesn't apply the `0.5` multiplier I s…
1.24
content:
  p:
    symbols:
      \b\w+\b:
        count: 16
        multiplier: 0.1
    score: 1
  code:
    symbols:
      \b\w+\b:
        count: 2
        multiplier: 0.1
    score: 1
multiplier: 1
0.8 0.992
After token expiration, I could not reproduce the problem and st…
2.25
content:
  p:
    symbols:
      \b\w+\b:
        count: 39
        multiplier: 0.1
    score: 1
multiplier: 1
1 2.25
+

[ 56.074 WXDAI ]

@0x4007
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Specification 1 5.69
Issue Comment 2 5.944
Review Comment 3 19.44
Conversation Incentives
Comment Formatting Relevance Reward
Looks like the filters are barely useable now that we have the s…
5.69
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 48
        wordValue: 0.1
    score: 1
    elementCount: 2
  img:
    regex:
      \b\w+\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
1 5.69
Okay both bots are broken @gentlementlegen We should have spli…
3.77
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 13
        wordValue: 0.2
    score: 1
    elementCount: 2
multiplier: 1
0.8 3.016
Actually, looks like it did the right thing for your reward on v…
3.66
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 21
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
0.8 2.928
Resolves https://github.com/ubiquity/work.ubq.fi/issues/69
0
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 10
        wordValue: 0
    score: 1
    elementCount: 1
multiplier: 0
0.8 -
I always struggle with Cypress
3.57
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 5
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
1 3.57
Only doesn't work on my local, the guess is token expiration aft…
15.87
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 28
        wordValue: 0.2
    score: 1
    elementCount: 2
  a:
    regex:
      \b\w+\b:
        wordCount: 11
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
1 15.87

[ 32.874 WXDAI ]

@gentlementlegen
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Comment 2 4.624
Review Comment 1 3.25
Conversation Incentives
Comment Formatting Relevance Reward
@0x4007 So it should be 25 each? I can confirm this is not handl…
2.54
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 25
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
0.8 2.032
Ah yes because it doesn't apply the `0.5` multiplier I s…
3.24
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 16
        wordValue: 0.1
    score: 1
    elementCount: 1
  code:
    regex:
      \b\w+\b:
        wordCount: 2
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
0.8 2.592
After token expiration, I could not reproduce the problem and st…
3.25
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 39
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
1 3.25
\ No newline at end of file diff --git a/tests/__mocks__/results/reward-split.json b/tests/__mocks__/results/reward-split.json index 53f9ce0d..66a339f4 100644 --- a/tests/__mocks__/results/reward-split.json +++ b/tests/__mocks__/results/reward-split.json @@ -8,19 +8,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 2, + "regex": { "\\b\\w+\\b": { - "count": 13, - "multiplier": 0.2 + "wordCount": 13, + "wordValue": 0.2 } - } + }, + "score": 1 } }, "multiplier": 1 }, "relevance": 0.8, - "reward": 1.416 + "reward": 3.016 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquity/work.ubq.fi/issues/69#issuecomment-2186802545" @@ -32,19 +33,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 21, - "multiplier": 0.2 + "wordCount": 21, + "wordValue": 0.2 } - } + }, + "score": 1 } }, "multiplier": 1 }, "relevance": 0.8, - "reward": 2.128 + "reward": 2.928 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquity/work.ubq.fi/issues/69#issuecomment-2186807999" @@ -56,28 +58,30 @@ "formatting": { "content": { "img": { - "score": 0, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { + "elementCount": 2, + "regex": { "\\b\\w+\\b": { - "count": 49, - "multiplier": 0.1 + "wordCount": 48, + "wordValue": 0.1 } - } + }, + "score": 1 } }, "multiplier": 1 }, "relevance": 1, - "reward": 2.73 + "reward": 5.69 }, "type": "ISSUE_SPECIFICATION", "url": "https://github.com/ubiquity/work.ubq.fi/issues/69" @@ -89,13 +93,14 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 10, - "multiplier": 0 + "wordCount": 10, + "wordValue": 0 } - } + }, + "score": 1 } }, "multiplier": 0 @@ -113,19 +118,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 5, - "multiplier": 0.2 + "wordCount": 5, + "wordValue": 0.2 } - } + }, + "score": 1 } }, "multiplier": 2 }, "relevance": 1, - "reward": 1.57 + "reward": 3.57 }, "type": "PULL_AUTHOR", "url": "https://github.com/ubiquity/work.ubq.fi/pull/70#issuecomment-2186530214" @@ -137,40 +143,42 @@ "formatting": { "content": { "a": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 11, - "multiplier": 0.2 + "wordCount": 11, + "wordValue": 0.2 } - } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { + "elementCount": 2, + "regex": { "\\b\\w+\\b": { - "count": 29, - "multiplier": 0.2 + "wordCount": 28, + "wordValue": 0.2 } - } + }, + "score": 1 } }, "multiplier": 2 }, "relevance": 1, - "reward": 10.07 + "reward": 15.87 }, "type": "PULL_AUTHOR", "url": "https://github.com/ubiquity/work.ubq.fi/pull/70#issuecomment-2186798329" } ], - "evaluationCommentHtml": "

[ 42.914 WXDAI ]

@0x4007
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Specification 1 2.73
Issue Comment 2 3.544
Review Comment 3 11.64
Conversation Incentives
Comment Formatting Relevance Reward
Looks like the filters are barely useable now that we have the s…
2.73
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 49
        multiplier: 0.1
    score: 1
  img:
    symbols:
      \\b\\w+\\b:
        count: 1
        multiplier: 0.1
    score: 0
multiplier: 1
1 2.73
Okay both bots are broken @gentlementlegen We should have spli…
1.77
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 13
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 1.416
Actually, looks like it did the right thing for your reward on v…
2.66
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 21
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 2.128
Resolves https://github.com/ubiquity/work.ubq.fi/issues/69
0
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 10
        multiplier: 0
    score: 1
multiplier: 0
0.8 -
I always struggle with Cypress
1.57
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 5
        multiplier: 0.2
    score: 1
multiplier: 2
1 1.57
Only doesn't work on my local, the guess is token expiration aft…
10.07
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 29
        multiplier: 0.2
    score: 1
  a:
    symbols:
      \\b\\w+\\b:
        count: 11
        multiplier: 0.2
    score: 1
multiplier: 2
1 10.07
", - "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI0MjkxNDAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjMzOTI5NDE3NjI3OTM5NzU1OTMxNzgxMTE1NjU5ODM3OTc0NzU4OTQwMzc0OTU0MDQxMzEyODYzODI3ODA0MTE2ODc3MDgzNTI4ODgiLCJkZWFkbGluZSI6IjU3ODk2MDQ0NjE4NjU4MDk3NzExNzg1NDkyNTA0MzQzOTUzOTI2NjM0OTkyMzMyODIwMjgyMDE5NzI4NzkyMDAzOTU2NTY0ODE5OTY3In0sInRyYW5zZmVyRGV0YWlscyI6eyJ0byI6IjB4NEQwNzA0ZjQwMEQ1N0JhOTNlRWE4ODc2NUMzRmNEQkQ4MjZkQ0ZjNCIsInJlcXVlc3RlZEFtb3VudCI6IjQyOTE0MDAwMDAwMDAwMDAwMDAwIn0sIm93bmVyIjoiMHhkOTUzMEYzZmJCRWExMWJlRDAxREMwOUU3OTMxOGYyZjIwMjIzNzE2Iiwic2lnbmF0dXJlIjoiMHhiZTk2MzcyODc5ZGRhYjcxOTMwZTliNjk0ZjkxYzBlZDE5Mzk3Y2QzYmNlNzU2Njg1YzkwOWU2MDE0ZWEwZmU2MjZkYmZiNDM5MTlmZmVlM2M0MWNlMDE1ZTQwZTZmOWUwNmQ3NTZkMTU1NjIwYWZjYjM1MGRlZmM1NGRjOGM1MTFjIiwibmV0d29ya0lkIjoxMDB9XQ==", + "evaluationCommentHtml": "

[ 56.074 WXDAI ]

@0x4007
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Specification 1 5.69
Issue Comment 2 5.944
Review Comment 3 19.44
Conversation Incentives
Comment Formatting Relevance Reward
Looks like the filters are barely useable now that we have the s…
5.69
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 48
        wordValue: 0.1
    score: 1
    elementCount: 2
  img:
    regex:
      \\b\\w+\\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
1 5.69
Okay both bots are broken @gentlementlegen We should have spli…
3.77
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 13
        wordValue: 0.2
    score: 1
    elementCount: 2
multiplier: 1
0.8 3.016
Actually, looks like it did the right thing for your reward on v…
3.66
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 21
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
0.8 2.928
Resolves https://github.com/ubiquity/work.ubq.fi/issues/69
0
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 10
        wordValue: 0
    score: 1
    elementCount: 1
multiplier: 0
0.8 -
I always struggle with Cypress
3.57
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 5
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
1 3.57
Only doesn't work on my local, the guess is token expiration aft…
15.87
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 28
        wordValue: 0.2
    score: 1
    elementCount: 2
  a:
    regex:
      \\b\\w+\\b:
        wordCount: 11
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
1 15.87
", + "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI1NjA3NDAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjMzOTI5NDE3NjI3OTM5NzU1OTMxNzgxMTE1NjU5ODM3OTc0NzU4OTQwMzc0OTU0MDQxMzEyODYzODI3ODA0MTE2ODc3MDgzNTI4ODgiLCJkZWFkbGluZSI6IjU3ODk2MDQ0NjE4NjU4MDk3NzExNzg1NDkyNTA0MzQzOTUzOTI2NjM0OTkyMzMyODIwMjgyMDE5NzI4NzkyMDAzOTU2NTY0ODE5OTY3In0sInRyYW5zZmVyRGV0YWlscyI6eyJ0byI6IjB4NEQwNzA0ZjQwMEQ1N0JhOTNlRWE4ODc2NUMzRmNEQkQ4MjZkQ0ZjNCIsInJlcXVlc3RlZEFtb3VudCI6IjU2MDc0MDAwMDAwMDAwMDAwMDAwIn0sIm93bmVyIjoiMHhkOTUzMEYzZmJCRWExMWJlRDAxREMwOUU3OTMxOGYyZjIwMjIzNzE2Iiwic2lnbmF0dXJlIjoiMHg4ZTQ5MDk0YTZjY2YzZDdlMjc3MzAwMzViMDIxNzQ4YjBhMDUzZGYxYTYxNzNiMTQ2YTUzOWY1NTA4NmQwMDAyMTIyNmRkOTdlODE3ZmE0NTk5MTllYjI1MDljOGQxNmY4MzcxODZlMzZhZjUyYWYzYzI3ODk2YmE1NzgzMjRlMDFjIiwibmV0d29ya0lkIjoxMDB9XQ==", "task": { "multiplier": 0.5, "reward": 25 }, - "total": 42.914, + "total": 56.074, "userId": 4975670 }, "gentlementlegen": { @@ -182,19 +190,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 25, - "multiplier": 0.1 + "wordCount": 25, + "wordValue": 0.1 } - } + }, + "score": 1 } }, "multiplier": 1 }, "relevance": 0.8, - "reward": 1.232 + "reward": 2.032 }, "type": "ISSUE_COLLABORATOR", "url": "https://github.com/ubiquity/work.ubq.fi/issues/69#issuecomment-2186805818" @@ -206,28 +215,30 @@ "formatting": { "content": { "code": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.1 + "wordCount": 2, + "wordValue": 0.1 } - } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 16, - "multiplier": 0.1 + "wordCount": 16, + "wordValue": 0.1 } - } + }, + "score": 1 } }, "multiplier": 1 }, "relevance": 0.8, - "reward": 0.992 + "reward": 2.592 }, "type": "ISSUE_COLLABORATOR", "url": "https://github.com/ubiquity/work.ubq.fi/issues/69#issuecomment-2186813200" @@ -239,31 +250,32 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 39, - "multiplier": 0.1 + "wordCount": 39, + "wordValue": 0.1 } - } + }, + "score": 1 } }, "multiplier": 1 }, "relevance": 1, - "reward": 2.25 + "reward": 3.25 }, "type": "PULL_COLLABORATOR", "url": "https://github.com/ubiquity/work.ubq.fi/pull/70#issuecomment-2186914050" } ], - "evaluationCommentHtml": "

[ 29.474 WXDAI ]

@gentlementlegen
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Comment 2 2.224
Review Comment 1 2.25
Conversation Incentives
Comment Formatting Relevance Reward
@0x4007 So it should be 25 each? I can confirm this is not handl…
1.54
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 25
        multiplier: 0.1
    score: 1
multiplier: 1
0.8 1.232
Ah yes because it doesn't apply the `0.5` multiplier I s…
1.24
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 16
        multiplier: 0.1
    score: 1
  code:
    symbols:
      \\b\\w+\\b:
        count: 2
        multiplier: 0.1
    score: 1
multiplier: 1
0.8 0.992
After token expiration, I could not reproduce the problem and st…
2.25
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 39
        multiplier: 0.1
    score: 1
multiplier: 1
1 2.25
", - "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiIyOTQ3NDAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjgzMDc2NDM3NDQ2NDk5NTg5MzA0NjExMTI4OTYzOTE2NzEwMTA2ODg2MTAyNDM2MDIzODgxNTIwMDU4MzQ2ODAwNTc4NzU0NDAxNzU1IiwiZGVhZGxpbmUiOiI1Nzg5NjA0NDYxODY1ODA5NzcxMTc4NTQ5MjUwNDM0Mzk1MzkyNjYzNDk5MjMzMjgyMDI4MjAxOTcyODc5MjAwMzk1NjU2NDgxOTk2NyJ9LCJ0cmFuc2ZlckRldGFpbHMiOnsidG8iOiIweDREMDcwNGY0MDBENTdCYTkzZUVhODg3NjVDM0ZjREJEODI2ZENGYzQiLCJyZXF1ZXN0ZWRBbW91bnQiOiIyOTQ3NDAwMDAwMDAwMDAwMDAwMCJ9LCJvd25lciI6IjB4ZDk1MzBGM2ZiQkVhMTFiZUQwMURDMDlFNzkzMThmMmYyMDIyMzcxNiIsInNpZ25hdHVyZSI6IjB4MmI3YjE0ODU0NmMyMDNlNDkyNGFlNmJjZjdmMDBhYzZiZDA5NjJjNjNlOWYzZmFlMGZmZWZjNmZlNDYyNTc4MzU3ZGU1MjgxOTk1Mzg5NTYyMWNjZTU4MDYwNDc2NjNmZGEwNDU1NDU4ZGVmNDk0NTc4NTA3YmM5OTAzNGVkMDYxYyIsIm5ldHdvcmtJZCI6MTAwfV0=", + "evaluationCommentHtml": "

[ 32.874 WXDAI ]

@gentlementlegen
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Comment 2 4.624
Review Comment 1 3.25
Conversation Incentives
Comment Formatting Relevance Reward
@0x4007 So it should be 25 each? I can confirm this is not handl…
2.54
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 25
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
0.8 2.032
Ah yes because it doesn't apply the `0.5` multiplier I s…
3.24
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 16
        wordValue: 0.1
    score: 1
    elementCount: 1
  code:
    regex:
      \\b\\w+\\b:
        wordCount: 2
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
0.8 2.592
After token expiration, I could not reproduce the problem and st…
3.25
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 39
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
1 3.25
", + "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiIzMjg3NDAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjgzMDc2NDM3NDQ2NDk5NTg5MzA0NjExMTI4OTYzOTE2NzEwMTA2ODg2MTAyNDM2MDIzODgxNTIwMDU4MzQ2ODAwNTc4NzU0NDAxNzU1IiwiZGVhZGxpbmUiOiI1Nzg5NjA0NDYxODY1ODA5NzcxMTc4NTQ5MjUwNDM0Mzk1MzkyNjYzNDk5MjMzMjgyMDI4MjAxOTcyODc5MjAwMzk1NjU2NDgxOTk2NyJ9LCJ0cmFuc2ZlckRldGFpbHMiOnsidG8iOiIweDREMDcwNGY0MDBENTdCYTkzZUVhODg3NjVDM0ZjREJEODI2ZENGYzQiLCJyZXF1ZXN0ZWRBbW91bnQiOiIzMjg3NDAwMDAwMDAwMDAwMDAwMCJ9LCJvd25lciI6IjB4ZDk1MzBGM2ZiQkVhMTFiZUQwMURDMDlFNzkzMThmMmYyMDIyMzcxNiIsInNpZ25hdHVyZSI6IjB4YzViOGJhYWRkZTEyN2Q5YmYxODA3MWVkYmJjMDQwMjhjM2ZlOTA0NDUwNzNhM2YzMDA0NjRmM2EzYWFkMzliNTU3ZTc3MTMwZjFhNTViNzIyZWNmODJjYTI4Y2Q4Yjk3N2YzZTYyNmRhMDdmZGIxZWUzMDNjMzI5NjcwMzI0MjUxYyIsIm5ldHdvcmtJZCI6MTAwfV0=", "task": { "multiplier": 0.5, "reward": 25 }, - "total": 29.474, + "total": 32.874, "userId": 9807008 } } diff --git a/tests/__mocks__/results/valid-configuration.json b/tests/__mocks__/results/valid-configuration.json index 5e974479..c040b3a1 100644 --- a/tests/__mocks__/results/valid-configuration.json +++ b/tests/__mocks__/results/valid-configuration.json @@ -64,7 +64,7 @@ "h5": 1, "h6": 1, "hr": 0, - "img": 0, + "img": 1, "li": 1, "p": 1, "pre": 0, @@ -96,7 +96,7 @@ "h5": 1, "h6": 1, "hr": 0, - "img": 0, + "img": 1, "li": 1, "p": 1, "pre": 0, @@ -128,7 +128,7 @@ "h5": 1, "h6": 1, "hr": 0, - "img": 0, + "img": 1, "li": 1, "p": 1, "pre": 0, @@ -160,7 +160,7 @@ "h5": 1, "h6": 1, "hr": 0, - "img": 0, + "img": 1, "li": 1, "p": 1, "pre": 0, @@ -192,7 +192,7 @@ "h5": 1, "h6": 1, "hr": 0, - "img": 0, + "img": 1, "li": 1, "p": 1, "pre": 0, @@ -224,7 +224,7 @@ "h5": 1, "h6": 1, "hr": 0, - "img": 0, + "img": 1, "li": 1, "p": 1, "pre": 0, @@ -256,7 +256,7 @@ "h5": 1, "h6": 1, "hr": 0, - "img": 0, + "img": 1, "li": 1, "p": 1, "pre": 0, @@ -288,7 +288,7 @@ "h5": 1, "h6": 1, "hr": 0, - "img": 0, + "img": 1, "li": 1, "p": 1, "pre": 0, @@ -320,7 +320,7 @@ "h5": 1, "h6": 1, "hr": 0, - "img": 0, + "img": 1, "li": 1, "p": 1, "pre": 0, @@ -352,7 +352,7 @@ "h5": 1, "h6": 1, "hr": 0, - "img": 0, + "img": 1, "li": 1, "p": 1, "pre": 0, From 7ad97d78b37cbf105156fcb0f12e926b69deb2fa Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Wed, 18 Sep 2024 23:27:16 +0900 Subject: [PATCH 06/61] chore: added ol multiplier --- .../formatting-evaluator-config.ts | 1 + src/parser/formatting-evaluator-module.ts | 2 +- .../results/valid-configuration.json | 30 ++++++++++++------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/configuration/formatting-evaluator-config.ts b/src/configuration/formatting-evaluator-config.ts index 4726bdf4..780282fb 100644 --- a/src/configuration/formatting-evaluator-config.ts +++ b/src/configuration/formatting-evaluator-config.ts @@ -33,6 +33,7 @@ const htmlType = Type.Record(Type.String(), Type.Number(), { td: 1, hr: 0, pre: 0, + ol: 0, }, }); diff --git a/src/parser/formatting-evaluator-module.ts b/src/parser/formatting-evaluator-module.ts index bfba7e37..93c97cac 100644 --- a/src/parser/formatting-evaluator-module.ts +++ b/src/parser/formatting-evaluator-module.ts @@ -174,7 +174,7 @@ export class FormattingEvaluatorModule implements Module { continue; } } else { - logger.error(`Could not find multiplier for comment [${commentType}], <${tagName}>`); + logger.error(`Could not find multiplier for element <${tagName}> in comment [${element.outerHTML}]`); element.remove(); continue; } diff --git a/tests/__mocks__/results/valid-configuration.json b/tests/__mocks__/results/valid-configuration.json index c040b3a1..3dff9dca 100644 --- a/tests/__mocks__/results/valid-configuration.json +++ b/tests/__mocks__/results/valid-configuration.json @@ -70,7 +70,8 @@ "pre": 0, "strong": 0, "td": 1, - "ul": 1 + "ul": 1, + "ol": 0 }, "regex": { "\\b\\w+\\b": 0.1 @@ -102,7 +103,8 @@ "pre": 0, "strong": 0, "td": 1, - "ul": 1 + "ul": 1, + "ol": 0 }, "regex": { "\\b\\w+\\b": 0.2 @@ -134,7 +136,8 @@ "pre": 0, "strong": 0, "td": 1, - "ul": 1 + "ul": 1, + "ol": 0 }, "regex": { "\\b\\w+\\b": 0.1 @@ -166,7 +169,8 @@ "pre": 0, "strong": 0, "td": 1, - "ul": 1 + "ul": 1, + "ol": 0 }, "regex": { "\\b\\w+\\b": 0.1 @@ -198,7 +202,8 @@ "pre": 0, "strong": 0, "td": 1, - "ul": 1 + "ul": 1, + "ol": 0 }, "regex": { "\\b\\w+\\b": 0.1 @@ -230,7 +235,8 @@ "pre": 0, "strong": 0, "td": 1, - "ul": 1 + "ul": 1, + "ol": 0 }, "regex": { "\\b\\w+\\b": 0 @@ -262,7 +268,8 @@ "pre": 0, "strong": 0, "td": 1, - "ul": 1 + "ul": 1, + "ol": 0 }, "regex": { "\\b\\w+\\b": 0.2 @@ -294,7 +301,8 @@ "pre": 0, "strong": 0, "td": 1, - "ul": 1 + "ul": 1, + "ol": 0 }, "regex": { "\\b\\w+\\b": 0.1 @@ -326,7 +334,8 @@ "pre": 0, "strong": 0, "td": 1, - "ul": 1 + "ul": 1, + "ol": 0 }, "regex": { "\\b\\w+\\b": 0.1 @@ -358,7 +367,8 @@ "pre": 0, "strong": 0, "td": 1, - "ul": 1 + "ul": 1, + "ol": 0 }, "regex": { "\\b\\w+\\b": 0.1 From c6d58d71a2acc6061b521c79e0303960c9599f20 Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Wed, 18 Sep 2024 23:33:16 +0900 Subject: [PATCH 07/61] chore: changed default img score --- src/configuration/formatting-evaluator-config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/configuration/formatting-evaluator-config.ts b/src/configuration/formatting-evaluator-config.ts index 780282fb..a5c7042a 100644 --- a/src/configuration/formatting-evaluator-config.ts +++ b/src/configuration/formatting-evaluator-config.ts @@ -18,7 +18,7 @@ const htmlType = Type.Record(Type.String(), Type.Number(), { code: 1, p: 1, em: 0, - img: 0, + img: 1, strong: 0, blockquote: 0, h1: 1, From ec75a0e9934ecdc628a20a2fec2f02c01ce22ded Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Thu, 19 Sep 2024 13:56:37 +0900 Subject: [PATCH 08/61] chore: fixed html tag count total --- src/parser/formatting-evaluator-module.ts | 8 ++++---- tests/__mocks__/results/valid-configuration.json | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/parser/formatting-evaluator-module.ts b/src/parser/formatting-evaluator-module.ts index 93c97cac..ea298101 100644 --- a/src/parser/formatting-evaluator-module.ts +++ b/src/parser/formatting-evaluator-module.ts @@ -84,16 +84,16 @@ export class FormattingEvaluatorModule implements Module { for (const symbol of Object.keys(curr.regex)) { const wordCount = new Decimal(curr.regex[symbol].wordCount); const wordValue = new Decimal(curr.regex[symbol].wordValue); - const score = new Decimal(curr.score); const exponent = this._wordCountExponent; - const wordTotalValue = wordCount .pow(exponent) // (count^exponent) .mul(wordValue); // symbol multiplier - const elementTotalValue = score.mul(curr.elementCount); // comment type multiplier - sum = sum.add(wordTotalValue.add(elementTotalValue)); + sum = sum.add(wordTotalValue); } + const score = new Decimal(curr.score); + const elementTotalValue = score.mul(curr.elementCount); // comment type multiplier + sum = sum.add(elementTotalValue); return acc.add(sum.mul(multiplierFactor.multiplier)); // formatting element score }, new Decimal(0)); } diff --git a/tests/__mocks__/results/valid-configuration.json b/tests/__mocks__/results/valid-configuration.json index 3dff9dca..11adb783 100644 --- a/tests/__mocks__/results/valid-configuration.json +++ b/tests/__mocks__/results/valid-configuration.json @@ -74,7 +74,8 @@ "ol": 0 }, "regex": { - "\\b\\w+\\b": 0.1 + "\\b\\w+\\b": 0.1, + "\\b\\W+\\b": 0.1 } }, "role": [ From 8c4fe1b57e154581186d97148725d6c4e04ba7b1 Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Thu, 19 Sep 2024 14:15:50 +0900 Subject: [PATCH 09/61] fix: relevance is only applied to content --- src/parser/content-evaluator-module.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/parser/content-evaluator-module.ts b/src/parser/content-evaluator-module.ts index 56a0cbb2..765b9bf9 100644 --- a/src/parser/content-evaluator-module.ts +++ b/src/parser/content-evaluator-module.ts @@ -74,6 +74,19 @@ export class ContentEvaluatorModule implements Module { return result; } + _getRewardForComment(comment: GithubCommentScore | undefined, relevance: number) { + let reward = new Decimal(comment?.score?.reward || 0); + + if (comment?.score?.formatting?.content) { + let elementTotalReward = new Decimal(0); + for (const [, { score, elementCount }] of Object.entries(comment.score.formatting.content)) { + elementTotalReward = elementTotalReward.add(elementCount * score); + } + reward = reward.sub(elementTotalReward).mul(relevance).add(elementTotalReward); + } + return reward; + } + async _processComment(comments: Readonly[], specificationBody: string) { const commentsWithScore: GithubCommentScore[] = [...comments]; @@ -107,11 +120,12 @@ export class ContentEvaluatorModule implements Module { currentRelevance = relevancesByAI[currentComment.id]; } - const currentReward = new Decimal(currentComment.score?.reward || 0); + const currentReward = this._getRewardForComment(currentComment, currentRelevance); + currentComment.score = { ...(currentComment.score || {}), relevance: new Decimal(currentRelevance).toNumber(), - reward: currentReward.mul(currentRelevance).toNumber(), + reward: currentReward.toNumber(), }; } From 6481e788f9de0e5671c24d2ca1d7108e4e0fa000 Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Thu, 19 Sep 2024 14:30:47 +0900 Subject: [PATCH 10/61] chore: added result for formatting --- src/parser/formatting-evaluator-module.ts | 4 +++- src/parser/github-comment-module.ts | 2 +- src/parser/processor.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/parser/formatting-evaluator-module.ts b/src/parser/formatting-evaluator-module.ts index ea298101..05bece0a 100644 --- a/src/parser/formatting-evaluator-module.ts +++ b/src/parser/formatting-evaluator-module.ts @@ -59,13 +59,15 @@ export class FormattingEvaluatorModule implements Module { const { formatting } = this._getFormattingScore(comment); const multiplierFactor = this._multipliers?.[comment.type] ?? { multiplier: 0 }; const formattingTotal = this._calculateFormattingTotal(formatting, multiplierFactor).toDecimalPlaces(2); + const reward = (comment.score?.reward ? formattingTotal.add(comment.score.reward) : formattingTotal).toNumber(); comment.score = { ...comment.score, + reward, formatting: { content: formatting, multiplier: multiplierFactor.multiplier, + result: reward, }, - reward: (comment.score?.reward ? formattingTotal.add(comment.score.reward) : formattingTotal).toNumber(), }; } } diff --git a/src/parser/github-comment-module.ts b/src/parser/github-comment-module.ts index 72e8c464..eafb192f 100644 --- a/src/parser/github-comment-module.ts +++ b/src/parser/github-comment-module.ts @@ -213,7 +213,7 @@ export class GithubCommentModule implements Module {
- ${new Decimal(commentScore.score?.reward || 0).div(new Decimal(commentScore.score?.relevance || 1))} + ${new Decimal(commentScore.score?.formatting?.result || 0)}
${formatting}
diff --git a/src/parser/processor.ts b/src/parser/processor.ts index 245fbb7a..90f911a0 100644 --- a/src/parser/processor.ts +++ b/src/parser/processor.ts @@ -102,6 +102,7 @@ export interface GithubCommentScore { formatting?: { content: Record; multiplier: number; + result: number; }; relevance?: number; clarity?: number; From ad069932c4bf863be337d273cd08c83fa2f21bd4 Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Thu, 19 Sep 2024 14:45:01 +0900 Subject: [PATCH 11/61] chore: updated README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d284dc59..84f6cb86 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,11 @@ Be sure to review all `*.test.*` files for implementation details. } ``` -Reward formula: `((count * wordValue) * (score * multiplier) * n) * relevance + task.reward = total` +Reward formula: + +```math +\sum_{i=0}^{n} \left( \sum_{j=0}^{n} \left(\text{wordCount}^{exponent} \times \text{wordValue} \times \text{relevance}\right) + \left(\text{score} \times \text{elementCount}\right) \right) + \text{task.reward} = \text{total} +``` ## Plugin configuration From e6b3e7971045832dd2edad18ea020bf2a3006684 Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Thu, 19 Sep 2024 14:49:12 +0900 Subject: [PATCH 12/61] chore: updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 84f6cb86..42bdf124 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Be sure to review all `*.test.*` files for implementation details. Reward formula: ```math -\sum_{i=0}^{n} \left( \sum_{j=0}^{n} \left(\text{wordCount}^{exponent} \times \text{wordValue} \times \text{relevance}\right) + \left(\text{score} \times \text{elementCount}\right) \right) + \text{task.reward} = \text{total} +\sum_{i=0}^{n} \left( \sum_{j=0}^{n} \left(\text{wordCount}^{exponent} \times \text{wordValue} \times \text{relevance}\right) + \left(\text{score} \times \text{elementCount}\right) \right) \times multiplier + \text{task.reward} = \text{total} ``` ## Plugin configuration From e14fef345312dbd51a3fcc8d05934ebd96a46707 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Thu, 19 Sep 2024 15:24:00 +0900 Subject: [PATCH 13/61] chore: fixing tests --- .../results/content-evaluator-results.json | 487 +++++++++-------- .../results/formatting-evaluator-results.json | 485 +++++++++-------- .../results/github-comment-results.json | 499 +++++++++--------- tests/__mocks__/results/output.html | 429 ++++++++------- .../results/permit-generation-results.json | 493 ++++++++--------- tests/__mocks__/results/reward-split.json | 61 ++- 6 files changed, 1293 insertions(+), 1161 deletions(-) diff --git a/tests/__mocks__/results/content-evaluator-results.json b/tests/__mocks__/results/content-evaluator-results.json index 6cad6852..d8a69f3b 100644 --- a/tests/__mocks__/results/content-evaluator-results.json +++ b/tests/__mocks__/results/content-evaluator-results.json @@ -8,19 +8,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 21, - "multiplier": 0.2 + "wordCount": 21, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 3.66 }, "relevance": 0.8, - "reward": 2.128 + "reward": 3.128 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1948930217" @@ -32,19 +34,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 16, - "multiplier": 0.2 + "wordCount": 16, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 3.11 }, "relevance": 0.8, - "reward": 1.688 + "reward": 2.688 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949201722" @@ -56,28 +60,31 @@ "formatting": { "content": { "code": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.2 + "wordCount": 2, + "wordValue": 0.2 } - } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { + "elementCount": 3, + "regex": { "\\b\\w+\\b": { - "count": 69, - "multiplier": 0.2 + "wordCount": 69, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 11.67 }, "relevance": 0.8, - "reward": 6.136 + "reward": 10.136 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949203681" @@ -89,19 +96,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 9, - "multiplier": 0.2 + "wordCount": 9, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 2.29 }, "relevance": 0.8, - "reward": 1.032 + "reward": 2.032 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949633751" @@ -113,19 +122,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 8, - "multiplier": 0.2 + "wordCount": 8, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 2.17 }, "relevance": 0.8, - "reward": 0.936 + "reward": 1.936 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949639054" @@ -137,19 +148,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 51, - "multiplier": 0.2 + "wordCount": 51, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 6.66 }, "relevance": 0.8, - "reward": 4.528 + "reward": 5.528 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949642845" @@ -161,55 +174,39 @@ "formatting": { "content": { "code": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 4, - "multiplier": 0.1 - } - } - }, - "em": { - "score": 0, - "symbols": { - "\\b\\w+\\b": { - "count": 15, - "multiplier": 0.1 - } - } - }, - "li": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 3, - "multiplier": 0.1 - } - } - }, - "ol": { - "score": 0, - "symbols": { - "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 - } - } + "elementCount": 1, + "regex": { + "\\b\\W+\\b": { + "wordCount": 0, + "wordValue": 0.1 + }, + "\\b\\w+\\b": { + "wordCount": 1, + "wordValue": 0.1 + } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 54, - "multiplier": 0.1 - } - } + "elementCount": 3, + "regex": { + "\\b\\W+\\b": { + "wordCount": 18, + "wordValue": 0.1 + }, + "\\b\\w+\\b": { + "wordCount": 19, + "wordValue": 0.1 + } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 6.49 }, "relevance": 1, - "reward": 3.55 + "reward": 6.49 }, "type": "ISSUE_SPECIFICATION", "url": "https://github.com/ubiquibot/comment-incentives/issues/22" @@ -221,19 +218,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 7, - "multiplier": 0.1 + "wordCount": 7, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 1.52 }, "relevance": 1, - "reward": 0.52 + "reward": 1.52 }, "type": "PULL_COLLABORATOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949021356" @@ -245,19 +244,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 12, - "multiplier": 0.1 + "wordCount": 12, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 1.83 }, "relevance": 1, - "reward": 0.83 + "reward": 1.83 }, "type": "PULL_COLLABORATOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949196677" @@ -269,70 +270,67 @@ "formatting": { "content": { "a": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 }, "code": { - "score": 1, - "symbols": { + "elementCount": 2, + "regex": { "\\b\\w+\\b": { - "count": 205, - "multiplier": 0.1 + "wordCount": 2, + "wordValue": 0.1 } - } + }, + "score": 1 }, "li": { - "score": 1, - "symbols": { + "elementCount": 2, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 441, - "multiplier": 0.1 - } - } - }, - "pre": { - "score": 0, - "symbols": { + "elementCount": 38, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.1 + "wordCount": 437, + "wordValue": 0.1 } - } + }, + "score": 1 }, "ul": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 61.74 }, "relevance": 1, - "reward": 27.3 + "reward": 61.74 }, "type": "PULL_COLLABORATOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949196678" } ], - "total": 48.648, + "total": 97.028, "userId": 4975670 }, "gitcoindev": { @@ -344,19 +342,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 49, - "multiplier": 0 + "wordCount": 49, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0 + "multiplier": 1, + "result": 3.73 }, "relevance": 0.8, - "reward": 0 + "reward": 3.184 }, "type": "ISSUE_ASSIGNEE", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949333227" @@ -368,19 +368,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 2, + "regex": { "\\b\\w+\\b": { - "count": 18, - "multiplier": 0 + "wordCount": 18, + "wordValue": 0 } - } + }, + "score": 1 } }, - "multiplier": 0 + "multiplier": 0, + "result": 0 }, "relevance": 0.8, - "reward": 0 + "reward": 0.4 }, "type": "PULL_SPECIFICATION", "url": "https://github.com/ubiquibot/comment-incentives/pull/25" @@ -392,19 +394,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 10, - "multiplier": 0.2 + "wordCount": 10, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 2 + "multiplier": 2, + "result": 4.83 }, "relevance": 1, - "reward": 2.83 + "reward": 4.83 }, "type": "PULL_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949044575" @@ -416,19 +420,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 15, - "multiplier": 0.2 + "wordCount": 15, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 2 + "multiplier": 2, + "result": 6 }, "relevance": 1, - "reward": 4 + "reward": 6 }, "type": "PULL_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949046925" @@ -438,7 +444,7 @@ "multiplier": 1, "reward": 37.5 }, - "total": 44.33, + "total": 51.914, "userId": 88761781 }, "molecula451": { @@ -450,28 +456,31 @@ "formatting": { "content": { "img": { - "score": 0, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { + "elementCount": 3, + "regex": { "\\b\\w+\\b": { - "count": 16, - "multiplier": 0.1 + "wordCount": 15, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 1.25 }, "relevance": 0.8, - "reward": 0.208 + "reward": 1.8 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1948916343" @@ -483,19 +492,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 5, - "multiplier": 0.1 + "wordCount": 5, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.35 }, "relevance": 0.8, - "reward": 0.08 + "reward": 0.48 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1948989989" @@ -507,19 +518,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 14, - "multiplier": 0.1 + "wordCount": 14, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.49 }, "relevance": 0.8, - "reward": 0.192 + "reward": 0.592 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949195772" @@ -531,19 +544,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 12, - "multiplier": 0.1 + "wordCount": 12, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.46 }, "relevance": 0.8, - "reward": 0.168 + "reward": 0.568 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949564869" @@ -555,19 +570,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 31, - "multiplier": 0.1 + "wordCount": 31, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.71 }, "relevance": 0.8, - "reward": 0.368 + "reward": 0.768 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949635137" @@ -579,19 +596,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.1 + "wordCount": 2, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.3 }, "relevance": 0.8, - "reward": 0.04 + "reward": 0.44 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949639196" @@ -603,19 +622,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 1, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.28 }, "relevance": 1, - "reward": 0.03 + "reward": 0.28 }, "type": "PULL_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949038563" @@ -627,25 +648,27 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 18, - "multiplier": 0.1 + "wordCount": 18, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.54 }, "relevance": 1, - "reward": 0.29 + "reward": 0.54 }, "type": "PULL_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949044855" } ], - "total": 1.376, + "total": 5.468, "userId": 41552663 } } diff --git a/tests/__mocks__/results/formatting-evaluator-results.json b/tests/__mocks__/results/formatting-evaluator-results.json index fb8c3602..2662a506 100644 --- a/tests/__mocks__/results/formatting-evaluator-results.json +++ b/tests/__mocks__/results/formatting-evaluator-results.json @@ -8,18 +8,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 21, - "multiplier": 0.2 + "wordCount": 21, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 3.66 }, - "reward": 2.66 + "reward": 3.66 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1948930217" @@ -31,18 +33,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 16, - "multiplier": 0.2 + "wordCount": 16, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 3.11 }, - "reward": 2.11 + "reward": 3.11 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949201722" @@ -54,27 +58,30 @@ "formatting": { "content": { "code": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.2 + "wordCount": 2, + "wordValue": 0.2 } - } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { + "elementCount": 3, + "regex": { "\\b\\w+\\b": { - "count": 69, - "multiplier": 0.2 + "wordCount": 69, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 11.67 }, - "reward": 7.67 + "reward": 11.67 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949203681" @@ -86,18 +93,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 9, - "multiplier": 0.2 + "wordCount": 9, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 2.29 }, - "reward": 1.29 + "reward": 2.29 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949633751" @@ -109,18 +118,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 8, - "multiplier": 0.2 + "wordCount": 8, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 2.17 }, - "reward": 1.17 + "reward": 2.17 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949639054" @@ -132,18 +143,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 51, - "multiplier": 0.2 + "wordCount": 51, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 6.66 }, - "reward": 5.66 + "reward": 6.66 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949642845" @@ -155,54 +168,38 @@ "formatting": { "content": { "code": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 4, - "multiplier": 0.1 - } - } - }, - "em": { - "score": 0, - "symbols": { - "\\b\\w+\\b": { - "count": 15, - "multiplier": 0.1 - } - } - }, - "li": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 3, - "multiplier": 0.1 - } - } - }, - "ol": { - "score": 0, - "symbols": { - "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 - } - } + "elementCount": 1, + "regex": { + "\\b\\W+\\b": { + "wordCount": 0, + "wordValue": 0.1 + }, + "\\b\\w+\\b": { + "wordCount": 1, + "wordValue": 0.1 + } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 54, - "multiplier": 0.1 - } - } + "elementCount": 3, + "regex": { + "\\b\\W+\\b": { + "wordCount": 18, + "wordValue": 0.1 + }, + "\\b\\w+\\b": { + "wordCount": 19, + "wordValue": 0.1 + } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 6.49 }, - "reward": 3.55 + "reward": 6.49 }, "type": "ISSUE_SPECIFICATION", "url": "https://github.com/ubiquibot/comment-incentives/issues/22" @@ -214,18 +211,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 7, - "multiplier": 0.1 + "wordCount": 7, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 1.52 }, - "reward": 0.52 + "reward": 1.52 }, "type": "PULL_COLLABORATOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949021356" @@ -237,18 +236,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 12, - "multiplier": 0.1 + "wordCount": 12, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 1.83 }, - "reward": 0.83 + "reward": 1.83 }, "type": "PULL_COLLABORATOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949196677" @@ -260,69 +261,66 @@ "formatting": { "content": { "a": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 }, "code": { - "score": 1, - "symbols": { + "elementCount": 2, + "regex": { "\\b\\w+\\b": { - "count": 205, - "multiplier": 0.1 + "wordCount": 2, + "wordValue": 0.1 } - } + }, + "score": 1 }, "li": { - "score": 1, - "symbols": { + "elementCount": 2, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 441, - "multiplier": 0.1 - } - } - }, - "pre": { - "score": 0, - "symbols": { + "elementCount": 38, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.1 + "wordCount": 437, + "wordValue": 0.1 } - } + }, + "score": 1 }, "ul": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 61.74 }, - "reward": 27.3 + "reward": 61.74 }, "type": "PULL_COLLABORATOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949196678" } ], - "total": 52.76, + "total": 101.14, "userId": 4975670 }, "gitcoindev": { @@ -334,18 +332,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 49, - "multiplier": 0 + "wordCount": 49, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0 + "multiplier": 1, + "result": 3.73 }, - "reward": 0 + "reward": 3.73 }, "type": "ISSUE_ASSIGNEE", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949333227" @@ -357,16 +357,18 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 2, + "regex": { "\\b\\w+\\b": { - "count": 18, - "multiplier": 0 + "wordCount": 18, + "wordValue": 0 } - } + }, + "score": 1 } }, - "multiplier": 0 + "multiplier": 0, + "result": 0 }, "reward": 0 }, @@ -380,18 +382,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 10, - "multiplier": 0.2 + "wordCount": 10, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 2 + "multiplier": 2, + "result": 4.83 }, - "reward": 2.83 + "reward": 4.83 }, "type": "PULL_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949044575" @@ -403,18 +407,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 15, - "multiplier": 0.2 + "wordCount": 15, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 2 + "multiplier": 2, + "result": 6 }, - "reward": 4 + "reward": 6 }, "type": "PULL_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949046925" @@ -424,7 +430,7 @@ "multiplier": 1, "reward": 37.5 }, - "total": 44.33, + "total": 52.06, "userId": 88761781 }, "molecula451": { @@ -436,27 +442,30 @@ "formatting": { "content": { "img": { - "score": 0, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { + "elementCount": 3, + "regex": { "\\b\\w+\\b": { - "count": 16, - "multiplier": 0.1 + "wordCount": 15, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 1.25 }, - "reward": 0.26 + "reward": 1.25 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1948916343" @@ -468,18 +477,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 5, - "multiplier": 0.1 + "wordCount": 5, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.35 }, - "reward": 0.1 + "reward": 0.35 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1948989989" @@ -491,18 +502,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 14, - "multiplier": 0.1 + "wordCount": 14, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.49 }, - "reward": 0.24 + "reward": 0.49 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949195772" @@ -514,18 +527,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 12, - "multiplier": 0.1 + "wordCount": 12, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.46 }, - "reward": 0.21 + "reward": 0.46 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949564869" @@ -537,18 +552,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 31, - "multiplier": 0.1 + "wordCount": 31, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.71 }, - "reward": 0.46 + "reward": 0.71 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949635137" @@ -560,18 +577,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.1 + "wordCount": 2, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.3 }, - "reward": 0.05 + "reward": 0.3 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949639196" @@ -583,18 +602,20 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 1, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.28 }, - "reward": 0.03 + "reward": 0.28 }, "type": "PULL_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949038563" @@ -606,24 +627,26 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 18, - "multiplier": 0.1 + "wordCount": 18, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.54 }, - "reward": 0.29 + "reward": 0.54 }, "type": "PULL_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949044855" } ], - "total": 1.64, + "total": 4.38, "userId": 41552663 } } diff --git a/tests/__mocks__/results/github-comment-results.json b/tests/__mocks__/results/github-comment-results.json index 4d494d3c..62010011 100644 --- a/tests/__mocks__/results/github-comment-results.json +++ b/tests/__mocks__/results/github-comment-results.json @@ -8,19 +8,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 21, - "multiplier": 0.2 + "wordCount": 21, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 3.66 }, "relevance": 0.8, - "reward": 2.128 + "reward": 3.128 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1948930217" @@ -32,19 +34,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 16, - "multiplier": 0.2 + "wordCount": 16, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 3.11 }, "relevance": 0.8, - "reward": 1.688 + "reward": 2.688 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949201722" @@ -56,28 +60,31 @@ "formatting": { "content": { "code": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.2 + "wordCount": 2, + "wordValue": 0.2 } - } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { + "elementCount": 3, + "regex": { "\\b\\w+\\b": { - "count": 69, - "multiplier": 0.2 + "wordCount": 69, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 11.67 }, "relevance": 0.8, - "reward": 6.136 + "reward": 10.136 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949203681" @@ -89,19 +96,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 9, - "multiplier": 0.2 + "wordCount": 9, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 2.29 }, "relevance": 0.8, - "reward": 1.032 + "reward": 2.032 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949633751" @@ -113,19 +122,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 8, - "multiplier": 0.2 + "wordCount": 8, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 2.17 }, "relevance": 0.8, - "reward": 0.936 + "reward": 1.936 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949639054" @@ -137,19 +148,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 51, - "multiplier": 0.2 + "wordCount": 51, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 6.66 }, "relevance": 0.8, - "reward": 4.528 + "reward": 5.528 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949642845" @@ -161,55 +174,39 @@ "formatting": { "content": { "code": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 4, - "multiplier": 0.1 - } - } - }, - "em": { - "score": 0, - "symbols": { - "\\b\\w+\\b": { - "count": 15, - "multiplier": 0.1 - } - } - }, - "li": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 3, - "multiplier": 0.1 - } - } - }, - "ol": { - "score": 0, - "symbols": { - "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 - } - } + "elementCount": 1, + "regex": { + "\\b\\W+\\b": { + "wordCount": 0, + "wordValue": 0.1 + }, + "\\b\\w+\\b": { + "wordCount": 1, + "wordValue": 0.1 + } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 54, - "multiplier": 0.1 - } - } + "elementCount": 3, + "regex": { + "\\b\\W+\\b": { + "wordCount": 18, + "wordValue": 0.1 + }, + "\\b\\w+\\b": { + "wordCount": 19, + "wordValue": 0.1 + } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 6.49 }, "relevance": 1, - "reward": 3.55 + "reward": 6.49 }, "type": "ISSUE_SPECIFICATION", "url": "https://github.com/ubiquibot/comment-incentives/issues/22" @@ -221,19 +218,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 7, - "multiplier": 0.1 + "wordCount": 7, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 1.52 }, "relevance": 1, - "reward": 0.52 + "reward": 1.52 }, "type": "PULL_COLLABORATOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949021356" @@ -245,19 +244,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 12, - "multiplier": 0.1 + "wordCount": 12, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 1.83 }, "relevance": 1, - "reward": 0.83 + "reward": 1.83 }, "type": "PULL_COLLABORATOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949196677" @@ -269,72 +270,69 @@ "formatting": { "content": { "a": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 }, "code": { - "score": 1, - "symbols": { + "elementCount": 2, + "regex": { "\\b\\w+\\b": { - "count": 205, - "multiplier": 0.1 + "wordCount": 2, + "wordValue": 0.1 } - } + }, + "score": 1 }, "li": { - "score": 1, - "symbols": { + "elementCount": 2, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 441, - "multiplier": 0.1 - } - } - }, - "pre": { - "score": 0, - "symbols": { + "elementCount": 38, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.1 + "wordCount": 437, + "wordValue": 0.1 } - } + }, + "score": 1 }, "ul": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 61.74 }, "relevance": 1, - "reward": 27.3 + "reward": 61.74 }, "type": "PULL_COLLABORATOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949196678" } ], - "evaluationCommentHtml": "

[ 48.648 WXDAI ]

@0x4007
Contributions Overview
View Contribution Count Reward
Issue Specification 1 3.55
Issue Comment 6 16.448
Review Comment 3 28.65
Conversation Incentives
Comment Formatting Relevance Reward
Can somebody work on generating a new `X25519_PRIVATE_KEY …
3.55
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 54
        multiplier: 0.1
    score: 1
  code:
    symbols:
      \\b\\w+\\b:
        count: 4
        multiplier: 0.1
    score: 1
  ol:
    symbols:
      \\b\\w+\\b:
        count: 1
        multiplier: 0.1
    score: 0
  li:
    symbols:
      \\b\\w+\\b:
        count: 3
        multiplier: 0.1
    score: 1
  em:
    symbols:
      \\b\\w+\\b:
        count: 15
        multiplier: 0.1
    score: 0
multiplier: 1
1 3.55
Link below for conversation context. It was to me. Anyways you n…
2.66
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 21
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 2.128
In the repository secrets I think I need to change the key to ma…
2.11
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 16
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 1.688
I just changed it to `627H-BcWbcp_O3YmQGIA6MqgxVsFuplFCA9DK3…
7.67
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 69
        multiplier: 0.2
    score: 1
  code:
    symbols:
      \\b\\w+\\b:
        count: 2
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 6.136
I don't understand what you mean by this
1.29
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 9
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 1.032
I'll investigate more on my computer later.
1.17
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 8
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 0.936
Will it be an issue if I revert to the commit and secret that I …
5.66
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 51
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 4.528
Need to document a private key too
0.52
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 7
        multiplier: 0.1
    score: 1
multiplier: 1
1 0.52
I was editing this right now but was too slow to push.
0.83
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 12
        multiplier: 0.1
    score: 1
multiplier: 1
1 0.83
I am quoting some code! <task-lists sortable=\"\"> <tab…
27.3
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 441
        multiplier: 0.1
    score: 1
  pre:
    symbols:
      \\b\\w+\\b:
        count: 2
        multiplier: 0.1
    score: 0
  code:
    symbols:
      \\b\\w+\\b:
        count: 205
        multiplier: 0.1
    score: 1
  a:
    symbols:
      \\b\\w+\\b:
        count: 1
        multiplier: 0.1
    score: 1
  ul:
    symbols:
      \\b\\w+\\b:
        count: 1
        multiplier: 0.1
    score: 1
  li:
    symbols:
      \\b\\w+\\b:
        count: 2
        multiplier: 0.1
    score: 1
multiplier: 1
1 27.3
", - "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI0ODY0ODAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjMzOTI5NDE3NjI3OTM5NzU1OTMxNzgxMTE1NjU5ODM3OTc0NzU4OTQwMzc0OTU0MDQxMzEyODYzODI3ODA0MTE2ODc3MDgzNTI4ODgiLCJkZWFkbGluZSI6IjU3ODk2MDQ0NjE4NjU4MDk3NzExNzg1NDkyNTA0MzQzOTUzOTI2NjM0OTkyMzMyODIwMjgyMDE5NzI4NzkyMDAzOTU2NTY0ODE5OTY3In0sInRyYW5zZmVyRGV0YWlscyI6eyJ0byI6IjB4NEQwNzA0ZjQwMEQ1N0JhOTNlRWE4ODc2NUMzRmNEQkQ4MjZkQ0ZjNCIsInJlcXVlc3RlZEFtb3VudCI6IjQ4NjQ4MDAwMDAwMDAwMDAwMDAwIn0sIm93bmVyIjoiMHhkOTUzMEYzZmJCRWExMWJlRDAxREMwOUU3OTMxOGYyZjIwMjIzNzE2Iiwic2lnbmF0dXJlIjoiMHgwYWE5ZmRhYjAyZWYyM2MxNTcwMDlhODMxYjVkYWVkNjBkNGExNmFmZmMyNDcyOGEzNWY5M2MwNTg2YzFiZmY1NmY0MGYzMjQyMjI3YWIwNTkxZWJlZjdhZTYzODdkMzg5YTZkYmM0ODY5OTg1NDU3NGRmNTM3NTdkN2NkMDE2MjFiIiwibmV0d29ya0lkIjoxMDB9XQ==", - "total": 48.648, + "evaluationCommentHtml": "

[ 97.028 WXDAI ]

@0x4007
Contributions Overview
View Contribution Count Reward
Issue Specification 1 6.49
Issue Comment 6 25.448
Review Comment 3 65.09
Conversation Incentives
Comment Formatting Relevance Reward
Can somebody work on generating a new `X25519_PRIVATE_KEY …
6.49
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 19
        wordValue: 0.1
      \\b\\W+\\b:
        wordCount: 18
        wordValue: 0.1
    score: 1
    elementCount: 3
  code:
    regex:
      \\b\\w+\\b:
        wordCount: 1
        wordValue: 0.1
      \\b\\W+\\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 6.49
1 6.49
Link below for conversation context. It was to me. Anyways you n…
3.66
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 21
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
result: 3.66
0.8 3.128
In the repository secrets I think I need to change the key to ma…
3.11
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 16
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
result: 3.11
0.8 2.688
I just changed it to `627H-BcWbcp_O3YmQGIA6MqgxVsFuplFCA9DK3…
11.67
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 69
        wordValue: 0.2
    score: 1
    elementCount: 3
  code:
    regex:
      \\b\\w+\\b:
        wordCount: 2
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
result: 11.67
0.8 10.136
I don't understand what you mean by this
2.29
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 9
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
result: 2.29
0.8 2.032
I'll investigate more on my computer later.
2.17
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 8
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
result: 2.17
0.8 1.936
Will it be an issue if I revert to the commit and secret that I …
6.66
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 51
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
result: 6.66
0.8 5.528
Need to document a private key too
1.52
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 7
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 1.52
1 1.52
I was editing this right now but was too slow to push.
1.83
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 12
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 1.83
1 1.83
I am quoting some code! <task-lists sortable=\"\"> <tab…
61.74
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 437
        wordValue: 0.1
    score: 1
    elementCount: 38
  code:
    regex:
      \\b\\w+\\b:
        wordCount: 2
        wordValue: 0.1
    score: 1
    elementCount: 2
  a:
    regex:
      \\b\\w+\\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 1
  ul:
    regex:
      \\b\\w+\\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 1
  li:
    regex:
      \\b\\w+\\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 2
multiplier: 1
result: 61.74
1 61.74
", + "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI5NzAyODAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjMzOTI5NDE3NjI3OTM5NzU1OTMxNzgxMTE1NjU5ODM3OTc0NzU4OTQwMzc0OTU0MDQxMzEyODYzODI3ODA0MTE2ODc3MDgzNTI4ODgiLCJkZWFkbGluZSI6IjU3ODk2MDQ0NjE4NjU4MDk3NzExNzg1NDkyNTA0MzQzOTUzOTI2NjM0OTkyMzMyODIwMjgyMDE5NzI4NzkyMDAzOTU2NTY0ODE5OTY3In0sInRyYW5zZmVyRGV0YWlscyI6eyJ0byI6IjB4NEQwNzA0ZjQwMEQ1N0JhOTNlRWE4ODc2NUMzRmNEQkQ4MjZkQ0ZjNCIsInJlcXVlc3RlZEFtb3VudCI6Ijk3MDI4MDAwMDAwMDAwMDAwMDAwIn0sIm93bmVyIjoiMHhkOTUzMEYzZmJCRWExMWJlRDAxREMwOUU3OTMxOGYyZjIwMjIzNzE2Iiwic2lnbmF0dXJlIjoiMHgwMDgzMjA3MmFlNjg4NWRkN2M2ZjVhNDE3ZDUxYjRhZjNhMGQxZDFiMDI2ZGEyOGFlZDVlMjQ3OGQ2ZGFkNDllM2Y5MmJhOGIxNmRlNTc0Mjk5NzIxNDk2MjQ4YWQyYzZhODE4MDMyNTQzYTI4NDE2NzU0MWRjMTA3YzBhYzBlYzFiIiwibmV0d29ya0lkIjoxMDB9XQ==", + "total": 97.028, "userId": 4975670 }, "gitcoindev": { @@ -346,19 +344,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 49, - "multiplier": 0 + "wordCount": 49, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0 + "multiplier": 1, + "result": 3.73 }, "relevance": 0.8, - "reward": 0 + "reward": 3.184 }, "type": "ISSUE_ASSIGNEE", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949333227" @@ -370,19 +370,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 2, + "regex": { "\\b\\w+\\b": { - "count": 18, - "multiplier": 0 + "wordCount": 18, + "wordValue": 0 } - } + }, + "score": 1 } }, - "multiplier": 0 + "multiplier": 0, + "result": 0 }, "relevance": 0.8, - "reward": 0 + "reward": 0.4 }, "type": "PULL_SPECIFICATION", "url": "https://github.com/ubiquibot/comment-incentives/pull/25" @@ -394,19 +396,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 10, - "multiplier": 0.2 + "wordCount": 10, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 2 + "multiplier": 2, + "result": 4.83 }, "relevance": 1, - "reward": 2.83 + "reward": 4.83 }, "type": "PULL_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949044575" @@ -418,31 +422,33 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 15, - "multiplier": 0.2 + "wordCount": 15, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 2 + "multiplier": 2, + "result": 6 }, "relevance": 1, - "reward": 4 + "reward": 6 }, "type": "PULL_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949046925" } ], - "evaluationCommentHtml": "

[ 44.33 WXDAI ]

@gitcoindev
Contributions Overview
View Contribution Count Reward
Issue Task 1 37.5
Issue Comment 1 0
Review Comment 3 6.83
Conversation Incentives
Comment Formatting Relevance Reward
@molecula451 I tried to override X25519_PRIVATE_KEY but it did n…
0
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 49
        multiplier: 0
    score: 1
multiplier: 0
0.8 -
The new evmPrivateKeyEncrypted generated for address 0x3a2E44e10…
0
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 18
        multiplier: 0
    score: 1
multiplier: 0
0.8 -
@pavlovcik @molecula451 please check now again, I added to docs.
2.83
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 10
        multiplier: 0.2
    score: 1
multiplier: 2
1 2.83
No way, full details are available in plain sight, only for test…
4
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 15
        multiplier: 0.2
    score: 1
multiplier: 2
1 4
", - "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI0NDMzMDAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjU2NTUzNDk0NDU0MDk3MDE4NzcyMjE2NjE5NTI3NTk5MjE1NzUwNDQ1NjI4MjY2Njk2MjA3MzcxNjE1Mzc1NTEzMjM5NjM2MDMyMDE4IiwiZGVhZGxpbmUiOiI1Nzg5NjA0NDYxODY1ODA5NzcxMTc4NTQ5MjUwNDM0Mzk1MzkyNjYzNDk5MjMzMjgyMDI4MjAxOTcyODc5MjAwMzk1NjU2NDgxOTk2NyJ9LCJ0cmFuc2ZlckRldGFpbHMiOnsidG8iOiIweDREMDcwNGY0MDBENTdCYTkzZUVhODg3NjVDM0ZjREJEODI2ZENGYzQiLCJyZXF1ZXN0ZWRBbW91bnQiOiI0NDMzMDAwMDAwMDAwMDAwMDAwMCJ9LCJvd25lciI6IjB4ZDk1MzBGM2ZiQkVhMTFiZUQwMURDMDlFNzkzMThmMmYyMDIyMzcxNiIsInNpZ25hdHVyZSI6IjB4ODU0OGQ1NDJiYjI4NmU5YTBjZTRlZTNjZWM1YTA0MzU4NTQ2MGNjMmYwYjE3NzViOWYxOTY3ZWRjZWUzMTMwODBmNWMxNTQ1OTZjMGE1NzgwNWQ0YzJjMjIwNzM5N2IzMmRjZTM1ODM2Njc5MTg1YmE4MThjZjgzOGY3YjU1YjAxYyIsIm5ldHdvcmtJZCI6MTAwfV0=", + "evaluationCommentHtml": "

[ 51.914 WXDAI ]

@gitcoindev
Contributions Overview
View Contribution Count Reward
Issue Task 1 37.5
Issue Comment 1 3.184
Review Comment 3 11.23
Conversation Incentives
Comment Formatting Relevance Reward
@molecula451 I tried to override X25519_PRIVATE_KEY but it did n…
3.73
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 49
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 3.73
0.8 3.184
The new evmPrivateKeyEncrypted generated for address 0x3a2E44e10…
0
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 18
        wordValue: 0
    score: 1
    elementCount: 2
multiplier: 0
result: 0
0.8 0.4
@pavlovcik @molecula451 please check now again, I added to docs.
4.83
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 10
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
result: 4.83
1 4.83
No way, full details are available in plain sight, only for test…
6
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 15
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
result: 6
1 6
", + "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI1MTkxNDAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjU2NTUzNDk0NDU0MDk3MDE4NzcyMjE2NjE5NTI3NTk5MjE1NzUwNDQ1NjI4MjY2Njk2MjA3MzcxNjE1Mzc1NTEzMjM5NjM2MDMyMDE4IiwiZGVhZGxpbmUiOiI1Nzg5NjA0NDYxODY1ODA5NzcxMTc4NTQ5MjUwNDM0Mzk1MzkyNjYzNDk5MjMzMjgyMDI4MjAxOTcyODc5MjAwMzk1NjU2NDgxOTk2NyJ9LCJ0cmFuc2ZlckRldGFpbHMiOnsidG8iOiIweDREMDcwNGY0MDBENTdCYTkzZUVhODg3NjVDM0ZjREJEODI2ZENGYzQiLCJyZXF1ZXN0ZWRBbW91bnQiOiI1MTkxNDAwMDAwMDAwMDAwMDAwMCJ9LCJvd25lciI6IjB4ZDk1MzBGM2ZiQkVhMTFiZUQwMURDMDlFNzkzMThmMmYyMDIyMzcxNiIsInNpZ25hdHVyZSI6IjB4MWRjOWFhMzdhNDJhMGY2Mjg2ZWIwMDM5YTAyNDZiZGY0YWQ1MDQ2ZDQ2YmYxOTMzMmUzMDUzY2QyYzc4YWUxZjUyOTZjNzRmNGM4YmRjODQ3MWVlZWMxODkyOTgwMWVlMzNmY2Q1NWVjNDRhZTc5ZTdlNDVlMTllODI0OGI3NmUxYyIsIm5ldHdvcmtJZCI6MTAwfV0=", "task": { "multiplier": 1, "reward": 37.5 }, - "total": 44.33, + "total": 51.914, "userId": 88761781 }, "molecula451": { @@ -454,28 +460,31 @@ "formatting": { "content": { "img": { - "score": 0, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { + "elementCount": 3, + "regex": { "\\b\\w+\\b": { - "count": 16, - "multiplier": 0.1 + "wordCount": 15, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 1.25 }, "relevance": 0.8, - "reward": 0.208 + "reward": 1.8 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1948916343" @@ -487,19 +496,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 5, - "multiplier": 0.1 + "wordCount": 5, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.35 }, "relevance": 0.8, - "reward": 0.08 + "reward": 0.48 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1948989989" @@ -511,19 +522,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 14, - "multiplier": 0.1 + "wordCount": 14, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.49 }, "relevance": 0.8, - "reward": 0.192 + "reward": 0.592 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949195772" @@ -535,19 +548,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 12, - "multiplier": 0.1 + "wordCount": 12, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.46 }, "relevance": 0.8, - "reward": 0.168 + "reward": 0.568 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949564869" @@ -559,19 +574,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 31, - "multiplier": 0.1 + "wordCount": 31, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.71 }, "relevance": 0.8, - "reward": 0.368 + "reward": 0.768 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949635137" @@ -583,19 +600,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.1 + "wordCount": 2, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.3 }, "relevance": 0.8, - "reward": 0.04 + "reward": 0.44 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949639196" @@ -607,19 +626,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 1, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.28 }, "relevance": 1, - "reward": 0.03 + "reward": 0.28 }, "type": "PULL_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949038563" @@ -631,27 +652,29 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 18, - "multiplier": 0.1 + "wordCount": 18, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.54 }, "relevance": 1, - "reward": 0.29 + "reward": 0.54 }, "type": "PULL_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949044855" } ], - "evaluationCommentHtml": "

[ 1.376 WXDAI ]

@molecula451
Contributions Overview
View Contribution Count Reward
Issue Comment 6 1.056
Review Comment 2 0.32
Conversation Incentives
Comment Formatting Relevance Reward
pavlovcik i think we need to update a bit the readme ![image_20…
0.26
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 16
        multiplier: 0.1
    score: 1
  img:
    symbols:
      \\b\\w+\\b:
        count: 1
        multiplier: 0.1
    score: 0
multiplier: 0.25
0.8 0.208
let us know when done
0.1
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 5
        multiplier: 0.1
    score: 1
multiplier: 0.25
0.8 0.08
https://github.com/ubiquibot/comment-incentives/actions/runs/793…
0.24
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 14
        multiplier: 0.1
    score: 1
multiplier: 0.25
0.8 0.192
@pavlovcik permitted with hard debug (tho no funds in the privat…
0.21
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 12
        multiplier: 0.1
    score: 1
multiplier: 0.25
0.8 0.168
pavlovcik i re-generated the X25519 to trigger the permit, what …
0.46
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 31
        multiplier: 0.1
    score: 1
multiplier: 0.25
0.8 0.368
sure thing
0.05
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 2
        multiplier: 0.1
    score: 1
multiplier: 0.25
0.8 0.04
indeed
0.03
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 1
        multiplier: 0.1
    score: 1
multiplier: 0.25
1 0.03
go to go pavlovick, we'll be using this one for test only or tes…
0.29
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 18
        multiplier: 0.1
    score: 1
multiplier: 0.25
1 0.29
", - "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiIxMzc2MDAwMDAwMDAwMDAwMDAwIn0sIm5vbmNlIjoiMTg0Mjc4OTk1ODM3NTAwODQ0Njg3NTg1NjIxNTU0MzQ5MzU5Nzc1OTU1MDg3MzA3MDMzNTgwODYxNjI3NDIzODg4NzcxNzk5MjA4NTAiLCJkZWFkbGluZSI6IjU3ODk2MDQ0NjE4NjU4MDk3NzExNzg1NDkyNTA0MzQzOTUzOTI2NjM0OTkyMzMyODIwMjgyMDE5NzI4NzkyMDAzOTU2NTY0ODE5OTY3In0sInRyYW5zZmVyRGV0YWlscyI6eyJ0byI6IjB4NEQwNzA0ZjQwMEQ1N0JhOTNlRWE4ODc2NUMzRmNEQkQ4MjZkQ0ZjNCIsInJlcXVlc3RlZEFtb3VudCI6IjEzNzYwMDAwMDAwMDAwMDAwMDAifSwib3duZXIiOiIweGQ5NTMwRjNmYkJFYTExYmVEMDFEQzA5RTc5MzE4ZjJmMjAyMjM3MTYiLCJzaWduYXR1cmUiOiIweDA3YTA5YTQwYjNlMWVlZTE4ZDQ1ZjU0YmVlM2RlOGY5MDE0YWYzZGI2MDFjMjE0OTNmM2I1NzkzNjE3NmFhZGQxNGQ3ZWYwNmM1ZWE2MzQ1ZmY4MWVhMDA5NzAwZDc3ZTU1ZTE2YThmZGM4ZmNhZjljMTllYjQ3ZWMxZmRiOGNkMWMiLCJuZXR3b3JrSWQiOjEwMH1d", - "total": 1.376, + "evaluationCommentHtml": "

[ 5.468 WXDAI ]

@molecula451
Contributions Overview
View Contribution Count Reward
Issue Comment 6 4.648
Review Comment 2 0.82
Conversation Incentives
Comment Formatting Relevance Reward
pavlovcik i think we need to update a bit the readme ![image_20…
1.25
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 15
        wordValue: 0.1
    score: 1
    elementCount: 3
  img:
    regex:
      \\b\\w+\\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 1.25
0.8 1.8
let us know when done
0.35
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 5
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 0.35
0.8 0.48
https://github.com/ubiquibot/comment-incentives/actions/runs/793…
0.49
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 14
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 0.49
0.8 0.592
@pavlovcik permitted with hard debug (tho no funds in the privat…
0.46
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 12
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 0.46
0.8 0.568
pavlovcik i re-generated the X25519 to trigger the permit, what …
0.71
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 31
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 0.71
0.8 0.768
sure thing
0.3
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 2
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 0.3
0.8 0.44
indeed
0.28
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 1
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 0.28
1 0.28
go to go pavlovick, we'll be using this one for test only or tes…
0.54
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 18
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 0.54
1 0.54
", + "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI1NDY4MDAwMDAwMDAwMDAwMDAwIn0sIm5vbmNlIjoiMTg0Mjc4OTk1ODM3NTAwODQ0Njg3NTg1NjIxNTU0MzQ5MzU5Nzc1OTU1MDg3MzA3MDMzNTgwODYxNjI3NDIzODg4NzcxNzk5MjA4NTAiLCJkZWFkbGluZSI6IjU3ODk2MDQ0NjE4NjU4MDk3NzExNzg1NDkyNTA0MzQzOTUzOTI2NjM0OTkyMzMyODIwMjgyMDE5NzI4NzkyMDAzOTU2NTY0ODE5OTY3In0sInRyYW5zZmVyRGV0YWlscyI6eyJ0byI6IjB4NEQwNzA0ZjQwMEQ1N0JhOTNlRWE4ODc2NUMzRmNEQkQ4MjZkQ0ZjNCIsInJlcXVlc3RlZEFtb3VudCI6IjU0NjgwMDAwMDAwMDAwMDAwMDAifSwib3duZXIiOiIweGQ5NTMwRjNmYkJFYTExYmVEMDFEQzA5RTc5MzE4ZjJmMjAyMjM3MTYiLCJzaWduYXR1cmUiOiIweGQ5OTc3NWI1MzU5YWY1YjI3ZDcyNTM0OTIwMTc5MWM5ODkzZTRlMGZhZjI2OGQ1YTczNjY0NThiZDJhMDZkZTMwMWE2ZjczMjE4ODQxNWYwYmMwM2M0MTUyOTNhZjA1NGE4NjAyMzRmZmIwMTlkNGQwNDVlMjA5N2E2MTA1YWZkMWIiLCJuZXR3b3JrSWQiOjEwMH1d", + "total": 5.468, "userId": 41552663 } } diff --git a/tests/__mocks__/results/output.html b/tests/__mocks__/results/output.html index 7dcf97de..101af891 100644 --- a/tests/__mocks__/results/output.html +++ b/tests/__mocks__/results/output.html @@ -1,10 +1,10 @@ -

[ 44.33 WXDAI ]

@gitcoindev
Contributions Overview
View Contribution Count Reward
Issue Task 1 37.5
Issue Comment 1 0
Review Comment 3 6.83
Conversation Incentives
Comment Formatting Relevance Reward
@molecula451 I tried to override X25519_PRIVATE_KEY but it did n…
0
content:
  p:
    symbols:
      \b\w+\b:
        count: 49
        multiplier: 0
    score: 1
multiplier: 0
0.8 -
The new evmPrivateKeyEncrypted generated for address 0x3a2E44e10…
0
content:
  p:
    symbols:
      \b\w+\b:
        count: 18
        multiplier: 0
    score: 1
multiplier: 0
0.8 -
@pavlovcik @molecula451 please check now again, I added to docs.
2.83
content:
  p:
    symbols:
      \b\w+\b:
        count: 10
        multiplier: 0.2
    score: 1
multiplier: 2
1 2.83
No way, full details are available in plain sight, only for test…
4
content:
  p:
    symbols:
      \b\w+\b:
        count: 15
        multiplier: 0.2
    score: 1
multiplier: 2
1 4

[ 1.376 WXDAI ]

@molecula451
Contributions Overview
View Contribution Count Reward
Issue Comment 6 1.056
Review Comment 2 0.32
Conversation Incentives
Comment Formatting Relevance Reward
pavlovcik i think we need to update a bit the readme ![image_20…
0.26
content:
  p:
    symbols:
      \b\w+\b:
        count: 16
        multiplier: 0.1
    score: 1
  img:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.1
    score: 0
multiplier: 0.25
0.8 0.208
let us know when done
0.1
content:
  p:
    symbols:
      \b\w+\b:
        count: 5
        multiplier: 0.1
    score: 1
multiplier: 0.25
0.8 0.08
https://github.com/ubiquibot/comment-incentives/actions/runs/793…
0.24
content:
  p:
    symbols:
      \b\w+\b:
        count: 14
        multiplier: 0.1
    score: 1
multiplier: 0.25
0.8 0.192
@pavlovcik permitted with hard debug (tho no funds in the privat…
0.21
content:
  p:
    symbols:
      \b\w+\b:
        count: 12
        multiplier: 0.1
    score: 1
multiplier: 0.25
0.8 0.168
pavlovcik i re-generated the X25519 to trigger the permit, what …
0.46
content:
  p:
    symbols:
      \b\w+\b:
        count: 31
        multiplier: 0.1
    score: 1
multiplier: 0.25
0.8 0.368
sure thing
0.05
content:
  p:
    symbols:
      \b\w+\b:
        count: 2
        multiplier: 0.1
    score: 1
multiplier: 0.25
0.8 0.04
indeed
0.03
content:
  p:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.1
    score: 1
multiplier: 0.25
1 0.03
go to go pavlovick, we'll be using this one for test only or tes…
0.29
content:
  p:
    symbols:
      \b\w+\b:
        count: 18
        multiplier: 0.1
    score: 1
multiplier: 0.25
1 0.29

[ 48.648 WXDAI ]

@0x4007
Contributions Overview
View Contribution Count Reward
Issue Specification 1 3.55
Issue Comment 6 16.448
Review Comment 3 28.65
Conversation Incentives
Comment Formatting Relevance Reward
Can somebody work on generating a new `X25519_PRIVATE_KEY …
3.55
content:
  p:
    symbols:
      \b\w+\b:
        count: 54
        multiplier: 0.1
    score: 1
  code:
    symbols:
      \b\w+\b:
        count: 4
        multiplier: 0.1
    score: 1
  ol:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.1
    score: 0
  li:
    symbols:
      \b\w+\b:
        count: 3
        multiplier: 0.1
    score: 1
  em:
    symbols:
      \b\w+\b:
        count: 15
        multiplier: 0.1
    score: 0
multiplier: 1
1 3.55
Link below for conversation context. It was to me. Anyways you n…
2.66
content:
  p:
    symbols:
      \b\w+\b:
        count: 21
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 2.128
In the repository secrets I think I need to change the key to ma…
2.11
content:
  p:
    symbols:
      \b\w+\b:
        count: 16
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 1.688
I just changed it to `627H-BcWbcp_O3YmQGIA6MqgxVsFuplFCA9DK3…
7.67
content:
  p:
    symbols:
      \b\w+\b:
        count: 69
        multiplier: 0.2
    score: 1
  code:
    symbols:
      \b\w+\b:
        count: 2
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 6.136
I don't understand what you mean by this
1.29
content:
  p:
    symbols:
      \b\w+\b:
        count: 9
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 1.032
I'll investigate more on my computer later.
1.17
content:
  p:
    symbols:
      \b\w+\b:
        count: 8
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 0.936
Will it be an issue if I revert to the commit and secret that I …
5.66
content:
  p:
    symbols:
      \b\w+\b:
        count: 51
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 4.528
Need to document a private key too
0.52
content:
  p:
    symbols:
      \b\w+\b:
        count: 7
        multiplier: 0.1
    score: 1
multiplier: 1
1 0.52
I was editing this right now but was too slow to push.
0.83
content:
  p:
    symbols:
      \b\w+\b:
        count: 12
        multiplier: 0.1
    score: 1
multiplier: 1
1 0.83
I am quoting some code! <task-lists sortable=""> <tab…
27.3
content:
  p:
    symbols:
      \b\w+\b:
        count: 441
        multiplier: 0.1
    score: 1
  pre:
    symbols:
      \b\w+\b:
        count: 2
        multiplier: 0.1
    score: 0
  code:
    symbols:
      \b\w+\b:
        count: 205
        multiplier: 0.1
    score: 1
  a:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.1
    score: 1
  ul:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.1
    score: 1
  li:
    symbols:
      \b\w+\b:
        count: 2
        multiplier: 0.1
    score: 1
multiplier: 1
1 27.3
+

[ 51.914 WXDAI ]

@gitcoindev
Contributions Overview
View Contribution Count Reward
Issue Task 1 37.5
Issue Comment 1 3.184
Review Comment 3 11.23
Conversation Incentives
Comment Formatting Relevance Reward
@molecula451 I tried to override X25519_PRIVATE_KEY but it did n…
3.73
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 49
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 3.73
0.8 3.184
The new evmPrivateKeyEncrypted generated for address 0x3a2E44e10…
0
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 18
        wordValue: 0
    score: 1
    elementCount: 2
multiplier: 0
result: 0
0.8 0.4
@pavlovcik @molecula451 please check now again, I added to docs.
4.83
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 10
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
result: 4.83
1 4.83
No way, full details are available in plain sight, only for test…
6
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 15
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
result: 6
1 6

[ 5.468 WXDAI ]

@molecula451
Contributions Overview
View Contribution Count Reward
Issue Comment 6 4.648
Review Comment 2 0.82
Conversation Incentives
Comment Formatting Relevance Reward
pavlovcik i think we need to update a bit the readme ![image_20…
1.25
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 15
        wordValue: 0.1
    score: 1
    elementCount: 3
  img:
    regex:
      \b\w+\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 1.25
0.8 1.8
let us know when done
0.35
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 5
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 0.35
0.8 0.48
https://github.com/ubiquibot/comment-incentives/actions/runs/793…
0.49
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 14
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 0.49
0.8 0.592
@pavlovcik permitted with hard debug (tho no funds in the privat…
0.46
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 12
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 0.46
0.8 0.568
pavlovcik i re-generated the X25519 to trigger the permit, what …
0.71
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 31
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 0.71
0.8 0.768
sure thing
0.3
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 2
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 0.3
0.8 0.44
indeed
0.28
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 1
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 0.28
1 0.28
go to go pavlovick, we'll be using this one for test only or tes…
0.54
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 18
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 0.25
result: 0.54
1 0.54

[ 97.028 WXDAI ]

@0x4007
Contributions Overview
View Contribution Count Reward
Issue Specification 1 6.49
Issue Comment 6 25.448
Review Comment 3 65.09
Conversation Incentives
Comment Formatting Relevance Reward
Can somebody work on generating a new `X25519_PRIVATE_KEY …
6.49
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 19
        wordValue: 0.1
      \b\W+\b:
        wordCount: 18
        wordValue: 0.1
    score: 1
    elementCount: 3
  code:
    regex:
      \b\w+\b:
        wordCount: 1
        wordValue: 0.1
      \b\W+\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 6.49
1 6.49
Link below for conversation context. It was to me. Anyways you n…
3.66
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 21
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
result: 3.66
0.8 3.128
In the repository secrets I think I need to change the key to ma…
3.11
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 16
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
result: 3.11
0.8 2.688
I just changed it to `627H-BcWbcp_O3YmQGIA6MqgxVsFuplFCA9DK3…
11.67
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 69
        wordValue: 0.2
    score: 1
    elementCount: 3
  code:
    regex:
      \b\w+\b:
        wordCount: 2
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
result: 11.67
0.8 10.136
I don't understand what you mean by this
2.29
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 9
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
result: 2.29
0.8 2.032
I'll investigate more on my computer later.
2.17
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 8
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
result: 2.17
0.8 1.936
Will it be an issue if I revert to the commit and secret that I …
6.66
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 51
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
result: 6.66
0.8 5.528
Need to document a private key too
1.52
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 7
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 1.52
1 1.52
I was editing this right now but was too slow to push.
1.83
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 12
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 1.83
1 1.83
I am quoting some code! <task-lists sortable=""> <tab…
61.74
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 437
        wordValue: 0.1
    score: 1
    elementCount: 38
  code:
    regex:
      \b\w+\b:
        wordCount: 2
        wordValue: 0.1
    score: 1
    elementCount: 2
  a:
    regex:
      \b\w+\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 1
  ul:
    regex:
      \b\w+\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 1
  li:
    regex:
      \b\w+\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 2
multiplier: 1
result: 61.74
1 61.74
\ No newline at end of file diff --git a/tests/__mocks__/results/permit-generation-results.json b/tests/__mocks__/results/permit-generation-results.json index bff2209e..09e5f15f 100644 --- a/tests/__mocks__/results/permit-generation-results.json +++ b/tests/__mocks__/results/permit-generation-results.json @@ -8,19 +8,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 21, - "multiplier": 0.2 + "wordCount": 21, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 3.66 }, "relevance": 0.8, - "reward": 2.128 + "reward": 3.128 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1948930217" @@ -32,19 +34,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 16, - "multiplier": 0.2 + "wordCount": 16, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 3.11 }, "relevance": 0.8, - "reward": 1.688 + "reward": 2.688 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949201722" @@ -56,28 +60,31 @@ "formatting": { "content": { "code": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.2 + "wordCount": 2, + "wordValue": 0.2 } - } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { + "elementCount": 3, + "regex": { "\\b\\w+\\b": { - "count": 69, - "multiplier": 0.2 + "wordCount": 69, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 11.67 }, "relevance": 0.8, - "reward": 6.136 + "reward": 10.136 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949203681" @@ -89,19 +96,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 9, - "multiplier": 0.2 + "wordCount": 9, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 2.29 }, "relevance": 0.8, - "reward": 1.032 + "reward": 2.032 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949633751" @@ -113,19 +122,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 8, - "multiplier": 0.2 + "wordCount": 8, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 2.17 }, "relevance": 0.8, - "reward": 0.936 + "reward": 1.936 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949639054" @@ -137,19 +148,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 51, - "multiplier": 0.2 + "wordCount": 51, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 6.66 }, "relevance": 0.8, - "reward": 4.528 + "reward": 5.528 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949642845" @@ -161,55 +174,39 @@ "formatting": { "content": { "code": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 4, - "multiplier": 0.1 - } - } - }, - "em": { - "score": 0, - "symbols": { - "\\b\\w+\\b": { - "count": 15, - "multiplier": 0.1 - } - } - }, - "li": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 3, - "multiplier": 0.1 - } - } - }, - "ol": { - "score": 0, - "symbols": { - "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 - } - } + "elementCount": 1, + "regex": { + "\\b\\W+\\b": { + "wordCount": 0, + "wordValue": 0.1 + }, + "\\b\\w+\\b": { + "wordCount": 1, + "wordValue": 0.1 + } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 54, - "multiplier": 0.1 - } - } + "elementCount": 3, + "regex": { + "\\b\\W+\\b": { + "wordCount": 18, + "wordValue": 0.1 + }, + "\\b\\w+\\b": { + "wordCount": 19, + "wordValue": 0.1 + } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 6.49 }, "relevance": 1, - "reward": 3.55 + "reward": 6.49 }, "type": "ISSUE_SPECIFICATION", "url": "https://github.com/ubiquibot/comment-incentives/issues/22" @@ -221,19 +218,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 7, - "multiplier": 0.1 + "wordCount": 7, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 1.52 }, "relevance": 1, - "reward": 0.52 + "reward": 1.52 }, "type": "PULL_COLLABORATOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949021356" @@ -245,19 +244,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 12, - "multiplier": 0.1 + "wordCount": 12, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 1.83 }, "relevance": 1, - "reward": 0.83 + "reward": 1.83 }, "type": "PULL_COLLABORATOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949196677" @@ -269,71 +270,68 @@ "formatting": { "content": { "a": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 }, "code": { - "score": 1, - "symbols": { + "elementCount": 2, + "regex": { "\\b\\w+\\b": { - "count": 205, - "multiplier": 0.1 + "wordCount": 2, + "wordValue": 0.1 } - } + }, + "score": 1 }, "li": { - "score": 1, - "symbols": { + "elementCount": 2, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { - "\\b\\w+\\b": { - "count": 441, - "multiplier": 0.1 - } - } - }, - "pre": { - "score": 0, - "symbols": { + "elementCount": 38, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.1 + "wordCount": 437, + "wordValue": 0.1 } - } + }, + "score": 1 }, "ul": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 61.74 }, "relevance": 1, - "reward": 27.3 + "reward": 61.74 }, "type": "PULL_COLLABORATOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949196678" } ], - "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI0ODY0ODAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjMzOTI5NDE3NjI3OTM5NzU1OTMxNzgxMTE1NjU5ODM3OTc0NzU4OTQwMzc0OTU0MDQxMzEyODYzODI3ODA0MTE2ODc3MDgzNTI4ODgiLCJkZWFkbGluZSI6IjU3ODk2MDQ0NjE4NjU4MDk3NzExNzg1NDkyNTA0MzQzOTUzOTI2NjM0OTkyMzMyODIwMjgyMDE5NzI4NzkyMDAzOTU2NTY0ODE5OTY3In0sInRyYW5zZmVyRGV0YWlscyI6eyJ0byI6IjB4NEQwNzA0ZjQwMEQ1N0JhOTNlRWE4ODc2NUMzRmNEQkQ4MjZkQ0ZjNCIsInJlcXVlc3RlZEFtb3VudCI6IjQ4NjQ4MDAwMDAwMDAwMDAwMDAwIn0sIm93bmVyIjoiMHhkOTUzMEYzZmJCRWExMWJlRDAxREMwOUU3OTMxOGYyZjIwMjIzNzE2Iiwic2lnbmF0dXJlIjoiMHgwYWE5ZmRhYjAyZWYyM2MxNTcwMDlhODMxYjVkYWVkNjBkNGExNmFmZmMyNDcyOGEzNWY5M2MwNTg2YzFiZmY1NmY0MGYzMjQyMjI3YWIwNTkxZWJlZjdhZTYzODdkMzg5YTZkYmM0ODY5OTg1NDU3NGRmNTM3NTdkN2NkMDE2MjFiIiwibmV0d29ya0lkIjoxMDB9XQ==", - "total": 48.648, + "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI5NzAyODAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjMzOTI5NDE3NjI3OTM5NzU1OTMxNzgxMTE1NjU5ODM3OTc0NzU4OTQwMzc0OTU0MDQxMzEyODYzODI3ODA0MTE2ODc3MDgzNTI4ODgiLCJkZWFkbGluZSI6IjU3ODk2MDQ0NjE4NjU4MDk3NzExNzg1NDkyNTA0MzQzOTUzOTI2NjM0OTkyMzMyODIwMjgyMDE5NzI4NzkyMDAzOTU2NTY0ODE5OTY3In0sInRyYW5zZmVyRGV0YWlscyI6eyJ0byI6IjB4NEQwNzA0ZjQwMEQ1N0JhOTNlRWE4ODc2NUMzRmNEQkQ4MjZkQ0ZjNCIsInJlcXVlc3RlZEFtb3VudCI6Ijk3MDI4MDAwMDAwMDAwMDAwMDAwIn0sIm93bmVyIjoiMHhkOTUzMEYzZmJCRWExMWJlRDAxREMwOUU3OTMxOGYyZjIwMjIzNzE2Iiwic2lnbmF0dXJlIjoiMHgwMDgzMjA3MmFlNjg4NWRkN2M2ZjVhNDE3ZDUxYjRhZjNhMGQxZDFiMDI2ZGEyOGFlZDVlMjQ3OGQ2ZGFkNDllM2Y5MmJhOGIxNmRlNTc0Mjk5NzIxNDk2MjQ4YWQyYzZhODE4MDMyNTQzYTI4NDE2NzU0MWRjMTA3YzBhYzBlYzFiIiwibmV0d29ya0lkIjoxMDB9XQ==", + "total": 97.028, "userId": 4975670 }, "gitcoindev": { @@ -345,19 +343,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 49, - "multiplier": 0 + "wordCount": 49, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0 + "multiplier": 1, + "result": 3.73 }, "relevance": 0.8, - "reward": 0 + "reward": 3.184 }, "type": "ISSUE_ASSIGNEE", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949333227" @@ -369,19 +369,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 2, + "regex": { "\\b\\w+\\b": { - "count": 18, - "multiplier": 0 + "wordCount": 18, + "wordValue": 0 } - } + }, + "score": 1 } }, - "multiplier": 0 + "multiplier": 0, + "result": 0 }, "relevance": 0.8, - "reward": 0 + "reward": 0.4 }, "type": "PULL_SPECIFICATION", "url": "https://github.com/ubiquibot/comment-incentives/pull/25" @@ -393,19 +395,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 10, - "multiplier": 0.2 + "wordCount": 10, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 2 + "multiplier": 2, + "result": 4.83 }, "relevance": 1, - "reward": 2.83 + "reward": 4.83 }, "type": "PULL_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949044575" @@ -417,30 +421,32 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 15, - "multiplier": 0.2 + "wordCount": 15, + "wordValue": 0.2 } - } + }, + "score": 1 } }, - "multiplier": 2 + "multiplier": 2, + "result": 6 }, "relevance": 1, - "reward": 4 + "reward": 6 }, "type": "PULL_AUTHOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949046925" } ], - "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI0NDMzMDAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjU2NTUzNDk0NDU0MDk3MDE4NzcyMjE2NjE5NTI3NTk5MjE1NzUwNDQ1NjI4MjY2Njk2MjA3MzcxNjE1Mzc1NTEzMjM5NjM2MDMyMDE4IiwiZGVhZGxpbmUiOiI1Nzg5NjA0NDYxODY1ODA5NzcxMTc4NTQ5MjUwNDM0Mzk1MzkyNjYzNDk5MjMzMjgyMDI4MjAxOTcyODc5MjAwMzk1NjU2NDgxOTk2NyJ9LCJ0cmFuc2ZlckRldGFpbHMiOnsidG8iOiIweDREMDcwNGY0MDBENTdCYTkzZUVhODg3NjVDM0ZjREJEODI2ZENGYzQiLCJyZXF1ZXN0ZWRBbW91bnQiOiI0NDMzMDAwMDAwMDAwMDAwMDAwMCJ9LCJvd25lciI6IjB4ZDk1MzBGM2ZiQkVhMTFiZUQwMURDMDlFNzkzMThmMmYyMDIyMzcxNiIsInNpZ25hdHVyZSI6IjB4ODU0OGQ1NDJiYjI4NmU5YTBjZTRlZTNjZWM1YTA0MzU4NTQ2MGNjMmYwYjE3NzViOWYxOTY3ZWRjZWUzMTMwODBmNWMxNTQ1OTZjMGE1NzgwNWQ0YzJjMjIwNzM5N2IzMmRjZTM1ODM2Njc5MTg1YmE4MThjZjgzOGY3YjU1YjAxYyIsIm5ldHdvcmtJZCI6MTAwfV0=", + "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI1MTkxNDAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjU2NTUzNDk0NDU0MDk3MDE4NzcyMjE2NjE5NTI3NTk5MjE1NzUwNDQ1NjI4MjY2Njk2MjA3MzcxNjE1Mzc1NTEzMjM5NjM2MDMyMDE4IiwiZGVhZGxpbmUiOiI1Nzg5NjA0NDYxODY1ODA5NzcxMTc4NTQ5MjUwNDM0Mzk1MzkyNjYzNDk5MjMzMjgyMDI4MjAxOTcyODc5MjAwMzk1NjU2NDgxOTk2NyJ9LCJ0cmFuc2ZlckRldGFpbHMiOnsidG8iOiIweDREMDcwNGY0MDBENTdCYTkzZUVhODg3NjVDM0ZjREJEODI2ZENGYzQiLCJyZXF1ZXN0ZWRBbW91bnQiOiI1MTkxNDAwMDAwMDAwMDAwMDAwMCJ9LCJvd25lciI6IjB4ZDk1MzBGM2ZiQkVhMTFiZUQwMURDMDlFNzkzMThmMmYyMDIyMzcxNiIsInNpZ25hdHVyZSI6IjB4MWRjOWFhMzdhNDJhMGY2Mjg2ZWIwMDM5YTAyNDZiZGY0YWQ1MDQ2ZDQ2YmYxOTMzMmUzMDUzY2QyYzc4YWUxZjUyOTZjNzRmNGM4YmRjODQ3MWVlZWMxODkyOTgwMWVlMzNmY2Q1NWVjNDRhZTc5ZTdlNDVlMTllODI0OGI3NmUxYyIsIm5ldHdvcmtJZCI6MTAwfV0=", "task": { "multiplier": 1, "reward": 37.5 }, - "total": 44.33, + "total": 51.914, "userId": 88761781 }, "molecula451": { @@ -452,28 +458,31 @@ "formatting": { "content": { "img": { - "score": 0, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 0, + "wordValue": 0.1 } - } + }, + "score": 1 }, "p": { - "score": 1, - "symbols": { + "elementCount": 3, + "regex": { "\\b\\w+\\b": { - "count": 16, - "multiplier": 0.1 + "wordCount": 15, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 1.25 }, "relevance": 0.8, - "reward": 0.208 + "reward": 1.8 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1948916343" @@ -485,19 +494,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 5, - "multiplier": 0.1 + "wordCount": 5, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.35 }, "relevance": 0.8, - "reward": 0.08 + "reward": 0.48 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1948989989" @@ -509,19 +520,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 14, - "multiplier": 0.1 + "wordCount": 14, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.49 }, "relevance": 0.8, - "reward": 0.192 + "reward": 0.592 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949195772" @@ -533,19 +546,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 12, - "multiplier": 0.1 + "wordCount": 12, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.46 }, "relevance": 0.8, - "reward": 0.168 + "reward": 0.568 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949564869" @@ -557,19 +572,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 31, - "multiplier": 0.1 + "wordCount": 31, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.71 }, "relevance": 0.8, - "reward": 0.368 + "reward": 0.768 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949635137" @@ -581,19 +598,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 2, - "multiplier": 0.1 + "wordCount": 2, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.3 }, "relevance": 0.8, - "reward": 0.04 + "reward": 0.44 }, "type": "ISSUE_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949639196" @@ -605,19 +624,21 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 1, - "multiplier": 0.1 + "wordCount": 1, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.28 }, "relevance": 1, - "reward": 0.03 + "reward": 0.28 }, "type": "PULL_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949038563" @@ -629,26 +650,28 @@ "formatting": { "content": { "p": { - "score": 1, - "symbols": { + "elementCount": 1, + "regex": { "\\b\\w+\\b": { - "count": 18, - "multiplier": 0.1 + "wordCount": 18, + "wordValue": 0.1 } - } + }, + "score": 1 } }, - "multiplier": 0.25 + "multiplier": 0.25, + "result": 0.54 }, "relevance": 1, - "reward": 0.29 + "reward": 0.54 }, "type": "PULL_CONTRIBUTOR", "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949044855" } ], - "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiIxMzc2MDAwMDAwMDAwMDAwMDAwIn0sIm5vbmNlIjoiMTg0Mjc4OTk1ODM3NTAwODQ0Njg3NTg1NjIxNTU0MzQ5MzU5Nzc1OTU1MDg3MzA3MDMzNTgwODYxNjI3NDIzODg4NzcxNzk5MjA4NTAiLCJkZWFkbGluZSI6IjU3ODk2MDQ0NjE4NjU4MDk3NzExNzg1NDkyNTA0MzQzOTUzOTI2NjM0OTkyMzMyODIwMjgyMDE5NzI4NzkyMDAzOTU2NTY0ODE5OTY3In0sInRyYW5zZmVyRGV0YWlscyI6eyJ0byI6IjB4NEQwNzA0ZjQwMEQ1N0JhOTNlRWE4ODc2NUMzRmNEQkQ4MjZkQ0ZjNCIsInJlcXVlc3RlZEFtb3VudCI6IjEzNzYwMDAwMDAwMDAwMDAwMDAifSwib3duZXIiOiIweGQ5NTMwRjNmYkJFYTExYmVEMDFEQzA5RTc5MzE4ZjJmMjAyMjM3MTYiLCJzaWduYXR1cmUiOiIweDA3YTA5YTQwYjNlMWVlZTE4ZDQ1ZjU0YmVlM2RlOGY5MDE0YWYzZGI2MDFjMjE0OTNmM2I1NzkzNjE3NmFhZGQxNGQ3ZWYwNmM1ZWE2MzQ1ZmY4MWVhMDA5NzAwZDc3ZTU1ZTE2YThmZGM4ZmNhZjljMTllYjQ3ZWMxZmRiOGNkMWMiLCJuZXR3b3JrSWQiOjEwMH1d", - "total": 1.376, + "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI1NDY4MDAwMDAwMDAwMDAwMDAwIn0sIm5vbmNlIjoiMTg0Mjc4OTk1ODM3NTAwODQ0Njg3NTg1NjIxNTU0MzQ5MzU5Nzc1OTU1MDg3MzA3MDMzNTgwODYxNjI3NDIzODg4NzcxNzk5MjA4NTAiLCJkZWFkbGluZSI6IjU3ODk2MDQ0NjE4NjU4MDk3NzExNzg1NDkyNTA0MzQzOTUzOTI2NjM0OTkyMzMyODIwMjgyMDE5NzI4NzkyMDAzOTU2NTY0ODE5OTY3In0sInRyYW5zZmVyRGV0YWlscyI6eyJ0byI6IjB4NEQwNzA0ZjQwMEQ1N0JhOTNlRWE4ODc2NUMzRmNEQkQ4MjZkQ0ZjNCIsInJlcXVlc3RlZEFtb3VudCI6IjU0NjgwMDAwMDAwMDAwMDAwMDAifSwib3duZXIiOiIweGQ5NTMwRjNmYkJFYTExYmVEMDFEQzA5RTc5MzE4ZjJmMjAyMjM3MTYiLCJzaWduYXR1cmUiOiIweGQ5OTc3NWI1MzU5YWY1YjI3ZDcyNTM0OTIwMTc5MWM5ODkzZTRlMGZhZjI2OGQ1YTczNjY0NThiZDJhMDZkZTMwMWE2ZjczMjE4ODQxNWYwYmMwM2M0MTUyOTNhZjA1NGE4NjAyMzRmZmIwMTlkNGQwNDVlMjA5N2E2MTA1YWZkMWIiLCJuZXR3b3JrSWQiOjEwMH1d", + "total": 5.468, "userId": 41552663 } } diff --git a/tests/__mocks__/results/reward-split.json b/tests/__mocks__/results/reward-split.json index 66a339f4..4a41cbf9 100644 --- a/tests/__mocks__/results/reward-split.json +++ b/tests/__mocks__/results/reward-split.json @@ -18,10 +18,11 @@ "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 3.77 }, "relevance": 0.8, - "reward": 3.016 + "reward": 3.416 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquity/work.ubq.fi/issues/69#issuecomment-2186802545" @@ -43,10 +44,11 @@ "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 3.66 }, "relevance": 0.8, - "reward": 2.928 + "reward": 3.128 }, "type": "ISSUE_AUTHOR", "url": "https://github.com/ubiquity/work.ubq.fi/issues/69#issuecomment-2186807999" @@ -60,6 +62,10 @@ "img": { "elementCount": 1, "regex": { + "\\b\\W+\\b": { + "wordCount": 0, + "wordValue": 0.1 + }, "\\b\\w+\\b": { "wordCount": 0, "wordValue": 0.1 @@ -68,8 +74,12 @@ "score": 1 }, "p": { - "elementCount": 2, + "elementCount": 3, "regex": { + "\\b\\W+\\b": { + "wordCount": 47, + "wordValue": 0.1 + }, "\\b\\w+\\b": { "wordCount": 48, "wordValue": 0.1 @@ -78,10 +88,11 @@ "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 9.32 }, "relevance": 1, - "reward": 5.69 + "reward": 9.32 }, "type": "ISSUE_SPECIFICATION", "url": "https://github.com/ubiquity/work.ubq.fi/issues/69" @@ -103,10 +114,11 @@ "score": 1 } }, - "multiplier": 0 + "multiplier": 0, + "result": 0 }, "relevance": 0.8, - "reward": 0 + "reward": 0.2 }, "type": "PULL_SPECIFICATION", "url": "https://github.com/ubiquity/work.ubq.fi/pull/70" @@ -128,7 +140,8 @@ "score": 1 } }, - "multiplier": 2 + "multiplier": 2, + "result": 3.57 }, "relevance": 1, "reward": 3.57 @@ -163,7 +176,8 @@ "score": 1 } }, - "multiplier": 2 + "multiplier": 2, + "result": 15.87 }, "relevance": 1, "reward": 15.87 @@ -172,13 +186,13 @@ "url": "https://github.com/ubiquity/work.ubq.fi/pull/70#issuecomment-2186798329" } ], - "evaluationCommentHtml": "

[ 56.074 WXDAI ]

@0x4007
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Specification 1 5.69
Issue Comment 2 5.944
Review Comment 3 19.44
Conversation Incentives
Comment Formatting Relevance Reward
Looks like the filters are barely useable now that we have the s…
5.69
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 48
        wordValue: 0.1
    score: 1
    elementCount: 2
  img:
    regex:
      \\b\\w+\\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
1 5.69
Okay both bots are broken @gentlementlegen We should have spli…
3.77
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 13
        wordValue: 0.2
    score: 1
    elementCount: 2
multiplier: 1
0.8 3.016
Actually, looks like it did the right thing for your reward on v…
3.66
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 21
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
0.8 2.928
Resolves https://github.com/ubiquity/work.ubq.fi/issues/69
0
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 10
        wordValue: 0
    score: 1
    elementCount: 1
multiplier: 0
0.8 -
I always struggle with Cypress
3.57
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 5
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
1 3.57
Only doesn't work on my local, the guess is token expiration aft…
15.87
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 28
        wordValue: 0.2
    score: 1
    elementCount: 2
  a:
    regex:
      \\b\\w+\\b:
        wordCount: 11
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
1 15.87
", - "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI1NjA3NDAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjMzOTI5NDE3NjI3OTM5NzU1OTMxNzgxMTE1NjU5ODM3OTc0NzU4OTQwMzc0OTU0MDQxMzEyODYzODI3ODA0MTE2ODc3MDgzNTI4ODgiLCJkZWFkbGluZSI6IjU3ODk2MDQ0NjE4NjU4MDk3NzExNzg1NDkyNTA0MzQzOTUzOTI2NjM0OTkyMzMyODIwMjgyMDE5NzI4NzkyMDAzOTU2NTY0ODE5OTY3In0sInRyYW5zZmVyRGV0YWlscyI6eyJ0byI6IjB4NEQwNzA0ZjQwMEQ1N0JhOTNlRWE4ODc2NUMzRmNEQkQ4MjZkQ0ZjNCIsInJlcXVlc3RlZEFtb3VudCI6IjU2MDc0MDAwMDAwMDAwMDAwMDAwIn0sIm93bmVyIjoiMHhkOTUzMEYzZmJCRWExMWJlRDAxREMwOUU3OTMxOGYyZjIwMjIzNzE2Iiwic2lnbmF0dXJlIjoiMHg4ZTQ5MDk0YTZjY2YzZDdlMjc3MzAwMzViMDIxNzQ4YjBhMDUzZGYxYTYxNzNiMTQ2YTUzOWY1NTA4NmQwMDAyMTIyNmRkOTdlODE3ZmE0NTk5MTllYjI1MDljOGQxNmY4MzcxODZlMzZhZjUyYWYzYzI3ODk2YmE1NzgzMjRlMDFjIiwibmV0d29ya0lkIjoxMDB9XQ==", + "evaluationCommentHtml": "

[ 60.504 WXDAI ]

@0x4007
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Specification 1 9.32
Issue Comment 2 6.544
Review Comment 3 19.64
Conversation Incentives
Comment Formatting Relevance Reward
Looks like the filters are barely useable now that we have the s…
9.32
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 48
        wordValue: 0.1
      \\b\\W+\\b:
        wordCount: 47
        wordValue: 0.1
    score: 1
    elementCount: 3
  img:
    regex:
      \\b\\w+\\b:
        wordCount: 0
        wordValue: 0.1
      \\b\\W+\\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 9.32
1 9.32
Okay both bots are broken @gentlementlegen We should have spli…
3.77
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 13
        wordValue: 0.2
    score: 1
    elementCount: 2
multiplier: 1
result: 3.77
0.8 3.416
Actually, looks like it did the right thing for your reward on v…
3.66
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 21
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
result: 3.66
0.8 3.128
Resolves https://github.com/ubiquity/work.ubq.fi/issues/69
0
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 10
        wordValue: 0
    score: 1
    elementCount: 1
multiplier: 0
result: 0
0.8 0.2
I always struggle with Cypress
3.57
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 5
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
result: 3.57
1 3.57
Only doesn't work on my local, the guess is token expiration aft…
15.87
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 28
        wordValue: 0.2
    score: 1
    elementCount: 2
  a:
    regex:
      \\b\\w+\\b:
        wordCount: 11
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
result: 15.87
1 15.87
", + "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI2MDUwNDAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjMzOTI5NDE3NjI3OTM5NzU1OTMxNzgxMTE1NjU5ODM3OTc0NzU4OTQwMzc0OTU0MDQxMzEyODYzODI3ODA0MTE2ODc3MDgzNTI4ODgiLCJkZWFkbGluZSI6IjU3ODk2MDQ0NjE4NjU4MDk3NzExNzg1NDkyNTA0MzQzOTUzOTI2NjM0OTkyMzMyODIwMjgyMDE5NzI4NzkyMDAzOTU2NTY0ODE5OTY3In0sInRyYW5zZmVyRGV0YWlscyI6eyJ0byI6IjB4NEQwNzA0ZjQwMEQ1N0JhOTNlRWE4ODc2NUMzRmNEQkQ4MjZkQ0ZjNCIsInJlcXVlc3RlZEFtb3VudCI6IjYwNTA0MDAwMDAwMDAwMDAwMDAwIn0sIm93bmVyIjoiMHhkOTUzMEYzZmJCRWExMWJlRDAxREMwOUU3OTMxOGYyZjIwMjIzNzE2Iiwic2lnbmF0dXJlIjoiMHgzODY5ODM0ZGZiMTY3ZjE4YzJiNjkyOGNiYTAwNzcxM2RiODk1MmJkNDQzZjI1MWU0Nzg5M2JhYjMwZmJmYmFkNGQ0NmYzMGMyNjZkYWE3ZTg2YmQyZjRmZmVhNjg0MTZmYWIzMjViMzEzODQwZmQ1Y2M2MmQ3NDY4ZDg1Y2Q4ZjFjIiwibmV0d29ya0lkIjoxMDB9XQ==", "task": { "multiplier": 0.5, "reward": 25 }, - "total": 56.074, + "total": 60.504, "userId": 4975670 }, "gentlementlegen": { @@ -200,10 +214,11 @@ "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 2.54 }, "relevance": 0.8, - "reward": 2.032 + "reward": 2.232 }, "type": "ISSUE_COLLABORATOR", "url": "https://github.com/ubiquity/work.ubq.fi/issues/69#issuecomment-2186805818" @@ -235,10 +250,11 @@ "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 3.24 }, "relevance": 0.8, - "reward": 2.592 + "reward": 2.992 }, "type": "ISSUE_COLLABORATOR", "url": "https://github.com/ubiquity/work.ubq.fi/issues/69#issuecomment-2186813200" @@ -260,7 +276,8 @@ "score": 1 } }, - "multiplier": 1 + "multiplier": 1, + "result": 3.25 }, "relevance": 1, "reward": 3.25 @@ -269,13 +286,13 @@ "url": "https://github.com/ubiquity/work.ubq.fi/pull/70#issuecomment-2186914050" } ], - "evaluationCommentHtml": "

[ 32.874 WXDAI ]

@gentlementlegen
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Comment 2 4.624
Review Comment 1 3.25
Conversation Incentives
Comment Formatting Relevance Reward
@0x4007 So it should be 25 each? I can confirm this is not handl…
2.54
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 25
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
0.8 2.032
Ah yes because it doesn't apply the `0.5` multiplier I s…
3.24
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 16
        wordValue: 0.1
    score: 1
    elementCount: 1
  code:
    regex:
      \\b\\w+\\b:
        wordCount: 2
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
0.8 2.592
After token expiration, I could not reproduce the problem and st…
3.25
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 39
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
1 3.25
", - "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiIzMjg3NDAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjgzMDc2NDM3NDQ2NDk5NTg5MzA0NjExMTI4OTYzOTE2NzEwMTA2ODg2MTAyNDM2MDIzODgxNTIwMDU4MzQ2ODAwNTc4NzU0NDAxNzU1IiwiZGVhZGxpbmUiOiI1Nzg5NjA0NDYxODY1ODA5NzcxMTc4NTQ5MjUwNDM0Mzk1MzkyNjYzNDk5MjMzMjgyMDI4MjAxOTcyODc5MjAwMzk1NjU2NDgxOTk2NyJ9LCJ0cmFuc2ZlckRldGFpbHMiOnsidG8iOiIweDREMDcwNGY0MDBENTdCYTkzZUVhODg3NjVDM0ZjREJEODI2ZENGYzQiLCJyZXF1ZXN0ZWRBbW91bnQiOiIzMjg3NDAwMDAwMDAwMDAwMDAwMCJ9LCJvd25lciI6IjB4ZDk1MzBGM2ZiQkVhMTFiZUQwMURDMDlFNzkzMThmMmYyMDIyMzcxNiIsInNpZ25hdHVyZSI6IjB4YzViOGJhYWRkZTEyN2Q5YmYxODA3MWVkYmJjMDQwMjhjM2ZlOTA0NDUwNzNhM2YzMDA0NjRmM2EzYWFkMzliNTU3ZTc3MTMwZjFhNTViNzIyZWNmODJjYTI4Y2Q4Yjk3N2YzZTYyNmRhMDdmZGIxZWUzMDNjMzI5NjcwMzI0MjUxYyIsIm5ldHdvcmtJZCI6MTAwfV0=", + "evaluationCommentHtml": "

[ 33.474 WXDAI ]

@gentlementlegen
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Comment 2 5.224
Review Comment 1 3.25
Conversation Incentives
Comment Formatting Relevance Reward
@0x4007 So it should be 25 each? I can confirm this is not handl…
2.54
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 25
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 2.54
0.8 2.232
Ah yes because it doesn't apply the `0.5` multiplier I s…
3.24
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 16
        wordValue: 0.1
    score: 1
    elementCount: 1
  code:
    regex:
      \\b\\w+\\b:
        wordCount: 2
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 3.24
0.8 2.992
After token expiration, I could not reproduce the problem and st…
3.25
content:
  p:
    regex:
      \\b\\w+\\b:
        wordCount: 39
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 3.25
1 3.25
", + "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiIzMzQ3NDAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjgzMDc2NDM3NDQ2NDk5NTg5MzA0NjExMTI4OTYzOTE2NzEwMTA2ODg2MTAyNDM2MDIzODgxNTIwMDU4MzQ2ODAwNTc4NzU0NDAxNzU1IiwiZGVhZGxpbmUiOiI1Nzg5NjA0NDYxODY1ODA5NzcxMTc4NTQ5MjUwNDM0Mzk1MzkyNjYzNDk5MjMzMjgyMDI4MjAxOTcyODc5MjAwMzk1NjU2NDgxOTk2NyJ9LCJ0cmFuc2ZlckRldGFpbHMiOnsidG8iOiIweDREMDcwNGY0MDBENTdCYTkzZUVhODg3NjVDM0ZjREJEODI2ZENGYzQiLCJyZXF1ZXN0ZWRBbW91bnQiOiIzMzQ3NDAwMDAwMDAwMDAwMDAwMCJ9LCJvd25lciI6IjB4ZDk1MzBGM2ZiQkVhMTFiZUQwMURDMDlFNzkzMThmMmYyMDIyMzcxNiIsInNpZ25hdHVyZSI6IjB4NDRiNDU1MzRiYzhhZDdhMzM1NTdhOGQzNzVhMTcxOGM1MzI4ZGY5YThhOGE5YThjYjRhZmNlZjBhZmUzMThmZDA2ZDQ5NzdmYzQxNDhmMjE3MDAyZTRkNzdmOTM1YWI5OTkzMGRmYjU3ZmZjMTVhMGMwZTIwYWZmYWJmMDZhZmMxYiIsIm5ldHdvcmtJZCI6MTAwfV0=", "task": { "multiplier": 0.5, "reward": 25 }, - "total": 32.874, + "total": 33.474, "userId": 9807008 } } From c56e43b2fddce581e1a037d66b23b436ff4c6482 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Thu, 19 Sep 2024 15:31:12 +0900 Subject: [PATCH 14/61] chore: fixing tests --- .../results/output-reward-split.html | 65 ++++++++++++------- 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/tests/__mocks__/results/output-reward-split.html b/tests/__mocks__/results/output-reward-split.html index 3c6ebba8..b7e4d199 100644 --- a/tests/__mocks__/results/output-reward-split.html +++ b/tests/__mocks__/results/output-reward-split.html @@ -1,10 +1,10 @@ -

[ 56.074 WXDAI ]

@0x4007
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Specification 1 5.69
Issue Comment 2 5.944
Review Comment 3 19.44
Conversation Incentives
Comment Formatting Relevance Reward
Looks like the filters are barely useable now that we have the s…
5.69
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 48
        wordValue: 0.1
    score: 1
    elementCount: 2
  img:
    regex:
      \b\w+\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
1 5.69
Okay both bots are broken @gentlementlegen We should have spli…
3.77
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 13
        wordValue: 0.2
    score: 1
    elementCount: 2
multiplier: 1
0.8 3.016
Actually, looks like it did the right thing for your reward on v…
3.66
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 21
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
0.8 2.928
Resolves https://github.com/ubiquity/work.ubq.fi/issues/69
0
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 10
        wordValue: 0
    score: 1
    elementCount: 1
multiplier: 0
0.8 -
I always struggle with Cypress
3.57
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 5
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
1 3.57
Only doesn't work on my local, the guess is token expiration aft…
15.87
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 28
        wordValue: 0.2
    score: 1
    elementCount: 2
  a:
    regex:
      \b\w+\b:
        wordCount: 11
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
1 15.87

[ 32.874 WXDAI ]

@gentlementlegen
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Comment 2 4.624
Review Comment 1 3.25
Conversation Incentives
Comment Formatting Relevance Reward
@0x4007 So it should be 25 each? I can confirm this is not handl…
2.54
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 25
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
0.8 2.032
Ah yes because it doesn't apply the `0.5` multiplier I s…
3.24
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 16
        wordValue: 0.1
    score: 1
    elementCount: 1
  code:
    regex:
      \b\w+\b:
        wordCount: 2
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
0.8 2.592
After token expiration, I could not reproduce the problem and st…
3.25
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 39
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
1 3.25
+

[ 60.504 WXDAI ]

@0x4007
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Specification 1 9.32
Issue Comment 2 6.544
Review Comment 3 19.64
Conversation Incentives
Comment Formatting Relevance Reward
Looks like the filters are barely useable now that we have the s…
9.32
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 48
        wordValue: 0.1
      \b\W+\b:
        wordCount: 47
        wordValue: 0.1
    score: 1
    elementCount: 3
  img:
    regex:
      \b\w+\b:
        wordCount: 0
        wordValue: 0.1
      \b\W+\b:
        wordCount: 0
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 9.32
1 9.32
Okay both bots are broken @gentlementlegen We should have spli…
3.77
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 13
        wordValue: 0.2
    score: 1
    elementCount: 2
multiplier: 1
result: 3.77
0.8 3.416
Actually, looks like it did the right thing for your reward on v…
3.66
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 21
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 1
result: 3.66
0.8 3.128
Resolves https://github.com/ubiquity/work.ubq.fi/issues/69
0
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 10
        wordValue: 0
    score: 1
    elementCount: 1
multiplier: 0
result: 0
0.8 0.2
I always struggle with Cypress
3.57
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 5
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
result: 3.57
1 3.57
Only doesn't work on my local, the guess is token expiration aft…
15.87
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 28
        wordValue: 0.2
    score: 1
    elementCount: 2
  a:
    regex:
      \b\w+\b:
        wordCount: 11
        wordValue: 0.2
    score: 1
    elementCount: 1
multiplier: 2
result: 15.87
1 15.87

[ 33.474 WXDAI ]

@gentlementlegen
Contributions Overview
View Contribution Count Reward
Issue Task 0.5 25
Issue Comment 2 5.224
Review Comment 1 3.25
Conversation Incentives
Comment Formatting Relevance Reward
@0x4007 So it should be 25 each? I can confirm this is not handl…
2.54
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 25
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 2.54
0.8 2.232
Ah yes because it doesn't apply the `0.5` multiplier I s…
3.24
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 16
        wordValue: 0.1
    score: 1
    elementCount: 1
  code:
    regex:
      \b\w+\b:
        wordCount: 2
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 3.24
0.8 2.992
After token expiration, I could not reproduce the problem and st…
3.25
content:
  p:
    regex:
      \b\w+\b:
        wordCount: 39
        wordValue: 0.1
    score: 1
    elementCount: 1
multiplier: 1
result: 3.25
1 3.25
\ No newline at end of file From 54f559981643fa5ccac14c551367cdb23d01d56d Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Mon, 23 Sep 2024 10:35:59 +0900 Subject: [PATCH 15/61] chore: removed undefined --- src/parser/content-evaluator-module.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser/content-evaluator-module.ts b/src/parser/content-evaluator-module.ts index 765b9bf9..57511ce9 100644 --- a/src/parser/content-evaluator-module.ts +++ b/src/parser/content-evaluator-module.ts @@ -74,7 +74,7 @@ export class ContentEvaluatorModule implements Module { return result; } - _getRewardForComment(comment: GithubCommentScore | undefined, relevance: number) { + _getRewardForComment(comment: GithubCommentScore, relevance: number) { let reward = new Decimal(comment?.score?.reward || 0); if (comment?.score?.formatting?.content) { From 867438b009e29ae257c1bc4b4657ff2776063e8d Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Mon, 23 Sep 2024 10:46:57 +0900 Subject: [PATCH 16/61] chore: merge development --- src/configuration/content-evaluator-config.ts | 16 - src/github-types.ts | 4 +- src/helpers/get-comment-details.ts | 21 + src/parser/content-evaluator-module.ts | 99 +- src/parser/data-purge-module.ts | 11 + src/parser/permit-generation-module.ts | 39 +- src/parser/processor.ts | 1 + src/start.ts | 7 +- src/types/content-evaluator-module-type.ts | 9 + src/types/openai-type.ts | 7 - src/types/requests.ts | 11 + tests/__mocks__/handlers.ts | 45 + .../__mocks__/results/data-purge-result.json | 582 ++- .../results/hidden-comment-purged.json | 26 + .../results/user-comment-results.json | 20 +- .../results/valid-configuration.json | 68 +- .../routes/issue-13-comments-get.json | 283 ++ .../__mocks__/routes/issue-13-events-get.json | 925 ++++ tests/__mocks__/routes/issue-13-get.json | 110 + .../issue-5-comments-get.json | 1648 +++++++ .../issue-5-events-get.json | 841 ++++ .../issue-5-get.json | 148 + .../issue-5-timeline-get.json | 4153 +++++++++++++++++ .../issue-12-comments-get.json | 134 + .../pull-12-comments-get.json | 3712 +++++++++++++++ .../pull-12-get.json | 402 ++ .../pull-12-reviews-get.json | 1757 +++++++ tests/action.test.ts | 4 + tests/get-activity.test.ts | 4 + tests/parser/permit-generation-module.test.ts | 100 +- tests/price-label.test.ts | 4 + tests/process.issue.test.ts | 49 +- tests/purging.test.ts | 131 + tests/rewards.test.ts | 33 +- 34 files changed, 15117 insertions(+), 287 deletions(-) create mode 100644 src/helpers/get-comment-details.ts create mode 100644 src/types/content-evaluator-module-type.ts delete mode 100644 src/types/openai-type.ts create mode 100644 tests/__mocks__/results/hidden-comment-purged.json create mode 100644 tests/__mocks__/routes/issue-13-comments-get.json create mode 100644 tests/__mocks__/routes/issue-13-events-get.json create mode 100644 tests/__mocks__/routes/issue-13-get.json create mode 100644 tests/__mocks__/routes/issue-5-conversation-rewards/issue-5-comments-get.json create mode 100644 tests/__mocks__/routes/issue-5-conversation-rewards/issue-5-events-get.json create mode 100644 tests/__mocks__/routes/issue-5-conversation-rewards/issue-5-get.json create mode 100644 tests/__mocks__/routes/issue-5-conversation-rewards/issue-5-timeline-get.json create mode 100644 tests/__mocks__/routes/pull-12-conversation-rewards/issue-12-comments-get.json create mode 100644 tests/__mocks__/routes/pull-12-conversation-rewards/pull-12-comments-get.json create mode 100644 tests/__mocks__/routes/pull-12-conversation-rewards/pull-12-get.json create mode 100644 tests/__mocks__/routes/pull-12-conversation-rewards/pull-12-reviews-get.json create mode 100644 tests/purging.test.ts diff --git a/src/configuration/content-evaluator-config.ts b/src/configuration/content-evaluator-config.ts index 28143f9f..117f0635 100644 --- a/src/configuration/content-evaluator-config.ts +++ b/src/configuration/content-evaluator-config.ts @@ -31,22 +31,6 @@ export const contentEvaluatorConfigurationType = Type.Object({ role: ["ISSUE_SPECIFICATION"], relevance: 1, }, - { - role: ["PULL_AUTHOR"], - relevance: 1, - }, - { - role: ["PULL_ASSIGNEE"], - relevance: 1, - }, - { - role: ["PULL_COLLABORATOR"], - relevance: 1, - }, - { - role: ["PULL_CONTRIBUTOR"], - relevance: 1, - }, ], } ), diff --git a/src/github-types.ts b/src/github-types.ts index 58d15799..850bf2be 100644 --- a/src/github-types.ts +++ b/src/github-types.ts @@ -2,7 +2,9 @@ import { RestEndpointMethodTypes } from "@octokit/rest"; export type GitHubIssue = RestEndpointMethodTypes["issues"]["get"]["response"]["data"]; export type GitHubPullRequest = RestEndpointMethodTypes["pulls"]["get"]["response"]["data"]; -export type GitHubIssueComment = RestEndpointMethodTypes["issues"]["listComments"]["response"]["data"][0]; +export type GitHubIssueComment = RestEndpointMethodTypes["issues"]["listComments"]["response"]["data"][0] & { + isMinimized?: boolean; +}; export type GitHubIssueEvent = RestEndpointMethodTypes["issues"]["listEvents"]["response"]["data"][0]; export type GitHubTimelineEvent = RestEndpointMethodTypes["issues"]["listEventsForTimeline"]["response"]["data"][0]; export type GitHubRepository = RestEndpointMethodTypes["repos"]["get"]["response"]["data"]; diff --git a/src/helpers/get-comment-details.ts b/src/helpers/get-comment-details.ts new file mode 100644 index 00000000..94bf450f --- /dev/null +++ b/src/helpers/get-comment-details.ts @@ -0,0 +1,21 @@ +import { GitHubIssueComment } from "../github-types"; +import { getOctokitInstance } from "../octokit"; +import { IssueComment } from "@octokit/graphql-schema"; +import { QUERY_COMMENT_DETAILS } from "../types/requests"; + +export async function getMinimizedCommentStatus(comments: GitHubIssueComment[]) { + const octokit = getOctokitInstance(); + const commentsData = await octokit.graphql<{ nodes?: IssueComment[] }>(QUERY_COMMENT_DETAILS, { + node_ids: comments.map((o) => o.node_id), + }); + + if (commentsData.nodes?.length) { + for (const commentNode of commentsData.nodes) { + const comment = comments.find((o) => o.node_id === commentNode.id); + // For each comment we add the 'isMinimized' info, which corresponds to a collapsed comment + if (comment) { + comment.isMinimized = commentNode.isMinimized; + } + } + } +} diff --git a/src/parser/content-evaluator-module.ts b/src/parser/content-evaluator-module.ts index 57511ce9..f23a518e 100644 --- a/src/parser/content-evaluator-module.ts +++ b/src/parser/content-evaluator-module.ts @@ -1,18 +1,23 @@ -import { Value } from "@sinclair/typebox/value"; import Decimal from "decimal.js"; import { encodingForModel, Tiktoken } from "js-tiktoken"; import OpenAI from "openai"; -import { commentEnum, CommentType } from "../configuration/comment-types"; import configuration from "../configuration/config-reader"; import { OPENAI_API_KEY } from "../configuration/constants"; import { ContentEvaluatorConfiguration, contentEvaluatorConfigurationType, } from "../configuration/content-evaluator-config"; -import logger from "../helpers/logger"; import { IssueActivity } from "../issue-activity"; -import openAiRelevanceResponseSchema, { RelevancesByOpenAi } from "../types/openai-type"; import { GithubCommentScore, Module, Result } from "./processor"; +import { Value } from "@sinclair/typebox/value"; +import { commentEnum, CommentKind, CommentType } from "../configuration/comment-types"; +import logger from "../helpers/logger"; +import { + openAiRelevanceResponseSchema, + CommentToEvaluate, + Relevances, + PrCommentToEvaluate, +} from "../types/content-evaluator-module-type"; /** * Evaluates and rates comments. @@ -89,22 +94,9 @@ export class ContentEvaluatorModule implements Module { async _processComment(comments: Readonly[], specificationBody: string) { const commentsWithScore: GithubCommentScore[] = [...comments]; + const { commentsToEvaluate, prCommentsToEvaluate } = this._splitCommentsByPrompt(commentsWithScore); - // exclude comments that have fixed relevance multiplier. e.g. review comments = 1 - const commentsToEvaluate: { id: number; comment: string }[] = []; - for (let i = 0; i < commentsWithScore.length; i++) { - const currentComment = commentsWithScore[i]; - if (!this._fixedRelevances[currentComment.type]) { - commentsToEvaluate.push({ - id: currentComment.id, - comment: currentComment.content, - }); - } - } - - const relevancesByAI = commentsToEvaluate.length - ? await this._evaluateComments(specificationBody, commentsToEvaluate) - : {}; + const relevancesByAI = await this._evaluateComments(specificationBody, commentsToEvaluate, prCommentsToEvaluate); if (Object.keys(relevancesByAI).length !== commentsToEvaluate.length) { console.error("Relevance / Comment length mismatch! \nWill use 1 as relevance for missing comments."); @@ -147,14 +139,60 @@ export class ContentEvaluatorModule implements Module { }, {}); } + _splitCommentsByPrompt(commentsWithScore: Readonly[]): { + commentsToEvaluate: CommentToEvaluate[]; + prCommentsToEvaluate: PrCommentToEvaluate[]; + } { + const commentsToEvaluate: CommentToEvaluate[] = []; + const prCommentsToEvaluate: PrCommentToEvaluate[] = []; + for (let i = 0; i < commentsWithScore.length; i++) { + const currentComment = commentsWithScore[i]; + if (!this._fixedRelevances[currentComment.type]) { + if (currentComment.type & CommentKind.PULL) { + prCommentsToEvaluate.push({ + id: currentComment.id, + comment: currentComment.content, + diffHunk: currentComment?.diffHunk, + }); + } else { + commentsToEvaluate.push({ + id: currentComment.id, + comment: currentComment.content, + }); + } + } + } + return { commentsToEvaluate, prCommentsToEvaluate }; + } + async _evaluateComments( specification: string, - comments: { id: number; comment: string }[] - ): Promise { - const prompt = this._generatePrompt(specification, comments); - const dummyResponse = JSON.stringify(this._generateDummyResponse(comments), null, 2); - const maxTokens = this._calculateMaxTokens(dummyResponse); + comments: CommentToEvaluate[], + prComments: PrCommentToEvaluate[] + ): Promise { + let commentRelevances: Relevances = {}; + let prCommentRelevances: Relevances = {}; + + if (comments.length) { + const dummyResponse = JSON.stringify(this._generateDummyResponse(comments), null, 2); + const maxTokens = this._calculateMaxTokens(dummyResponse); + + const promptForComments = this._generatePromptForComments(specification, comments); + commentRelevances = await this._submitPrompt(promptForComments, maxTokens); + } + + if (prComments.length) { + const dummyResponse = JSON.stringify(this._generateDummyResponse(prComments), null, 2); + const maxTokens = this._calculateMaxTokens(dummyResponse); + + const promptForPrComments = this._generatePromptForPrComments(specification, prComments); + prCommentRelevances = await this._submitPrompt(promptForPrComments, maxTokens); + } + + return { ...commentRelevances, ...prCommentRelevances }; + } + async _submitPrompt(prompt: string, maxTokens: number): Promise { const response: OpenAI.Chat.ChatCompletion = await this._openAi.chat.completions.create({ model: this._configuration?.openAi.model || "gpt-4o-2024-08-06", response_format: { type: "json_object" }, @@ -186,7 +224,7 @@ export class ContentEvaluatorModule implements Module { } } - _generatePrompt(issue: string, comments: { id: number; comment: string }[]) { + _generatePromptForComments(issue: string, comments: CommentToEvaluate[]) { if (!issue?.length) { throw new Error("Issue specification comment is missing or empty"); } @@ -196,4 +234,15 @@ export class ContentEvaluatorModule implements Module { comments.length }.`; } + + _generatePromptForPrComments(issue: string, comments: PrCommentToEvaluate[]) { + if (!issue?.length) { + throw new Error("Issue specification comment is missing or empty"); + } + return `I need to evaluate the value of a GitHub contributor's comments in a pull request. Some of these comments are code review comments, and some are general suggestions or a part of the discussion. I'm interested in how much each comment helps to solve the GitHub issue and improve code quality. Please provide a float between 0 and 1 to represent the value of each comment. A score of 1 indicates that the comment is very valuable and significantly improves the submitted solution and code quality, whereas a score of 0 indicates a negative or zero impact. A stringified JSON is given below that contains the specification of the GitHub issue, and comments by different contributors. The property "diffHunk" presents the chunk of code being addressed for a possible change in a code review comment. \n\n\`\`\`\n${JSON.stringify( + { specification: issue, comments: comments } + )}\n\`\`\`\n\n\nTo what degree are each of the comments valuable? Please reply with ONLY a JSON where each key is the comment ID given in JSON above, and the value is a float number between 0 and 1 corresponding to the comment. The float number should represent the value of the comment for improving the issue solution and code quality. The total number of properties in your JSON response should equal exactly ${ + comments.length + }.`; + } } diff --git a/src/parser/data-purge-module.ts b/src/parser/data-purge-module.ts index 511af9b9..fba5ccf9 100644 --- a/src/parser/data-purge-module.ts +++ b/src/parser/data-purge-module.ts @@ -1,8 +1,10 @@ import { Value } from "@sinclair/typebox/value"; import configuration from "../configuration/config-reader"; import { DataPurgeConfiguration, dataPurgeConfigurationType } from "../configuration/data-purge-config"; +import logger from "../helpers/logger"; import { IssueActivity } from "../issue-activity"; import { Module, Result } from "./processor"; +import { GitHubPullRequestReviewComment } from "../github-types"; /** * Removes the data in the comments that we do not want to be processed. @@ -20,6 +22,11 @@ export class DataPurgeModule implements Module { async transform(data: Readonly, result: Result) { for (const comment of data.allComments) { + // Skips comments if they are minimized + if ("isMinimized" in comment && comment.isMinimized) { + logger.debug("Skipping hidden comment", { comment }); + continue; + } if (comment.body && comment.user?.login && result[comment.user.login]) { const newContent = comment.body // Remove quoted text @@ -31,6 +38,9 @@ export class DataPurgeModule implements Module { // Keep only one new line needed by markdown-it package to convert to html .replace(/\n\s*\n/g, "\n") .trim(); + + const reviewComment = comment as GitHubPullRequestReviewComment; + if (newContent.length) { result[comment.user.login].comments = [ ...(result[comment.user.login].comments ?? []), @@ -39,6 +49,7 @@ export class DataPurgeModule implements Module { content: newContent, url: comment.html_url, type: comment.type, + diffHunk: reviewComment?.pull_request_review_id ? reviewComment?.diff_hunk : undefined, }, ]; } diff --git a/src/parser/permit-generation-module.ts b/src/parser/permit-generation-module.ts index c73418ae..fc21f0be 100644 --- a/src/parser/permit-generation-module.ts +++ b/src/parser/permit-generation-module.ts @@ -54,7 +54,11 @@ export class PermitGenerationModule implements Module { console.warn("[PermitGenerationModule] Invalid env detected, skipping."); return Promise.resolve(result); } - const isPrivateKeyAllowed = await this._isPrivateKeyAllowed(payload.evmPrivateEncrypted, program.eventPayload.repository.owner.id, program.eventPayload.repository.id); + const isPrivateKeyAllowed = await this._isPrivateKeyAllowed( + payload.evmPrivateEncrypted, + program.eventPayload.repository.owner.id, + program.eventPayload.repository.id + ); if (!isPrivateKeyAllowed) { console.warn("[PermitGenerationModule] Private key is not allowed to be used in this organization/repository."); return Promise.resolve(result); @@ -275,38 +279,38 @@ export class PermitGenerationModule implements Module { /** * Checks whether partner's private key is allowed to be used in current repository. - * + * * If partner accidentally shares his encrypted private key then a malicious user * will be able to use that leaked private key in another organization with permits * generated from a leaked partner's wallet. - * + * * Partner private key (`evmPrivateEncrypted` config param in `conversation-rewards` plugin) supports 2 formats: * 1. PRIVATE_KEY:GITHUB_OWNER_ID * 2. PRIVATE_KEY:GITHUB_OWNER_ID:GITHUB_REPOSITORY_ID - * + * * Here `GITHUB_OWNER_ID` can be: * 1. Github organization id (if ubiquibot is used within an organization) * 2. Github user id (if ubiquibot is simply installed in a user's repository) - * - * Format "PRIVATE_KEY:GITHUB_OWNER_ID" restricts in which particular organization (or user related repositories) + * + * Format "PRIVATE_KEY:GITHUB_OWNER_ID" restricts in which particular organization (or user related repositories) * this private key can be used. It can be set either in the organization wide config either in the repository wide one. - * - * Format "PRIVATE_KEY:GITHUB_OWNER_ID:GITHUB_REPOSITORY_ID" restricts organization (or user related repositories) and + * + * Format "PRIVATE_KEY:GITHUB_OWNER_ID:GITHUB_REPOSITORY_ID" restricts organization (or user related repositories) and * a particular repository where private key is allowed to be used. - * - * @param privateKeyEncrypted Encrypted private key (with "X25519_PRIVATE_KEY") string (in any of the 2 different formats) + * + * @param privateKeyEncrypted Encrypted private key (with "X25519_PRIVATE_KEY") string (in any of the 2 different formats) * @param githubContextOwnerId Github organization or used id from which the "conversation-rewards" is executed * @param githubContextRepositoryId Github repository id from which the "conversation-rewards" is executed * @returns Whether private key is allowed to be used in current owner/repository context */ async _isPrivateKeyAllowed( - privateKeyEncrypted: string, - githubContextOwnerId: number, + privateKeyEncrypted: string, + githubContextOwnerId: number, githubContextRepositoryId: number ): Promise { // decrypt private key const privateKeyDecrypted = await decrypt(privateKeyEncrypted, process.env.X25519_PRIVATE_KEY); - + // parse decrypted private key const privateKeyParsed = parseDecryptedPrivateKey(privateKeyDecrypted); if (!privateKeyParsed.privateKey) { @@ -327,8 +331,13 @@ export class PermitGenerationModule implements Module { // private key + owner id + repository id // Format: PRIVATE_KEY:GITHUB_OWNER_ID:GITHUB_REPOSITORY_ID if (privateKeyParsed.allowedOrganizationId && privateKeyParsed.allowedRepositoryId) { - if (privateKeyParsed.allowedOrganizationId !== githubContextOwnerId || privateKeyParsed.allowedRepositoryId !== githubContextRepositoryId) { - console.log(`Current organization/user id ${githubContextOwnerId} and repository id ${githubContextRepositoryId} are not allowed to use this private key`); + if ( + privateKeyParsed.allowedOrganizationId !== githubContextOwnerId || + privateKeyParsed.allowedRepositoryId !== githubContextRepositoryId + ) { + console.log( + `Current organization/user id ${githubContextOwnerId} and repository id ${githubContextRepositoryId} are not allowed to use this private key` + ); return false; } return true; diff --git a/src/parser/processor.ts b/src/parser/processor.ts index 90f911a0..a2bde023 100644 --- a/src/parser/processor.ts +++ b/src/parser/processor.ts @@ -98,6 +98,7 @@ export interface GithubCommentScore { content: string; url: string; type: CommentKind | CommentAssociation; + diffHunk?: string; score?: { formatting?: { content: Record; diff --git a/src/start.ts b/src/start.ts index 4f75dcfe..c43f69d2 100644 --- a/src/start.ts +++ b/src/start.ts @@ -10,6 +10,7 @@ import { GitHubTimelineEvent, GitHubUser, } from "./github-types"; +import { getMinimizedCommentStatus } from "./helpers/get-comment-details"; // async function main(gitHubIssueUrl: GitHubIssue["html_url"]) { // const issueParams = parseGitHubUrl(gitHubIssueUrl); @@ -80,7 +81,11 @@ export async function getIssueEvents(issueParams: IssueParams): Promise { const octokit = getOctokitInstance(); - return await octokit.paginate(octokit.issues.listComments.endpoint.merge(issueParams)); + const comments: GitHubIssueComment[] = await octokit.paginate( + octokit.issues.listComments.endpoint.merge(issueParams) + ); + await getMinimizedCommentStatus(comments); + return comments; } export async function getPullRequestReviews(pullParams: PullParams): Promise { const octokit = getOctokitInstance(); diff --git a/src/types/content-evaluator-module-type.ts b/src/types/content-evaluator-module-type.ts new file mode 100644 index 00000000..5caad71a --- /dev/null +++ b/src/types/content-evaluator-module-type.ts @@ -0,0 +1,9 @@ +import { Type, Static } from "@sinclair/typebox"; + +export type CommentToEvaluate = { id: number; comment: string }; + +export type PrCommentToEvaluate = { id: number; comment: string; diffHunk?: string }; + +export const openAiRelevanceResponseSchema = Type.Record(Type.String(), Type.Number({ minimum: 0, maximum: 1 })); + +export type Relevances = Static; diff --git a/src/types/openai-type.ts b/src/types/openai-type.ts deleted file mode 100644 index 58190740..00000000 --- a/src/types/openai-type.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Type, Static } from "@sinclair/typebox"; - -const openAiRelevanceResponseSchema = Type.Record(Type.String(), Type.Number({ minimum: 0, maximum: 1 })); - -export type RelevancesByOpenAi = Static; - -export default openAiRelevanceResponseSchema; diff --git a/src/types/requests.ts b/src/types/requests.ts index a209a45d..3fd25f89 100644 --- a/src/types/requests.ts +++ b/src/types/requests.ts @@ -33,3 +33,14 @@ export const LINKED_PULL_REQUESTS = /* GraphQL */ ` } } `; + +export const QUERY_COMMENT_DETAILS = /* GraphQL */ ` + query commentDetails($node_ids: [ID!]!) { + nodes(ids: $node_ids) { + ... on IssueComment { + id + isMinimized + } + } + } +`; diff --git a/tests/__mocks__/handlers.ts b/tests/__mocks__/handlers.ts index 404f1da7..8fff3efd 100644 --- a/tests/__mocks__/handlers.ts +++ b/tests/__mocks__/handlers.ts @@ -1,17 +1,28 @@ import { http, HttpResponse } from "msw"; import { db } from "./db"; +import issue5Get from "./routes/issue-5-conversation-rewards/issue-5-get.json"; import issue22CommentsGet from "./routes/issue-22-comments-get.json"; +import issue5EventsGet from "./routes/issue-5-conversation-rewards/issue-5-events-get.json"; import issue22Get from "./routes/issue-22-get.json"; +import issue13Get from "./routes/issue-13-get.json"; import issue25CommentsGet from "./routes/issue-25-comments-get.json"; import issue69EventsGet from "./routes/issue-69-events-get.json"; +import issue13EventsGet from "./routes/issue-13-events-get.json"; import issue69CommentsGet from "./routes/issue-69-comments-get.json"; +import issue13CommentsGet from "./routes/issue-13-comments-get.json"; import issue69Get from "./routes/issue-69-get.json"; import issueEvents2Get from "./routes/issue-events-2-get.json"; import issueEventsGet from "./routes/issue-events-get.json"; +import issue5CommentsGet from "./routes/issue-5-conversation-rewards/issue-5-comments-get.json"; +import issue12CommentsGet from "./routes/pull-12-conversation-rewards/issue-12-comments-get.json"; +import pull12Get from "./routes/pull-12-conversation-rewards/pull-12-get.json"; +import pull12ReviewsGet from "./routes/pull-12-conversation-rewards/pull-12-reviews-get.json"; +import pull12CommentsGet from "./routes/pull-12-conversation-rewards/pull-12-comments-get.json"; import issueTimelineGet from "./routes/issue-timeline-get.json"; import issue69TimelineGet from "./routes/issue-69-timeline-get.json"; import issue70CommentsGet from "./routes/issue-70-comments-get.json"; import pullsCommentsGet from "./routes/pulls-comments-get.json"; +import issue5TimelineGet from "./routes/issue-5-conversation-rewards/issue-5-timeline-get.json"; import pullsGet from "./routes/pulls-get.json"; import pulls70Get from "./routes/issue-70-get.json"; import pullsReviewsGet from "./routes/pulls-reviews-get.json"; @@ -20,6 +31,34 @@ import pullsReviewsGet from "./routes/pulls-reviews-get.json"; * Intercepts the routes and returns a custom payload */ export const handlers = [ + http.get("https://api.github.com/repos/ubiquibot/conversation-rewards/issues/5", () => { + return HttpResponse.json(issue5Get); + }), + http.get("https://api.github.com/repos/ubiquibot/conversation-rewards/issues/5/events", () => { + return HttpResponse.json(issue5EventsGet); + }), + http.get("https://api.github.com/repos/ubiquibot/conversation-rewards/issues/5/comments", () => { + return HttpResponse.json(issue5CommentsGet); + }), + http.get("https://api.github.com/repos/ubiquibot/conversation-rewards/issues/12/comments", () => { + return HttpResponse.json(issue12CommentsGet); + }), + http.get("https://api.github.com/repos/ubiquibot/conversation-rewards/issues/5/timeline", () => { + return HttpResponse.json(issue5TimelineGet); + }), + http.get("https://api.github.com/repos/ubiquibot/conversation-rewards/pulls/12", () => { + return HttpResponse.json(pull12Get); + }), + http.get("https://api.github.com/repos/ubiquibot/conversation-rewards/pulls/12/reviews", () => { + return HttpResponse.json(pull12ReviewsGet); + }), + http.get("https://api.github.com/repos/ubiquibot/conversation-rewards/pulls/12/comments", () => { + return HttpResponse.json(pull12CommentsGet); + }), + + http.get("https://api.github.com/repos/Meniole/conversation-rewards/issues/13", () => { + return HttpResponse.json(issue13Get); + }), http.get("https://api.github.com/repos/ubiquibot/comment-incentives/issues/22", () => { return HttpResponse.json(issue22Get); }), @@ -38,12 +77,18 @@ export const handlers = [ http.get("https://api.github.com/repos/ubiquibot/comment-incentives/issues/22/comments", () => { return HttpResponse.json(issue22CommentsGet); }), + http.get("https://api.github.com/repos/Meniole/conversation-rewards/issues/13/events", () => { + return HttpResponse.json(issue13EventsGet); + }), http.get("https://api.github.com/repos/ubiquity/work.ubq.fi/issues/69/comments", () => { return HttpResponse.json(issue69CommentsGet); }), http.get("https://api.github.com/repos/ubiquibot/comment-incentives/issues/25/comments", () => { return HttpResponse.json(issue25CommentsGet); }), + http.get("https://api.github.com/repos/Meniole/conversation-rewards/issues/13/comments", () => { + return HttpResponse.json(issue13CommentsGet); + }), http.get("https://api.github.com/repos/ubiquibot/comment-incentives/issues/22/timeline", () => { return HttpResponse.json(issueTimelineGet); }), diff --git a/tests/__mocks__/results/data-purge-result.json b/tests/__mocks__/results/data-purge-result.json index 72e66a1d..7b441084 100644 --- a/tests/__mocks__/results/data-purge-result.json +++ b/tests/__mocks__/results/data-purge-result.json @@ -1,155 +1,551 @@ { - "gitcoindev": { - "userId": 88761781, - "total": 37.5, + "gentlementlegen": { + "userId": 9807008, + "total": 400, "task": { - "reward": 37.5, + "reward": 400, "multiplier": 1 }, "comments": [ { - "id": 1949333227, - "content": "@molecula451 I tried to override X25519_PRIVATE_KEY but it did not help. It seems that https://github.com/ubiquibot/production/blob/1937a6ba75588f51d1bf07fed1f6384f79090465/.github/ubiquibot-config.yml#L2 takes precedence over https://github.com/ubiquibot/comment-incentives/blob/main/.github/ubiquibot-config.yml#L2 (I see the first one in logs).", - "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949333227", - "type": "ISSUE_ASSIGNEE" + "id": 2033404518, + "content": "This needs https://github.com/ubiquibot/conversation-rewards/pull/7 to be merged first. Also probably needs https://github.com/ubiquibot/permit-generation/pull/2 to be able to generate the permits properly.", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2033404518", + "type": "ISSUE_AUTHOR" + }, + { + "id": 2036174312, + "content": "To me 1 is the most straightforward to do for few reasons:\r\n- the comment reward plugin has all the needed data already\r\n- it can import the https://github.com/ubiquibot/permit-generation to generate permits itself\r\n- if it is done this way it can be used as a complete standalone without the kernel\r\n3 might make more sense in terms of architecture however. In such case the kernel should pass down results. It is more of an architecture question. Although, if we ever have other plugins in the flow that have influence on the total incentives, it would make sense to go through the kernel to aggregate the total result.", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2036174312", + "type": "ISSUE_AUTHOR" + }, + { + "id": 2036367126, + "content": "I think each plugin should output JSON not html as it is not reliable to parse nor manipulate and requires `window` instance to be instantiated which is annoying on `node` based projects. \r\nHaving a plugin handling commenting seems quite weird as commenting is done by calling Octokit and the REST api which is already a library by itself, so no need to encapsulate it within another one to do the same thing.\r\nMy view on this, is to finalize https://github.com/ubiquibot/permit-generation/issues/5 to import it withing the `conversation-reward` that will post the comment itself as well, otherwise the architecture will be quite convoluted doing ping pong with everything.", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2036367126", + "type": "ISSUE_AUTHOR" + }, + { + "id": 2036385985, + "content": "If you want to manipulate and convey data, HTML really is not made for this. If you want something formatted similarly but made for data we can use XML format.\r\nThe new comment reward actually does instantiate a DOM through [JSDOM](https://github.com/ubiquibot/conversation-rewards/blob/ba434761281446a23566cd02c68bd3b0e79d4eb1/src/parser/formatting-evaluator-module.ts#L80) to make things way simpler instead of using Regex everywhere which is highly unreliable. But there it makes sense because we are parsing comments from an HTML page content.\r\nBiggest advantage from this is to have the comment reward fully standalone, while easy to integrate with the kernel.\r\nIf we do something that handles the comment it means each and every module has to send it there and that module should understand every different content / format we send which would be way easier if the module itself handled its own comments, formatting wise.", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2036385985", + "type": "ISSUE_AUTHOR" + }, + { + "id": 2036411811, + "content": "But then how do we consider the formatting of that output?\r\nPractical case: we want to post a comment when a user queries a wallet. That comment is 'user name': 'wallet 0x0'\r\nKernel calls the comment plugin, saying that it wants a comment to be posted. Should the Kernel send the rendering it wants, should the comment plugin transform the data to HTML?\r\nThen, comment-reward wants to post the results. Should ask the Kernel to call the comment plugin, but then formatting is different. Should the Kernel notify the comment plugin that it wants a different output formatting? Should the Kernel compute beforehand the HTML and send it to the comment plugin?\r\nMight be something I don't grasp there. Because I do understand your use case but it seems to be very deterministic on what is the purpose of the plugins which kinda defeats the purpose of having plugins, looks more like a monolithic approach to me", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2036411811", + "type": "ISSUE_AUTHOR" + }, + { + "id": 2036458775, + "content": "This can work, but we skyrocket coupling and to me defeat purpose of plugins that should be unaware of each other. If any plugin has to understand the result of a previous plugin, it means these plugins have necessarily to co-exist so basically they become a single plugin with no purpose to split them.", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2036458775", + "type": "ISSUE_AUTHOR" + }, + { + "id": 2036535332, + "content": "@pavlovcik To mitigate that that's why inside the comment reward itself I also integrated that `Module` principle so code is not coupled tightly and easy to build on. There is as usual pros and cons to both approaches (splitting or not) but biggest pro is that comments get evaluated once in the same spot, so we save calls to OpenAPI and speed up the process. Also makes it only one configuration file in one location. We need to think about our best options there.", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2036535332", + "type": "ISSUE_AUTHOR" }, { - "id": 1730006888, - "content": "The new evmPrivateKeyEncrypted generated for address 0x3a2E44e10AbEf5CB4a6E492c5ba93d30068d2D95 (no funds).\r\nResolves: https://github.com/ubiquibot/comment-incentives/issues/22", - "url": "https://github.com/ubiquibot/comment-incentives/pull/25", + "id": 2051094255, + "content": "I realized that to carry this task properly we need to handle flags for comment more delicately as they only indicate if the comment is `ISSUE | REVIEW` with the level `MEMBER | CONTRIBUTOR` etc. but doesn't specify if it is from a task, a specification and so on. Tags should be added to the config properly as well.", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2051094255", + "type": "ISSUE_AUTHOR" + }, + { + "id": 2054424028, + "content": "Agreed, I think currently there are 3 possible things to annotate on the comments:\r\n- `SPECIFICATION` for the issue itself, `TASK` for the related PR fixing it, or simply `COMMENT`\r\n- `MEMBER` or `CONTRIBUTOR` for the status of the member\r\n- `REVIEW` or `ISSUE` for where the comment was added\r\nI think this shall cover all cases.", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2054424028", + "type": "ISSUE_AUTHOR" + }, + { + "id": 2218638141, + "content": "In the v1 of the Ubiquibot, when a result gets evaluated, a recap is posted to the related issue with a summary and details of the rewards as well as the link to the rewards themselves Example: https://github.com/ubiquity/cloudflare-deploy-action/issues/9#issuecomment-2028623754\r\nThe same logic should be applied in the v2 version by creating a new Module responsible to post that comment. This module will receive a similar input than the one mentioned [here](https://github.com/ubiquity/cloudflare-deploy-action/issues/9#issuecomment-2028623754)\r\nThe module should be:\r\n- possible to enable / disable\r\n- eventually configurable (what data to show / hide)\r\n- coming with tests", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5", + "type": "ISSUE_SPECIFICATION" + }, + { + "id": 1822452078, + "content": "Resolves #5 \r\nDepends on #8 \r\nReviews looks gigantic but it's only due to the API snapshots I promise.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12", "type": "PULL_SPECIFICATION" }, { - "id": 1949044575, - "content": "@pavlovcik @molecula451 please check now again, I added to docs.", - "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949044575", + "id": 1570010044, + "content": "I think in this case it makes sense because this function will return `\"\"` if nothing is found. If I return `undefined` or `null` it will be interpreted in HTML as a string and will display the text null or undefined.\r\nI changed the code to always return `content` so it forces it to be properly initialized which should avoid mistakes.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1570010044", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";" + }, + { + "id": 1570011467, + "content": "It is supposed to represent a comment. Would you prefer a descriptive action such as `COMMENTED`?", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1570011467", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -27,29 +27,39 @@ formattingEvaluator:\n td: 1\n hr: 0\n multipliers:\n- - type: [ISSUE, ISSUER]:\n+ - type: [ISSUE, ISSUER, TASK]:\n+ formattingMultiplier: 1\n+ wordValue: 0.1\n+ - type: [ISSUE, ISSUER, COMMENT]:\n formattingMultiplier: 1\n wordValue: 0.2\n- - type: [ISSUE, ASSIGNEE]:\n+ - type: [ISSUE, ASSIGNEE, COMMENT]:" + }, + { + "id": 1570014142, + "content": "True, just picked this up from the previous codebase. https://rpc.gnosischain.com should do it for both then?", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1570014142", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -0,0 +1,22 @@\n+// available tokens for payouts\n+export const PAYMENT_TOKEN_PER_NETWORK: Record = {\n+ \"1\": {\n+ rpc: \"https://rpc-bot.ubq.fi/v1/mainnet\"," + }, + { + "id": 1570187141, + "content": "Seems convoluted to me and I don't know what problem that solved, but sure can do. Because either way this will yield an empty string or populated string?\r\nEither way changed to a `const string[]` to minimize mistakes then!", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1570187141", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";" + }, + { + "id": 1570188450, + "content": "Changed `COMMENT` to `COMMENTED`, added jsdoc description for each value\r\nhttps://github.com/ubiquibot/conversation-rewards/blob/559c13c9a7d548519a6434e1b8393fd0d5c8f3db/src/issue-activity.ts#L21", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1570188450", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -27,29 +27,39 @@ formattingEvaluator:\n td: 1\n hr: 0\n multipliers:\n- - type: [ISSUE, ISSUER]:\n+ - type: [ISSUE, ISSUER, TASK]:\n+ formattingMultiplier: 1\n+ wordValue: 0.1\n+ - type: [ISSUE, ISSUER, COMMENT]:\n formattingMultiplier: 1\n wordValue: 0.2\n- - type: [ISSUE, ASSIGNEE]:\n+ - type: [ISSUE, ASSIGNEE, COMMENT]:" + }, + { + "id": 1573413974, + "content": "Simply makes the docs linking the code within the comment, for convenience, and looks like this\r\n\"image\"\r\nAlso be careful you linked a random GitHub account within your comment", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1573413974", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}" + }, + { + "id": 1573416633, + "content": "In the case of a string it would coerce the value and you would get \"null\" as a string so I get your point indeed", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1573416633", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";" + }, + { + "id": 1573420718, + "content": "`observe` would help to chose what we want to include and ignore? We surely can add more properties as it goes. The purpose of this section is to attribute different multipliers based on the type of comment, mimicking the old [codebase](https://github.com/ubiquibot/comment-incentives/blob/525fcdccc8f0d9032a41cdaed3b4fbc6514d44b6/src/handlers/issue/comment-scoring-by-contribution-style.ts)", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1573420718", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -27,29 +27,39 @@ formattingEvaluator:\n td: 1\n hr: 0\n multipliers:\n- - type: [ISSUE, ISSUER]:\n+ - type: [ISSUE, ISSUER, TASK]:\n+ formattingMultiplier: 1\n+ wordValue: 0.1\n+ - type: [ISSUE, ISSUER, COMMENTED]:\n formattingMultiplier: 1\n wordValue: 0.2\n- - type: [ISSUE, ASSIGNEE]:\n+ - type: [ISSUE, ASSIGNEE, COMMENTED]:\n formattingMultiplier: 0\n wordValue: 0\n- - type: [ISSUE, COLLABORATOR]:\n+ - type: [ISSUE, COLLABORATOR, COMMENTED]:" + }, + { + "id": 1573731420, + "content": "Not very useful indeed. I am working on the tests on a separate PR to avoid cluttering that one. I didn't cover all the tests cases yet!\r\nhttps://github.com/ubiquibot/conversation-rewards/pull/14", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1573731420", + "type": "PULL_AUTHOR", + "diffHunk": "" + }, + { + "id": 1573731649, + "content": "See https://github.com/ubiquibot/conversation-rewards/pull/14 for the soon up to date mocks", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1573731649", + "type": "PULL_AUTHOR", + "diffHunk": "" + }, + { + "id": 1573733603, + "content": "Good point, also symbol should not be DAI but ETH isn't it?\r\n`pay.ubq.fi` seems to be using https://rpc.mevblocker.io for its RPC which seems to have low latency, a good privacy and score according to Chainlist as well.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1573733603", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -0,0 +1,22 @@\n+// available tokens for payouts\n+export const PAYMENT_TOKEN_PER_NETWORK: Record = {\n+ \"1\": {\n+ rpc: \"https://rpc.gnosischain.com\",\n+ token: \"0x6B175474E89094C44Da98b954EedeAC495271d0F\",\n+ symbol: \"DAI\",\n+ }," + }, + { + "id": 1573737049, + "content": "Had changed it everywhere else but here, now it should be fine", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1573737049", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";" + }, + { + "id": 1574114225, + "content": "This matches any whitespace character (spaces, tabs, line breaks) so basically I make the produced HTML one liner. This helps to collect it from the CLI, makes the string shorter and more compact.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1574114225", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -0,0 +1,216 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ body += result[key].evaluationCommentHtml;\n+ }\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ function createIncentiveRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function buildIncentiveRow(commentScore: GithubCommentScore) {\n+ // Properly escape carriage returns for HTML rendering\n+ const formatting = stringify(commentScore.score?.formatting?.content).replace(/[\\n\\r]/g, \" \");\n+ return `\n+ \n+ \n+
\n+ ${commentScore.content.replace(/(.{64})..+/, \"$1…\")}\n+
\n+ \n+ \n+
\n+ \n+ ${Object.values(commentScore.score?.formatting?.content || {}).reduce((acc, curr) => {\n+ return acc.add(curr.score * curr.count);\n+ }, new Decimal(0))}\n+ \n+
${formatting}
\n+
\n+ \n+ ${commentScore.score?.relevance || \"-\"}\n+ ${commentScore.score?.reward || \"-\"}\n+ `;\n+ }\n+\n+ for (const issueComment of sorted.issues.comments) {\n+ content.push(buildIncentiveRow(issueComment));\n+ }\n+ for (const reviewComment of sorted.reviews) {\n+ content.push(buildIncentiveRow(reviewComment));\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ return `\n+
\n+ \n+ \n+

\n+ \n+ [ ${result.total} ${getPayoutConfigByNetworkId(program.opts().evmNetworkId).symbol} ]\n+ \n+

\n+
\n+ @${username}\n+
\n+
\n+
\n+
Contributions Overview
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ ${createContributionRows()}\n+ \n+
ViewContributionCountReward
\n+
Conversation Incentives
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ ${createIncentiveRows()}\n+ \n+
CommentFormattingRelevanceReward
\n+
\n+ `\n+ .replace(/\\s+/g, \" \")" + }, + { + "id": 1574622869, + "content": "By definition `dump` was just outputting results to stdout, but I could make it return the result as well. Since the console log is what we want to make sure works properly to be reused by other workflows, I thought it would make sense to test it that way because potentially if we forget other logs somewhere that would mess up the output for the next Action step.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1574622869", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -0,0 +1,41 @@\n+import { parseGitHubUrl } from \"../src/start\";\n+import { IssueActivity } from \"../src/issue-activity\";\n+import { Processor } from \"../src/parser/processor\";\n+import { UserExtractorModule } from \"../src/parser/user-extractor-module\";\n+import { server } from \"./__mocks__/node\";\n+import { DataPurgeModule } from \"../src/parser/data-purge-module\";\n+import userCommentResults from \"./__mocks__/results/user-comment-results.json\";\n+import dataPurgeResults from \"./__mocks__/results/data-purge-result.json\";\n+\n+const issueUrl = process.env.TEST_ISSUE_URL || \"https://github.com/ubiquibot/comment-incentives/issues/22\";\n+\n+beforeAll(() => server.listen());\n+afterEach(() => server.resetHandlers());\n+afterAll(() => server.close());\n+\n+describe(\"Modules tests\", () => {\n+ const issue = parseGitHubUrl(issueUrl);\n+ const activity = new IssueActivity(issue);\n+\n+ beforeAll(async () => {\n+ await activity.init();\n+ });\n+\n+ it(\"Should extract users from comments\", async () => {\n+ const logSpy = jest.spyOn(console, \"log\");\n+ const processor = new Processor();\n+ processor[\"_transformers\"] = [new UserExtractorModule()];\n+ await processor.run(activity);\n+ processor.dump();\n+ expect(logSpy).toHaveBeenCalledWith(JSON.stringify(userCommentResults, undefined, 2));" + }, + { + "id": 1574702577, + "content": "Un-nested them one level. I think that the `buildXrow` should just be contained by that function because its purpose only serves inside of it.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1574702577", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(" + }, + { + "id": 1574724902, + "content": "I assumed BigInt only handles integers, and we manipulate a lot of floating decimal values for our operations (mostly everything has a floating point)", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1574724902", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))" + }, + { + "id": 1574767984, + "content": "There is one permit generated per participating user, last run:\r\nhttps://github.com/Meniole/test/issues/1#issuecomment-2069443938", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1574767984", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ function createIncentiveRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function buildIncentiveRow(commentScore: GithubCommentScore) {\n+ // Properly escape carriage returns for HTML rendering\n+ const formatting = stringify(commentScore.score?.formatting?.content).replace(/[\\n\\r]/g, \" \");\n+ return `\n+ \n+ \n+
\n+ ${commentScore.content.replace(/(.{64})..+/, \"$1…\")}\n+
\n+ \n+ \n+
\n+ \n+ ${Object.values(commentScore.score?.formatting?.content || {}).reduce((acc, curr) => {\n+ return acc.add(curr.score * curr.count);\n+ }, new Decimal(0))}\n+ \n+
${formatting}
\n+
\n+ \n+ ${commentScore.score?.relevance || \"-\"}\n+ ${commentScore.score?.reward || \"-\"}\n+ `;\n+ }\n+\n+ for (const issueComment of sorted.issues.comments) {\n+ content.push(buildIncentiveRow(issueComment));\n+ }\n+ for (const reviewComment of sorted.reviews) {\n+ content.push(buildIncentiveRow(reviewComment));\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ return `\n+
\n+ \n+ \n+

\n+ " + }, + { + "id": 1575659438, + "content": "I made it according to the previous version:\r\n- Issue Specification means the item when opening an issue\r\n- Issue Task means the item that fixed the issue\r\nExample with the current comments:\r\nhttps://github.com/ubiquibot/comment-incentives/issues/31#issuecomment-1998609326", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1575659438", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000," + }, + { + "id": 1575675704, + "content": "Wouldn't that lead to precision loss in JS and after the division we could end up with 42.000000001 results? That's also what `DecimalJs` fixes in this case.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1575675704", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))" + }, + { + "id": 1576567583, + "content": "That is correct. I understand now why you're confused:\r\nThe value for the task would be\r\n`\"ISSUE|ISSUER|TASK\"`\r\nbecause it is inside the `issue`\r\nThe value for the Specification would be\r\n`\"REVIEW|ISSUER|SPECIFICATION\"`\r\nbecause it is inside the `pull`\r\nI display `Issue: Specification` and `Issue: Task` just to stick to our current display format. Maybe instead I could display `Review: Task` instead?", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1576567583", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000," + }, + { + "id": 1577477616, + "content": "I don't think is it relevant in this scenario because we are not manipulating big numbers. Decimaljs allows for non-precision loss on the operations because there is a lot of multiply / divide with floating points which can result in very long decimals due to Js nature.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1577477616", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))" + }, + { + "id": 1578162024, + "content": "@whilefoo you are correct, these were wrongly used. I corrected `TASK` and replaced it by `SPECIFICATION` so we have:\r\n`\"ISSUE|ISSUER|SPECIFICATION\"` and `\"REVIEW|ISSUER|TASK\"`\r\nI used `ISSUER` for this because technically the issuer is not necessarily the assignee in both cases.\r\nFix within next PR:\r\nhttps://github.com/ubiquibot/conversation-rewards/pull/14/commits/90e150f76073c9cfa16a251f8c1ae48a75aa5408", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1578162024", + "type": "PULL_AUTHOR", + "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000," + }, + { + "id": 2056635516, + "content": "Example of successful comment posting with results:\r\nhttps://github.com/Meniole/test/issues/1#issuecomment-2056572986", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#issuecomment-2056635516", "type": "PULL_AUTHOR" }, { - "id": 1949046925, - "content": "No way, full details are available in plain sight, only for test in production purposes", - "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949046925", + "id": 2063348339, + "content": "@0x4007 I believe that if I had all the tests in this PR it will become enormous, maybe I ought to do it in a separate PR.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#issuecomment-2063348339", "type": "PULL_AUTHOR" } ] }, - "molecula451": { + "0x4007": { "total": 0, - "userId": 41552663, + "userId": 4975670, "comments": [ { - "id": 1948916343, - "content": "pavlovcik i think we need to update a bit the readme\r\n![image_2024-02-16_131036879](https://github.com/ubiquibot/comment-incentives/assets/41552663/41516d66-4666-47d7-9efe-517fb26293dd)\r\ndm what to whom?", - "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1948916343", - "type": "ISSUE_CONTRIBUTOR" + "id": 2030164289, + "content": "@whilefoo rfc on how we can deal with comment outputs. Perhaps we can have a standard recognized property on the output interface? Then the kernel can decide whether to pass it around or something. \r\n```ts\r\ninterface PluginOutput {\r\n comment: string; // html comment\r\n rewards: Rewards; // { \"whilefoo\": \"500\", \"token\": \"0x0\" } etc\r\n}\r\n```", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2030164289", + "type": "ISSUE_COLLABORATOR" }, { - "id": 1948989989, - "content": "let us know when done", - "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1948989989", - "type": "ISSUE_CONTRIBUTOR" + "id": 2033488255, + "content": "I think you should fork from and overtake that second pull due to us being behind schedule", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2033488255", + "type": "ISSUE_COLLABORATOR" }, { - "id": 1949195772, - "content": "https://github.com/ubiquibot/comment-incentives/actions/runs/7935268560 invalid input sounds unexpected @gitcoindev ??", - "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949195772", - "type": "ISSUE_CONTRIBUTOR" + "id": 2036355445, + "content": "I think the most pure architecture would be that plugins can NOT inherit (write) authentication (only read if possible) of the kernel. As a consequence, no plugin should be able to post directly any issue. Ideally it should only be the kernel with a direct interface to issues. Plugins should just output comment HTML and the kernel can post it all in a single comment at the end of the webhook event invocation chain.\r\nCould be interesting to have a dedicated plugin to handle commenting, but because this seems like such an essential capability, I would more carefully consider the pros/cons of including this within the kernel. \r\n- On one hand, I really like the idea of making the kernel as pure and lean as possible\r\n- On the other hand there are practical considerations that if every plugin standard output interface includes `comment:` and then we don't have the `comment` capability available (the comment plugin is not included in the config) then why is this a standard output property required on every plugin?\r\nI'm not concerned about latency now. Besides we can port any plugin to Cloudflare Workers (or combine several inside a single Worker) when we are ready to fix latency issues. To be honest though, except for setting labels, I have no problem with latency (like with permit generation) so there's no need to overengineer yet. I also love the GitHub Actions logs being available for easy debugging, and the fact that they are super generous with the compute. \r\nGiven the entire conversation and all the considerations, I definitely think we should do option 3. \r\nThis separates concerns the best, which will allow our plugin ecosystem to grow the fastest.", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2036355445", + "type": "ISSUE_COLLABORATOR" }, { - "id": 1949564869, - "content": "@pavlovcik permitted with hard debug (tho no funds in the private key)", - "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949564869", - "type": "ISSUE_CONTRIBUTOR" + "id": 2036370459, + "content": "I know JSON makes things more complicated than it needs to be with serialization/transport. Then we have problems like this https://github.com/ubiquibot/conversation-rewards/issues/18. If the comment property is ONLY meant to be used for GitHub comments, then transporting HTML only is the most sensible. Besides, there's no other metadata thats necessary within the `comment` property, which is the main point of sending a JSON object (it has multiple properties.) \r\nAs a somewhat side note: there should also not be any variables inside of the HTML. We could look it as like server-side-rendering (or in this case, plugin-side-rendering) handle producing the final HTML output and then output it as a single string of html entities. \r\nWe are currently using `mdast` in `@ubiquibot/comment-incentives` to generate virtual DOMs. No `window` needed.\r\nIf we agree that this is considered as technical debt, and that we are accruing this so that we can get back on schedule, ok.", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2036370459", + "type": "ISSUE_COLLABORATOR" }, { - "id": 1949635137, - "content": "pavlovcik i re-generated the X25519 to trigger the permit, what you don't understand? using a private key i own, but also did many commits to reach the root cause", - "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949635137", - "type": "ISSUE_CONTRIBUTOR" + "id": 2036393020, + "content": "Going back to my \"plugin-side-rendering\" mention, the data manipulation happens inside of the logic of the plugin. Then when the plugin is finally done with all of its compute, it emits a single string in the `comment` output property. This string is the final, rendered HTML. \r\nThe `comment` output is not intended to be consumed by other plugins. In most cases, the kernel will concatenate all the `comment` outputs from every plugin and post a single comment at the end. Plugins will consume the `metadata` property output which will include raw values to work with. I forget where I originally proposed this, but imagine something like:\r\n```typescript\r\ntype HtmlString = string;\r\ntype RequestedPermits = { username: string; amount: string; token: string; }[]\r\ninterface PluginOutput {\r\n metadata: Record;\r\n comment: HtmlString;\r\n rewards: RequestedPermits;\r\n}\r\n```", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2036393020", + "type": "ISSUE_COLLABORATOR" }, { - "id": 1949639196, - "content": "sure thing", - "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949639196", - "type": "ISSUE_CONTRIBUTOR" + "id": 2036433646, + "content": "The proposed `comment` output is intended for ease of composability for MOST situations, basically that the output from one plugin would just be appended to the final rendered comment. For simple plugin configurations (plugins not modifying the output results of others) this seems like straightforward architecture. \r\nHowever, as we know, there will be situations where a subsequent plugin will consider the results of a previous plugin, which means it would need to change the comment that is rendered. \r\nIn this situation the subsequent plugin should clobber the output of the previous plugin. It is now clear to be that this will be a new challenge to express to the kernel that it should ignore the comment output of a previous plugin. I suppose it would be straightforward in the metadata using the plugin ID i.e. `{ \"silences\": [\"ubiquibot/conversation-rewards\"] }`.\r\nI think that comments should be handled from within the kernel. There should not be a separate comment plugin. Read my explanation [here](https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2036355445). \r\n### Inputs\r\nFor completeness of my [previous comment](https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2036393020):\r\n```typescript\r\ntype PluginId = string; // i.e. `ubiquibot/conversation-rewards` `ubiquibot/assistive-pricing`\r\ninterface PluginInput {\r\n metadata: Record;\r\n context: GitHubEventContext;\r\n}\r\n```\r\nNotice that we should not pass in the HTML of other plugins. Instead, just the metadata (\"computed\") values from the previous plugins.", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2036433646", + "type": "ISSUE_COLLABORATOR" + }, + { + "id": 2036516869, + "content": "I understand your concern and I would need to put more thought into composability. Maybe the `comment` proposal is bad after all due to your point. It's only useful with simple plugins, but for more complex ones your point is valid. \r\nI need help to think through how any partner in the future can create new plugins that modify \r\n1. permit reward amounts \r\n2. XP reward amounts\r\nI don't like the idea of having a single monolithic rewards generation plugin that wraps all the ways possible to compute rewards (i.e. time estimation, comment rewards, review rewards etc)", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2036516869", + "type": "ISSUE_COLLABORATOR" + }, + { + "id": 2053332029, + "content": "I see, so you're suggesting that we must annotate each comment as well in order to properly handle the scoring at the end?\nOff hand I think there's:\n1. Specification \n2. Issue comment\n3. Pull request comment (a normal comment on a pull request, not related to posting a \"review\"\n4. Pull request review comment (associated with a \"review state\" I.e. approved, left comments, requested changes)\nI suppose we need a better naming convention for the pull related ones. They are considered as separate entities according to the GitHub api. They require different methods to obtain both types.", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2053332029", + "type": "ISSUE_COLLABORATOR" + }, + { + "id": 2055783331, + "content": "Consider calling it \"contributor\" and \"collaborator\" as that is how it is presented on the GitHub APIs as I recall. \nAlso I think you forgot about the \"review comments\"", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2055783331", + "type": "ISSUE_COLLABORATOR" + }, + { + "id": 2007841578, + "content": "Nice code quality per usual", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#pullrequestreview-2007841578", + "type": "PULL_COLLABORATOR" + }, + { + "id": 1569964797, + "content": "\"Comment\" implication isn't clear to me", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1569964797", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -27,29 +27,39 @@ formattingEvaluator:\n td: 1\n hr: 0\n multipliers:\n- - type: [ISSUE, ISSUER]:\n+ - type: [ISSUE, ISSUER, TASK]:\n+ formattingMultiplier: 1\n+ wordValue: 0.1\n+ - type: [ISSUE, ISSUER, COMMENT]:\n formattingMultiplier: 1\n wordValue: 0.2\n- - type: [ISSUE, ASSIGNEE]:\n+ - type: [ISSUE, ASSIGNEE, COMMENT]:" + }, + { + "id": 1569970517, + "content": "I've always been anti empty string for variable declarations. It's led to too many problems with other less experienced developers. I wish for a linter rule to flag these as a consequence. \nConsider initializing an empty array as a buffer and then joining it at the end.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1569970517", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";" + }, + { + "id": 1569971792, + "content": "Our RPCs don't work anymore", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1569971792", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -0,0 +1,22 @@\n+// available tokens for payouts\n+export const PAYMENT_TOKEN_PER_NETWORK: Record = {\n+ \"1\": {\n+ rpc: \"https://rpc-bot.ubq.fi/v1/mainnet\"," + }, + { + "id": 1570133378, + "content": "Yes consider changing them to verbs \n`ISSUER`\n`COMMENTED`\nI'm not 100% the best way to name all of them I have to look at the full list", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1570133378", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -27,29 +27,39 @@ formattingEvaluator:\n td: 1\n hr: 0\n multipliers:\n- - type: [ISSUE, ISSUER]:\n+ - type: [ISSUE, ISSUER, TASK]:\n+ formattingMultiplier: 1\n+ wordValue: 0.1\n+ - type: [ISSUE, ISSUER, COMMENT]:\n formattingMultiplier: 1\n wordValue: 0.2\n- - type: [ISSUE, ASSIGNEE]:\n+ - type: [ISSUE, ASSIGNEE, COMMENT]:" + }, + { + "id": 1570159594, + "content": "`[].join(\"\");` yields an empty string as well if there's nothing in the array.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1570159594", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";" + }, + { + "id": 1570588757, + "content": "Perhaps it will make the config more expressive if you add other properties?\nFor example \n```yml\nobserve:\n views:\n - ISSUE\n - PULL\n actors:\n - ISSUER \n - COLLABORATOR \n actions: \n - COMMENTED\n```", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1570588757", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -27,29 +27,39 @@ formattingEvaluator:\n td: 1\n hr: 0\n multipliers:\n- - type: [ISSUE, ISSUER]:\n+ - type: [ISSUE, ISSUER, TASK]:\n+ formattingMultiplier: 1\n+ wordValue: 0.1\n+ - type: [ISSUE, ISSUER, COMMENTED]:\n formattingMultiplier: 1\n wordValue: 0.2\n- - type: [ISSUE, ASSIGNEE]:\n+ - type: [ISSUE, ASSIGNEE, COMMENTED]:\n formattingMultiplier: 0\n wordValue: 0\n- - type: [ISSUE, COLLABORATOR]:\n+ - type: [ISSUE, COLLABORATOR, COMMENTED]:" + }, + { + "id": 1570589892, + "content": "What is this @link syntax", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1570589892", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}" + }, + { + "id": 1570591425, + "content": "Just noticed the bit wise operators 1337 code", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1570591425", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -73,12 +103,17 @@ export class IssueActivity {\n self: GitHubPullRequest | GitHubIssue | null\n ) {\n let ret = 0;\n- ret |= \"pull_request_review_id\" in comment ? CommentType.REVIEW : CommentType.ISSUE;\n+ ret |= \"pull_request_review_id\" in comment || \"draft\" in comment ? CommentType.REVIEW : CommentType.ISSUE;" + }, + { + "id": 1570596007, + "content": "It might seem convoluted but I think that it condenses the logic to coerce everything into a string as expected. This is a suggestion to be proactive when we set up the empty string linter one day. \nFor example if you `push` any element into the array (compared to `+=`) when you join they should render as expected. \n```js \n[ null, null ].join(\"\"); // \"\"\nnull += null; // 0 I think?\n```", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1570596007", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";" + }, + { + "id": 1573720820, + "content": "I am aware of its purpose. I am proposing to make the config more expressive so that its more intuitive to work with.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1573720820", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -27,29 +27,39 @@ formattingEvaluator:\n td: 1\n hr: 0\n multipliers:\n- - type: [ISSUE, ISSUER]:\n+ - type: [ISSUE, ISSUER, TASK]:\n+ formattingMultiplier: 1\n+ wordValue: 0.1\n+ - type: [ISSUE, ISSUER, COMMENTED]:\n formattingMultiplier: 1\n wordValue: 0.2\n- - type: [ISSUE, ASSIGNEE]:\n+ - type: [ISSUE, ASSIGNEE, COMMENTED]:\n formattingMultiplier: 0\n wordValue: 0\n- - type: [ISSUE, COLLABORATOR]:\n+ - type: [ISSUE, COLLABORATOR, COMMENTED]:" + }, + { + "id": 1573722731, + "content": "Will you use array syntax?", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1573722731", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";" }, { - "id": 1949038563, - "content": "indeed", - "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949038563", - "type": "PULL_CONTRIBUTOR" + "id": 1573723262, + "content": "This regex appears to convert repeating spaces i.e. `\" \"` to a single space `\" \"` what is the purpose of this?", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1573723262", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -0,0 +1,216 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ body += result[key].evaluationCommentHtml;\n+ }\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ function createIncentiveRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function buildIncentiveRow(commentScore: GithubCommentScore) {\n+ // Properly escape carriage returns for HTML rendering\n+ const formatting = stringify(commentScore.score?.formatting?.content).replace(/[\\n\\r]/g, \" \");\n+ return `\n+ \n+ \n+
\n+ ${commentScore.content.replace(/(.{64})..+/, \"$1…\")}\n+
\n+ \n+ \n+
\n+ \n+ ${Object.values(commentScore.score?.formatting?.content || {}).reduce((acc, curr) => {\n+ return acc.add(curr.score * curr.count);\n+ }, new Decimal(0))}\n+ \n+
${formatting}
\n+
\n+ \n+ ${commentScore.score?.relevance || \"-\"}\n+ ${commentScore.score?.reward || \"-\"}\n+ `;\n+ }\n+\n+ for (const issueComment of sorted.issues.comments) {\n+ content.push(buildIncentiveRow(issueComment));\n+ }\n+ for (const reviewComment of sorted.reviews) {\n+ content.push(buildIncentiveRow(reviewComment));\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ return `\n+
\n+ \n+ \n+

\n+ \n+ [ ${result.total} ${getPayoutConfigByNetworkId(program.opts().evmNetworkId).symbol} ]\n+ \n+

\n+
\n+ @${username}\n+
\n+
\n+
\n+
Contributions Overview
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ ${createContributionRows()}\n+ \n+
ViewContributionCountReward
\n+
Conversation Incentives
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ ${createIncentiveRows()}\n+ \n+
CommentFormattingRelevanceReward
\n+
\n+ `\n+ .replace(/\\s+/g, \" \")" }, { - "id": 1949044855, - "content": "go to go pavlovick, we'll be using this one for test only or test in production (lmao) ?", - "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949044855", - "type": "PULL_CONTRIBUTOR" + "id": 1573723774, + "content": "This doesn't seem right. Network ID 1 is mainnet. The RPC clearly is for gnosis chain. Perhaps try and find a nice mainnet RPC?", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1573723774", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -0,0 +1,22 @@\n+// available tokens for payouts\n+export const PAYMENT_TOKEN_PER_NETWORK: Record = {\n+ \"1\": {\n+ rpc: \"https://rpc.gnosischain.com\",\n+ token: \"0x6B175474E89094C44Da98b954EedeAC495271d0F\",\n+ symbol: \"DAI\",\n+ }," + }, + { + "id": 1573724498, + "content": "Seems like not a very useful mock.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1573724498", + "type": "PULL_COLLABORATOR", + "diffHunk": "" + }, + { + "id": 1573724853, + "content": "Same here", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1573724853", + "type": "PULL_COLLABORATOR", + "diffHunk": "" + }, + { + "id": 1574086028, + "content": "The token address indeed represents DAI on mainnet.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1574086028", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -0,0 +1,22 @@\n+// available tokens for payouts\n+export const PAYMENT_TOKEN_PER_NETWORK: Record = {\n+ \"1\": {\n+ rpc: \"https://rpc.gnosischain.com\",\n+ token: \"0x6B175474E89094C44Da98b954EedeAC495271d0F\",\n+ symbol: \"DAI\",\n+ }," + }, + { + "id": 1574086293, + "content": "@gentlementlegen rfc", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1574086293", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -0,0 +1,216 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ body += result[key].evaluationCommentHtml;\n+ }\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ function createIncentiveRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function buildIncentiveRow(commentScore: GithubCommentScore) {\n+ // Properly escape carriage returns for HTML rendering\n+ const formatting = stringify(commentScore.score?.formatting?.content).replace(/[\\n\\r]/g, \" \");\n+ return `\n+ \n+ \n+
\n+ ${commentScore.content.replace(/(.{64})..+/, \"$1…\")}\n+
\n+ \n+ \n+
\n+ \n+ ${Object.values(commentScore.score?.formatting?.content || {}).reduce((acc, curr) => {\n+ return acc.add(curr.score * curr.count);\n+ }, new Decimal(0))}\n+ \n+
${formatting}
\n+
\n+ \n+ ${commentScore.score?.relevance || \"-\"}\n+ ${commentScore.score?.reward || \"-\"}\n+ `;\n+ }\n+\n+ for (const issueComment of sorted.issues.comments) {\n+ content.push(buildIncentiveRow(issueComment));\n+ }\n+ for (const reviewComment of sorted.reviews) {\n+ content.push(buildIncentiveRow(reviewComment));\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ return `\n+
\n+ \n+ \n+

\n+ \n+ [ ${result.total} ${getPayoutConfigByNetworkId(program.opts().evmNetworkId).symbol} ]\n+ \n+

\n+
\n+ @${username}\n+
\n+
\n+
\n+
Contributions Overview
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ ${createContributionRows()}\n+ \n+
ViewContributionCountReward
\n+
Conversation Incentives
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ ${createIncentiveRows()}\n+ \n+
CommentFormattingRelevanceReward
\n+
\n+ `\n+ .replace(/\\s+/g, \" \")" + }, + { + "id": 1575555444, + "content": "Why not do it in the industry standard way? All values are denominated in `1e18` without floating point. \nAt the end, for rendering, we just need to divide by `1e18`", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1575555444", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))" + }, + { + "id": 1575556553, + "content": "I'm not sure if I understand but task reward is if you completed the task (if you are an assignee when the issue is completed) and specification reward is if you write the specification (you are the original issue author)", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1575556553", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000," + }, + { + "id": 1576666170, + "content": "Spoke a bit on this in dms. @whilefoo my intent with referring to GitHub Issues as \"tasks\" was to emphasize that its a funded, and recognized \"real project\" so I want to refer to them as \"tasks\" instead of just \"issues.\"\r\nSince we are dealing so heavily with the GitHub API, I figured that there is benefit to being specific about what words we are using. Sure we can load in all the GitHub issues on a repository, but not all of them will be funded and recognized. \r\nWe are only primarily concerned with working with \"tasks\" aka funded GitHub issues.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1576666170", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000," + }, + { + "id": 1577225638, + "content": "Possibly. I personally haven't had that issue but either way my suggestion is to keep everything internally without a decimal and then only convert it upon rendering.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1577225638", + "type": "PULL_COLLABORATOR", + "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))" + }, + { + "id": 2063712447, + "content": "I think it's fine. I generally scrutinize test code less than normal program code anyways.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#issuecomment-2063712447", + "type": "PULL_COLLABORATOR" } ] }, - "0x4007": { + "whilefoo": { "total": 0, - "userId": 4975670, + "userId": 139262667, "comments": [ { - "id": 1948930217, - "content": "Link below for conversation context. It was to me. Anyways you need to create a new private key for this task!", - "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1948930217", - "type": "ISSUE_AUTHOR" + "id": 2035427134, + "content": "there are a couple of options:\r\n1. we let the conversation-rewards plugin generate and post the comment\r\n2. we put comment as output and then another module is responsible for posting it or let conversation-rewards generate rewards and permit-generation generate permits and a third module that uses output from previous plugins to make a comment and post it\r\n3. we let the conversation-rewards plugin generate the comment and pass it as a standard property like you suggested.\r\nIn theory 2. option sounds good to separate concerns but it's another plugin which means another call to github actions thus more latency, so for the sake of speed it'd go with option 1 or 3, but going with these 2 options would mean there will 1 comment for rewards summary and 1 comment for permits.\r\nI'm not sure if option 3 is any better than option 1 because the plugin already has a token that has permissions to post comments so passing it to the kernel doesn't make much difference.", + "url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2035427134", + "type": "ISSUE_CONTRIBUTOR" }, { - "id": 1949201722, - "content": "In the repository secrets I think I need to change the key to match @gitcoindev's", - "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949201722", - "type": "ISSUE_AUTHOR" + "id": 1574427305, + "content": "```suggestion\r\n return result;\r\n```\r\nresolve is unnecessary here and some other places I saw it too", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1574427305", + "type": "PULL_CONTRIBUTOR", + "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);" }, { - "id": 1949203681, - "content": "I just changed it to `627H-BcWbcp_O3YmQGIA6MqgxVsFuplFCA9DK3iC7GQ`\r\nI hope that it doesn't break production for some reason (it should get it from Netlify secrets, but not sure if we implemented this correctly!)\r\nI fear that we might need to build a feature for this to support development key pair and production. Unfortunately I'm already winding down for the day so I'll leave you guys to try and investigate.", - "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949203681", - "type": "ISSUE_AUTHOR" + "id": 1574441918, + "content": "I'm not sure if it's a good idea to rely on logs for testing, is not possible to use output from the processor?", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1574441918", + "type": "PULL_CONTRIBUTOR", + "diffHunk": "@@ -0,0 +1,41 @@\n+import { parseGitHubUrl } from \"../src/start\";\n+import { IssueActivity } from \"../src/issue-activity\";\n+import { Processor } from \"../src/parser/processor\";\n+import { UserExtractorModule } from \"../src/parser/user-extractor-module\";\n+import { server } from \"./__mocks__/node\";\n+import { DataPurgeModule } from \"../src/parser/data-purge-module\";\n+import userCommentResults from \"./__mocks__/results/user-comment-results.json\";\n+import dataPurgeResults from \"./__mocks__/results/data-purge-result.json\";\n+\n+const issueUrl = process.env.TEST_ISSUE_URL || \"https://github.com/ubiquibot/comment-incentives/issues/22\";\n+\n+beforeAll(() => server.listen());\n+afterEach(() => server.resetHandlers());\n+afterAll(() => server.close());\n+\n+describe(\"Modules tests\", () => {\n+ const issue = parseGitHubUrl(issueUrl);\n+ const activity = new IssueActivity(issue);\n+\n+ beforeAll(async () => {\n+ await activity.init();\n+ });\n+\n+ it(\"Should extract users from comments\", async () => {\n+ const logSpy = jest.spyOn(console, \"log\");\n+ const processor = new Processor();\n+ processor[\"_transformers\"] = [new UserExtractorModule()];\n+ await processor.run(activity);\n+ processor.dump();\n+ expect(logSpy).toHaveBeenCalledWith(JSON.stringify(userCommentResults, undefined, 2));" }, { - "id": 1949633751, - "content": "I don't understand what you mean by this", - "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949633751", - "type": "ISSUE_AUTHOR" + "id": 1574458540, + "content": "why so many nested functions? it becomes hard to read", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1574458540", + "type": "PULL_CONTRIBUTOR", + "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(" }, { - "id": 1949639054, - "content": "I'll investigate more on my computer later.", - "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949639054", - "type": "ISSUE_AUTHOR" + "id": 1574460099, + "content": "is there a reason we are using Decimal.js instead of native BigInt?", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1574460099", + "type": "PULL_CONTRIBUTOR", + "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))" }, { - "id": 1949642845, - "content": "Will it be an issue if I revert to the commit and secret that I had before?\nIt was the production x25519 key in the GitHub repository secrets when it was working like eight hours ago. \nPosting this message before checking on my computer to get you before you log off.", - "url": "https://github.com/ubiquibot/comment-incentives/issues/22#issuecomment-1949642845", - "type": "ISSUE_AUTHOR" + "id": 1574487172, + "content": "Shouldn't task be issue opening item and specification is pull request opening item? At least that's how I understand from the code.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1574487172", + "type": "PULL_CONTRIBUTOR", + "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000," }, { - "id": 2139000633, - "content": "Can somebody work on generating a new `X25519_PRIVATE_KEY` for the ubiquibot organization? We need to share it for development purposes.\r\n1. Generate a new key\r\n2. Encrypt a new `evmPrivateKeyEncrypted` (no funds!) and add to the org bot config\r\n3. Add the shared test key to the `comment-incentives` readme. \r\nhttps://github.com/ubiquibot/comment-incentives/pull/21/commits/567419d9688e92edf698f64c697f1a7cafe1d02e\r\n_Originally posted by @pavlovcik in https://github.com/ubiquibot/comment-incentives/issues/19#issuecomment-1948876653_", - "url": "https://github.com/ubiquibot/comment-incentives/issues/22", - "type": "ISSUE_SPECIFICATION" + "id": 1574492061, + "content": "I assume this is a permit for task assignee, but where are other permits or is that not done yet?", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1574492061", + "type": "PULL_CONTRIBUTOR", + "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ function createIncentiveRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function buildIncentiveRow(commentScore: GithubCommentScore) {\n+ // Properly escape carriage returns for HTML rendering\n+ const formatting = stringify(commentScore.score?.formatting?.content).replace(/[\\n\\r]/g, \" \");\n+ return `\n+ \n+ \n+
\n+ ${commentScore.content.replace(/(.{64})..+/, \"$1…\")}\n+
\n+ \n+ \n+
\n+ \n+ ${Object.values(commentScore.score?.formatting?.content || {}).reduce((acc, curr) => {\n+ return acc.add(curr.score * curr.count);\n+ }, new Decimal(0))}\n+ \n+
${formatting}
\n+
\n+ \n+ ${commentScore.score?.relevance || \"-\"}\n+ ${commentScore.score?.reward || \"-\"}\n+ `;\n+ }\n+\n+ for (const issueComment of sorted.issues.comments) {\n+ content.push(buildIncentiveRow(issueComment));\n+ }\n+ for (const reviewComment of sorted.reviews) {\n+ content.push(buildIncentiveRow(reviewComment));\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ return `\n+
\n+ \n+ \n+

\n+ " }, { - "id": 1949021356, - "content": "Need to document a private key too", - "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949021356", - "type": "PULL_COLLABORATOR" + "id": 1575851470, + "content": "gotcha, I thought this html is for all users", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1575851470", + "type": "PULL_CONTRIBUTOR", + "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ function createIncentiveRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function buildIncentiveRow(commentScore: GithubCommentScore) {\n+ // Properly escape carriage returns for HTML rendering\n+ const formatting = stringify(commentScore.score?.formatting?.content).replace(/[\\n\\r]/g, \" \");\n+ return `\n+ \n+ \n+
\n+ ${commentScore.content.replace(/(.{64})..+/, \"$1…\")}\n+
\n+ \n+ \n+
\n+ \n+ ${Object.values(commentScore.score?.formatting?.content || {}).reduce((acc, curr) => {\n+ return acc.add(curr.score * curr.count);\n+ }, new Decimal(0))}\n+ \n+
${formatting}
\n+
\n+ \n+ ${commentScore.score?.relevance || \"-\"}\n+ ${commentScore.score?.reward || \"-\"}\n+ `;\n+ }\n+\n+ for (const issueComment of sorted.issues.comments) {\n+ content.push(buildIncentiveRow(issueComment));\n+ }\n+ for (const reviewComment of sorted.reviews) {\n+ content.push(buildIncentiveRow(reviewComment));\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ return `\n+
\n+ \n+ \n+

\n+ " }, { - "id": 1949196677, - "content": "I was editing this right now but was too slow to push.", - "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949196677", - "type": "PULL_COLLABORATOR" + "id": 1576482609, + "content": "I can see from the example that it works correctly but when reading the code I get confused\r\nhttps://github.com/ubiquibot/conversation-rewards/pull/12/files#diff-03f6b1f98f9f1df2651b65c46241c43e65d9544f7ea1de71e94255e757b3f2f0R108\r\nas I understand the if statement will be true if the comment is the first/opening comment of the issue or pull request so then it checks if it's issue then it will be TASK otherwise (if it's PR) it will be SPECIFICATION?", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1576482609", + "type": "PULL_CONTRIBUTOR", + "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000," }, { - "id": 1949196678, - "content": "I am quoting some code!\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n

[ 0.28 WXDAI ]

@gentlementlegen
Contributions Overview
View Contribution Count Reward
Issue Specification 1 0.1
Issue Comment 7 0.18
Conversation Incentives
Comment Formatting Relevance Reward
issue 2
0.2
p:\r\n  count: 2\r\n  score: 1\r\n
0.5 0.1
test
0.2
p:\r\n  count: 1\r\n  score: 1\r\n
- -
```hey```
0.4
p:\r\n  count: 1\r\n  score: 1\r\ncode:\r\n  count: 1\r\n  score: 1\r\n
- -
``` heyo ```
0.4
p:\r\n  count: 1\r\n  score: 1\r\ncode:\r\n  count: 1\r\n  score: 1\r\n
- -
gr
0.2
p:\r\n  count: 1\r\n  score: 1\r\n
- -
te
0.2
p:\r\n  count: 1\r\n  score: 1\r\n
- -
fwe
0.2
p:\r\n  count: 1\r\n  score: 1\r\n
- -
te
0.2
p:\r\n  count: 1\r\n  score: 1\r\n
0.9 0.18
\r\n
\r\n
\r\n[😂](https://emojipedia.org/face-with-tears-of-joy)\r\n- elem 1\r\n- elem 2", - "url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949196678", - "type": "PULL_COLLABORATOR" + "id": 1578040543, + "content": "Ok so we need it for precise floating point calculations, in that case BigInt is not applicable.", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1578040543", + "type": "PULL_CONTRIBUTOR", + "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))" + }, + { + "id": 1578050965, + "content": "why is it `ISSUER` which is meant for author of issue/review. wouldn't it make more sense to use `ASIGNEE`?\r\nisn't specification the first comment of the issue so how is it inside PR?", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1578050965", + "type": "PULL_CONTRIBUTOR", + "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000," + }, + { + "id": 1579556333, + "content": "this makes more sense!", + "url": "https://github.com/ubiquibot/conversation-rewards/pull/12#discussion_r1579556333", + "type": "PULL_CONTRIBUTOR", + "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000," } ] } diff --git a/tests/__mocks__/results/hidden-comment-purged.json b/tests/__mocks__/results/hidden-comment-purged.json new file mode 100644 index 00000000..61436992 --- /dev/null +++ b/tests/__mocks__/results/hidden-comment-purged.json @@ -0,0 +1,26 @@ +{ + "gentlementlegen": { + "comments": [ + { + "content": "Issue", + "id": 2524890317, + "type": "ISSUE_SPECIFICATION", + "url": "https://github.com/Meniole/conversation-rewards/issues/13" + } + ], + "total": 0, + "userId": 9807008 + }, + "ubiquity-ubiquibot": { + "comments": [ + { + "content": "Other comment.", + "id": 2349004935, + "type": "ISSUE_CONTRIBUTOR", + "url": "https://github.com/Meniole/conversation-rewards/issues/13#issuecomment-2349004935" + } + ], + "total": 0, + "userId": 163369652 + } +} diff --git a/tests/__mocks__/results/user-comment-results.json b/tests/__mocks__/results/user-comment-results.json index 6cf13331..94f0b56a 100644 --- a/tests/__mocks__/results/user-comment-results.json +++ b/tests/__mocks__/results/user-comment-results.json @@ -1,18 +1,18 @@ { - "molecula451": { - "total": 0, - "userId": 41552663 + "gentlementlegen": { + "userId": 9807008, + "total": 400, + "task": { + "reward": 400, + "multiplier": 1 + } }, "0x4007": { "total": 0, "userId": 4975670 }, - "gitcoindev": { - "total": 37.5, - "task": { - "reward": 37.5, - "multiplier": 1 - }, - "userId": 88761781 + "whilefoo": { + "total": 0, + "userId": 139262667 } } diff --git a/tests/__mocks__/results/valid-configuration.json b/tests/__mocks__/results/valid-configuration.json index 11adb783..ee7c98d3 100644 --- a/tests/__mocks__/results/valid-configuration.json +++ b/tests/__mocks__/results/valid-configuration.json @@ -11,33 +11,7 @@ "multipliers": [ { "relevance": 1, - "role": [ - "ISSUE_SPECIFICATION" - ] - }, - { - "relevance": 1, - "role": [ - "PULL_AUTHOR" - ] - }, - { - "relevance": 1, - "role": [ - "PULL_ASSIGNEE" - ] - }, - { - "relevance": 1, - "role": [ - "PULL_COLLABORATOR" - ] - }, - { - "relevance": 1, - "role": [ - "PULL_CONTRIBUTOR" - ] + "role": ["ISSUE_SPECIFICATION"] } ], "openAi": { @@ -78,9 +52,7 @@ "\\b\\W+\\b": 0.1 } }, - "role": [ - "ISSUE_SPECIFICATION" - ] + "role": ["ISSUE_SPECIFICATION"] }, { "multiplier": 1, @@ -111,9 +83,7 @@ "\\b\\w+\\b": 0.2 } }, - "role": [ - "ISSUE_AUTHOR" - ] + "role": ["ISSUE_AUTHOR"] }, { "multiplier": 1, @@ -144,9 +114,7 @@ "\\b\\w+\\b": 0.1 } }, - "role": [ - "ISSUE_ASSIGNEE" - ] + "role": ["ISSUE_ASSIGNEE"] }, { "multiplier": 1, @@ -177,9 +145,7 @@ "\\b\\w+\\b": 0.1 } }, - "role": [ - "ISSUE_COLLABORATOR" - ] + "role": ["ISSUE_COLLABORATOR"] }, { "multiplier": 0.25, @@ -210,9 +176,7 @@ "\\b\\w+\\b": 0.1 } }, - "role": [ - "ISSUE_CONTRIBUTOR" - ] + "role": ["ISSUE_CONTRIBUTOR"] }, { "multiplier": 0, @@ -243,9 +207,7 @@ "\\b\\w+\\b": 0 } }, - "role": [ - "PULL_SPECIFICATION" - ] + "role": ["PULL_SPECIFICATION"] }, { "multiplier": 2, @@ -276,9 +238,7 @@ "\\b\\w+\\b": 0.2 } }, - "role": [ - "PULL_AUTHOR" - ] + "role": ["PULL_AUTHOR"] }, { "multiplier": 1, @@ -309,9 +269,7 @@ "\\b\\w+\\b": 0.1 } }, - "role": [ - "PULL_ASSIGNEE" - ] + "role": ["PULL_ASSIGNEE"] }, { "multiplier": 1, @@ -342,9 +300,7 @@ "\\b\\w+\\b": 0.1 } }, - "role": [ - "PULL_COLLABORATOR" - ] + "role": ["PULL_COLLABORATOR"] }, { "multiplier": 0.25, @@ -375,9 +331,7 @@ "\\b\\w+\\b": 0.1 } }, - "role": [ - "PULL_CONTRIBUTOR" - ] + "role": ["PULL_CONTRIBUTOR"] } ], "wordCountExponent": 0.85 diff --git a/tests/__mocks__/routes/issue-13-comments-get.json b/tests/__mocks__/routes/issue-13-comments-get.json new file mode 100644 index 00000000..19e682cb --- /dev/null +++ b/tests/__mocks__/routes/issue-13-comments-get.json @@ -0,0 +1,283 @@ +[ + { + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/comments/2349000511", + "html_url": "https://github.com/Meniole/conversation-rewards/issues/13#issuecomment-2349000511", + "issue_url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/13", + "id": 2349000511, + "node_id": "IC_kwDOMjwkd86MAuc_", + "user": { + "login": "ubiquity-ubiquibot", + "id": 163369652, + "node_id": "U_kgDOCbzStA", + "avatar_url": "https://avatars.githubusercontent.com/u/163369652?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ubiquity-ubiquibot", + "html_url": "https://github.com/ubiquity-ubiquibot", + "followers_url": "https://api.github.com/users/ubiquity-ubiquibot/followers", + "following_url": "https://api.github.com/users/ubiquity-ubiquibot/following{/other_user}", + "gists_url": "https://api.github.com/users/ubiquity-ubiquibot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ubiquity-ubiquibot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ubiquity-ubiquibot/subscriptions", + "organizations_url": "https://api.github.com/users/ubiquity-ubiquibot/orgs", + "repos_url": "https://api.github.com/users/ubiquity-ubiquibot/repos", + "events_url": "https://api.github.com/users/ubiquity-ubiquibot/events{/privacy}", + "received_events_url": "https://api.github.com/users/ubiquity-ubiquibot/received_events", + "type": "User", + "site_admin": false + }, + "created_at": "2024-09-13T13:44:35Z", + "updated_at": "2024-09-13T13:44:58Z", + "author_association": "NONE", + "body": "Hide my comment!", + "isMinimized": true, + "reactions": { + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/comments/2349000511/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "performed_via_github_app": null + }, + { + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/comments/2349004935", + "html_url": "https://github.com/Meniole/conversation-rewards/issues/13#issuecomment-2349004935", + "issue_url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/13", + "id": 2349004935, + "node_id": "IC_kwDOMjwkd86MAviH", + "user": { + "login": "ubiquity-ubiquibot", + "id": 163369652, + "node_id": "U_kgDOCbzStA", + "avatar_url": "https://avatars.githubusercontent.com/u/163369652?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ubiquity-ubiquibot", + "html_url": "https://github.com/ubiquity-ubiquibot", + "followers_url": "https://api.github.com/users/ubiquity-ubiquibot/followers", + "following_url": "https://api.github.com/users/ubiquity-ubiquibot/following{/other_user}", + "gists_url": "https://api.github.com/users/ubiquity-ubiquibot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ubiquity-ubiquibot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ubiquity-ubiquibot/subscriptions", + "organizations_url": "https://api.github.com/users/ubiquity-ubiquibot/orgs", + "repos_url": "https://api.github.com/users/ubiquity-ubiquibot/repos", + "events_url": "https://api.github.com/users/ubiquity-ubiquibot/events{/privacy}", + "received_events_url": "https://api.github.com/users/ubiquity-ubiquibot/received_events", + "type": "User", + "site_admin": false + }, + "created_at": "2024-09-13T13:46:29Z", + "updated_at": "2024-09-13T13:46:29Z", + "author_association": "NONE", + "body": "Other comment.", + "reactions": { + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/comments/2349004935/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "performed_via_github_app": null + }, + { + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/comments/2349298501", + "html_url": "https://github.com/Meniole/conversation-rewards/issues/13#issuecomment-2349298501", + "issue_url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/13", + "id": 2349298501, + "node_id": "IC_kwDOMjwkd86MB3NF", + "user": { + "login": "ubiquity-os-testing[bot]", + "id": 163226901, + "node_id": "BOT_kgDOCbqlFQ", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D", + "html_url": "https://github.com/apps/ubiquity-os-testing", + "followers_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/followers", + "following_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/following{/other_user}", + "gists_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/subscriptions", + "organizations_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/orgs", + "repos_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/repos", + "events_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/events{/privacy}", + "received_events_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/received_events", + "type": "Bot", + "site_admin": false + }, + "created_at": "2024-09-13T16:06:36Z", + "updated_at": "2024-09-13T16:07:08Z", + "author_association": "NONE", + "body": "

[ 0.015 WXDAI ]

@ubiquity-ubiquibot
Contributions Overview
View Contribution Count Reward
Issue Comment 1 0.015
Conversation Incentives
Comment Formatting Relevance Reward
Other comment.
0.05
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 2
        multiplier: 0.1
    score: 1
multiplier: 0.25
0.3 0.015

[ 0.2 WXDAI ]

@gentlementlegen
Contributions Overview
View Contribution Count Reward
Issue Specification 1 0.2
Conversation Incentives
Comment Formatting Relevance Reward
Issue
0.2
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 1
        multiplier: 0.1
      \\b\\W+\\b:
        count: 1
        multiplier: 0.1
    score: 1
multiplier: 1
1 0.2
\n", + "reactions": { + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/comments/2349298501/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "performed_via_github_app": { + "id": 854943, + "client_id": "Iv1.c40b23828df3fafd", + "slug": "ubiquity-os-testing", + "node_id": "A_kwDOAJWkoM4ADQuf", + "owner": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "name": "ubiquity-os-testing", + "description": "TESTING VERSION\r\nEnables Ubiquity DevPool automation in your repository.", + "external_url": "https://github.com/ubiquity/ubiquibot-kernel.git", + "html_url": "https://github.com/apps/ubiquity-os-testing", + "created_at": "2024-03-13T03:08:55Z", + "updated_at": "2024-08-18T08:06:46Z", + "permissions": { + "actions": "write", + "contents": "write", + "issues": "write", + "members": "read", + "metadata": "read", + "organization_hooks": "write", + "pull_requests": "write", + "repository_hooks": "write", + "workflows": "write" + }, + "events": [ + "issues", + "issue_comment", + "label", + "pull_request", + "pull_request_review", + "pull_request_review_comment", + "push", + "repository_dispatch" + ] + } + }, + { + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/comments/2350076757", + "html_url": "https://github.com/Meniole/conversation-rewards/issues/13#issuecomment-2350076757", + "issue_url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/13", + "id": 2350076757, + "node_id": "IC_kwDOMjwkd86ME1NV", + "user": { + "login": "ubiquity-os-testing[bot]", + "id": 163226901, + "node_id": "BOT_kgDOCbqlFQ", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D", + "html_url": "https://github.com/apps/ubiquity-os-testing", + "followers_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/followers", + "following_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/following{/other_user}", + "gists_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/subscriptions", + "organizations_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/orgs", + "repos_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/repos", + "events_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/events{/privacy}", + "received_events_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/received_events", + "type": "Bot", + "site_admin": false + }, + "created_at": "2024-09-13T20:09:25Z", + "updated_at": "2024-09-13T20:09:55Z", + "author_association": "NONE", + "body": "

[ 0.015 WXDAI ]

@ubiquity-ubiquibot
Contributions Overview
View Contribution Count Reward
Issue Comment 1 0.015
Conversation Incentives
Comment Formatting Relevance Reward
Other comment.
0.05
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 2
        multiplier: 0.1
    score: 1
multiplier: 0.25
0.3 0.015

[ 0.2 WXDAI ]

@gentlementlegen
Contributions Overview
View Contribution Count Reward
Issue Specification 1 0.2
Conversation Incentives
Comment Formatting Relevance Reward
Issue
0.2
content:
  p:
    symbols:
      \\b\\w+\\b:
        count: 1
        multiplier: 0.1
      \\b\\W+\\b:
        count: 1
        multiplier: 0.1
    score: 1
multiplier: 1
1 0.2
\n", + "reactions": { + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/comments/2350076757/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "performed_via_github_app": { + "id": 854943, + "client_id": "Iv1.c40b23828df3fafd", + "slug": "ubiquity-os-testing", + "node_id": "A_kwDOAJWkoM4ADQuf", + "owner": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "name": "ubiquity-os-testing", + "description": "TESTING VERSION\r\nEnables Ubiquity DevPool automation in your repository.", + "external_url": "https://github.com/ubiquity/ubiquibot-kernel.git", + "html_url": "https://github.com/apps/ubiquity-os-testing", + "created_at": "2024-03-13T03:08:55Z", + "updated_at": "2024-08-18T08:06:46Z", + "permissions": { + "actions": "write", + "contents": "write", + "issues": "write", + "members": "read", + "metadata": "read", + "organization_hooks": "write", + "pull_requests": "write", + "repository_hooks": "write", + "workflows": "write" + }, + "events": [ + "issues", + "issue_comment", + "label", + "pull_request", + "pull_request_review", + "pull_request_review_comment", + "push", + "repository_dispatch" + ] + } + } +] diff --git a/tests/__mocks__/routes/issue-13-events-get.json b/tests/__mocks__/routes/issue-13-events-get.json new file mode 100644 index 00000000..bbdf9cad --- /dev/null +++ b/tests/__mocks__/routes/issue-13-events-get.json @@ -0,0 +1,925 @@ +[ + { + "id": 14249263469, + "node_id": "LE_lADOMjwkd86WfsTNzwAAAANRUoFt", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14249263469", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "labeled", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T13:44:01Z", + "label": { + "name": "Time: <1 Hour", + "color": "ededed" + }, + "performed_via_github_app": null + }, + { + "id": 14249263479, + "node_id": "LE_lADOMjwkd86WfsTNzwAAAANRUoF3", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14249263479", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "labeled", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T13:44:01Z", + "label": { + "name": "Priority: 1 (Normal)", + "color": "ededed" + }, + "performed_via_github_app": null + }, + { + "id": 14249264251, + "node_id": "LE_lADOMjwkd86WfsTNzwAAAANRUoR7", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14249264251", + "actor": { + "login": "ubiquity-os-testing[bot]", + "id": 163226901, + "node_id": "BOT_kgDOCbqlFQ", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D", + "html_url": "https://github.com/apps/ubiquity-os-testing", + "followers_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/followers", + "following_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/following{/other_user}", + "gists_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/subscriptions", + "organizations_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/orgs", + "repos_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/repos", + "events_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/events{/privacy}", + "received_events_url": "https://api.github.com/users/ubiquity-os-testing%5Bbot%5D/received_events", + "type": "Bot", + "site_admin": false + }, + "event": "labeled", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T13:44:04Z", + "label": { + "name": "Price: 12.5 USD", + "color": "ededed" + }, + "performed_via_github_app": null + }, + { + "id": 14250494095, + "node_id": "CE_lADOMjwkd86WfsTNzwAAAANRZUiP", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250494095", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "closed", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:12:31Z", + "state_reason": null, + "performed_via_github_app": null + }, + { + "id": 14250508612, + "node_id": "MEE_lADOMjwkd86WfsTNzwAAAANRZYFE", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250508612", + "actor": { + "login": "ubiquity-ubiquibot", + "id": 163369652, + "node_id": "U_kgDOCbzStA", + "avatar_url": "https://avatars.githubusercontent.com/u/163369652?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ubiquity-ubiquibot", + "html_url": "https://github.com/ubiquity-ubiquibot", + "followers_url": "https://api.github.com/users/ubiquity-ubiquibot/followers", + "following_url": "https://api.github.com/users/ubiquity-ubiquibot/following{/other_user}", + "gists_url": "https://api.github.com/users/ubiquity-ubiquibot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ubiquity-ubiquibot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ubiquity-ubiquibot/subscriptions", + "organizations_url": "https://api.github.com/users/ubiquity-ubiquibot/orgs", + "repos_url": "https://api.github.com/users/ubiquity-ubiquibot/repos", + "events_url": "https://api.github.com/users/ubiquity-ubiquibot/events{/privacy}", + "received_events_url": "https://api.github.com/users/ubiquity-ubiquibot/received_events", + "type": "User", + "site_admin": false + }, + "event": "mentioned", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:13:39Z", + "performed_via_github_app": null + }, + { + "id": 14250508622, + "node_id": "SE_lADOMjwkd86WfsTNzwAAAANRZYFO", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250508622", + "actor": { + "login": "ubiquity-ubiquibot", + "id": 163369652, + "node_id": "U_kgDOCbzStA", + "avatar_url": "https://avatars.githubusercontent.com/u/163369652?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ubiquity-ubiquibot", + "html_url": "https://github.com/ubiquity-ubiquibot", + "followers_url": "https://api.github.com/users/ubiquity-ubiquibot/followers", + "following_url": "https://api.github.com/users/ubiquity-ubiquibot/following{/other_user}", + "gists_url": "https://api.github.com/users/ubiquity-ubiquibot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ubiquity-ubiquibot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ubiquity-ubiquibot/subscriptions", + "organizations_url": "https://api.github.com/users/ubiquity-ubiquibot/orgs", + "repos_url": "https://api.github.com/users/ubiquity-ubiquibot/repos", + "events_url": "https://api.github.com/users/ubiquity-ubiquibot/events{/privacy}", + "received_events_url": "https://api.github.com/users/ubiquity-ubiquibot/received_events", + "type": "User", + "site_admin": false + }, + "event": "subscribed", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:13:39Z", + "performed_via_github_app": null + }, + { + "id": 14250508640, + "node_id": "MEE_lADOMjwkd86WfsTNzwAAAANRZYFg", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250508640", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "mentioned", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:13:39Z", + "performed_via_github_app": null + }, + { + "id": 14250508651, + "node_id": "SE_lADOMjwkd86WfsTNzwAAAANRZYFr", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250508651", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "subscribed", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:13:39Z", + "performed_via_github_app": null + }, + { + "id": 14250566442, + "node_id": "REE_lADOMjwkd86WfsTNzwAAAANRZmMq", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250566442", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "reopened", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:18:12Z", + "state_reason": "reopened", + "performed_via_github_app": null + }, + { + "id": 14250567225, + "node_id": "CE_lADOMjwkd86WfsTNzwAAAANRZmY5", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250567225", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "closed", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:18:15Z", + "state_reason": null, + "performed_via_github_app": null + }, + { + "id": 14250581230, + "node_id": "MEE_lADOMjwkd86WfsTNzwAAAANRZpzu", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250581230", + "actor": { + "login": "ubiquity-ubiquibot", + "id": 163369652, + "node_id": "U_kgDOCbzStA", + "avatar_url": "https://avatars.githubusercontent.com/u/163369652?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ubiquity-ubiquibot", + "html_url": "https://github.com/ubiquity-ubiquibot", + "followers_url": "https://api.github.com/users/ubiquity-ubiquibot/followers", + "following_url": "https://api.github.com/users/ubiquity-ubiquibot/following{/other_user}", + "gists_url": "https://api.github.com/users/ubiquity-ubiquibot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ubiquity-ubiquibot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ubiquity-ubiquibot/subscriptions", + "organizations_url": "https://api.github.com/users/ubiquity-ubiquibot/orgs", + "repos_url": "https://api.github.com/users/ubiquity-ubiquibot/repos", + "events_url": "https://api.github.com/users/ubiquity-ubiquibot/events{/privacy}", + "received_events_url": "https://api.github.com/users/ubiquity-ubiquibot/received_events", + "type": "User", + "site_admin": false + }, + "event": "mentioned", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:19:21Z", + "performed_via_github_app": null + }, + { + "id": 14250581242, + "node_id": "SE_lADOMjwkd86WfsTNzwAAAANRZpz6", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250581242", + "actor": { + "login": "ubiquity-ubiquibot", + "id": 163369652, + "node_id": "U_kgDOCbzStA", + "avatar_url": "https://avatars.githubusercontent.com/u/163369652?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ubiquity-ubiquibot", + "html_url": "https://github.com/ubiquity-ubiquibot", + "followers_url": "https://api.github.com/users/ubiquity-ubiquibot/followers", + "following_url": "https://api.github.com/users/ubiquity-ubiquibot/following{/other_user}", + "gists_url": "https://api.github.com/users/ubiquity-ubiquibot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ubiquity-ubiquibot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ubiquity-ubiquibot/subscriptions", + "organizations_url": "https://api.github.com/users/ubiquity-ubiquibot/orgs", + "repos_url": "https://api.github.com/users/ubiquity-ubiquibot/repos", + "events_url": "https://api.github.com/users/ubiquity-ubiquibot/events{/privacy}", + "received_events_url": "https://api.github.com/users/ubiquity-ubiquibot/received_events", + "type": "User", + "site_admin": false + }, + "event": "subscribed", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:19:21Z", + "performed_via_github_app": null + }, + { + "id": 14250581255, + "node_id": "MEE_lADOMjwkd86WfsTNzwAAAANRZp0H", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250581255", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "mentioned", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:19:21Z", + "performed_via_github_app": null + }, + { + "id": 14250581265, + "node_id": "SE_lADOMjwkd86WfsTNzwAAAANRZp0R", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250581265", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "subscribed", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:19:22Z", + "performed_via_github_app": null + }, + { + "id": 14250629566, + "node_id": "REE_lADOMjwkd86WfsTNzwAAAANRZ1m-", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250629566", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "reopened", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:23:17Z", + "state_reason": "reopened", + "performed_via_github_app": null + }, + { + "id": 14250633219, + "node_id": "CE_lADOMjwkd86WfsTNzwAAAANRZ2gD", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250633219", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "closed", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:23:36Z", + "state_reason": null, + "performed_via_github_app": null + }, + { + "id": 14250646748, + "node_id": "MEE_lADOMjwkd86WfsTNzwAAAANRZ5zc", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250646748", + "actor": { + "login": "ubiquity-ubiquibot", + "id": 163369652, + "node_id": "U_kgDOCbzStA", + "avatar_url": "https://avatars.githubusercontent.com/u/163369652?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ubiquity-ubiquibot", + "html_url": "https://github.com/ubiquity-ubiquibot", + "followers_url": "https://api.github.com/users/ubiquity-ubiquibot/followers", + "following_url": "https://api.github.com/users/ubiquity-ubiquibot/following{/other_user}", + "gists_url": "https://api.github.com/users/ubiquity-ubiquibot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ubiquity-ubiquibot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ubiquity-ubiquibot/subscriptions", + "organizations_url": "https://api.github.com/users/ubiquity-ubiquibot/orgs", + "repos_url": "https://api.github.com/users/ubiquity-ubiquibot/repos", + "events_url": "https://api.github.com/users/ubiquity-ubiquibot/events{/privacy}", + "received_events_url": "https://api.github.com/users/ubiquity-ubiquibot/received_events", + "type": "User", + "site_admin": false + }, + "event": "mentioned", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:24:43Z", + "performed_via_github_app": null + }, + { + "id": 14250646760, + "node_id": "SE_lADOMjwkd86WfsTNzwAAAANRZ5zo", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250646760", + "actor": { + "login": "ubiquity-ubiquibot", + "id": 163369652, + "node_id": "U_kgDOCbzStA", + "avatar_url": "https://avatars.githubusercontent.com/u/163369652?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ubiquity-ubiquibot", + "html_url": "https://github.com/ubiquity-ubiquibot", + "followers_url": "https://api.github.com/users/ubiquity-ubiquibot/followers", + "following_url": "https://api.github.com/users/ubiquity-ubiquibot/following{/other_user}", + "gists_url": "https://api.github.com/users/ubiquity-ubiquibot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ubiquity-ubiquibot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ubiquity-ubiquibot/subscriptions", + "organizations_url": "https://api.github.com/users/ubiquity-ubiquibot/orgs", + "repos_url": "https://api.github.com/users/ubiquity-ubiquibot/repos", + "events_url": "https://api.github.com/users/ubiquity-ubiquibot/events{/privacy}", + "received_events_url": "https://api.github.com/users/ubiquity-ubiquibot/received_events", + "type": "User", + "site_admin": false + }, + "event": "subscribed", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:24:43Z", + "performed_via_github_app": null + }, + { + "id": 14250646784, + "node_id": "MEE_lADOMjwkd86WfsTNzwAAAANRZ50A", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250646784", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "mentioned", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:24:43Z", + "performed_via_github_app": null + }, + { + "id": 14250646795, + "node_id": "SE_lADOMjwkd86WfsTNzwAAAANRZ50L", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250646795", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "subscribed", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:24:43Z", + "performed_via_github_app": null + }, + { + "id": 14250918311, + "node_id": "REE_lADOMjwkd86WfsTNzwAAAANRa8Gn", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250918311", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "reopened", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:48:10Z", + "state_reason": "reopened", + "performed_via_github_app": null + }, + { + "id": 14250919054, + "node_id": "CE_lADOMjwkd86WfsTNzwAAAANRa8SO", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250919054", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "closed", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:48:14Z", + "state_reason": null, + "performed_via_github_app": null + }, + { + "id": 14250931718, + "node_id": "MEE_lADOMjwkd86WfsTNzwAAAANRa_YG", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250931718", + "actor": { + "login": "ubiquity-ubiquibot", + "id": 163369652, + "node_id": "U_kgDOCbzStA", + "avatar_url": "https://avatars.githubusercontent.com/u/163369652?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ubiquity-ubiquibot", + "html_url": "https://github.com/ubiquity-ubiquibot", + "followers_url": "https://api.github.com/users/ubiquity-ubiquibot/followers", + "following_url": "https://api.github.com/users/ubiquity-ubiquibot/following{/other_user}", + "gists_url": "https://api.github.com/users/ubiquity-ubiquibot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ubiquity-ubiquibot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ubiquity-ubiquibot/subscriptions", + "organizations_url": "https://api.github.com/users/ubiquity-ubiquibot/orgs", + "repos_url": "https://api.github.com/users/ubiquity-ubiquibot/repos", + "events_url": "https://api.github.com/users/ubiquity-ubiquibot/events{/privacy}", + "received_events_url": "https://api.github.com/users/ubiquity-ubiquibot/received_events", + "type": "User", + "site_admin": false + }, + "event": "mentioned", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:49:20Z", + "performed_via_github_app": null + }, + { + "id": 14250931726, + "node_id": "SE_lADOMjwkd86WfsTNzwAAAANRa_YO", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250931726", + "actor": { + "login": "ubiquity-ubiquibot", + "id": 163369652, + "node_id": "U_kgDOCbzStA", + "avatar_url": "https://avatars.githubusercontent.com/u/163369652?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ubiquity-ubiquibot", + "html_url": "https://github.com/ubiquity-ubiquibot", + "followers_url": "https://api.github.com/users/ubiquity-ubiquibot/followers", + "following_url": "https://api.github.com/users/ubiquity-ubiquibot/following{/other_user}", + "gists_url": "https://api.github.com/users/ubiquity-ubiquibot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ubiquity-ubiquibot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ubiquity-ubiquibot/subscriptions", + "organizations_url": "https://api.github.com/users/ubiquity-ubiquibot/orgs", + "repos_url": "https://api.github.com/users/ubiquity-ubiquibot/repos", + "events_url": "https://api.github.com/users/ubiquity-ubiquibot/events{/privacy}", + "received_events_url": "https://api.github.com/users/ubiquity-ubiquibot/received_events", + "type": "User", + "site_admin": false + }, + "event": "subscribed", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:49:20Z", + "performed_via_github_app": null + }, + { + "id": 14250931739, + "node_id": "MEE_lADOMjwkd86WfsTNzwAAAANRa_Yb", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250931739", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "mentioned", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:49:20Z", + "performed_via_github_app": null + }, + { + "id": 14250931747, + "node_id": "SE_lADOMjwkd86WfsTNzwAAAANRa_Yj", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250931747", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "subscribed", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:49:20Z", + "performed_via_github_app": null + }, + { + "id": 14250957481, + "node_id": "REE_lADOMjwkd86WfsTNzwAAAANRbFqp", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250957481", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "reopened", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:51:33Z", + "state_reason": "reopened", + "performed_via_github_app": null + }, + { + "id": 14250957838, + "node_id": "CE_lADOMjwkd86WfsTNzwAAAANRbFwO", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250957838", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "closed", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:51:35Z", + "state_reason": null, + "performed_via_github_app": null + }, + { + "id": 14250987173, + "node_id": "REE_lADOMjwkd86WfsTNzwAAAANRbM6l", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250987173", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "reopened", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:54:13Z", + "state_reason": "reopened", + "performed_via_github_app": null + }, + { + "id": 14250987647, + "node_id": "CE_lADOMjwkd86WfsTNzwAAAANRbNB_", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/events/14250987647", + "actor": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "event": "closed", + "commit_id": null, + "commit_url": null, + "created_at": "2024-09-13T15:54:16Z", + "state_reason": null, + "performed_via_github_app": null + } +] diff --git a/tests/__mocks__/routes/issue-13-get.json b/tests/__mocks__/routes/issue-13-get.json new file mode 100644 index 00000000..2ffbbe06 --- /dev/null +++ b/tests/__mocks__/routes/issue-13-get.json @@ -0,0 +1,110 @@ +{ + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/13", + "repository_url": "https://api.github.com/repos/Meniole/conversation-rewards", + "labels_url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/13/labels{/name}", + "comments_url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/13/comments", + "events_url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/13/events", + "html_url": "https://github.com/Meniole/conversation-rewards/issues/13", + "id": 2524890317, + "node_id": "I_kwDOMjwkd86WfsTN", + "number": 13, + "title": "Issue", + "user": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "labels": [ + { + "id": 7332964436, + "node_id": "LA_kwDOMjwkd88AAAABtRQoVA", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/labels/Price:%2012.5%20USD", + "name": "Price: 12.5 USD", + "color": "ededed", + "default": false, + "description": null + }, + { + "id": 7332964465, + "node_id": "LA_kwDOMjwkd88AAAABtRQocQ", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/labels/Time:%20%3C1%20Hour", + "name": "Time: <1 Hour", + "color": "ededed", + "default": false, + "description": null + }, + { + "id": 7332964478, + "node_id": "LA_kwDOMjwkd88AAAABtRQofg", + "url": "https://api.github.com/repos/Meniole/conversation-rewards/labels/Priority:%201%20(Normal)", + "name": "Priority: 1 (Normal)", + "color": "ededed", + "default": false, + "description": null + } + ], + "state": "closed", + "locked": false, + "assignee": null, + "assignees": [ + + ], + "milestone": null, + "comments": 4, + "created_at": "2024-09-13T13:44:01Z", + "updated_at": "2024-09-13T20:09:55Z", + "closed_at": "2024-09-13T20:09:10Z", + "author_association": "NONE", + "active_lock_reason": null, + "body": "Issue", + "closed_by": { + "login": "gentlementlegen", + "id": 9807008, + "node_id": "MDQ6VXNlcjk4MDcwMDg=", + "avatar_url": "https://avatars.githubusercontent.com/u/9807008?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlementlegen", + "html_url": "https://github.com/gentlementlegen", + "followers_url": "https://api.github.com/users/gentlementlegen/followers", + "following_url": "https://api.github.com/users/gentlementlegen/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlementlegen/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlementlegen/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlementlegen/subscriptions", + "organizations_url": "https://api.github.com/users/gentlementlegen/orgs", + "repos_url": "https://api.github.com/users/gentlementlegen/repos", + "events_url": "https://api.github.com/users/gentlementlegen/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlementlegen/received_events", + "type": "User", + "site_admin": false + }, + "reactions": { + "url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/13/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "timeline_url": "https://api.github.com/repos/Meniole/conversation-rewards/issues/13/timeline", + "performed_via_github_app": null, + "state_reason": "completed" +} diff --git a/tests/__mocks__/routes/issue-5-conversation-rewards/issue-5-comments-get.json b/tests/__mocks__/routes/issue-5-conversation-rewards/issue-5-comments-get.json new file mode 100644 index 00000000..c5d445f6 --- /dev/null +++ b/tests/__mocks__/routes/issue-5-conversation-rewards/issue-5-comments-get.json @@ -0,0 +1,1648 @@ +[ + { + "url": "https://api.github.com/repos/ubiquibot/conversation-rewards/issues/comments/2030164289", + "html_url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2030164289", + "issue_url": "https://api.github.com/repos/ubiquibot/conversation-rewards/issues/5", + "id": 2030164289, + "node_id": "IC_kwDOLUK0B855AdlB", + "user": { + "login": "0x4007", + "id": 4975670, + "node_id": "MDQ6VXNlcjQ5NzU2NzA=", + "avatar_url": "https://avatars.githubusercontent.com/u/4975670?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/0x4007", + "html_url": "https://github.com/0x4007", + "followers_url": "https://api.github.com/users/0x4007/followers", + "following_url": "https://api.github.com/users/0x4007/following{/other_user}", + "gists_url": "https://api.github.com/users/0x4007/gists{/gist_id}", + "starred_url": "https://api.github.com/users/0x4007/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/0x4007/subscriptions", + "organizations_url": "https://api.github.com/users/0x4007/orgs", + "repos_url": "https://api.github.com/users/0x4007/repos", + "events_url": "https://api.github.com/users/0x4007/events{/privacy}", + "received_events_url": "https://api.github.com/users/0x4007/received_events", + "type": "User", + "site_admin": false + }, + "created_at": "2024-04-01T17:02:54Z", + "updated_at": "2024-04-01T17:04:15Z", + "author_association": "MEMBER", + "body": "@whilefoo rfc on how we can deal with comment outputs. Perhaps we can have a standard recognized property on the output interface? Then the kernel can decide whether to pass it around or something. \r\n\r\n```ts\r\ninterface PluginOutput {\r\n comment: string; // html comment\r\n rewards: Rewards; // { \"whilefoo\": \"500\", \"token\": \"0x0\" } etc\r\n}\r\n```", + "reactions": { + "url": "https://api.github.com/repos/ubiquibot/conversation-rewards/issues/comments/2030164289/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "performed_via_github_app": null + }, + { + "url": "https://api.github.com/repos/ubiquibot/conversation-rewards/issues/comments/2030221788", + "html_url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2030221788", + "issue_url": "https://api.github.com/repos/ubiquibot/conversation-rewards/issues/5", + "id": 2030221788, + "node_id": "IC_kwDOLUK0B855Arnc", + "user": { + "login": "jordan-ae", + "id": 33989423, + "node_id": "MDQ6VXNlcjMzOTg5NDIz", + "avatar_url": "https://avatars.githubusercontent.com/u/33989423?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jordan-ae", + "html_url": "https://github.com/jordan-ae", + "followers_url": "https://api.github.com/users/jordan-ae/followers", + "following_url": "https://api.github.com/users/jordan-ae/following{/other_user}", + "gists_url": "https://api.github.com/users/jordan-ae/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jordan-ae/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jordan-ae/subscriptions", + "organizations_url": "https://api.github.com/users/jordan-ae/orgs", + "repos_url": "https://api.github.com/users/jordan-ae/repos", + "events_url": "https://api.github.com/users/jordan-ae/events{/privacy}", + "received_events_url": "https://api.github.com/users/jordan-ae/received_events", + "type": "User", + "site_admin": false + }, + "created_at": "2024-04-01T17:36:50Z", + "updated_at": "2024-04-01T17:36:50Z", + "author_association": "NONE", + "body": "/start", + "reactions": { + "url": "https://api.github.com/repos/ubiquibot/conversation-rewards/issues/comments/2030221788/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "performed_via_github_app": null + }, + { + "url": "https://api.github.com/repos/ubiquibot/conversation-rewards/issues/comments/2030221968", + "html_url": "https://github.com/ubiquibot/conversation-rewards/issues/5#issuecomment-2030221968", + "issue_url": "https://api.github.com/repos/ubiquibot/conversation-rewards/issues/5", + "id": 2030221968, + "node_id": "IC_kwDOLUK0B855ArqQ", + "user": { + "login": "ubiquibot[bot]", + "id": 113181824, + "node_id": "BOT_kgDOBr8EgA", + "avatar_url": "https://avatars.githubusercontent.com/in/236521?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ubiquibot%5Bbot%5D", + "html_url": "https://github.com/apps/ubiquibot", + "followers_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/followers", + "following_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/following{/other_user}", + "gists_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/subscriptions", + "organizations_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/orgs", + "repos_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/repos", + "events_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/events{/privacy}", + "received_events_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/received_events", + "type": "Bot", + "site_admin": false + }, + "created_at": "2024-04-01T17:36:59Z", + "updated_at": "2024-04-01T17:36:59Z", + "author_association": "NONE", + "body": "\n\n\n\n\n\n\n\n\n\n\n\n
DeadlineMon, Apr 1, 7:36 PM UTC
Registered Wallet0x2F05fD58023B0a95d1866aa0A3b672cEf05945c5
\n

Tips:
\n