mycognosist / solar

A minimal Secure Scuttlebutt replication node.
Other
22 stars 2 forks source link

fix: return full feed including last message #46

Closed black-puppydog closed 1 year ago

black-puppydog commented 1 year ago

probably a typo? before, the feed RPC would return all messages except the last one. Noticed when a publish call returned an unexpected sequence number.

mycognosist commented 1 year ago

@black-puppydog

You are quite right. Good catch and thanks for the PR! So nice to have a second set of eyes looking at this :)

Do you mind adding a test for this? You'll find a bunch of checks bundled together in the test_append_feed() test on L327. You could add the following at the very end of that test:

// Get all messages comprising the feed.
let feed = kv.get_feed(&keypair.id).unwrap();

// Ensure that two messages are returned.
assert_eq!(feed.len(), 2);
black-puppydog commented 1 year ago

hah, in fact I was writing on some tests yesterday but was too tired to continue so I left this PR as a sort of bookmark :D

black-puppydog commented 1 year ago

okay got it. two commits: one introduces the test, one fixes the test

black-puppydog commented 1 year ago

Oooookay I have it now. @mycognosist I might have enabled CI for this because I was working on my own master, so the title doesn't reflect the right scope. BUT...

  1. I think the CI would be good to have here, too. :)
  2. In the process of making this I came across this issue in clippy.