diff options
author | Eric Wong <e@80x24.org> | 2021-10-03 19:07:17 -0500 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-10-04 03:36:28 +0000 |
commit | b28e74c9dc0acad164187f6f584f815df1bc6ec7 (patch) | |
tree | 0b223e4f48d2a87ec87557a53fc2d6ba2ef9ee77 /t | |
parent | c2b4e6111a561095d5155402d6900dae09b704eb (diff) | |
download | public-inbox-b28e74c9dc0acad164187f6f584f815df1bc6ec7.tar.gz |
Unlike v1 inboxes (which don't accept duplicate Message-IDs at all), and v2 inboxes (which generate a new Message-ID for duplicates), extindex must accept duplicate Message-IDs as-is. This was fine for storage, but prevented the reference-cycle mechanism of our message threading display algorithm from working reliably. It could no longer delete the ->{parent} field from clobbered entries in the %id_table. So we now take into account reused Message-IDs and never clobber entries in %id_table. Instead, we mark reused Message-IDs as "imposters" and special-case them by injecting them as children after all other threading is complete. This cycle was noticed using a pre-release of Devel::Mwrap::PSGI: https://80x24.org/mwrap-perl.git
Diffstat (limited to 't')
-rw-r--r-- | t/thread-cycle.t | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/t/thread-cycle.t b/t/thread-cycle.t index 4b47c01c..e89b1846 100644 --- a/t/thread-cycle.t +++ b/t/thread-cycle.t @@ -96,7 +96,26 @@ if ('sorting by Date') { is("\n".$backward, "\n".$forward, 'forward and backward matches'); } -done_testing(); +SKIP: { + require_mods 'Devel::Cycle', 1; + Devel::Cycle->import('find_cycle'); + my @dup = ( + { mid => 5, references => '<6>' }, + { mid => 5, references => '<6> <1>' }, + ); + open my $fh, '+>', \(my $out = '') or xbail "open: $!"; + (undef, $smsgs) = $make_objs->(@dup); + eval 'package EmptyInbox; sub smsg_by_mid { undef }'; + my $ctx = { ibx => bless {}, 'EmptyInbox' }; + my $rootset = PublicInbox::SearchThread::thread($smsgs, sub { + [ sort { $a->{mid} cmp $b->{mid} } @{$_[0]} ] }, $ctx); + my $oldout = select $fh; + find_cycle($rootset); + select $oldout; + is($out, '', 'nothing from find_cycle'); +} # Devel::Cycle check + +done_testing; sub thread_to_s { my ($msgs) = @_; |