/srv/irclogs.ubuntu.com/2009/12/23/#launchpad-reviews.txt

=== abentley1 is now known as abentley
stubbac: https://code.edge.launchpad.net/~stub/launchpad/librarian-gc/+merge/16486 (cherry pick candidate addressing critical bug)03:08
jtvhi bac!  is that topic line still current?03:17
mwhudsoni doubt it03:20
mwhudsonstub: how did that librarian-gc bug happen?03:23
mwhudsonjtv: i can do a review for you if you want03:24
jtvmwhudson: very kind, but only asking03:24
jtvdon't need anything reviewed03:24
stubIt died with abel's recent refactoring (dropping LibraryFileContent.deleted, replacing with a NULLable LibraryFileAlias.content)03:25
mwhudsonstub: ah ok03:26
stubPreviously we just set the LibraryFIleContent.deleted for expired files if there are no other unexpired references to that content. That code was removed, and not replaced.03:27
mwhudsonstub: would it be possible to write that query using storm's query builder?03:29
=== stub1 is now known as stub
mwhudsonstub: would it be possible to write that query using storm's query builder?03:30
mwhudsonstub: also, i think a comment in the tests about the timescale of "recent" would be nice03:31
stubYes, but I doubt it would be more readable and the rest of the file uses raw SQL03:31
mwhudsonok03:31
stubI didn't want to infect the tests with definitions for recent etc. because that can change03:32
mwhudsonwell03:32
mwhudsonwhen i read the test i had no idea if a day ago was recent03:32
stubI suspect we will be turning it down from 1 week to 1 or 2 days shortly based on elmo's comments maintaining debian archives03:33
stubok03:33
mwhudsoni guess it would be better if both the code and the tests keyed off a config value03:34
stubI'll add comments to that effect (1 day old is certainly recent, 30 days is certainly well expired, and values in between depend on the current settings in the garbage collector but are not really that important)03:34
mwhudsonstub: that would be great, thanks03:34
stubYer - nobody ever gets around to adding it as a config value ;)03:34
stubThis is a cherry pick so I have an excuse this time ;)03:34
mwhudsonwell, there's no time like the present!03:35
mwhudsonheh, darn, foiled03:35
* mwhudson reviews in the webapp03:37
stubAhh.... I should use self.recent_past actually03:46
stubAnd add the comment there.03:46
mwhudsonheh03:46
mwhudsonyes please :)03:46
stubhttps://code.edge.launchpad.net/~stub/launchpad/librarian-report/+merge/1652204:40
stub(not at all urgent)04:40
stub(but short)04:40
=== stub changed the topic of #launchpad-reviews to: on call: - || reviewing: - || queue [] || This channel is logged: http://irclogs.ubuntu.com || https://code.edge.launchpad.net/launchpad/+activereviews
stubjtv: https://code.edge.launchpad.net/~stub/launchpad/librarian-report/+merge/16522 still needs its bureaucracy dealt with.10:38
jtvstub: oh, I thought bac approved that one?10:38
jtvstub: I still hate you for using slashes in dates, but given that it's a matter of "whatever the db accepts"...10:39
stubclick the button and stop wining like a bitch10:40
jtvstub: I already did, nigga10:40
stubThank you my good man.10:42
=== jtv changed the topic of #launchpad-reviews to: on call: jtv || reviewing: - || queue [] || This channel is logged: http://irclogs.ubuntu.com || https://code.edge.launchpad.net/launchpad/+activereviews
jpdshttps://code.edge.launchpad.net/~jpds/launchpad/fix_489363/+merge/16531 - is good to go. :)11:30
jpdsjtv: Maybe you could take a look?^ :)11:54
jtvjpds: I'm OCR today, so that sounds reasonable.  :-)11:54
=== jtv changed the topic of #launchpad-reviews to: on call: jtv || reviewing: jpds || queue [] || This channel is logged: http://irclogs.ubuntu.com || https://code.edge.launchpad.net/launchpad/+activereviews
jtvjpds, a pattern I've found massively useful to know about: when you find yourself retrieving the current time, isolate it in a method that your test can override.11:57
jtvjpds: for instance, I think your test will fail after december 31st, 9999 and you can avoid that by dictating the time.11:57
jtv(hurry!)11:57
jtvjpds: I'd suggest two separate tests—one with the real time to ensure that logging doesn't break due to differences between "naïve" and "timestamp-aware" timestamps and such, but doesn't really care about the output; and another that fakes the time and looks for an exact match.11:58
henningejtv: fancy a review of the intltool detection code?12:00
=== henninge changed the topic of #launchpad-reviews to: on call: jtv || reviewing: jpds || queue [henninge] || This channel is logged: http://irclogs.ubuntu.com || https://code.edge.launchpad.net/launchpad/+activereviews
jtvhenninge: cool!12:00
henningejtv: actually, the biggest part is translation domain extraction now ...12:00
jtvjpds: I do like your logging mixin, and it makes it very easy to get this testing right12:00
jtvjpds: taking a step back though, why not the standard logging module?  The log files from our scripts do have timestamps.12:02
jpdsjtv: Those are interesting senarios, will look into them.12:04
jpdsjtv: Which module is that?12:04
jtvjpds: "import logging"12:04
jtvI'm sure it has a facility somewhere for directing to a file as well.12:04
jtvit seems the sort of wheel you're doomed to reinvent here12:04
jpdsjtv: Hmm, well, the changes I've made are the ones sinzui suggested.12:05
jtvjpds: then I defer to his wisdom... he's not the sort to miss a thing like that12:05
jtvjpds: I'd definitely try to move log_file into LoggingMixin entirely, so ArchiveMirrorProberCallbacks doesn't need to know about it; and make the test just pass a StringIO in its place.12:06
jtvThen afaics you don't need to create that fake logging class for your test12:08
jpdsjtv: OK, I'll look into that.12:16
jtvjpds: meanwhile I'll go have my team standup :-)12:17
allenapjtv: Oops, I just remembered I'm OCR today too.12:28
bachi henninge12:28
henningebac:  in call atm12:28
jtvallenap: the more the merrier... I can start work on henning's branch soon though12:29
bachenninge: ok.  i looked at your 'deactivate a user' branch yesterday but it still had test failures12:29
allenapjtv: Okay, cool. I think it makes more sense for you to do his branch in any case.12:30
jtvy12:30
henningebac: Hi!12:34
henningebac: yes, I am aware of that.12:34
jtvjtv หิว12:34
=== jtv is now known as jtv-eat
henningebac: I had meant to pass the branch on to intellectronica but never got around to it.12:35
henningebac: We just agreed that I will fix and get this done today, so it can land.12:36
bachenninge: ok, cool.  if you need me to look at it tomorrow i'd be happy to.12:36
bac(i'm off today)12:36
henningebac: great! I feared I might not get a reviewer tomorrow ... ;) Although, we may not have much overlap since I am off in the afternoon.12:37
bachenninge: i can review it and if it needs no revisions could even land it for you12:38
henningebac: cool, thanks.12:38
=== jtv-eat is now known as jtv
jtvhenninge: I find check_potfiles_in a bit hard to read... why not:13:16
jtv    command = (13:16
jtv        "cd '%s' %% rm -f missing notexist && intltool-update -m" % path)13:16
jtv?13:16
jtv(Although with variables on command lines in gnu systems it's usually a good habit to add a "--" to avoid accidental injection of command-line options)13:17
jtvSpeaking of which, I suppose path needs escaping.13:17
jtvhenninge: did you get my note about check_potfiles earlier?13:41
jtvjpds: any progress?13:41
jpdsjtv: Sorry, popped out for lunch.14:04
jtvjpds: I'm asking since I won't be sticking around for too much longer14:04
jpdsjtv: So far I have http://paste.ubuntu.com/345345/ - now I *think* I have to create something like DummyProductReleaseFinder in lib/lp/registry/tests/test_prf_finder.py /14:06
jtvjpds: the method looks fine... why the DummyProductReleaseFinder?14:07
jpdsjtv: So I can make _getTime return a predetermined datetime?14:08
jtvjpds: in the tests?  You can just re-assign the method as if it were a member variable.14:08
jpdsjtv: That's what I meant, like: http://pastebin.ubuntu.com/345349/14:09
jtvjpds: why not instantiate a normal LoggingMixin in the test (no special class) and insert a fake _getTime there?14:10
jtvjpds: same for setting log_file (and btw I don't see why the logfile variable is needed there)14:10
jpdsjtv: special class> Can you give me an example?14:19
jpdsjtv: logfile> Copied that from what Curtis suggested.14:19
jtvjpds: something like prober = LogginMixin() ; prober.log_file = StringIO() ; prober._getTime = fake_gettime"14:20
jtv...where fake_gettime is a function that you create in your tests, which returns a fixed datetime.14:21
jtvjpds: as mentioned, it'd be nice if the log_file could be passed to the LoggingMixin as a constructor argument—that'd also remove ugliness from the test.14:23
henningejtv: I am back14:30
henningejtv: saw your note, let me look at it14:30
jtvhenninge: I'm working on a reply in the MP right now14:30
henningejtv: I copied that call to intltool-update from danilo's damned lies code and he was using dicts with format strings all the time.14:33
jtvhenninge: it can be a nice thing to do, but in this case in _my_ opinion it harms readability more than it helps.14:34
henningejtv: but I have no problem writing it the way you suggested, except for the single vs. double quotes. I don't think they are as equal as they are in python.14:34
jtvjpds: note fake_gettime is private, so better start its name with an underscore14:34
jtvhenninge: no they aren't...  double-quotes allow the variable to pull a lot more tricks.  That's why I usually use single quotes in shell scripts.14:35
henningeI see14:35
jtvbut ultimately the only way to make it safe is to escape the variable14:35
jpdsjtv: Correct fake_gettime.14:38
jpdscorrected*14:38
jtvjpds: what was the problem?14:38
jtvyou said something about it getting overridden?14:39
jpdsjtv: Oh, just the underscore thing.14:39
jtvah14:39
henningejtv: hm, do what do we have to do the escaping. I am a bit stumped atm.14:39
jtvhenninge: good question :/14:40
jtvI'm running out of time here, but you could google for shell escaping in python14:40
henningejtv: that's fine.14:41
jtvor alternatively, prove to me that what's in that variable isn't going to be a problem in our use case :-)14:41
henningejtv: it isn't because the paths are provided from another function that gets them from the file system.14:42
henninge(that sentence should probably be using singulars to be clearer)14:42
jtvhenninge: perhaps... I don't see how it implies that the string is safe14:43
=== allenap changed the topic of #launchpad-reviews to: on call: jtv, allenap || reviewing: jpds, - || queue [henninge] || This channel is logged: http://irclogs.ubuntu.com || https://code.edge.launchpad.net/launchpad/+activereviews
henningejtv: because it is not entered by a user but derived from a system call.14:44
henningejtv: the top-level function only works on the current directory, no chance for someone to get in  a malicious parameter.14:45
jtvjpds: in your test, you could now verify that the log message is what you expect using a simple self.assertEqual(expected_value, actual_value)14:45
jpdsjtv: Ah, I just took a self.failUnlessEqual() and am running the tests now. :)14:46
=== allenap changed the topic of #launchpad-reviews to: on call: jtv, allenap || reviewing: jpds, - || queue [henninge, allenap] || This channel is logged: http://irclogs.ubuntu.com || https://code.edge.launchpad.net/launchpad/+activereviews
jtvhenninge: the path comes from a parameter... I don't see anything here that tells us what that parameter might be14:47
jtvjpds: that's fine too14:47
henningejtv: you were talking about our particular use case ...14:48
jtvhenninge: yes, but I still don't know why a package couldn't have a directory "\" ; rm -rf / ; echo \""14:49
jpdsjtv: The test passes. :)14:53
jtvjpds: \o/14:53
=== salgado is now known as salgado-lunch
jtvnow, with these tricks you sometimes get subtle little type mismatches the fake you injected isn't quite compatible with what the real call would have given you.  So you'll also want a test without the fake, and without testing the output in detail, just to make sure using a real time doesn't break.14:54
* jtv left out a word there14:54
jtvyou sometimes get subtle little type mismatches _where_ the fake you injected isn't quite compatible14:55
sinzuiWas the word "waffle"?14:55
jpdsjtv: OK, and what should I do about the 31/12/9999 thing?14:56
jtvjpds: I don't serious think we need to worry about the Y10K problem just yet.  :-)  In fact, that second test should be very lightweight—it really just needs to break when the datetime trick you pulled in your current test is wrong.14:57
jtv*seriously14:58
* jtv must be very tired14:58
sinzuijpds: The date should be formatted at 2011-01-3115:03
sinzuidates are bigendian in reality15:04
allenapsinzui: Are you reviewing https://code.edge.launchpad.net/~jpds/launchpad/fix_489363/+merge/16531, just passing through, or talking about something else? In either of the last two cases, I'll review it.15:09
jtvallenap: I think that's the one I'm looking at15:10
jtvyes, it is15:10
allenapjtv: Okay, I'll leave it alone then.15:10
sinzuiallenap: I am passing through. I saw a confusing date and had to remark on it15:10
allenapsinzui: Cool, thanks.15:10
jtvjpds: sinzui was right about the date btw...  slashes in dates are pure, unmitigated, 7th-circle-of-hell evil15:11
jpdssinzui, jtv: I'm not doing slashes in dates, I'm just doing: "Wed Oct 20 12:00:00 2004".15:21
jtvjpds: I think he was just commenting on how you wrote it in here.  :-)15:21
sinzuiI was15:22
=== salgado-lunch is now known as salgado
allenapjtv: Why are slashes so bad in dates? Honest question :)15:34
jtvallenap: what date is 08/09/10 ?15:35
allenapjtv: But what date is 08-09-10?15:35
jtvallenap: at least the convention there is pretty unambiguous: September 8 of next year15:35
henningejtv: do you like this better? http://paste.ubuntu.com/345393/15:38
henningejtv: it avoids the shell completely15:38
jtvhenninge: wow!15:39
henningethat can mean anything15:39
jtvhenninge: nonsense...  it can not mean, for instance, "the 3rd decimal of pi is 1"15:40
henningeok, but apart from that ...15:40
allenapjtv: I suppose so. I hoped everyone learnt to use the full year about a decade ago. As for month and day ordering, I think there's only the Americans to blame. Alas, 300 million people are difficult to ignore.15:40
jtvhenninge: in this case I mean to express admiration at your solution.15:40
henninge"Wow, this is great!" or "Wow, I have never seen such rubbish!"15:40
henningeoption 1 it is15:41
henningejtv: I am glad you llike it ;)15:41
jtvallenap: that's it in a nutshell... ostracizing them would be difficult and could be called discrimination, so the easiest way out is to ostracize the slash instead15:41
jtvhenninge: and "call" looks a lot simpler than Popen too15:42
henningea little googling and RTFM15:44
=== beuno is now known as beuno-lunch
=== jamalta_ is now known as jamalta
henningejtv: did you have any other points to raise about the branch?16:10
jtvhenninge: yes, still working on that reply in the mp16:11
henningejtv: anything we can short-cut here?16:11
jtvhenninge: I'm almost through, hang on16:11
jtvhenninge: I've posted a reply16:18
jtvhenninge: feel free to point out where I get nonsensical...  I seem to be making a lot of mistakes tonight16:19
sinzuiallenap: jtv: I have a CP candidate that will appear in reviews in a few minutes16:19
allenapsinzui: I can take it.16:19
jtvallenap: I was about to ask.  Thanks.  :)16:19
sinzuiflacoste will check it after it clears review and we verity it on staging16:19
* henninge checks Bangkok time16:20
henningejtv! Go to bed!16:20
jtvhenninge: soon!16:21
henningejtv: today! (your today)16:21
jtvhenninge: that'd be hard, unless I sleep in the office16:21
jtvjpds: test_logMessage_ensure_message looks good...  in test_logMessage_fake_time you can also use a local variable instead of a class member; then everything referring to self.prober can go away and you'll end up with just 3 methods.16:24
jtv_fake_gettime, test_logMessage_fake_time, and test_logMessage_ensure_message16:24
jtvjpds: I wouldn't call the middle one test_logMessage_fake_time though; that's how you test, but you want to say what behaviour you're testing—maybe test_logMessage_output because you're actually verifying the output16:25
jtvjpds: in a similar vein, maybe test_logMessage_integration for test_logMessage_ensure_message since you're testing the integration.  (A bit far-fetched perhaps; but it seems weird to say both "test" and "ensure" for the same thing in the same identifier)16:26
=== salgado is now known as salgado-afk
=== allenap changed the topic of #launchpad-reviews to: on call: jtv, allenap || reviewing: jpds, sinzui || queue [henninge, allenap] || This channel is logged: http://irclogs.ubuntu.com || https://code.edge.launchpad.net/launchpad/+activereviews
=== jtv changed the topic of #launchpad-reviews to: on call: jtv, allenap || reviewing: {jpds, henninge}, sinzui || queue [allenap] || This channel is logged: http://irclogs.ubuntu.com || https://code.edge.launchpad.net/launchpad/+activereviews
jtvallenap: that's a nice corner I've painted you into...16:41
allenapjtv: Hehehe :)16:42
allenapallenap: r=me, it's Christmas after all.16:42
jpdsjtv: All done and pushed.16:42
al-maisanjtv: not sure what time it is on your end but the branch we discussed earlier is now ready for review: https://code.edge.launchpad.net/~al-maisan/launchpad/pending-jobs-499861/+merge/1655016:46
jtvallenap: wait... you can _do_ that!?16:47
jtval-maisan: far too late for another review!16:47
al-maisanjtv: understood ..or maybe allenap could take a look at it?16:47
al-maisanif it's not too late for him16:47
jtvjpds: and since I'm being difficult... LogginMixin & its methods need to have docstrings.  :-)16:48
allenapal-maisan: I very much doubt I'll get to it. It's my last day today and I have some other things to finish off after doing sinzui's branch and before going afk.16:48
al-maisanallenap: I understand .. never mind .. have a nice break!16:48
allenapal-maisan: Thanks :)16:48
al-maisanjtv: are you around tomorrow by any chance?16:49
jtval-maisan: try bugging me about it tomorrow16:49
jtvheh16:49
al-maisanjtv: he he :)16:49
=== beuno-lunch is now known as beuno
jpdsjtv: Sure, done.16:51
jtvthanks16:51
jtvjpds: approved.  You can now "ec2 land https://code.edge.launchpad.net/~jpds/launchpad/fix_489363/+merge/16531"16:55
jpdsjtv: I don't have access to PQM.16:55
jtvjpds: nm I'll do it then16:55
=== salgado-afk is now known as salgado
jpdsjtv: Thanks!16:57
=== jtv changed the topic of #launchpad-reviews to: on call: allenap || reviewing: sinzui || queue [allenap] || This channel is logged: http://irclogs.ubuntu.com || https://code.edge.launchpad.net/launchpad/+activereviews
jtvallenap: that's me bowing out :)16:59
jtvhenninge: continue on your mp tomorrow?16:59
allenapjtv: Cheerio, until 2010 :)16:59
henningejtv: yes, I'll have something ready for you when you start.16:59
henningejtv: thanks for hanging around this long.16:59
jpdsjtv: Have a great holiday!16:59
jtvallenap: oh, you're not here tomorrow?  then happy 2553 BE!16:59
allenapjtv: Thanks :)17:00
jtvjpds: thanks, same to you!17:00
jtvhenninge: great, I like tag-team development17:00
jtvoh, it's midnight... no more trains.  :)17:00
allenapsinzui: All done, r=me.17:08
sinzuithanks. Have a lovely holiday17:09
=== salgado is now known as salgado-afk
=== allenap changed the topic of #launchpad-reviews to: on call: - || reviewing: - || queue [] || This channel is logged: http://irclogs.ubuntu.com || https://code.edge.launchpad.net/launchpad/+activereviews
=== salgado-afk is now known as salgado
=== salgado is now known as salgado-afk

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!