Service - Issue

From Izara Wiki
Jump to navigation Jump to search

Overview

Issues can be raised against any objType, when an issue is raised a jury is selected by sortition and decides on whether the issue is acquitted or the severity and level of punishment for the offense.

Issues link to a top level comment which in turn sets the primary subject of the issue, discussion of the issue happens in this comment's replies.

Notes

  • jurors could be rewarded with tokens that can be traded and used by sellers to increase exposure of their listings
  • users can opt-in/out of being available for jury selection
  • have levels of users to create levels of appeal, eg first level jury, appeal to a higher level jury sorted from senior or skilled users, then final appeal where the entire community can vote if the decision/s should be overturned
  • initially punishments can be informally decided on inside the comment thread, then have another forum where admins are tasked with actioning decisions. In the future these could be formalized into standard flows depending on how the community develops.
  • in future integrate range choice voting, for now jurors decide how to complete the issue, any juror can complete/acquit
  • after completion it is a juror's responsibility to pass the decision to admins, eg have forum for this work

Repository

https://bitbucket.org/izara-core-shared/izara-core-shared-issue

Object Schemas

Additional Information
Per Service Schemas

objType

issue

{
	objectType: "issue",
	canDelete: false,
	belongTo: { 
		serviceTag: "user",
		objectType: "user"
	},	
	storageResources: {
		myGraph: {
			storageType: "graph",
			graphServerTag: "GraphHandler"
		}
    },
    fieldNames: {
		issueId: {
			type: "string",
			randomOnCreate: true,
			canUpdate: false,
			storageResourceTags: ['myGraph']
		}
		decisionStatus: {
			type: "string", // list/boolean? acquitted|pending|complete
			canUpdate: true,
			storageResourceTags: ['myGraph']
		}
		numberOfJurors: {
			type: "integer",
			storageResourceTags: ['myGraph']
		}
		severity: {
			type: "integer", // arbritary severity ladder, eg 1-5
			canUpdate: true,
			storageResourceTags: ['myGraph']
		}
    },
    identifiers: [
		{
			type: "identifier",
			fieldName: "issueId"
		}
    ]
}

juror

{
	objectType: "juror",
	canDelete: false,
	storageResources: {
		myGraph: {
			storageType: "graph",
			graphServerTag: "GraphHandler"
		}
    },
    fieldNames: {
		jurorId: {
			type: "string",
			randomOnCreate: true,
			canUpdate: false,
			storageResourceTags: ['myGraph']
		}
		status: {
			type: "string", // pending|invalid|confirmed is pending until user confirms, if request expires is invalid and a new juror is attempted
			canUpdate: true,
			storageResourceTags: ['myGraph']
		}
    },
    identifiers: [
		{
			type: "identifier",
			fieldName: "jurorId"
		}
    ]
}

Object Relationships

useIssueComment

{
	"useIssueComment": {
		fieldNames: {
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "issue",
						objectType: "issue"
					},
					linkType: "one",
					requiredOnCreate: true,
				},
				to: {
					objType: {
						serviceTag: "comment",
						objectType: "comment"
					},
					linkType: "one"
				}
			}
		]
	}
}
  • Connects an issue to it's comment thread, the comment is a new comment that is not inReplyTo another comment, the primarySubjects of the comment are the objects that the issue is related to
  • All issues will have one comment where the issue is discussed

hasJuror

{
	"hasJuror": {
		fieldNames: {
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "issue",					
						objectType: "issue"
					},
					linkType: "many",
				},
				to: {
					objType: {
						serviceTag: "issue",				
						objectType: "juror"					
					},				
					linkType: "many",
				}
			}
		]
	}
}
  • Links an issue to a potential juror

isJuror

{
	"isJuror": {
		fieldNames: {
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "issue",					
						objectType: "juror"
					},
					linkType: "many",
				},
				to: {
					objType: {
						serviceTag: "user",
						objectType: "user"
					},
					linkType: "one"
				}
			}
		]
	}
}
  • Link Juror object to it's user, one juror has one isJuror link

supportIssue

{
	"supportIssue": {
		fieldNames: {
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "user",
						objectType: "user"
					},
					linkType: "many",
				},
				to: {
					objType: {
						serviceTag: "issue",
						objectType: "issue"
					},
					linkType: "many"
				}
			}
		]
	}
}

disagreeWithIssue

{
	"disagreeWithIssue": {
		fieldNames: {
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "user",
						objectType: "user"
					},
					linkType: "many",
				},
				to: {
					objType: {
						serviceTag: "issue",
						objectType: "issue"
					},
					linkType: "many"
				}
			}
		]
	}
}
  • Any number of users can add support or disagree for an issue, this will help indicate the importance of the issue to the community
  • no flow required for this, user can create at any time, but maybe have hook/flow that validates user not already added a link

flowSchemas

validateIssue

  • hook into create Issue logic
  • checks that the useIssueComment is a top level comment not inReplyTo another comment
  • use a const to set numberOfJurors (in future calculate numberOfJurors according to comment's primary subject)

decideInitialJurors

  • trigger after creating an issue
  • random search users for numberOfJurors (in future may have requirements to be a juror, eg user option not be a juror)
  • create juror instance with hasJuror link to issue and isJuror link to user
  • perhaps create an eventBridge event per juror, or per Issue that timeouts pending juror requests
  • for each juror find a userContact and send message (in future users set which userContact is used for each system message)

jurorRejectAssignment

  • when a user declines to be a juror
  • set juror status to invalid
  • decide a new juror using findNewJuror (library or child flow)

jurorAcceptAssignment

  • when a user accepts to be a juror
  • set juror status to confirmed

jurorAssignmentTimeout

  • triggered after a period if a juror does not confirm (eg event bridge)
  • set juror/s to invalid
  • decide a new juror using findNewJuror (library or child flow)
  • in future can add a delinquentJuror link to user to record how many times not confirm

issueDecision

  • a juror sets the issue decisionStatus to complete/acquitted, and severity

Working documents

Issue