Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Serialization of HTML Comments #18

Closed
0x4007 opened this issue Feb 13, 2024 · 33 comments · Fixed by #19
Closed

Serialization of HTML Comments #18

0x4007 opened this issue Feb 13, 2024 · 33 comments · Fixed by #19

Comments

@0x4007
Copy link
Member

0x4007 commented Feb 13, 2024

HTML Comment Serialization

Whenever the bot needs to repost a comment, its serialization of the html and markdown comment syntax is unhandled, leading to situations like this comment.)

Ensure that the bot can properly handle these embedded metadata comments in the conversation rewards table (it displays a preview of every comment body)

Solution

Ideally we can use a library or some built in methods but in case those are not available.

  • Be sure to test specifically for HTML comment: <!-- -->:
  • test specifically for embedded markdown
  • test specifically for embedded JSON objects
  • test specifically for embedded code

ChatGPT:

HTML Entity Encoding for Special Characters: Continue with HTML entity encoding for characters that may interfere > with HTML rendering. This step ensures that your embedded content doesn't get interpreted as HTML.

Markdown Escaping: Escape markdown-specific syntax by prefixing special characters with backslashes (). This > includes characters like *, _, #, etc., which markdown interprets for formatting.

function encodeHtmlEntities(str: string): string {
  return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
}

function escapeMarkdown(content: string): string {
  // Escapes markdown special characters
  return content.replace(/([*_`#\[\]()<>])/g, '\\$1');
}

function embedJsonInMarkdown(json: any): string {
  // Converts JSON to string and escapes for markdown
  const jsonString = JSON.stringify(json, null, 2);
  const escapedJson = escapeMarkdown(jsonString);
  return "```\n" + escapedJson + "\n```";
}

Further Examples

Check out gitcoindev's conversation incentives: ubiquity/ubiquibot#665 (comment)

Original Specification

When generating the payment permits, the bot includes a table for "conversation rewards" with details around how the conversation rewards were calculated.

However, I quoted a bot comment, which included the JSON metadata that the bot embeds inside of an HTML comment <!-- {} --> inside of its GitHub comment.

When generating the conversation rewards table, the rendering broke because it doesn't know how to deal with HTML comments. It dumped the full JSON object into the comment incentives calculation table, which looked very wrong.

It should filter any HTML that is commented out so that it does not break the "comment incentives" table.

Unfortunately I deleted the offending comment from the back-linked conversation, but I hope that this description makes sense.

@FernandVEYRIER Looks like there is some type of edge case with the bot failing to display the conversation incentives by trying to parse My quote comment with "evaluating results"'s embedded metadata (we use HTML commenting to embed a JSON object of metadata for bot comments to inter operate with other bot plugins (standardized way for information to be shared about bot comments)

I'll have to regenerate and try again after deleting the offending comments.

Originally posted by @pavlovcik in ubiquity/devpool-directory-bounties#14 (comment)

Copy link

ubiquibot bot commented Feb 13, 2024

! action has an uncaught error

@0x4007
Copy link
Member Author

0x4007 commented Feb 15, 2024

! action has an uncaught error

For context, this comment has the following metadata embedded, which only repository admins can technically see.

{
  "handlerType": {
    "type": "post",
    "actions": [
      null
    ]
  },
  "activeHandler": "onLabelChangeSetPricing",
  "error": {
    "name": "HttpError",
    "status": 422,
    "response": {
      "url": "https://api.github.com/repos/ubiquibot/comment-incentives/labels",
      "status": 422,
      "headers": {
        "access-control-allow-origin": "*",
        "access-control-expose-headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
        "content-length": "182",
        "content-security-policy": "default-src 'none'",
        "content-type": "application/json; charset=utf-8",
        "date": "Tue, 13 Feb 2024 13:31:03 GMT",
        "referrer-policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
        "server": "GitHub.com",
        "strict-transport-security": "max-age=31536000; includeSubdomains; preload",
        "vary": "Accept-Encoding, Accept, X-Requested-With",
        "x-accepted-github-permissions": "issues=write; pull_requests=write",
        "x-content-type-options": "nosniff",
        "x-frame-options": "deny",
        "x-github-api-version-selected": "2022-11-28",
        "x-github-media-type": "github.v3; format=json",
        "x-github-request-id": "84C4:3D93:19D0499:34192E1:65CB6F17",
        "x-ratelimit-limit": "5000",
        "x-ratelimit-remaining": "4818",
        "x-ratelimit-reset": "1707831648",
        "x-ratelimit-resource": "core",
        "x-ratelimit-used": "182",
        "x-xss-protection": "0"
      },
      "data": {
        "message": "Validation Failed",
        "errors": [
          {
            "resource": "Label",
            "code": "already_exists",
            "field": "name"
          }
        ],
        "documentation_url": "https://docs.github.com/rest/issues/labels#create-a-label"
      }
    },
    "request": {
      "method": "POST",
      "url": "https://api.github.com/repos/ubiquibot/comment-incentives/labels",
      "headers": {
        "accept": "application/vnd.github.v3+json",
        "user-agent": "probot/12.3.3 octokit-core.js/3.6.0 Node.js/20.11.0 (linux; x64)",
        "authorization": "token [REDACTED]",
        "content-type": "application/json; charset=utf-8"
      },
      "body": "{\"name\":\"Price: 25 USD\",\"color\":\"1f883d\"}",
      "request": {}
    }
  },
  "caller": "renderCatchAll",
  "revision": null
}

@gentlementlegen
Copy link
Contributor

@pavlovcik The issue was in ubiquity/devpool-directory-bounties#14 (comment) correct? Could you put back the comment that breaks for testing?

@0x4007
Copy link
Member Author

0x4007 commented Feb 16, 2024

Unfortunately I deleted it and I can't undelete. I realized my mistake only after filing this issue.

We MAY be able to recover the original comment from the GitHub Actions logs but would need to sift through and compare timestamps.

@gentlementlegen
Copy link
Contributor

No way you could recreate something similar? I am not sure how to create the test case currently

@0x4007
Copy link
Member Author

0x4007 commented Feb 16, 2024

I think it is one of these successful runs from "3 days ago". Let me investigate first. I can recreate simply by re-running the action which would be the best way anyways.

@FernandVEYRIER would you like me to re-run both or are you able to extract the information that you need from there?


I just realized that the plugin live processes the latest comment information in the conversation. Given that I deleted the offending comment it would not process it again. I can't remember off hand exactly how I produced the offending comment unfortunately.


I tried looking through logs and commit histories but I can't figure out exactly what the offending comment was. As a consequence I don't know what to do to set it up again. I guess you can just make up something and prove that html comments are filtered out if they are quote commented. Perhaps try a "quote reply" to a bot comment with some metadata inside.

@0x4007
Copy link
Member Author

0x4007 commented Feb 17, 2024

I am pretty sure I ended up fixing this by no longer logging out the offending metadata ubiquibot/comment-incentives#23


Update: my fix just makes the issue less likely to occur but it is not a solution.

@0x4007 0x4007 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 17, 2024
Copy link

ubiquibot bot commented Feb 17, 2024

# Issue was not closed as completed. Skipping.
` inside of its GitHub comment. \r\n\r\nWhen generating the conversation rewards table, the rendering broke because it doesn't know how to deal with HTML comments. It dumped the full JSON object into the comment incentives calculation table, which looked very wrong. \r\n\r\nIt should filter any HTML that is commented out so that it does not break the \"comment incentives\" table.\r\n\r\nUnfortunately I deleted the offending comment from the back-linked conversation, but I hope that this description makes sense.\r\n\r\n> @FernandVEYRIER Looks like there is some type of edge case with the bot failing to display the conversation incentives by trying to parse My quote comment with \"evaluating results\"'s embedded metadata (we use HTML commenting to embed a JSON object of metadata for bot comments to inter operate with other bot plugins (standardized way for information to be shared about bot comments)\r\n\r\n> I'll have to regenerate and try again after deleting the offending comments. \r\n\r\n_Originally posted by @pavlovcik in https://github.com/ubiquity/devpool-directory-bounties/issues/14#issuecomment-1941514786_",
"reactions": {
  "url": "https://api.github.com/repos/ubiquibot/comment-incentives/issues/17/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/ubiquibot/comment-incentives/issues/17/timeline",
"performed_via_github_app": null,
"state_reason": "not_planned"

},
"caller": "preflightChecks",
"revision": null
}
-->

@0x4007
Copy link
Member Author

0x4007 commented Feb 17, 2024

lol the irony

@0x4007 0x4007 changed the title Comment Incentives Table Should Ignore HTML Commented Out Metadata Serialization of HTML Comments Feb 17, 2024
@0x4007 0x4007 reopened this Feb 17, 2024
Copy link

ubiquibot bot commented Feb 17, 2024

! action has an uncaught error

@ubiquibot ubiquibot bot removed the Price: 25 USD label Feb 17, 2024
@0x4007
Copy link
Member Author

0x4007 commented Feb 26, 2024

Looks like it broke on the triple back tick from within the comment. That makes sense. I guess those need to be escaped.

          <details>
<summary>
  <b
    ><h3>
      <a
        href="https://pay.ubq.fi/?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI1MDAwMDAwMDAwMDAwMDAwMDAwMCJ9LCJub25jZSI6IjI1MzMxMzYzNjEwOTUzMTg0ODgzOTg2MzU3MTA2MzA2NDEwMzA2NDA4MDI4NTMxODI2NzQ1NTA2MDc3NDM2ODkwMDcxMzk5OTk5NDYxIiwiZGVhZGxpbmUiOiIxMTU3OTIwODkyMzczMTYxOTU0MjM1NzA5ODUwMDg2ODc5MDc4NTMyNjk5ODQ2NjU2NDA1NjQwMzk0NTc1ODQwMDc5MTMxMjk2Mzk5MzUifSwidHJhbnNmZXJEZXRhaWxzIjp7InRvIjoiMHg0MDA3Q0UyMDgzYzdGM0UxODA5N2FlQjNBMzliYjhlQzE0OWEzNDFkIiwicmVxdWVzdGVkQW1vdW50IjoiNTAwMDAwMDAwMDAwMDAwMDAwMDAifSwib3duZXIiOiIweDQ0Q2ExNURiMTAxZkQxYzE5NDQ2N0RiNkFGMGM2N0M2QmJGNEFCNTEiLCJzaWduYXR1cmUiOiIweGI2ZDhhZDRmMDc3ZjZkMTFkM2NmYThjZTgyMDRkYWYzMzkyNmU1MGY3N2UxOTQ1ZGFlZmI0MmJjOWQ0OTMxMzUzZTJmNzc4YjA3MWU2YjE0M2ViN2FmZjM5YzZjMWQ0ZGE4ZjM4ZTEzNThjNTg1ZjBhMjdmZGNjNGIyMDEyZWUwMWMiLCJuZXR3b3JrSWQiOjEwMH1d"
      >
        [ 50 WXDAI ]</a
      >
    </h3>
    <h6>@pavlovcik</h6></b
  >
</summary>
<h6>Contributions Overview</h6>
ViewContributionCountReward
IssueComment36.9
ReviewComment743.1
Conversation Incentives
CommentFormattingRelevanceReward
Not sure if this is a two or four hour task...
1.10.21.1
> The bot hasn't linked me yet, I'm not going to assign myself a...
3.20.523.2
It's weird that GitHub is not considering your "closing keyword"...
2.60.542.6
Your code is outdated. Pull from head...
0.70.370.7
I got it under one second on my [branch](https://github.com/pavl...
2.7
a:
  count: 1
  score: "1"
  words: 1
0.652.7
> As did I without the additional 15 rpc calls however it's a go...
4.10.644.1
I was going to merge yours in but I realized that its not stable...
5.80.695.8
> I'm a little confused as to what you mean by it's not currentl...
20.2
a:
  count: 1
  score: "1"
  words: 3
code:
  count: 4
  score: "4"
  words: 6
0.7820.2
Let me spend some time testing today and I'll be careful to clea...
4.10.84.1
The error that I got is from.
erc20-permit.ts:67 Error:...</a></h6></td><td><details><summary>5.5</summary>
<pre>code:
  count: 1
  score: "1"
  words: 0
</pre>
</details></td><td>0.78</td><td>5.5</td></tr></tbody></table>
  </details>
  

  <details>
    <summary>
      <b
        ><h3>
          <a
            href="https://pay.ubq.fi/?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI0MzU3MDAwMDAwMDAwMDAwMDAwMDAifSwibm9uY2UiOiIzNjkyNjE3MTgyMjY4NTcwODEwNzAyNDQ2MzY1NDE4NjIxOTU3NDc4MzY4Nzg4NDc5NDk4NjAyMTQwNDU3NjI5Njk3MTQ2MzQxNjQ4OSIsImRlYWRsaW5lIjoiMTE1NzkyMDg5MjM3MzE2MTk1NDIzNTcwOTg1MDA4Njg3OTA3ODUzMjY5OTg0NjY1NjQwNTY0MDM5NDU3NTg0MDA3OTEzMTI5NjM5OTM1In0sInRyYW5zZmVyRGV0YWlscyI6eyJ0byI6IjB4QWU1RDFGMTkyMDEzZGI4ODliMWUyMTE1QTM3MGFCMTMzZjM1OTc2NSIsInJlcXVlc3RlZEFtb3VudCI6IjQzNTcwMDAwMDAwMDAwMDAwMDAwMCJ9LCJvd25lciI6IjB4NDRDYTE1RGIxMDFmRDFjMTk0NDY3RGI2QUYwYzY3QzZCYkY0QUI1MSIsInNpZ25hdHVyZSI6IjB4YTJmNjkxYjVjZDkxMzJlYjllYzJlMjI1NzRiMTkxYWUxZDRhNzkzOGI0MTQ4ZDAwZTI0ZjhhN2Y3NTM3MmFlOTVmMzIyY2VlZjg5MzFlN2ZkZDYxOWNlYzNkNDA1NTNlOTZmNTg0OTFhOGJlMDU3NTBjYTY3ZDM0NGQ4YTIwY2ExYyIsIm5ldHdvcmtJZCI6MTAwfV0%3D"
          >
            [ 435.7 WXDAI ]</a
          >
        </h3>
        <h6>@Keyrxng</h6></b
      >
    </summary>
    <h6>Contributions Overview</h6>
<table><thead>
<tr><th>View</th><th>Contribution</th><th>Count</th><th>Reward</th>
</thead><tbody>
<tr><td>Issue</td><td>Specification</td><td>1</td><td>19</td></tr>
<tr><td>Issue</td><td>Task</td><td>1</td><td>200</td></tr>
<tr><td>Issue</td><td>Comment</td><td>1</td><td>6.4</td></tr>
<tr><td>Issue</td><td>Comment</td><td>1</td><td>0</td></tr>
<tr><td>Review</td><td>Comment</td><td>10</td><td>140.2</td></tr>
<tr><td>Review</td><td>Comment</td><td>10</td><td>70.1</td></tr>
</tbody></table>
    <h6>Conversation Incentives</h6><table><thead><tr><th>Comment</th><th>Formatting</th><th>Relevance</th><th>Reward</th></tr></thead><tbody><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/issues/168">Follow-on task to #158 

The goal is to reduce TTC (time till ...</a></h6></td><td><details><summary>19</summary>
<pre>li:
  count: 4
  score: "4"
  words: 53
</pre>
</details></td><td>1</td><td>19</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/issues/168#issuecomment-1954639846">The bot hasn't linked me yet, I'm not going to assign myself and...</a></h6></td><td>6.4</td><td>0.05</td><td>6.4</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/issues/168#issuecomment-1954639846">The bot hasn't linked me yet, I'm not going to assign myself and...</a></h6></td><td>-</td><td>0.05</td><td>-</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1954683499">lmao I'll get there sooner or later with Git 😂 ...</a></h6></td><td>2</td><td>0.05</td><td>2</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1957269289">Optimistic rendering time till claimable:

![optimistic-w-add-...</a></h6></td><td>2.2</td><td>0.57</td><td>2.2</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1957280053">had a nightmare trying to get that submodule added, thats what c...</a></h6></td><td>11.2</td><td>0.29</td><td>11.2</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1957348255">The rpc speed mapping is cool but I think it's a bit overkill pi...</a></h6></td><td>23.8</td><td>0.5</td><td>23.8</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1957797441">It's not determined by a block being mined as it involves no onc...</a></h6></td><td>12.6</td><td>0.505</td><td>12.6</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1957817839">> > It's not determined by a block being mined as it involves no...</a></h6></td><td><details><summary>18.6</summary>
<pre>code:
  count: 1
  score: "2"
  words: 3
</pre>
</details></td><td>0.52</td><td>18.6</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1957841044">As did I without the additional 15 rpc calls however it's a good...</a></h6></td><td>6.6</td><td>0.59</td><td>6.6</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1960692481">I'm a little confused as to what you mean by it's not currently ...</a></h6></td><td><details><summary>27.8</summary>
<pre>a:
  count: 1
  score: "2"
  words: 3
code:
  count: 4
  score: "8"
  words: 6
</pre>
</details></td><td>0.75</td><td>27.8</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1961222782">Hitting localhost I generated 10 permits with an open window eac...</a></h6></td><td><details><summary>16.6</summary>
<pre>code:
  count: 1
  score: "2"
  words: 7
</pre>
</details></td><td>0.71</td><td>16.6</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1963541663">This resolves the no network issue. 

I test by setting the ``...</a></h6></td><td><details><summary>18.8</summary>
<pre>code:
  count: 5
  score: "10"
  words: 7
</pre>
</details></td><td>0.76</td><td>18.8</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1954683499">lmao I'll get there sooner or later with Git 😂 ...</a></h6></td><td>1</td><td>0.05</td><td>1</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1957269289">Optimistic rendering time till claimable:

![optimistic-w-add-...</a></h6></td><td>1.1</td><td>0.57</td><td>1.1</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1957280053">had a nightmare trying to get that submodule added, thats what c...</a></h6></td><td>5.6</td><td>0.29</td><td>5.6</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1957348255">The rpc speed mapping is cool but I think it's a bit overkill pi...</a></h6></td><td>11.9</td><td>0.5</td><td>11.9</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1957797441">It's not determined by a block being mined as it involves no onc...</a></h6></td><td>6.3</td><td>0.505</td><td>6.3</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1957817839">> > It's not determined by a block being mined as it involves no...</a></h6></td><td><details><summary>9.3</summary>
<pre>code:
  count: 1
  score: "1"
  words: 3
</pre>
</details></td><td>0.52</td><td>9.3</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1957841044">As did I without the additional 15 rpc calls however it's a good...</a></h6></td><td>3.3</td><td>0.59</td><td>3.3</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1960692481">I'm a little confused as to what you mean by it's not currently ...</a></h6></td><td><details><summary>13.9</summary>
<pre>a:
  count: 1
  score: "1"
  words: 3
code:
  count: 4
  score: "4"
  words: 6
</pre>
</details></td><td>0.75</td><td>13.9</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1961222782">Hitting localhost I generated 10 permits with an open window eac...</a></h6></td><td><details><summary>8.3</summary>
<pre>code:
  count: 1
  score: "1"
  words: 7
</pre>
</details></td><td>0.71</td><td>8.3</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1963541663">This resolves the no network issue. 

I test by setting the ``...</a></h6></td><td><details><summary>9.4</summary>
<pre>code:
  count: 5
  score: "5"
  words: 7
</pre>
</details></td><td>0.76</td><td>9.4</td></tr></tbody></table>
  </details>
  

  <details>
    <summary>
      <b
        ><h3>
          <a
            href="https://pay.ubq.fi/?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI5OTAwMDAwMDAwMDAwMDAwMDAwIn0sIm5vbmNlIjoiMTE0MTU0MTY3NDA3NTQxMTMxOTk2NTk0MjU5NzQzMjQ1MTcyNDcxOTU3MTM2MzUyMDQ3MjQ1Mzg4NzIwNDM1NTk5NjYzMzU2OTU4MTA3IiwiZGVhZGxpbmUiOiIxMTU3OTIwODkyMzczMTYxOTU0MjM1NzA5ODUwMDg2ODc5MDc4NTMyNjk5ODQ2NjU2NDA1NjQwMzk0NTc1ODQwMDc5MTMxMjk2Mzk5MzUifSwidHJhbnNmZXJEZXRhaWxzIjp7InRvIjoiMHgzMzZDMDMzODQyRkEzMTZkNDcwZTgyMGM4MWI3NDJlNjJBMDc2NURDIiwicmVxdWVzdGVkQW1vdW50IjoiOTkwMDAwMDAwMDAwMDAwMDAwMCJ9LCJvd25lciI6IjB4NDRDYTE1RGIxMDFmRDFjMTk0NDY3RGI2QUYwYzY3QzZCYkY0QUI1MSIsInNpZ25hdHVyZSI6IjB4MDI3OThkMTljMjE0MDg3Mzk2NmFjYWY3NTFiMTlkNmM2ZmEyMjBjM2MwZTkyZTExOWVlMzI0NzBjNGViOGFjNTAwNzdjODJkZjQyMDdkZWE3MTk1ZDJhNzRkNTI0NTQyM2UwYjY1ODZmMWIwYWUyNzVjZmE0ODE0OWY5NWQ4MTcxYiIsIm5ldHdvcmtJZCI6MTAwfV0%3D"
          >
            [ 9.9 WXDAI ]</a
          >
        </h3>
        <h6>@rndquu</h6></b
      >
    </summary>
    <h6>Contributions Overview</h6>
<table><thead>
<tr><th>View</th><th>Contribution</th><th>Count</th><th>Reward</th>
</thead><tbody>
<tr><td>Review</td><td>Comment</td><td>2</td><td>9.9</td></tr>
</tbody></table>
    <h6>Conversation Incentives</h6><table><thead><tr><th>Comment</th><th>Formatting</th><th>Relevance</th><th>Reward</th></tr></thead><tbody><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1957785172">> local anvil hits instantly everytime

As far as I remember w...</a></h6></td><td><details><summary>5.5</summary>
<pre>a:
  count: 1
  score: "1"
  words: 1
</pre>
</details></td><td>0.59</td><td>5.5</td></tr><tr><td><h6><a href="https://github.com/ubiquity/pay.ubq.fi/pull/169#issuecomment-1957804369">> It's not determined by a block being mined as it involves no o...</a></h6></td><td><details><summary>4.4</summary>
<pre>code:
  count: 1
  score: "1"
  words: 3
</pre>
</details></td><td>0.44</td><td>4.4</td></tr></tbody></table>
  </details>
  
<!-- Ubiquity - Transactions - generatePermits - 385a90e
[
  {
    "permit": {
      "permitted": {
        "token": "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",
        "amount": "50000000000000000000"
      },
      "nonce": "25331363610953184883986357106306410306408028531826745506077436890071399999461",
      "deadline": "115792089237316195423570985008687907853269984665640564039457584007913129639935"
    },
    "transferDetails": {
      "to": "0x4007CE2083c7F3E18097aeB3A39bb8eC149a341d",
      "requestedAmount": "50000000000000000000"
    },
    "owner": "0x44Ca15Db101fD1c194467Db6AF0c67C6BbF4AB51",
    "signature": "0xb6d8ad4f077f6d11d3cfa8ce8204daf33926e50f77e1945daefb42bc9d4931353e2f778b071e6b143eb7aff39c6c1d4da8f38e1358c585f0a27fdcc4b2012ee01c",
    "networkId": 100
  },
  {
    "permit": {
      "permitted": {
        "token": "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",
        "amount": "435700000000000000000"
      },
      "nonce": "36926171822685708107024463654186219574783687884794986021404576296971463416489",
      "deadline": "115792089237316195423570985008687907853269984665640564039457584007913129639935"
    },
    "transferDetails": {
      "to": "0xAe5D1F192013db889b1e2115A370aB133f359765",
      "requestedAmount": "435700000000000000000"
    },
    "owner": "0x44Ca15Db101fD1c194467Db6AF0c67C6BbF4AB51",
    "signature": "0xa2f691b5cd9132eb9ec2e22574b191ae1d4a7938b4148d00e24f8a7f75372ae95f322ceef8931e7fdd619cec3d40553e96f58491a8be05750ca67d344d8a20ca1c",
    "networkId": 100
  },
  {
    "permit": {
      "permitted": {
        "token": "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",
        "amount": "9900000000000000000"
      },
      "nonce": "114154167407541131996594259743245172471957136352047245388720435599663356958107",
      "deadline": "115792089237316195423570985008687907853269984665640564039457584007913129639935"
    },
    "transferDetails": {
      "to": "0x336C033842FA316d470e820c81b742e62A0765DC",
      "requestedAmount": "9900000000000000000"
    },
    "owner": "0x44Ca15Db101fD1c194467Db6AF0c67C6BbF4AB51",
    "signature": "0x02798d19c2140873966acaf751b19d6c6fa220c3c0e92e119ee32470c4eb8ac50077c82df4207dea7195d2a74d5245423e0b6586f1b0ae275cfa48149f95d8171b",
    "networkId": 100
  }
]
-->

_Originally posted by @ubiquibot[bot] in https://github.com/ubiquity/pay.ubq.fi/issues/168#issuecomment-1963889840_
            

@gentlementlegen
Copy link
Contributor

/start

Copy link

ubiquibot bot commented Feb 29, 2024

DeadlineThu, Feb 29, 4:00 AM UTC
Registered Wallet 0x0fC1b909ba9265A846b82CF4CE352fc3e7EeB2ED
Tips:
  • Use /wallet 0x0000...0000 if you want to update your registered payment wallet address.
  • Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
  • Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.

@gentlementlegen
Copy link
Contributor

@pavlovcik If I recall correctly you said you've been rewriting that whole thing, is it still relevant?

@0x4007
Copy link
Member Author

0x4007 commented Feb 29, 2024

I got saturated rewriting the conversation incentives module first. I didn't get a chance to finish.

https://github.com/ubiquibot/conversation-rewards

The next module would be permit generation.

The final module would be the comment generation. So basically this would consume the output of the permit generation module.

That would essentially just be an array of permits. Feel free to start making that module from scratch?

@gentlementlegen
Copy link
Contributor

So I believe we shall close this issue then.
And the comment generation would be the part that is in charge on doing the summary comment that gets posted to the timeline of the issue if I understand the workflow properly?

@0x4007
Copy link
Member Author

0x4007 commented Feb 29, 2024

I haven't figured out the architecture to be honest. I think it makes sense that the conversation incentives indeed handles all that calculation but I'm unsure about how to pass it THROUGH permit generation module and then into the final permit comment module

rfc @whilefoo

Ideally if the kernel can store output information from each module. Then a future module can request a specific property from all of the outputs so far. I think we can take inspiration from how GitHub Actions already implemented this. We specify an output in the config and then pass it in directly from the config into the plugin.


Either way @FernandVEYRIER I think there's plenty of ground work to lay out before we figure out these "external-to-plugin" details

@whilefoo
Copy link
Contributor

In the current implementation the permit generation plugin would be responsible for passing the calculation to the final permit comment along with permits.

Ideally if the kernel can store output information from each module. Then a future module can request a specific property from all of the outputs so far. I think we can take inspiration from how GitHub Actions already implemented this. We specify an output in the config and then pass it in directly from the config into the plugin.

I do like this idea, for example something like this:

- name: "Comment incentives"
  uses:
    - id: conversation-incentives
      plugin: ubiquibot/conversation-incentives
      with:
       ...
    - id: permit-generation
      plugin: ubiquibot/permit-generation
      with:
       calculation: {{ conversation-incentives.outputs.calculation }} 
       ...
    - plugin: ubiquibot/permit-comment
      with:
       permits: {{ permit-generation.outputs.permits }} 
       calculation: {{ conversation-incentives.outputs.calculation }} 

@gentlementlegen
Copy link
Contributor

@whilefoo Looks neat indeed, Now the question would be how to ensure that the formats are compatible between each step to pass down the data efficiently.

@0x4007
Copy link
Member Author

0x4007 commented Mar 1, 2024

@whilefoo Looks neat indeed, Now the question would be how to ensure that the formats are compatible between each step to pass down the data efficiently.

In GitHub actions it isn't necessary to worry about compatibility within the intermediary modules. You essentially direct the output precisely wherever it's needed. So all the outputs would, in a sense, stay in the memory of the kernel.

@gentlementlegen
Copy link
Contributor

/stop

Copy link

ubiquibot bot commented Mar 4, 2024

+ You have been unassigned from the task

@gentlementlegen
Copy link
Contributor

Will move this to the https://github.com/ubiquibot/conversation-rewards repo since it is no more relevant here.

Copy link

Hello from the worker!

@gentlementlegen gentlementlegen transferred this issue from ubiquibot/comment-incentives May 5, 2024
@gentlementlegen
Copy link
Contributor

/start

Copy link

ubiquibot bot commented May 5, 2024

! No price label is set, so this is not ready to be self assigned yet.

@gentlementlegen
Copy link
Contributor

/start

Copy link

ubiquibot bot commented May 5, 2024

Warning! This task was created over 81 days ago. Please confirm that this issue specification is accurate before starting.
DeadlineSun, May 5, 6:54 AM UTC
Registered Wallet 0x0fC1b909ba9265A846b82CF4CE352fc3e7EeB2ED
Tips:
  • Use /wallet 0x0000...0000 if you want to update your registered payment wallet address.
  • Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
  • Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.

Copy link

ubiquibot bot commented May 16, 2024

+ Evaluating results. Please wait...

Copy link

ubiquibot bot commented May 16, 2024

[ 687.2 WXDAI ]

@0x4007
Contributions Overview
ViewContributionCountReward
IssueSpecification172.2
IssueComment9615
Conversation Incentives
CommentFormattingRelevanceReward
# HTML Comment Serialization

Whenever the bot needs to repost...

72.2

h1:
  count: 1
  score: "1"
  words: 3
h3:
  count: 3
  score: "3"
  words: 5
a:
  count: 1
  score: "1"
  words: 2
li:
  count: 4
  score: "4"
  words: 28
code:
  count: 3
  score: "3"
  words: 4
172.2
> ```diff > ! action has an uncaught error > ```

For contex...

61.8

code:
  count: 2
  score: "2"
  words: 0
-61.8
Unfortunately I deleted it and I can't undelete. I realized my m...
9.2
a:
  count: 1
  score: "1"
  words: 3
-9.2
I think it is one of these successful runs from "3 days ago". Le...
41.6
li:
  count: 2
  score: "2"
  words: 22
hr:
  count: 2
  score: "2"
  words: 0
-41.6
I am pretty sure I ended up fixing this by no longer logging out...
9.4
hr:
  count: 1
  score: "1"
  words: 0
-9.4
lol the irony...
0.6-0.6
Looks like it broke on the triple back tick from within the comm...
442
code:
  count: 2
  score: "2"
  words: 0
-442
I got saturated rewriting the conversation incentives module fir...
13.6-13.6
I haven't figured out the architecture to be honest. I think it ...
28.8
code:
  count: 2
  score: "2"
  words: 4
hr:
  count: 1
  score: "1"
  words: 0
-28.8
> @whilefoo Looks neat indeed, Now the question would be how to ...
8-8

[ 129.9 WXDAI ]

@gentlementlegen
Contributions Overview
ViewContributionCountReward
IssueTask1100
IssueComment60
IssueComment614.9
ReviewComment17.5
ReviewComment17.5
Conversation Incentives
CommentFormattingRelevanceReward
@pavlovcik The issue was in https://github.com/ubiquity/devpool-...
---
No way you could recreate something similar? I am not sure how t...
---
@pavlovcik If I recall correctly you said you've been rewriting ...
---
So I believe we shall close this issue then. And the comment ge...
---
@whilefoo Looks neat indeed, Now the question would be how to en...
---
Will move this to the https://github.com/ubiquibot/conversation-...
---
@pavlovcik The issue was in https://github.com/ubiquity/devpool-...
2.7-2.7
No way you could recreate something similar? I am not sure how t...
1.8-1.8
@pavlovcik If I recall correctly you said you've been rewriting ...
1.8-1.8
So I believe we shall close this issue then. And the comment ge...
4.1-4.1
@whilefoo Looks neat indeed, Now the question would be how to en...
2.6-2.6
Will move this to the https://github.com/ubiquibot/conversation-...
1.9-1.9
Added tests to make sure the serialization for complex comments ...
7.5
a:
  count: 2
  score: "2"
  words: 4
0.837.5
Added tests to make sure the serialization for complex comments ...
7.5
a:
  count: 2
  score: "2"
  words: 4
0.837.5

[ 10.3 WXDAI ]

@whilefoo
Contributions Overview
ViewContributionCountReward
IssueComment110.3
Conversation Incentives
CommentFormattingRelevanceReward
In the current implementation the `permit generation` plugin wou...
10.3
code:
  count: 3
  score: "3"
  words: 4
-10.3

@0x4007
Copy link
Member Author

0x4007 commented May 16, 2024

Lol my comment reward 👀

@gentlementlegen
Copy link
Contributor

@0x4007 The king of copy pasta. I checked the logs actually ChatGpt broke on the comment because it was too long but since relevance is not applied anyway you got the full reward haha

@0x4007
Copy link
Member Author

0x4007 commented May 16, 2024

I don't plan to claim it. Or perhaps claim and return 442

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

Successfully merging a pull request may close this issue.

3 participants