I'm noticing duplicates appear on the top list of HN. I've got a screenshot if people need one but thought I'd post this in case someone who can fix this views 'new' postings.
0. View frontpage with horror. Remind self not to panic.
1. Back out latest release, which contained a bunch of
low-level changes, and restart the server.
2. Use the server repl to analyze what's happening. Notice that the problem is duplication in the list of
top stories, because its len
is 180 and len:dedup of it is 157. Fix the
immediate problem with
(zap dedup ranked-stories*)
Now
there are only 157 top stories, but no one will notice.
2. The list of top stories is kept in order by reinserting things
into it when they get upvoted. Hypothesis: this code is not
recognizing duplicates.
4. The expression where it should get rid of duplicates is
(rem elt seq)
5. Why is that not working? Because I just stupidly expanded
the Arc testify operator to treat tables as tests, like
functions. What used to be
(def testify (x)
(if (isa x 'fn) x [is _ x]))
had become
(def testify (x)
(if (in (type x) 'fn 'table) x [is _ x]))
I thought I'd rarely want to find or remove a particular
table from a list. I'd be much more likely to want to use
one like a fn. Doh. I forgot all the items in News are tables.
6. Revert to old definition of testify, test on localhost, commit code, restart
server again.
7. Be really thankful that the problem was not some other much more frightening stuff we changed today, like the definition of atomic.
I think that just has to do with the javascript/DOM - DIV ids are supposed to be unique to a page so the upvote is just affecting the first one it finds.