Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial TrustGraph integration (backend) #104

Closed
wants to merge 10 commits into from

Conversation

harlantwood
Copy link
Collaborator

@harlantwood harlantwood commented Mar 31, 2023

There is much useful context and short- and long- term discussion of TrustGraph integration in #94.

This PR is backend only, no frontend, to prepare for future full TrustGraph integration.

Feed

  • Feed by weight, over a certain recent time period
    • We query all TrustAtoms created by the Agent
    • We filter for those TrustAtoms above a weight threshold (nominally >= 0)
    • We follow those links to get their targets (followed agents)
    • We fetch posts from those agents which mention the relevant hashtags
    • We order these posts according to some combination of: weight of tags and recency (don't want to see very old highly weighted at top)

Following

  • In addition to our current "follows", we optionally add TrustAtoms which can be thought of as "nuanced follow information" -- eg ( "cuisine", 99% ).
    • DNA: create trustatom with topic/weight
  • A default follow is a TrustAtom with no weight (discuss: or 50%) and no topic (discuss: could be __FOLLOW__ or similar)
  • Remove the existing follow links, they are replaced by TrustAtoms

Unfollowing

  • On "unfollow", we will delete the relevant TrustAtoms

Consider

  • TG uses agent_initial_pubkey vs MF uses BOTH agent_latest_pubkey and agent_initial_pubkey

#[derive(Debug, Serialize, Deserialize, SerializedBytes)]
#[serde(rename_all = "camelCase")]
pub struct FollowTopicInput {
pub topic: String,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub topic: String,
pub topic: Option<String>,

pub struct FollowInput {
pub agent: AgentPubKey,
pub follow_topics: Vec<FollowTopicInput>,
pub follow_other: bool,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub follow_other: bool,

@@ -419,6 +551,23 @@ pub fn get_mews_with_mention(agent_pub_key: AgentPubKey) -> ExternResult<Vec<Fee
get_mews_from_path(path)
}

fn get_mews_from_path_by_author(path: Path, author: AgentPubKey) -> ExternResult<Vec<FeedMew>> {
let mut full_path = path;
full_path.append_component(hdk::hash_path::path::Component::from("by".to_string()));
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nuke the "by"

Suggested change
full_path.append_component(hdk::hash_path::path::Component::from("by".to_string()));

README.md Show resolved Hide resolved
@harlantwood harlantwood changed the title Initial TrustGraph integration Initial TrustGraph integration (backend) May 13, 2023
@harlantwood harlantwood self-assigned this May 13, 2023
@@ -0,0 +1,714 @@
use hdk::prelude::*;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO delete this file after harvesting the useful functions

@@ -0,0 +1,38 @@
use hdk::prelude::*;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to top level /crates/helpers
or break out into its own repo
or PR it to
https://github.com/holochain/hc-utils

@@ -27,6 +30,116 @@ pub fn get_all_mews_with_context(_: ()) -> ExternResult<Vec<FeedMew>> {
Ok(feedmews)
}

#[hdk_extern]
pub fn get_trusted_mews_with_context(input: RecommendedInput) -> ExternResult<Vec<FeedMew>> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adapt to get links by hashtag, then FILTER by author (of link!)

@harlantwood harlantwood force-pushed the feature/trustgraph branch 3 times, most recently from 6e899e3 to 9218ad9 Compare May 21, 2023 02:52
@bierlingm
Copy link
Collaborator

We're gearing up for the first release now and the question is arising: do you think we will be able to launch with it, or should we go ahead without and introduce it after?

We did talk about it being included in the first release in the What's Happening newsletter.

Was great to see you at dweb camp, hope everything's well, @harlantwood !

hwood-fg and others added 3 commits July 7, 2023 18:31
Remove TrustGraph zome call infra from frontend

refactor(ui): make trust graph wrapper a vue input component

Create vec of trust atoms on follow

Update tests with new `follow` signature

Write test for following with TAs; Comment out most tests

CI reverts

Cleanup

Fix CI step name

Tests from develop, plus follow test from TrustGraph

Comment out our test; add dep

Rough cut of Recommended mews

Sweettest infra

Iterate on Recommended feed DNA func

Iterate

Iterate Recommended MewsFeed

Follow -- reinstate trust atom creation, better

Refactor out call_local_zome function

Work on tests, cleanup

Test fixes; run sweettest in CI

Lock TG to git ref

Commit old flake.lock file (holonix 2023-03-25) to avoid infinite hang on Mac M1

Try latest holonix

Fix CI command

Update TG git ref

Use latest TG git repo

CI: restore rust from branch; run both runners even if 1 fails

Always cache rust builds

Test helpers

Iterate on tests

test:watch

FollowInput in TS & tryorama

Add path: hashtag.#mytag.by.MYPUBKEY

Test of Recommeneded

Only show recent mews in Recommended

add payload so it fails for right reason

Update nix action to v20

sleet without tokio -- hangs on CI

Update flake

Simplify test

WIP test refactor broken

Test refactor working (thx GPT4)

More test helper refactor

Refactor tests

Refactor tests

Refactor tests

Refactor tests

Refactor tests

Refactor tests

Refactor tests

CPU burning sleep which may work on CI...

Try commenting out test with sleep for CI

Run tests serial, not parallel; begin test on ordering feed; better duration handling

Clippy fixes

Update flake.lock

Update Cargo.lock

Move tests to new dna

Order TrustFeedMews by topic weight

Lint

Update lockfiles

Update "follow" code in frontend

First cut at "Your Basket" view

Basket feed getting closer...

TrustAtom Vue work

Frontend tweaks and design notes

flake lock

Update hdk/hdi + flake lock

Various updates

Try to fix nix, breaking on CI:

https://github.com/GeekGene/MewsFeed/actions/runs/4761734440/jobs/8463253867

Use alternative hc cahcix cache as well

Run TG on push; push to holochain cache -- CI is timing out in mewsfeed org

Reduce nix storage space

Check disk space on CI

Test assert eq

Less debugging

Update flake

migrate tests to ts step 1: mv

Commit old sweet tests, and start sour tests

Convert "recommended" func test rs -> ts

Work on trust feed

Reinstate much of trustgraph infra + trust feed

trustgraph zome infra, test fixes

Fix up types & tests

Cleanup/refactor

Cleanup

Revert frontend changes -- split off to own branch

rm ui

flake lock

Follow topics + refactor helpers

Convert more sweet -> sour tests

Await asyncs; fix zome

Minor test fixes and comments

Update flake lock

Fix some instances of `follow` in tests

Good stuff

Link Types

Ignore TAs starting with __
@mattyg mattyg deleted the branch GeekGene:develop August 2, 2023 02:06
@mattyg mattyg closed this Aug 2, 2023
@harlantwood
Copy link
Collaborator Author

Unfortunately I have too many balls in the air, and need to reduce those in order to do a good job with a smaller number.

So with sadness I’m putting TrustGraph/MewsFeed integration on hold, to be resumed if/when bandwidth is available.

If anyone in the community wants to pick it up in the meantime I’m happy to advise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants