<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!
<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