ssbc / ssb-social-index

scuttlebutt plugin for getting reduced state based on the author's social graph
5 stars 2 forks source link

socialValue does not respect `false` #3

Open christianbundy opened 4 years ago

christianbundy commented 4 years ago

Big bug. If you set publicWebHosting = true and then publicWebHosting = false, then when you call socialValue for that key you always get true. It looks like latestValueStream has the same problem?

christianbundy commented 4 years ago

Wrote a test but couldn't orient myself in index.js well enough to fix it.

npm install --save-dev ssb-db ssb-backlinks
const ssbDb = require('ssb-db')
const ssbBacklinks = require('ssb-backlinks')
const ssbSocialIndex = require('./')

const aboutIndex = ssbSocialIndex({
  namespace: 'about',
  type: 'about',
  destField: 'about'
})

let api = {}

api = ssbDb.init(api, { temp: true })
api.backlinks = ssbBacklinks.init(api)
api.about = aboutIndex.init(api)

const { id } = api

api.publish({ type: 'about', about: id, beep: true }, (err) => {
  if (err) throw err
  api.about.socialValue({ dest: id, key: 'beep' }, (err, beep) => {
    if (err) throw err
    if (beep !== true) throw new Error('beep should be true')
    api.publish({ type: 'about', about: id, beep: false }, (err) => {
      if (err) throw err
      api.about.socialValue({ dest: id, key: 'beep' }, (err, beep) => {
        if (err) throw err
        if (beep !== false) throw new Error('beep should be false')
      })
    })
  })
})
stale[bot] commented 4 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

stale[bot] commented 3 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

christianbundy commented 3 years ago

(If you assign yourself as someone who cares about this issue, stale[bot] will leave it alone.)

staltz commented 3 years ago

@christianbundy I know, and I don't think that's useful either. Because issues that no one assigns themselves to fix are still valid issues to remain open, they don't become stale with time, they may or may not become stale with commit count increasing over time, which in our ecosystem of packages is not that true.

christianbundy commented 3 years ago

Yeah, that's one valid way to treat open issues.

Personally, I used stale[bot] with the heuristic that "issues are open while they are actively progressing" rather than "issues are open until they have been proven to be irrelevant", but if you want to use them that way it might be worthwhile to disable stale[bot]. Or, use the 'pinned' label and stalebot won't touch them either.

Mostly just don't want to see you having to manually fix automated changes that you don't like every TIME_PERIOD.