pub enum Event {
Commented {
body: String,
path: String,
line: u32,
blob_oid: String,
},
Approved {
commit: String,
},
Rejected {
commit: String,
reason: String,
},
IssueOpened {
title: String,
body: String,
},
IssueCommented {
body: String,
},
IssueClosed {
reason: String,
},
}Expand description
What happened.
A closed set on purpose. An open one — a kind: String — would let a client
invent an event nobody can fold, and a log that holds events its reader does
not understand is a log whose state depends on who is reading it.
Variants§
Commented
A comment on a pull request, or — when path
is set — on ONE line of ONE file version.
§The anchor follows the code, not the pull request
An empty path is the original per-pull-request comment, and its signed
bytes are byte-for-byte what they were before the anchor existed. A
non-empty path anchors the comment to (path, line, blob_oid), and the
blob is the load-bearing field: it names the exact file version the line
lived in. A rebase that does not touch the file leaves that blob’s oid
unchanged, so the comment stays on its line; a rebase that rewrites the
file gives it a new blob, so the comment stops matching and the line it
was about is visibly gone. Anchoring to the pull request number instead
would carry the comment onto a rewritten file it was never made on.
Fields
Approved
An approval of a specific commit.
The commit is part of what is signed, so an approval cannot silently
come to cover a different tip: force-push after a review and the
approval still names the commit that was reviewed, which is exactly the
fact an auditor needs and the one a mutable approved: bool destroys.
Rejected
A withdrawal of an earlier approval.
IssueOpened
An issue opened.
The one place the forge grows a state machine of its own, because an
issue — unlike a pull request’s review — has no crate::pulls record
that owns whether it is open. The issue IS the fold of its events, and
this is the event that says it exists. Its number is not signed: it is
fold_issues’s to assign, so that two readers of the same log agree on
it the way they agree on everything else here.
That the OPENING is signed at all is the property GitHub, GitLab and
Gitea have no equivalent for: who filed this is the actor’s own sshsig.
IssueCommented
A comment on an issue.
The issue number is ForgeEvent::pull — the subject the event is
about — so a comment is bound by the signature to its thread.
IssueClosed
An issue closed, with the reason it was.
Appended, never deleted: what the fold shows is that the issue is shut, and the close — the reason with it — stays readable, which is the fact an auditor wants.