GNU bug report logs - #75789
[PATCH Debbugs] Factor cache accesses into dedicated functions

Previous Next

Package: emacs;

Reported by: Morgan Smith <Morgan.J.Smith <at> outlook.com>

Date: Thu, 23 Jan 2025 18:35:01 UTC

Severity: wishlist

Tags: patch

Fixed in version 31.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Morgan Smith <morgan.j.smith <at> outlook.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 75789 <at> debbugs.gnu.org
Subject: bug#75789: [PATCH Debbugs] Factor cache accesses into dedicated functions
Date: Sun, 09 Feb 2025 21:01:30 -0500
[Message part 1 (text/plain, inline)]
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Morgan Smith <Morgan.J.Smith <at> outlook.com> writes:
>
>> Hello!
>
> Hi Morgan,
>
Hi Michael,

Apologies for the delay.  I started a new job the day after I sent this
email!

>> Just a little bit of code cleanup.  I hope this is helpful.
>>
>> You'll notice I removed a bit in `debbugs-newest-bugs' that was supposed to
>> temporarily generate a null value.  I'm not entirely certain but I don't
>> believe that actually does anything right?  Immediately after that we make a
>> synchronous soap call anyways and then return that value.
>
> I don't know. See the comment you've removed as well:
>
> --8<---------------cut here---------------start------------->8---
>> -	  ;; Due to `debbugs-gnu-completion-table', this function
>> -	  ;; could be called in rapid sequence.  We cache temporarily
>> -	  ;; the value nil, therefore.
> --8<---------------cut here---------------end--------------->8---
>
> Have you checked that this doesn't happen without the temporary
> setting?

I'm honestly still not sure.  Maybe it's a simple test but I'm still
scared of completion tables from a bad experience a few years back.
I've just made some modifications so the same logic is in place.

>
> Some few comments:
>
>> index ce6489ca39..d0aa9e87b4 100644
>> --- a/test/debbugs-tests.el
>> +++ b/test/debbugs-tests.el
>> @@ -28,6 +28,10 @@
>>
>>  (require 'debbugs)
>>
>> +;; TODO: This shouldn't be necessary but I get the error
>> +;; "(void-variable debbugs-gnu-use-threads)" without this
>> +(require 'debbugs-gnu)
>
> Oops. This is an existing bug. I will try to fix it later.
>

Thanks for fixing that!

>> +(add-function
>> + :around (symbol-function #'debbugs-get-cache)
>> + #'debbugs-test--override-float-time)
>> +
>> +(add-function
>> + :around (symbol-function #'debbugs-put-cache)
>> + #'debbugs-test--override-float-time)
>
> This is wrong as-it-is. The extended definitions of debbugs-*-cache will
> persist after running the tests. A strict rule is, that all changes must
> be reverted after running the tests.

This is being violated in the current tests by the stubbing out of
`soap-invoke-internal'.  Please see the first attached patch where I fix
this.

> I don't believe you need this. Keep the (cl-letf (((symbol-function
> #'float-time) ...))) clause in debbugs-test-get-status, and do the same
> in debbugs-test-newest-bug-cached.

I wanted a clean wrapper around the cache functions to make it easy for
future testing.  Specifically, I want to add a feature so the cache
survives an emacs restart.

> Otherwise, it looks good to me. Please push to the debbugs repo; I'll
> play with it for a while before making a new release.

I don't believe I have push access to the repository.

> Thanks, and best regards, Michael.

Thanks for reviewing my patches!

Morgan

[0001-tests-Call-new-setup-and-teardown-functions-in-tests.patch (text/x-patch, attachment)]
[0002-Factor-cache-accesses-into-dedicated-functions.patch (text/x-patch, attachment)]

This bug report was last modified 94 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.