gchristensen changed the topic of #nixos-borg to: https://www.patreon.com/ofborg https://monitoring.nix.ci/dashboard/db/ofborg?refresh=10s&orgId=1&from=now-1h&to=now "I get to skip reviewing the PHP code and just wait until it is rewritten in something sane, like POSIX shell. || https://logs.nix.samueldr.com/nixos-borg
orivej has joined #nixos-borg
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #nixos-borg
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #nixos-borg
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #nixos-borg
orivej has quit [Ping timeout: 244 seconds]
<gchristensen> sometimes, I wish there were more people who cared about the code in ofborg. I can write the junkiest code of all time and not many people care at all, as long as it makes their life better. that is cool, I appreciate that -- it is why I work on it of course! -- but also it'd be nice to have people pushing me to make good code, too :)
orivej has joined #nixos-borg
<gchristensen> LnL: can you help me add a new field to BuildResult sometime?
<gchristensen> I'd like to add `completed_at` as DateTime<Utc> using Chrono's datetime lib
<LnL> sure
<gchristensen> note my comments about ofborg ^ aren't just about ofborg obviously :P I haven't done much team dev in a while, and feel it is showing :)
<LnL> ~20min :)
<gchristensen> no worries / rush
<LnL> so, what's up?
<gchristensen> so <3 on the tagged datatypes
<gchristensen> I'd like to add a field for when the job finished, as reported by the builder, so the "finished at" time on the github checks page can be correct
<LnL> ah, nice
<gchristensen> I thought about doing it in the check posting code,but it makes the code / tests ugly, since the tests would need to deal with time :P
<LnL> right
<LnL> I guess the question is v2 vs option?
<gchristensen> yeah
<LnL> I'm not sure either, I would say that it depends on the implementation
<gchristensen> I guess I'm inclined to go the heavier route and go v2
<gchristensen> it'll make some code a bit more complicated I think, but more clearly describes my intention
<LnL> success -> status is a good example where you can make a sane translation and just assume the new version later on
<LnL> hmm, can't you do the same here? "now" seems a reasonable default as fallback
<LnL> or are you back to step one then?
<gchristensen> hmmm good idea
<gchristensen> / point
<gchristensen> I'll take a crack at it later today
<LnL> and since the type of time_finished() won't be Optional it's kind of ok not to test the default value it gets?
<LnL> any testing with eg. mocks would end up with similar coverage unless you can do magic stuff like the python mock library
<gchristensen> yeah, this seems really good!
<LnL> if it was something where you'd have to handle the condition anyway I'd just use Optional and make it strict in the next version
<LnL> whaa, I just thought of this idea and somebody already wrote it!
<gchristensen> omg what is going on here
<LnL> I have no clue, but the description sounds like what I was thinking
<gchristensen> just this morning I came across my .nix file to identify likely maintainers of changed paths
<LnL> except for validating that meta.license == whatever it's supposed to be
<LnL> :o
<gchristensen> oh, just kidding, I thought I had it but I don't
<gchristensen> ah here it is in all its hellish glory https://gist.github.com/grahamc/cc261485efe823e457ca876c76fae90e
* LnL stares
<gchristensen> awwwyeah
<LnL> did you know echo "1 +1 " | nix-instantiate --eval - works?
<gchristensen> I did not
<gchristensen> this could easily be less bad by using the data ofborg already has in RAM
<LnL> or cat <<-EOF | nix-instantiate --eval - in this case
<gchristensen> but I've not added it because, well, mass-rebuilder.rs
<LnL> yeah, that would be really cool
<gchristensen> if I just made it a teensy bit better on a daily basis, it might one day become reasonable
<LnL> oh what! you get the diff from ofborg
<gchristensen> I get the list of changed attributes
<gchristensen> if let Some(attrs) = rebuildsniff.calculate_rebuild() { in massrebuilder.rs
<Mic92> the rust is forgiving when writing bad code, I feel. I had the same intention, when doing my project.
<gchristensen> which project was that?
<Mic92> cntr.
<gchristensen> ahh
<gchristensen> I always sort of wanted my amqp workers to be pure functions-ish, mass rebuilder is complicated because it talks to github a lot
<gchristensen> (not because, but that is one thing it does which is complicated :))
<gchristensen> I've considered having it, instead of talking to github, emitting jobs to a queue
<Mic92> How do you develop ofborg?
<gchristensen> and having a set-github-status queue
<Mic92> I had the problem that I don't know how to test ofborg on my laptop
<gchristensen> it is horrible, Mic92. horrible. I stop a corresponding worker in production and run it locally with a prod config.
<Mic92> gchristensen: could maybe record the requests from github somehow, so that one could replay them locally? Maybe there is some rust equivalent to: https://github.com/kevin1024/vcrpy
<gchristensen> yeah, that could help
<gchristensen> the intention of pure functions was you didn't need to mock anything out, of course -- just send some messages in and see what messages came out
<gchristensen> but road to hell, good intentions, etc
<Mic92> gchristensen: or maybe we could have a fake nixpkgs for testing?
<Mic92> or clone
<gchristensen> yea
<gchristensen> there is some of that
<samueldr> last time I worked on the vagrant setup, it was setting up a rabbitmq queue correctly
<Mic92> When dealing with external apis I don't feel like pure function are helping a lot.
<Mic92> Because you don't know what your input and outputs is supposed to be.
<gchristensen> no, but they don't have to work that way -- the PR evaluator is basically write-only to github's API
<gchristensen> if they did more (any?) reading, I'd 100% agree
<LnL> I don't think the api usage is complicated enough that a stub is needed