Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Automatically add a testcase via a comment #231

Closed
hellow554 opened this issue Dec 18, 2019 · 44 comments
Closed

Automatically add a testcase via a comment #231

hellow554 opened this issue Dec 18, 2019 · 44 comments

Comments

@hellow554
Copy link
Contributor

Just like @rustbot can be pinged, why not using the same with @rust-lang-glacier-bot?

I would suggest something like this:


Hey, I found a mcve for this ICE. With this mcve it works.

fn main() { panic!() }

@rust-lang-glacier-bot add ICE https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=34dc5c9d1e14ff10ff8be22be265e7ef


Then the bot can try the playgroundand see if it ICEs and automatically adds it.

If we don't want an automatism, something like @rust-lang-glacier-bot +r can be used, similar to @bors.

What do you think?

@hellow554
Copy link
Contributor Author

Also it should be possible to update an ice, but using update ICE <playgroundlink?

@JohnTitor
Copy link
Member

So, we have to serve and manage glacier-bot like rustbot(triagebot)? If so, I'm not sure but it may be a burden to the members (particularly infra team).

@hellow554
Copy link
Contributor Author

hellow554 commented Dec 19, 2019

Can you explain the "serve and manage" part a little bit more? I never developed a github bot, nor looked I at the source of rustbot/triagebot/bors. I do not know how much effort it is to develop such bot.

But we can aggree, that it will be a burden to somebody. But it will be increase the awareness and the usefulness of this repository. Nobody needs to open a PR anymore, nobody needs to approve it (well, if we go for the +r method, then somebody must approve it, but centril of jonas are around everywhere ^^)

It's up to you to decide wether it's worth the effort to develop (and maintain (?)) such a bot.

@Mark-Simulacrum
Copy link
Member

I would be happy to accept a patch that includes this functionality into triagebot, but I don't think we need a separate bot for this.

@hellow554
Copy link
Contributor Author

Should this issue be transfered to the https://github.com/rust-lang/triagebot/ repo then?

@Mark-Simulacrum
Copy link
Member

I would imagine that tracking it here makes more sense, but feel free to reopen there if needed.

@JohnTitor
Copy link
Member

I would be happy to accept a patch that includes this functionality into triagebot, but I don't think we need a separate bot for this.

Sounds good, I agree with that!

@LeSeulArtichaut
Copy link

rust-lang/triagebot#526 landed, so this should probably be closed?

@Mark-Simulacrum
Copy link
Member

We should test it out first :)

@LeSeulArtichaut
Copy link

Should we have a dummy ICE PR? Or do we want to wait until we have an ICE with MCVE ready?

@JohnTitor
Copy link
Member

I tried in rust-lang/rust#72554 and we should have enabled glacier command in the rust-lang/rust at first... And the current command is tricky for me, we should also document this in the wiki.

@JohnTitor
Copy link
Member

Hm, I tried with rust-lang/rust#72554 (comment) but there is no response for about an hour.

@LeSeulArtichaut
Copy link

cc @Elinvynia

@Elinvynia
Copy link
Contributor

I see where the issue could possibly be, I parse the URL like so:
format!("{}{}", url.replace("github", "githubusercontent"), "/playground.rs")
But the actual URL gets turned from:
https://gist.github.com/rust-play/e9a2a667c7f9015fdf681a7e6a542d63
into:
https://gist.githubusercontent.com/rust-play/e9a2a667c7f9015fdf681a7e6a542d63/raw/954385e527026fbf86c856f532fe80caad114887/playground.rs
Which means I need to rethink my approach.

If only team members are supposed to use this, then I guess we could allow any URL that resolves into text.

@LeSeulArtichaut the above thing aside, it still should have created a PR, albeit with the wrong content. Do you see any potential issue with how I've done the octocrab side of things?

@LeSeulArtichaut
Copy link

It's possible that octocrab could have failed e.g. to parse a GitHub response. If that's the case the error should have been logged, cc @Mark-Simulacrum.
I'll look a bit at the code you wrote to see if I can find some other potential mistakes.

@Mark-Simulacrum
Copy link
Member

handling event failed: JSON Error in content._links.self: invalid type: string "https://api.github.com/repos/rustbot/glacier/contents/ices/72554.rs?ref=triagebot-ice-72554", expected struct SelfLink at line 1 column 631
{
    "commit": {
        "author": {
            "date": "2020-05-26T03:31:03Z",
            "email": "[email protected]",
            "name": "rustbot"
        },
        "committer": {
            "date": "2020-05-26T03:31:03Z",
            "email": "[email protected]",
            "name": "rustbot"
        },
        "html_url": "https://github.com/rustbot/glacier/commit/7058a63594715f21fc3704de434e3a8a2fc5906b",
        "message": "Add ICE reproduction for issue #72554.",
        "node_id": "MDY6Q29tbWl0MjY2MTc3NjA1OjcwNThhNjM1OTQ3MTVmMjFmYzM3MDRkZTQzNGUzYThhMmZjNTkwNmI=",
        "parents": [
            {
                "html_url": "https://github.com/rustbot/glacier/commit/cc054a91d1e98f459566f32451b9fb205e08d5b7",
                "sha": "cc054a91d1e98f459566f32451b9fb205e08d5b7",
                "url": "https://api.github.com/repos/rustbot/glacier/git/commits/cc054a91d1e98f459566f32451b9fb205e08d5b7"
            }
        ],
        "sha": "7058a63594715f21fc3704de434e3a8a2fc5906b",
        "tree": {
            "sha": "03273b8de059311c7a2139a7a3b31c59ffb5e3c9",
            "url": "https://api.github.com/repos/rustbot/glacier/git/trees/03273b8de059311c7a2139a7a3b31c59ffb5e3c9"
        },
        "url": "https://api.github.com/repos/rustbot/glacier/git/commits/7058a63594715f21fc3704de434e3a8a2fc5906b",
        "verification": {
            "payload": null,
            "reason": "unsigned",
            "signature": null,
            "verified": false
        }
    },
    "content": {
        "_links": {
            "git": "https://api.github.com/repos/rustbot/glacier/git/blobs/8537307691275bdf5dd2c646e3775649643ccecf",
            "html": "https://github.com/rustbot/glacier/blob/triagebot-ice-72554/ices/72554.rs",
            "self": "https://api.github.com/repos/rustbot/glacier/contents/ices/72554.rs?ref=triagebot-ice-72554"
        },
        "download_url": "https://raw.githubusercontent.com/rustbot/glacier/triagebot-ice-72554/ices/72554.rs",
        "git_url": "https://api.github.com/repos/rustbot/glacier/git/blobs/8537307691275bdf5dd2c646e3775649643ccecf",
        "html_url": "https://github.com/rustbot/glacier/blob/triagebot-ice-72554/ices/72554.rs",
        "name": "72554.rs",
        "path": "ices/72554.rs",
        "sha": "8537307691275bdf5dd2c646e3775649643ccecf",
        "size": 9,
        "type": "file",
        "url": "https://api.github.com/repos/rustbot/glacier/contents/ices/72554.rs?ref=triagebot-ice-72554"
    }
}
	

@LeSeulArtichaut
Copy link

Error comes from Octocrab, cc @XAMPPRocky

@XAMPPRocky
Copy link
Member

XAMPPRocky commented May 28, 2020

The error is with this model, I can make a fix for this later, but if someone else wants to please go ahead. https://github.com/XAMPPRocky/octocrab/blob/96e9413c921078463e249078ac0cc5956ac80d1a/src/models.rs#L786

@XAMPPRocky
Copy link
Member

I've published a fix for this in 0.3.2.

@kellda
Copy link

kellda commented Jul 25, 2020

Is this fixed by rust-lang/triagebot#580 ?

@JohnTitor
Copy link
Member

JohnTitor commented Jul 25, 2020

I'm not sure, let me check it...

@JohnTitor
Copy link
Member

It... doesn't still work well? rust-lang/rust#74120 (comment)

@kellda
Copy link

kellda commented Jul 25, 2020

@kellda
Copy link

kellda commented Jul 25, 2020

@Mark-Simulacrum is there something in the logs ?

@Mark-Simulacrum
Copy link
Member

https://gist.github.com/Mark-Simulacrum/bcb29951de2a15b94c4a761d06515d35 is the log for the event -- looks like maybe a bug in octocrab?

@kellda
Copy link

kellda commented Jul 25, 2020

Not sure it is related. The error happends 3s after the glacier command, and only 1ms after a notification handler <- Just a strange timing
glacier.rs shows up in the backtrace, so it's related

@LeSeulArtichaut
Copy link

IIRC octocrab is only used for glacier currently.
cc @XAMPPRocky about the model error.

@Mark-Simulacrum
Copy link
Member

The backtrace clearly indicates that the error happens as a result of this line: https://github.com/rust-lang/triagebot/blob/e03ad06feda31ff2d832db8f4d61b795ca8bbcbc/src/handlers/glacier.rs#L52

@kellda
Copy link

kellda commented Jul 25, 2020

@XAMPPRocky
Copy link
Member

XAMPPRocky commented Jul 25, 2020

Thank you for the report! If someone wants to make a PR to octocrab to make those fields optional I would accept a PR and put out a patch release, otherwise I can make the change later.

@kellda
Copy link

kellda commented Jul 25, 2020

I don't think that any field should be made optional. I think it should be a whole different struct.

I'll open a PR if I get some time to fix it.

@XAMPPRocky
Copy link
Member

The fix has now been published as part of 0.5.0.

@kellda
Copy link

kellda commented Jul 27, 2020

Does it work now ?

Btw is there any reason only team members can use this command ?

@LeSeulArtichaut
Copy link

Still doesn't look like it's working? rust-lang/rust#74120 (comment)

@Mark-Simulacrum
Copy link
Member


[2020-07-27T13:53:18.159Z ERROR triagebot src/lib.rs:170] request_id=3f2f2acd-911f-4bb6-9e9f-a44a8bd1a7a9 handling event failed: GitHub: Error: Reference already exists

Unfortunately, I don't know what reference already exists. Maybe this is enough though; happy to deploy more logging or whatever.

I would prefer to limit commands that cause triagebot to take noisy action (e.g., opening PRs or pushing commits) to team members just for safety even if we believe them to be relatively secure.

@JohnTitor
Copy link
Member

Unfortunately, I don't know what reference already exists.

The cause is that rustbot fork repo has the same name branch already, I think it was created in the previous time. https://github.com/rustbot/glacier/tree/triagebot-ice-74120

@kellda
Copy link

kellda commented Jul 27, 2020

And getting the raw rust code didn't worked:
master...rustbot:triagebot-ice-74120

cc @Elinvynia

@Elinvynia
Copy link
Contributor

@kellda Thanks, I'll have a look!

@workingjubilee
Copy link
Member

workingjubilee commented Sep 9, 2020

Hitting the main GitHub URL would let one scrape the button and then follow the raw link, however, more simply, given a gist hash, hitting GitHub's REST/JSON API at https://api.github.com/gists/{hash} will yield a JSON-formatted response that is more easily traversed and will probably include all the relevant content already within some subfield of a subfield, including multiple files if it is the rare multi-file gist.

e.g. https://api.github.com/gists/fa3a4448239b08769f0c581dd1588f36

@camelid
Copy link
Member

camelid commented Dec 1, 2020

This was implemented in triagebot as the glacier command! An example of usage:

@rustbot glacier "https://gist.github.com/rust-play/27c280d0e5bba7174cf90a120019a279"

Make sure to include "/rust-play/" in the URL or it won't work.

@camelid camelid closed this as completed Dec 1, 2020
@kellda
Copy link

kellda commented Dec 1, 2020

Does it work now ?

@camelid
Copy link
Member

camelid commented Dec 1, 2020

Yes: see #551 for an example.

@langston-barrett
Copy link
Contributor

Does this still work? I tried it on rust-lang/rust#109146 but don't see a PR.

@workingjubilee
Copy link
Member

Does this still work? I tried it on rust-lang/rust#109146 but don't see a PR.

It requires gists associated with @rust-play, the bot user that runs the Rust Playground.

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

No branches or pull requests

10 participants