unison icon indicating copy to clipboard operation
unison copied to clipboard

Share API: Codebase history - `GET /codebase/history`

Open hojberg opened this issue 3 years ago • 2 comments

Get the history of the logged in users codebase.

Endpoint:

GET /codebase/history

Response body:

type CodebaseLogEntry = {
  id: string // UUID
  title: string
  detail: string
  hash: string // Unison Hash of the root branch at the time of the entry
  logType: "sync_success" | "sync_failure"
  createdAt: string // ISO 8601
  ip?: string
  location?: string
}

type CodebaseHistory = Array<CodebaseLogEntry>

Used to debug sync issues and to allow the user to audit their codebase.

hojberg avatar Sep 01 '22 18:09 hojberg

A few things;

  1. What do you plan to use the codebase entry ID for?
  2. What do you envision being in the title/detail?
  3. What constitutes a "sync_failure"?
  4. I assume we probably want the userID or userHandle of the user who did the event, which is easier to work with? (preferably not both)
  5. Are there any query params for filtering or paging you'd like? I think we should page requests like this that may get long, so an offset and limit would be a good place to start; but I could also imagine some sort of time-based filter in the future (but we can always add that later)

ChrisPenner avatar Sep 19 '22 22:09 ChrisPenner

  1. I don't need it right now, but was thinking there might be something down the line where you'd use the id to show details of a single entry or perhaps as a range query: "show me the longs between id a and id b". Useful in searches also. Either way, not important for right now. I mostly included it as a pseudo postgres table strawman (where I think you'd want it for sure)

  2. Depends on what data we end up lifting up to actual fields, but things like the hash that was changed from and the namespace involved could be cool. Maybe these would be better as more structured fields?

  3. We can skip this as part of that sum type for now. I really want that to exist, but i'm not sure how best to report it.

  4. UserHandle, Avatar, and Name would be ideal

  5. Definitely want to have this be paginated. I think offset, and limit is good for now. Definitely want search and date ranges etc later on.

hojberg avatar Sep 19 '22 22:09 hojberg