By the way, do you remember this bit?
As for today's subject, I've been brewing a couple of V patches in my lab over the last month or so. [...] This comes after about nine months of not touching the code at all; and I sure as hell hope I don't have to add anything new in the next eighteen.
Except it's been less than sechs months and here I am, with another couple of V patches brewin' in my lab for the last month or so. I suppose Feedbot has gathered some active users over the last year, which usage led to more errors being discovered, which... well, this makes me quite happy, to be honest!
Anyhow, the first patch:
fixes some odd behaviour found when one of the users (who shall remain anonymous) entered a command along the lines of:
!1 http://my-url/feed
which, to be more precise, led to a crash. But what if http
had been a (Common Lisp) package, and what if //my-url/feed
were some actual symbol within that package? So if you happen to use Feedbot and are inclined towards this kind of thing, don't be shy and do check whether it properly rejects silly inputs. I don't have any bounties for this, but thou shalt have my gratitude nevertheless.
The second patch:
coming from complaints in the forum, sounds like this:
diff -uNr a/botworks/feedbot/feedbot.lisp b/botworks/feedbot/feedbot.lisp
--- a/botworks/feedbot/feedbot.lisp 589a6539ef2bb2470fa15c6f9dfcdc6aa02852b066f732c247864d7b7ae9244cb3442350ab4d28af819160f2f1fe8a4d9b585924e482a0ff390f6560935784c0
+++ b/botworks/feedbot/feedbot.lisp 104d50f6f616e19038aeec3127eb78e250672791149dec8abc72abed0af768fa824df8fb50eae7b84ff3316eafb0b83784959306f1ea50f783865b43bde9848d
@@ -211,8 +211,10 @@
new-entries))))
;; Delete old entries
(delete-stale-entries-in-feed! feed entries)
- ;; Return new entries
- new-entries)))
+ ;; Return new entries; here we assume that the entries were
+ ;; taken in from newest to oldest, so we return the list
+ ;; reversed, so that they can be delivered fifo.
+ (nreverse new-entries))))
;; -- b.
(defmacro with-feed-db ((feed-db) bot &body body)
@@ -725,8 +727,19 @@
(return-from cmd-body))
;; Nick is subscribed -- remove from rcpt list
- (delete-rcpt-from-feed! feed rcpt)
- (respond-unsubscribed bot rcpt url))))))
+ (delete-rcpt-from-feed! feed rcpt)))
+
+ ;; Nick might have pending messages in the queue ready to be
+ ;; delivered to him/her -- purge them.
+ (flet ((to-rcpt-p (msg)
+ (string= (get-msg-to! msg) rcpt)))
+ (with-msg-queue (msg-queue) bot
+ (setf msg-queue
+ (delete-msgs-from-queue-if! msg-queue #'to-rcpt-p))))
+
+ ;; We have successfuly unsubscribed rcpt from url; let the user
+ ;; know.
+ (respond-unsubscribed bot rcpt url))))
(trilemabot-define-cmd (:list bot message target arguments)
(declare (ignore arguments))
diff -uNr a/botworks/manifest b/botworks/manifest
--- a/botworks/manifest 3bc51c1efff2bde00958ec987c4c4953136f26139ef85c36ee07eb7dd34ff6b78b7bb3e185e1938f5782b6dfbfc5110a6e2d98bfddb11b5b326136025105459b
+++ b/botworks/manifest cc66f39a74683840cd8aad3ce309c6cc8f8ae879d18402aea4303723f7ef9d6c8c8b82732782d7a11101c2749cbfa8e7593000c25a24c469514e64ca69b2db03
@@ -8,3 +8,4 @@
595463 trilemabot-voicer-tweaks spyked add load-otp-stash method; add default path param value for -otp-stash methods
595780 feedbot-concurrency-fixes spyked fix bot crashes when message queue gets loaded; decouple feed grabbing from locked db updates; remove useless methods
613858 trilemabot-robustize-command-parsing spyked make trilemabot command parser more robust
+614472 feedbot-fixes-msg-delivery spyked fix message delivery behaviours: deliver messages in temporal order/reverse order of appearance in the feed; and *do not* deliver any messages to unsubscribed nicks
which should be pretty self-explanatory, really.
Following this rather pleasant experience1 of fixing some crap out of my machinery, the principal idea which stays with me is that source code -- along with, perhaps, many of the (by)products of "engineering" in general -- is so shitty mainly because it lacks (among others) clarity, that is, the property of being built upon clear concepts, themselves constructed upon priors which (among others) leave no room for ambiguity. Moreover, since V is here, this clarity requirement applies as well to changes occuring to software and to the structure of V trees themselves.
Thusly... well, there's no grand lesson here I suppose, other than that I've understood that I should strive as much as possible for such clarity in the future.
-
For what it's worth, Common Lisp remains one of the most pleasant languages to not only write, but also maintain code in. But what is this "pleasant" I keep mentioning?
Don't get me wrong, this is very clearly not about the language, but about a certain style of writing code, that certain languages, through their structure, seem to facilitate more or less -- a style which ensures that, through the very way the code is organized and written, it's going to be quite easy to load in head when needed; and conversely, absent this style of writing, the code will take orders of magnitude more effort to work with. I've personally looked at clear and concise code written in anything from assembly to C++ and from Ada to Forth. It's all a matter of choosing the adequate abstractions for the job and maybe Common Lisp is just a particularly good fit for IRC bots. To be honest, ircbot-lisp doesn't sound like such a horrible idea to me. ↩
Great read, and thanks again for taking time to provide me with the links and assistance in irc.
I was able to press using esthlos-v and so far have had no hiccups. I also agree with your sentiment that Common Lisp is " one of the most pleasant languages to not only write, but also maintain code in". Once I have done more testing in my channel, I will likely mirror this patchset on my site sans the python command routing junk, which I certainly will never have a need for.
Cheers! Great to hear the tree presses with esthlos-v.
> I will likely mirror this patchset on my site
Cool, let me know when you have a mirror up, so I'll link it back somewhere.
[...] when I fixed this? Well, it seems my fix works except when it doesn't, which reveals a deeper problem with the [...]
[...] Feedbot and you're wondering what's new, I'd like to let you know that not much has changed since the winter update. Or rather, not much was expected to change, until very recently, when some Freenode [...]
[...] linguistic comprehension is needed to internalize the specification of some problem in a clear language -- which is why, yes, specification is the bottleneck! -- but other than that, the same [...]
[...] engineering lies with the poor language itself, with the unexamined practice of writing code before clearly specifying what it's supposed to do. I am not blaming engineers in particular for this either, as [...]
[...] it, and among all the programming systems that I've humbly tried, I still find it the most powerful for solving problems of arbitrary [...]