get_about_info() returns incorrect values #31

Closed
opened 2022-02-25 12:58:15 +00:00 by glyph · 4 comments
Owner

When get_about_info(ssb_id) is given a recently-created ssb_id (ie. a fairly new profile), the correct information is returned. However, the same method returns incorrect data when given an ssb_id representing an older profile with many interactions.

Examples

@glyph profile data

all values incorrect except public key

public key: @HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519
image: &GjcN4mOTz66vSlNXP/PJq95eXYd75ggqrU34FF3uhdg=.sha256
name: hoodownr wisdom
description: This is a wiki listing of [Mumble](https://www.mumble.info/) servers that SSB peers are welcome to use. Hostname|Password|Operator|Location|Provider|Server -:|-|-|-:|-|- celehner.com||[@cel](@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519)|New York, NY, USA|DigitalOcean|uMurmur orient.celehner.com||[@cel](@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519)|Orient, NY, USA|physical|uMurmur west.celehner.com||[@cel](@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519)|San Jose, CA, USA|Vultr|uMurmur muchmuch.coffee||[@Daan](@MRiJ+CvDnD9ZjqunY1oy6tsk0IdbMDC4Q3tTC8riS3s=.ed25519)|Germany|Hetzner|Murmur blockades.org||[@dan hassan](@NeB4q4Hy9IiMxs5L08oevEhivxW+/aDu/s/0SkNayi0=.ed25519)|London, UK|DigitalOcean|Murmur sunshinegardens.org||[@xj9](@xuq5ATR6hDNt6/0q1RB+L1f0dyeVk1kG1JAXu4jo/GU=.ed25519)|Seattle, WA, USA|Vultr|Murmur
@cblgh profile data

all values incorrect except public key

public key: @C6fAmdXgqTDbmZGAohUaYuyKdz3m6GBoLLtml3fUn+o=.ed25519
image: &quNQxuelIlnkQiuW1P1okba5yt9+OvZl1mgddbjZjvc=.sha256
name: forums
description: We will gather for a series of Workshops and a shared dedicated time to improve on the SSB stack Documentation hosted by [@bumbleblue](@rvvWhg5LADU0yYPedpldTKR7aUj1JRBqaT4nFUbV26w=.ed25519) and [@zelf](@3ZeNUiYQZisGC6PLf3R+u2s5avtxLsXC66xuK41e6Zk=.ed25519) #### 7th of December 09:30-11:00 CET - welcome to the sprint! 14:00-15:00 CET - Voice and Tone 18:30-19:00 CET - EOD check-in #### 8th of December 09:30-11:00 CET - Information architecture map + sort 14:00-15:00 CET - [Drafts and feedback] | [Tutorial tests] 18:30-19:00 CET - EOD check-in #### 9th of December 09:30-11:00 CET - Morning coffee [open session] 14:00-15:00 CET - Voice and Tone 18:30-19:00 CET - Beer and pizza and next steps Time to sit back and relax, chitchat and admire the work we have put in, potlock is welcome, BYO, virtual or physical <3 _____________ More info to come 🌸
@notplants profile data

name and description are incorrect

public key: @5Pt3dKy2HTJ0mWuS78oIiklIX0gBz6BTfEnXsbvke9c=.ed25519
name: peachcloud
image: &aDH5RZ5cT3exyqKxgCf4ulsOvBkBfOo93LyHOSvN8W8=.sha256
description: # The Repair Library ![yarrow2.jpg](&pIeYO+EO100HVBfF+cJxdX3kits0828yi3wDYCv6Ch4=.sha256) *a drawing of Achillea Millefolium, commonly known as yarrow, a plant traditionally used in stanching the flow of blood from wounds* 📘🦎📕 Inspired by a few conversations that have been happening recently around the scuttleverse, and a long humyn history before that, this "event" is intended as a communal wiki for sharing resources and tools for community accountability and repair, in general and for the scuttleverse. how can we support each other in navigating conflict and harm individually or collectively? when you've learned you harmed someone, what are ways to approach repair? when you've been hurt, what resources are available? what do community accountability processes look like without police or prisons? what can this look like in an online space? conflict and harm happens, so how can we support each other and learn from it when it does? 📘🦎📕 This is a wiki for anyone who wants to think about (& practice) what individual or community accountability looks like. Feel free to add new sections, resources, or to share things in replies to the thread. You can also refer back to this by labeling things with #repair-library, or referencing this post. Below I've started some initial topics which can change as needed. ## Tools Specific To Scuttleverse [The Douchebag Jar](%yEELtVTisMHMYPQNZoJFBGQO/NoSXVJxRO4PSiM7dGM=.sha256), for when you are ready to apologize with more than just words Community Gardening/Therapy Fund (still being [discussed](%yEELtVTisMHMYPQNZoJFBGQO/NoSXVJxRO4PSiM7dGM=.sha256)) ## Apologizing Without Centering Yourself https://www.instagram.com/p/CCbw7ubAE_9/ from [@mia.mingus](https://www.instagram.com/mia.mingus/) https://www.instagram.com/p/CCUZcpXqgY0/?igshid=1od3xk3ewoysf from [@selflove_tribute](https://www.instagram.com/selflove_tribute/) ## Community Accountability Processes [The Consentful Tech Zine](http://www.consentfultech.io/wp-content/uploads/2019/10/Building-Consentful-Tech.pdf) ## Transformative Justice [A beautiful podcast exploring transformative justice in practice](https://pca.st/0owb143t) Jasmyn Elise Story is an international Restorative Justice Facilitator and founder of The People’s Coalition, an organization that aims to provide information, access, and resources to lower the impact of structural violence experienced by historically marginalized groups. Jasmyn recently bought a 15 acre farm in the heart of Alabama, which will be home to Freedom Farm Azul, a retreat space in the tradition of Fannie Lou Hamer and Frida Kahlo. In this powerful offering, Jasmyn walks us through transformative justice process as an alternative to traditional law enforcement and punitive justice, exploring communal listening, accountability, forgiveness, relational culture, plant medicine healing, and much more along the way.
When `get_about_info(ssb_id)` is given a recently-created `ssb_id` (ie. a fairly new profile), the correct information is returned. However, the same method returns incorrect data when given an `ssb_id` representing an older profile with many interactions. **Examples** ```text @glyph profile data all values incorrect except public key public key: @HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519 image: &GjcN4mOTz66vSlNXP/PJq95eXYd75ggqrU34FF3uhdg=.sha256 name: hoodownr wisdom description: This is a wiki listing of [Mumble](https://www.mumble.info/) servers that SSB peers are welcome to use. Hostname|Password|Operator|Location|Provider|Server -:|-|-|-:|-|- celehner.com||[@cel](@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519)|New York, NY, USA|DigitalOcean|uMurmur orient.celehner.com||[@cel](@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519)|Orient, NY, USA|physical|uMurmur west.celehner.com||[@cel](@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519)|San Jose, CA, USA|Vultr|uMurmur muchmuch.coffee||[@Daan](@MRiJ+CvDnD9ZjqunY1oy6tsk0IdbMDC4Q3tTC8riS3s=.ed25519)|Germany|Hetzner|Murmur blockades.org||[@dan hassan](@NeB4q4Hy9IiMxs5L08oevEhivxW+/aDu/s/0SkNayi0=.ed25519)|London, UK|DigitalOcean|Murmur sunshinegardens.org||[@xj9](@xuq5ATR6hDNt6/0q1RB+L1f0dyeVk1kG1JAXu4jo/GU=.ed25519)|Seattle, WA, USA|Vultr|Murmur ``` ```text @cblgh profile data all values incorrect except public key public key: @C6fAmdXgqTDbmZGAohUaYuyKdz3m6GBoLLtml3fUn+o=.ed25519 image: &quNQxuelIlnkQiuW1P1okba5yt9+OvZl1mgddbjZjvc=.sha256 name: forums description: We will gather for a series of Workshops and a shared dedicated time to improve on the SSB stack Documentation hosted by [@bumbleblue](@rvvWhg5LADU0yYPedpldTKR7aUj1JRBqaT4nFUbV26w=.ed25519) and [@zelf](@3ZeNUiYQZisGC6PLf3R+u2s5avtxLsXC66xuK41e6Zk=.ed25519) #### 7th of December 09:30-11:00 CET - welcome to the sprint! 14:00-15:00 CET - Voice and Tone 18:30-19:00 CET - EOD check-in #### 8th of December 09:30-11:00 CET - Information architecture map + sort 14:00-15:00 CET - [Drafts and feedback] | [Tutorial tests] 18:30-19:00 CET - EOD check-in #### 9th of December 09:30-11:00 CET - Morning coffee [open session] 14:00-15:00 CET - Voice and Tone 18:30-19:00 CET - Beer and pizza and next steps Time to sit back and relax, chitchat and admire the work we have put in, potlock is welcome, BYO, virtual or physical <3 _____________ More info to come 🌸 ``` ```text @notplants profile data name and description are incorrect public key: @5Pt3dKy2HTJ0mWuS78oIiklIX0gBz6BTfEnXsbvke9c=.ed25519 name: peachcloud image: &aDH5RZ5cT3exyqKxgCf4ulsOvBkBfOo93LyHOSvN8W8=.sha256 description: # The Repair Library ![yarrow2.jpg](&pIeYO+EO100HVBfF+cJxdX3kits0828yi3wDYCv6Ch4=.sha256) *a drawing of Achillea Millefolium, commonly known as yarrow, a plant traditionally used in stanching the flow of blood from wounds* 📘🦎📕 Inspired by a few conversations that have been happening recently around the scuttleverse, and a long humyn history before that, this "event" is intended as a communal wiki for sharing resources and tools for community accountability and repair, in general and for the scuttleverse. how can we support each other in navigating conflict and harm individually or collectively? when you've learned you harmed someone, what are ways to approach repair? when you've been hurt, what resources are available? what do community accountability processes look like without police or prisons? what can this look like in an online space? conflict and harm happens, so how can we support each other and learn from it when it does? 📘🦎📕 This is a wiki for anyone who wants to think about (& practice) what individual or community accountability looks like. Feel free to add new sections, resources, or to share things in replies to the thread. You can also refer back to this by labeling things with #repair-library, or referencing this post. Below I've started some initial topics which can change as needed. ## Tools Specific To Scuttleverse [The Douchebag Jar](%yEELtVTisMHMYPQNZoJFBGQO/NoSXVJxRO4PSiM7dGM=.sha256), for when you are ready to apologize with more than just words Community Gardening/Therapy Fund (still being [discussed](%yEELtVTisMHMYPQNZoJFBGQO/NoSXVJxRO4PSiM7dGM=.sha256)) ## Apologizing Without Centering Yourself https://www.instagram.com/p/CCbw7ubAE_9/ from [@mia.mingus](https://www.instagram.com/mia.mingus/) https://www.instagram.com/p/CCUZcpXqgY0/?igshid=1od3xk3ewoysf from [@selflove_tribute](https://www.instagram.com/selflove_tribute/) ## Community Accountability Processes [The Consentful Tech Zine](http://www.consentfultech.io/wp-content/uploads/2019/10/Building-Consentful-Tech.pdf) ## Transformative Justice [A beautiful podcast exploring transformative justice in practice](https://pca.st/0owb143t) Jasmyn Elise Story is an international Restorative Justice Facilitator and founder of The People’s Coalition, an organization that aims to provide information, access, and resources to lower the impact of structural violence experienced by historically marginalized groups. Jasmyn recently bought a 15 acre farm in the heart of Alabama, which will be home to Freedom Farm Azul, a retreat space in the tradition of Fannie Lou Hamer and Frida Kahlo. In this powerful offering, Jasmyn walks us through transformative justice process as an alternative to traditional law enforcement and punitive justice, exploring communal listening, accountability, forgiveness, relational culture, plant medicine healing, and much more along the way. ```
glyph added the
bug
label 2022-02-25 12:58:15 +00:00
Author
Owner

The filter on get_about_message_stream(ssb_id) seems to be broken. The stream seemingly returns all messages for the given ID.

The filter on `get_about_message_stream(ssb_id)` seems to be broken. The stream seemingly returns **all** messages for the given ID.
Author
Owner

The culprit:

L77 of src/messages.rs:

The matches! macro does not match to the level of the variant of the enums being tested, only to the top-level of the type. Since mtype and message_type are SsbMessageContentType, matches! will always return true, even if the variants are different. Ie. SsbMessageContentType::About and SsbMessageContentType::Vote are considered a match.

TIL.

pub fn is_message_type(&self, message_type: SsbMessageContentType) -> bool {
    let self_message_type = self.get_message_type();
    match self_message_type {
        Ok(mtype) => {
            matches!(mtype, message_type)
        }
        Err(_err) => false,
    }
}
The culprit: L77 of `src/messages.rs`: The `matches!` macro does not match to the level of the variant of the enums being tested, only to the top-level of the type. Since `mtype` and `message_type` are `SsbMessageContentType`, `matches!` will always return true, even if the variants are different. Ie. `SsbMessageContentType::About` and `SsbMessageContentType::Vote` are considered a match. TIL. ```rust pub fn is_message_type(&self, message_type: SsbMessageContentType) -> bool { let self_message_type = self.get_message_type(); match self_message_type { Ok(mtype) => { matches!(mtype, message_type) } Err(_err) => false, } } ```
Author
Owner

And the final fix:

We need to add the about_val check. This ensures that we only return about messages that are actually about the ssb_id (not just authored by the ssb_id). Previously we were returning all about messages involving ssb_id (even those which were about something else).

// if there are still keys we are looking for, then continue searching
match res {
    Ok(msg) => {
        // for each key we are searching for, check if this about
        // message contains a value for that key
        for key in &keys_to_search_for.clone() {
            let about_val = msg.content.get("about").and_then(|val| val.as_str());
            let option_val = msg
                .content
                .get(key)
                .and_then(|val| val.as_str())
                .map(|val| val.to_string());
            match option_val {
                // only return val if this msg is about the given ssb_id
                Some(val) if about_val == Some(ssb_id) => {
                    // if a value is found, then insert it
                    profile_info.insert(key.to_string(), val);
                    // remove this key from keys_to_search_for,
                    // since we are no longer searching for it
                    keys_to_search_for.retain(|val| val != key)
                }
                _ => continue,
            }
        }
    }
    Err(_err) => {
        // skip errors
        continue;
    }
}
And the final fix: We need to add the `about_val` check. This ensures that we only return `about` messages that are actually about the `ssb_id` (not just authored by the `ssb_id`). Previously we were returning all `about` messages involving `ssb_id` (even those which were about something else). ```rust // if there are still keys we are looking for, then continue searching match res { Ok(msg) => { // for each key we are searching for, check if this about // message contains a value for that key for key in &keys_to_search_for.clone() { let about_val = msg.content.get("about").and_then(|val| val.as_str()); let option_val = msg .content .get(key) .and_then(|val| val.as_str()) .map(|val| val.to_string()); match option_val { // only return val if this msg is about the given ssb_id Some(val) if about_val == Some(ssb_id) => { // if a value is found, then insert it profile_info.insert(key.to_string(), val); // remove this key from keys_to_search_for, // since we are no longer searching for it keys_to_search_for.retain(|val| val != key) } _ => continue, } } } Err(_err) => { // skip errors continue; } } ```
Author
Owner

Patched in PR#32.

Patched in [PR#32](https://git.coopcloud.tech/golgi-ssb/golgi/pulls/32).
glyph closed this issue 2022-02-26 12:21:43 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: golgi-ssb/golgi#31
No description provided.