pr_01m47d15m3e54sn21z27rpy5n9/crates/contracts/src/work.rs

1,371 lines45,170 bytesCodeBlame
1//! The work service: issues, pull requests, comments and sessions.
2//!
3//! Each `*Args` struct is the argument of the method of the same name,
4//! served at `POST /rpc/<method>`.
5//!
6//! Issues and pull requests share one sequence of numbers per repository,
7//! so `#12` names exactly one of them.
8
9use serde::{Deserialize, Serialize};
10
11use crate::repos::{CompareArgs, RepoPath};
12use crate::{User, Viewer};
13
14/// Labels every repository starts with. Any other label comes into being
15/// the first time it is put on an issue.
16pub const DEFAULT_LABELS: [&str; 5] = ["bug", "feature", "docs", "chore", "question"];
17
18/// `open` or `closed`: the filter on lists of issues and pull requests. An
19/// open pull request is a draft or one ready for review; a closed one was
20/// merged or closed without merging.
21#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
22#[serde(rename_all = "lowercase")]
23pub enum State {
24 Open,
25 Closed,
26}
27
28/// Why an issue was closed.
29#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
30#[serde(rename_all = "snake_case")]
31pub enum IssueReason {
32 /// The work was done. If a pull request did it, `resolved_by` names it.
33 Completed,
34 NotPlanned,
35}
36
37impl IssueReason {
38 pub fn as_str(self) -> &'static str {
39 match self {
40 IssueReason::Completed => "completed",
41 IssueReason::NotPlanned => "not_planned",
42 }
43 }
44}
45
46/// Something that should change in a repository: a bug, a feature, a
47/// question. Opened by a person, an agent or an integration. Pull requests
48/// are made against it; the one that is merged resolves it.
49#[derive(Clone, Debug, Serialize, Deserialize)]
50#[serde(rename_all = "camelCase")]
51pub struct Issue {
52 pub id: String,
53 pub repo_id: String,
54 /// Shown as `#12`.
55 pub number: u32,
56 pub title: String,
57 /// Markdown. Also what an agent is given to work from.
58 pub body: String,
59 pub labels: Vec<String>,
60 /// Commands that must pass for a pull request to be accepted.
61 pub checks: Vec<String>,
62 pub state: State,
63 /// Set when closed.
64 pub reason: Option<IssueReason>,
65 /// The number of the pull request whose merge closed this issue.
66 pub resolved_by: Option<u32>,
67 pub author: User,
68 /// RFC 3339.
69 pub created_at: String,
70 /// RFC 3339.
71 pub updated_at: String,
72 /// RFC 3339.
73 pub closed_at: Option<String>,
74 /// Pull requests made against this issue, in any state.
75 pub pull_count: u32,
76 pub comment_count: u32,
77 /// Usernames of the people it is assigned to.
78 #[serde(default)]
79 pub assignees: Vec<String>,
80 /// The numbers of the issues that have to be merged before this one is
81 /// worked on.
82 #[serde(default)]
83 pub blocked_by: Vec<u32>,
84 /// Whether a g1t agent takes it as soon as it can: at once, or when
85 /// what it is blocked by has merged.
86 #[serde(default)]
87 pub queued: bool,
88 /// The agent working on it now: the one behind its newest pull request
89 /// that is still in progress in a fork, such as `g1t-agent`.
90 #[serde(default)]
91 pub agent: Option<String>,
92}
93
94#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
95#[serde(rename_all = "lowercase")]
96pub enum PullStatus {
97 /// Still being worked on.
98 Draft,
99 /// Ready for review.
100 Open,
101 Merged,
102 /// Closed without merging.
103 Closed,
104}
105
106impl PullStatus {
107 pub fn as_str(self) -> &'static str {
108 match self {
109 PullStatus::Draft => "draft",
110 PullStatus::Open => "open",
111 PullStatus::Merged => "merged",
112 PullStatus::Closed => "closed",
113 }
114 }
115
116 /// Whether the pull request can still be changed or merged.
117 pub fn is_active(self) -> bool {
118 matches!(self, PullStatus::Draft | PullStatus::Open)
119 }
120}
121
122/// Where the agent runs: on g1t's sandboxes, or in someone's own session.
123#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
124#[serde(rename_all = "lowercase")]
125pub enum Runtime {
126 Hosted,
127 External,
128}
129
130/// A proposed change. It is made either in a fork created for it, which is
131/// how agents work, or on a branch pushed to the repository itself.
132#[derive(Clone, Debug, Serialize, Deserialize)]
133#[serde(rename_all = "camelCase")]
134pub struct Pull {
135 pub id: String,
136 pub repo_id: String,
137 /// Shown as `#12`.
138 pub number: u32,
139 /// The number of the issue this is for, if any.
140 pub issue: Option<u32>,
141 pub title: String,
142 /// Markdown: what changed and why. Set when marked ready.
143 pub body: Option<String>,
144 /// A label for the agent doing the work, e.g. `claude-code`.
145 pub agent: String,
146 pub runtime: Runtime,
147 pub status: PullStatus,
148 /// The fork holding the change, unless it is on a branch.
149 pub fork: Option<RepoPath>,
150 /// The fork's repository id.
151 pub fork_repo_id: Option<String>,
152 /// The branch of the repository holding the change, unless it is in a
153 /// fork.
154 pub branch: Option<String>,
155 pub head_commit: Option<String>,
156 /// For a merged pull request, what the branch pointed to before the
157 /// merge. Comparing against it shows what the pull request changed.
158 pub merge_base: Option<String>,
159 /// Username of whoever merged it.
160 pub merged_by: Option<String>,
161 /// RFC 3339.
162 pub merged_at: Option<String>,
163 /// Set on a pull request closed because another one for the same issue
164 /// was merged: that one's number.
165 pub superseded_by: Option<u32>,
166 /// Where the latest run of the issue's acceptance checks stands, if
167 /// there has been one against the current head.
168 pub check_status: Option<CheckStatus>,
169 /// The files it changes, as of its latest push.
170 #[serde(default)]
171 pub files: Vec<ChangedFile>,
172 /// Usernames of the people it is assigned to.
173 #[serde(default)]
174 pub assignees: Vec<String>,
175 /// Those whose review was asked for: usernames, and `g1t-agent` when a
176 /// g1t agent was asked.
177 #[serde(default)]
178 pub reviewers: Vec<String>,
179 pub author: User,
180 /// RFC 3339.
181 pub created_at: String,
182 /// RFC 3339.
183 pub updated_at: String,
184}
185
186/// One file a pull request changes, and by how much.
187#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
188pub struct ChangedFile {
189 pub path: String,
190 pub additions: u32,
191 pub deletions: u32,
192}
193
194/// Another pull request in progress that changes some of the same files.
195/// Two for the same issue are alternatives; two for different issues are
196/// heading for a conflict.
197#[derive(Clone, Debug, Serialize, Deserialize)]
198pub struct Overlap {
199 pub number: u32,
200 pub title: String,
201 /// The number of the issue the other pull request is for.
202 pub issue: Option<u32>,
203 /// The files both change.
204 pub paths: Vec<String>,
205}
206
207impl Pull {
208 /// What to ask the repos service to see what this pull request changes.
209 ///
210 /// A fork is compared as a whole. A branch is compared by name while
211 /// the pull request is open, and by the commit it was merged or closed
212 /// at afterwards, so later pushes to the branch do not change the record.
213 pub fn comparison(&self, viewer: &Viewer) -> CompareArgs {
214 let settled = matches!(self.status, PullStatus::Merged | PullStatus::Closed);
215 let (repo_id, head) = match &self.fork_repo_id {
216 Some(fork) => (fork.clone(), None),
217 None => (
218 self.repo_id.clone(),
219 self.head_commit
220 .clone()
221 .filter(|_| settled)
222 .or_else(|| self.branch.clone()),
223 ),
224 };
225 CompareArgs {
226 repo_id,
227 viewer: viewer.clone(),
228 base: self.merge_base.clone(),
229 head,
230 }
231 }
232}
233
234#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
235#[serde(rename_all = "lowercase")]
236pub enum CheckStatus {
237 /// Waiting for a sandbox.
238 Queued,
239 Running,
240 Passed,
241 Failed,
242 /// The checks could not be run at all.
243 Errored,
244}
245
246impl CheckStatus {
247 pub fn as_str(self) -> &'static str {
248 match self {
249 CheckStatus::Queued => "queued",
250 CheckStatus::Running => "running",
251 CheckStatus::Passed => "passed",
252 CheckStatus::Failed => "failed",
253 CheckStatus::Errored => "errored",
254 }
255 }
256}
257
258/// How one acceptance check went.
259#[derive(Clone, Debug, Serialize, Deserialize)]
260#[serde(rename_all = "camelCase")]
261pub struct CheckResult {
262 pub command: String,
263 pub passed: bool,
264 /// Absent when the command was stopped for taking too long.
265 #[serde(default)]
266 pub exit_code: Option<i32>,
267 /// What the command printed, standard output and error together. The
268 /// end of it, when there was a lot.
269 #[serde(default)]
270 pub output: String,
271 #[serde(default)]
272 pub duration_ms: u64,
273}
274
275/// One run of an issue's acceptance checks against a pull request's head,
276/// in a sandbox that holds nothing but that commit.
277#[derive(Clone, Debug, Serialize, Deserialize)]
278#[serde(rename_all = "camelCase")]
279pub struct CheckRun {
280 pub id: String,
281 /// The commit that was checked.
282 pub head_commit: String,
283 pub status: CheckStatus,
284 pub results: Vec<CheckResult>,
285 /// Why the checks could not be run, when `status` is `errored`.
286 pub error: Option<String>,
287 /// RFC 3339.
288 pub created_at: String,
289 /// RFC 3339.
290 pub finished_at: Option<String>,
291}
292
293/// A reviewer's decision on a pull request.
294#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
295#[serde(rename_all = "snake_case")]
296pub enum Verdict {
297 Approve,
298 RequestChanges,
299}
300
301impl Verdict {
302 pub fn as_str(self) -> &'static str {
303 match self {
304 Verdict::Approve => "approve",
305 Verdict::RequestChanges => "request_changes",
306 }
307 }
308}
309
310/// What an entry in a conversation is.
311#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
312#[serde(rename_all = "lowercase")]
313pub enum CommentKind {
314 /// Something a person or an agent wrote.
315 #[default]
316 Comment,
317 /// Something that happened: an assignment, a review asked for, a close.
318 Event,
319}
320
321/// A comment on an issue or a pull request. On a pull request it can sit
322/// on one line of the change, and it can carry a reviewer's verdict.
323#[derive(Clone, Debug, Serialize, Deserialize)]
324#[serde(rename_all = "camelCase")]
325pub struct Comment {
326 pub id: String,
327 /// Something a person wrote, or something that happened.
328 #[serde(default)]
329 pub kind: CommentKind,
330 pub author: User,
331 /// Markdown. For an event, what its author did, as the rest of a
332 /// sentence that starts with their name: "assigned ana".
333 pub body: String,
334 /// The file commented on, for a comment on a line.
335 pub path: Option<String>,
336 /// The line of that file, as numbered after the change.
337 pub line: Option<u32>,
338 pub verdict: Option<Verdict>,
339 /// RFC 3339.
340 pub created_at: String,
341}
342
343#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
344#[serde(rename_all = "snake_case")]
345pub enum SessionEntryKind {
346 Prompt,
347 Message,
348 ToolCall,
349 ToolResult,
350 Note,
351}
352
353/// One step of an agent's session: the "why" behind a pull request's commits.
354#[derive(Clone, Debug, Serialize, Deserialize)]
355pub struct SessionEntry {
356 pub seq: u32,
357 pub kind: SessionEntryKind,
358 pub text: String,
359 /// For tool calls and results.
360 pub tool: Option<String>,
361 /// The fork's head commit when this entry was recorded, if known.
362 pub commit: Option<String>,
363 /// RFC 3339.
364 pub at: String,
365}
366
367#[derive(Clone, Debug, Serialize, Deserialize)]
368pub struct NewSessionEntry {
369 pub kind: SessionEntryKind,
370 pub text: String,
371 #[serde(default)]
372 pub tool: Option<String>,
373 #[serde(default)]
374 pub commit: Option<String>,
375}
376
377#[derive(Clone, Debug, Serialize, Deserialize)]
378pub struct IssueDetail {
379 pub issue: Issue,
380 /// Every pull request made against it, oldest first.
381 pub pulls: Vec<Pull>,
382 pub comments: Vec<Comment>,
383}
384
385#[derive(Clone, Debug, Serialize, Deserialize)]
386pub struct PullDetail {
387 pub pull: Pull,
388 /// The issue it is for, if any.
389 pub issue: Option<Issue>,
390 pub comments: Vec<Comment>,
391 /// The latest run of the issue's acceptance checks.
392 pub checks: Option<CheckRun>,
393 /// Other pull requests in progress that change the same files.
394 #[serde(default)]
395 pub overlaps: Vec<Overlap>,
396 /// Whether the branch it would merge into has moved on without it, so
397 /// that it has to catch up before it can merge.
398 #[serde(default)]
399 pub behind: bool,
400 /// Whether a g1t agent is reviewing it right now.
401 #[serde(default)]
402 pub review_pending: bool,
403 /// Where it stands on its way to being merged, for a pull request g1t
404 /// is seeing through. Absent on anyone else's.
405 #[serde(default)]
406 pub lifecycle: Option<Lifecycle>,
407 /// A merge was asked for while it was behind: g1t is bringing it up to
408 /// date and will then land it.
409 #[serde(default)]
410 pub landing: bool,
411 /// Why g1t stopped working on it, if it did: a catch-up that could not
412 /// be completed, for example.
413 #[serde(default)]
414 pub stalled: Option<String>,
415 /// Messages people sent the agent while it worked, oldest first.
416 #[serde(default)]
417 pub messages: Vec<AgentMessage>,
418}
419
420/// A message a person sent an agent at work on a pull request. The agent
421/// receives it at its next step.
422#[derive(Clone, Debug, Serialize, Deserialize)]
423#[serde(rename_all = "camelCase")]
424pub struct AgentMessage {
425 pub id: String,
426 pub author: String,
427 pub body: String,
428 /// RFC 3339.
429 pub created_at: String,
430 /// RFC 3339. When the agent received it; null until then.
431 pub delivered_at: Option<String>,
432 /// `message` from a person, or from another pull request's agent a
433 /// `question`, a `handoff` of work, or the `answer` to one.
434 #[serde(default = "message_kind")]
435 pub kind: String,
436 /// The pull request whose agent sent it, when an agent did.
437 #[serde(default)]
438 pub from_number: Option<u32>,
439 /// The pull request it was sent to.
440 #[serde(default)]
441 pub to_number: u32,
442 /// For a question or handoff: the reply, once there is one.
443 #[serde(default)]
444 pub answer: Option<String>,
445 /// For a handoff: whether it was declined.
446 #[serde(default)]
447 pub declined: bool,
448 /// For the agent that sent it: what to expect, when the agent it asked
449 /// is not at work and will not answer soon.
450 #[serde(default, skip_serializing_if = "Option::is_none")]
451 pub hint: Option<String>,
452}
453
454fn message_kind() -> String {
455 "message".to_owned()
456}
457
458/// `message_agent`: sends the agent working on a pull request a message.
459/// The pull request's author and members of the workspace may. Returns
460/// `Outcome<AgentMessage>`.
461#[derive(Debug, Serialize, Deserialize)]
462pub struct MessageAgentArgs {
463 pub actor: User,
464 pub repo: RepoPath,
465 pub number: u32,
466 pub body: String,
467 /// For an agent: `question` or `handoff`; a person's is a `message`.
468 #[serde(default)]
469 pub kind: Option<String>,
470 /// For an agent: the pull request it is working on, which the reply
471 /// goes back to.
472 #[serde(default)]
473 pub from_number: Option<u32>,
474}
475
476/// `answer_message`: replies to a question or a handoff an agent received,
477/// accepting or declining a handoff. The reply reaches the asking agent at
478/// its next step. Returns `Outcome<AgentMessage>`, the message answered.
479#[derive(Debug, Serialize, Deserialize)]
480pub struct AnswerMessageArgs {
481 pub actor: User,
482 pub repo: RepoPath,
483 pub id: String,
484 pub body: String,
485 #[serde(default)]
486 pub decline: bool,
487}
488
489/// `take_messages`: the messages not yet delivered to the agent working on
490/// a pull request, marked delivered. Only g1t's agents may. Returns
491/// `Outcome<Vec<AgentMessage>>`.
492#[derive(Debug, Serialize, Deserialize)]
493pub struct TakeMessagesArgs {
494 pub actor: User,
495 pub repo: RepoPath,
496 pub number: u32,
497}
498
499/// A step on the way from an assigned issue to a pull request that is ready
500/// to merge. g1t takes each one without being asked.
501#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
502#[serde(rename_all = "snake_case")]
503pub enum Stage {
504 /// The agent is making the change.
505 Working,
506 /// The issue's acceptance checks are running against it.
507 Checking,
508 /// A g1t agent is reviewing it.
509 Reviewing,
510 /// The agent is addressing failed checks or a review.
511 Revising,
512 /// The agent is merging in the branch it would land on, which moved.
513 CatchingUp,
514 /// In the repository's merge queue, being tested with what is ahead of
515 /// it before it lands.
516 Queued,
517 /// Checks passed, reviewed and approved, up to date. A person merges.
518 Ready,
519 /// g1t has stopped and a person has to decide what happens next.
520 NeedsYou,
521}
522
523/// Where a pull request made by a g1t agent stands. See [`Stage`].
524#[derive(Clone, Debug, Serialize, Deserialize)]
525pub struct Lifecycle {
526 pub stage: Stage,
527 /// One sentence saying what is happening, or why it stopped.
528 pub detail: String,
529 /// How many times the agent has been sent back to revise it.
530 pub revisions: u32,
531}
532
533/// `advance`: works out the next step for a pull request g1t is seeing
534/// through and, if there is one to take now, claims it, so that it is
535/// taken once however many times this is called. Called by the runner
536/// service, which carries the step out. Returns `Advance`.
537#[derive(Debug, Serialize, Deserialize)]
538#[serde(rename_all = "camelCase")]
539pub struct AdvanceArgs {
540 pub pull_id: String,
541}
542
543#[derive(Debug, Serialize, Deserialize)]
544#[serde(tag = "action", rename_all = "snake_case")]
545pub enum Advance {
546 /// Nothing to do now: a step is under way, or it is a person's turn.
547 None,
548 /// Have a g1t agent review it.
549 Review { job: LifecycleJob },
550 /// Send the agent back to address `job.feedback`.
551 Revise { job: LifecycleJob },
552 /// Merge in the branch it would land on.
553 CatchUp { job: LifecycleJob },
554}
555
556/// What the runner needs to carry out a step of a pull request's lifecycle.
557#[derive(Debug, Serialize, Deserialize)]
558#[serde(rename_all = "camelCase")]
559pub struct LifecycleJob {
560 pub pull_id: String,
561 pub repo: RepoPath,
562 pub number: u32,
563 /// Who the pull request belongs to. Sandboxes act as them.
564 pub author: User,
565 /// The repository holding the change: its fork, or the repository
566 /// itself for one made on a branch.
567 pub source: RepoPath,
568 /// The branch of the source holding the change; its default branch
569 /// when absent.
570 #[serde(default)]
571 pub branch: Option<String>,
572 pub default_branch: String,
573 pub title: String,
574 pub description: String,
575 pub issue: Option<Issue>,
576 /// For a revision: the failed checks or the review to address.
577 pub feedback: String,
578 /// For a revision: which one this is, from 1.
579 pub round: u32,
580}
581
582/// How a repository wants its pull requests handled. A repository that has
583/// changed nothing has the defaults.
584#[derive(Clone, Debug, Serialize, Deserialize)]
585#[serde(rename_all = "camelCase", default)]
586pub struct RepoSettings {
587 /// Land a g1t agent's pull request without a person once it is ready:
588 /// checks passed and approved as the settings below require.
589 pub auto_merge: bool,
590 /// Refuse to merge a pull request that does not contain the default
591 /// branch's latest commits, so that what merges is what was checked.
592 /// When off, merging one that is behind brings it up to date first.
593 pub require_up_to_date: bool,
594 /// How many approving reviews a pull request needs before it may
595 /// merge. A reviewer who has since asked for changes blocks it.
596 pub required_approvals: u32,
597 /// Whether a g1t agent's approval counts towards `required_approvals`.
598 pub count_agent_approvals: bool,
599 /// Whether a member may merge although the acceptance checks did not
600 /// pass.
601 pub allow_ignoring_checks: bool,
602 /// Whether a g1t agent's pull request is reviewed by a second agent
603 /// without being asked.
604 pub agent_review: bool,
605 /// How many times a g1t agent is sent back to its pull request before
606 /// a person is asked instead.
607 pub max_revisions: u32,
608 /// Merge through a queue: pull requests are tested together with those
609 /// ahead of them, and only a combination that passed reaches the default
610 /// branch.
611 pub merge_queue: bool,
612 /// Username of the member who last changed the settings, if anyone has.
613 pub updated_by: Option<String>,
614 /// RFC 3339.
615 pub updated_at: Option<String>,
616}
617
618impl Default for RepoSettings {
619 fn default() -> Self {
620 RepoSettings {
621 auto_merge: false,
622 require_up_to_date: false,
623 required_approvals: 0,
624 count_agent_approvals: true,
625 allow_ignoring_checks: true,
626 agent_review: true,
627 max_revisions: 2,
628 merge_queue: false,
629 updated_by: None,
630 updated_at: None,
631 }
632 }
633}
634
635/// `update_settings`: replaces a repository's settings. Members of its
636/// workspace only. Returns `Outcome<RepoSettings>`. `get_settings` takes
637/// `ViewArgs` and returns the same.
638#[derive(Debug, Serialize, Deserialize)]
639pub struct UpdateSettingsArgs {
640 pub actor: User,
641 pub repo: RepoPath,
642 /// Who changed them and when are filled in by the service.
643 pub settings: RepoSettings,
644}
645
646/// `catch_up_job`: what the runner needs to bring a pull request up to date
647/// because a merge of it was asked for. Null if none was. Returns
648/// `Option<LifecycleJob>`.
649#[derive(Debug, Serialize, Deserialize)]
650#[serde(rename_all = "camelCase")]
651pub struct CatchUpJobArgs {
652 pub pull_id: String,
653}
654
655/// `stall`: records that a step could not be carried out, so that g1t
656/// stops and a person is asked. Returns `bool`.
657#[derive(Debug, Serialize, Deserialize)]
658#[serde(rename_all = "camelCase")]
659pub struct StallArgs {
660 pub pull_id: String,
661 pub reason: String,
662}
663
664/// `managed_pulls`: ids of the open pull requests g1t is seeing through,
665/// in one repository or in all of them. Returns `Vec<String>`.
666#[derive(Debug, Default, Serialize, Deserialize)]
667#[serde(rename_all = "camelCase")]
668pub struct ManagedPullsArgs {
669 #[serde(default)]
670 pub repo_id: Option<String>,
671}
672
673/// `open_issue`. Returns `Outcome<Issue>`.
674#[derive(Debug, Serialize, Deserialize)]
675pub struct OpenIssueArgs {
676 pub actor: User,
677 pub repo: RepoPath,
678 pub title: String,
679 #[serde(default)]
680 pub body: String,
681 #[serde(default)]
682 pub labels: Vec<String>,
683 #[serde(default)]
684 pub checks: Vec<String>,
685}
686
687/// `list_issues`, newest first. Returns `Outcome<Vec<Issue>>`.
688#[derive(Debug, Serialize, Deserialize)]
689pub struct ListIssuesArgs {
690 pub repo: RepoPath,
691 pub viewer: Viewer,
692 #[serde(default)]
693 pub state: Option<State>,
694 /// Only issues carrying this label.
695 #[serde(default)]
696 pub label: Option<String>,
697}
698
699/// `list_pulls`, newest first. Returns `Outcome<Vec<Pull>>`.
700#[derive(Debug, Serialize, Deserialize)]
701pub struct ListPullsArgs {
702 pub repo: RepoPath,
703 pub viewer: Viewer,
704 #[serde(default)]
705 pub state: Option<State>,
706}
707
708/// `get_issue` (`Outcome<IssueDetail>`), `get_pull` (`Outcome<PullDetail>`),
709/// `read_session` (`Outcome<Vec<SessionEntry>>`), `list_labels`
710/// (`Outcome<Vec<String>>`) and `counts` (`Outcome<Counts>`). The last two
711/// ignore `number`.
712#[derive(Debug, Serialize, Deserialize)]
713#[serde(rename_all = "camelCase")]
714pub struct ViewArgs {
715 pub repo: RepoPath,
716 #[serde(default)]
717 pub number: u32,
718 pub viewer: Viewer,
719 /// For `read_session`: only entries after this sequence number.
720 #[serde(default)]
721 pub after_seq: u32,
722}
723
724/// How many issues and pull requests are open on a repository.
725#[derive(Debug, Serialize, Deserialize)]
726pub struct Counts {
727 pub issues: u32,
728 pub pulls: u32,
729}
730
731/// `update_issue`: changes whichever fields are given. The author or a
732/// member of the workspace may. Returns `Outcome<Issue>`.
733#[derive(Debug, Serialize, Deserialize)]
734pub struct UpdateIssueArgs {
735 pub actor: User,
736 pub repo: RepoPath,
737 pub number: u32,
738 #[serde(default)]
739 pub title: Option<String>,
740 #[serde(default)]
741 pub body: Option<String>,
742 #[serde(default)]
743 pub labels: Option<Vec<String>>,
744 /// Usernames of the people it is assigned to; replaces the whole set.
745 /// Assigning it to the g1t agent is the runner's `run`, not this.
746 #[serde(default)]
747 pub assignees: Option<Vec<String>>,
748}
749
750/// `close_issue` and `reopen_issue`. Each returns `Outcome<Issue>`.
751#[derive(Debug, Serialize, Deserialize)]
752pub struct IssueActionArgs {
753 pub actor: User,
754 pub repo: RepoPath,
755 pub number: u32,
756 /// For `close_issue`; `completed` if left out.
757 #[serde(default)]
758 pub reason: Option<IssueReason>,
759}
760
761/// `add_comment`, on an issue or a pull request. On a pull request it may
762/// name a line of the change, and may carry a verdict; nobody can give a
763/// verdict on their own pull request. Returns `Outcome<Comment>`.
764#[derive(Debug, Serialize, Deserialize)]
765pub struct AddCommentArgs {
766 pub actor: User,
767 pub repo: RepoPath,
768 pub number: u32,
769 /// May be empty when approving.
770 #[serde(default)]
771 pub body: String,
772 #[serde(default)]
773 pub path: Option<String>,
774 #[serde(default)]
775 pub line: Option<u32>,
776 #[serde(default)]
777 pub verdict: Option<Verdict>,
778}
779
780/// `open_pull`. Without `branch`, forks the repo and returns a draft pull
781/// request to push to. With it, opens a pull request, ready for review,
782/// for a branch already pushed to the repo. Returns `Outcome<Pull>`.
783#[derive(Debug, Serialize, Deserialize)]
784pub struct OpenPullArgs {
785 pub actor: User,
786 pub repo: RepoPath,
787 /// The issue this is for.
788 #[serde(default)]
789 pub issue: Option<u32>,
790 /// Defaults to the issue's title; required without an issue.
791 #[serde(default)]
792 pub title: String,
793 /// What changed and why. Usually set later, when a draft is marked ready.
794 #[serde(default)]
795 pub body: String,
796 /// A branch of the repository that already holds the change.
797 #[serde(default)]
798 pub branch: Option<String>,
799 #[serde(default)]
800 pub agent: String,
801 pub runtime: Runtime,
802}
803
804/// `ready_pull`, `close_pull` and `merge_pull`. Each returns `Outcome<Pull>`.
805#[derive(Debug, Serialize, Deserialize)]
806#[serde(rename_all = "camelCase")]
807pub struct PullActionArgs {
808 pub actor: User,
809 pub repo: RepoPath,
810 pub number: u32,
811 /// For `ready_pull`: what changed and why.
812 #[serde(default)]
813 pub summary: String,
814 /// For `merge_pull`: leave the issue open and the other pull requests
815 /// for it untouched, because this one is only part of the work.
816 #[serde(default)]
817 pub keep_issue_open: bool,
818 /// For `merge_pull`: merge although the acceptance checks have not
819 /// passed.
820 #[serde(default)]
821 pub ignore_checks: bool,
822}
823
824/// Where a plan stands.
825#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
826#[serde(rename_all = "lowercase")]
827pub enum PlanStatus {
828 /// An agent is reading the repository and writing it.
829 Planning,
830 /// Written, and waiting for a person to read and apply it.
831 Ready,
832 /// It could not be written.
833 Failed,
834 /// Its issues have been opened.
835 Applied,
836}
837
838/// One issue a plan proposes.
839#[derive(Clone, Debug, Default, Serialize, Deserialize)]
840#[serde(rename_all = "camelCase", default)]
841pub struct PlannedIssue {
842 pub title: String,
843 /// Markdown: what to change, where, and why.
844 pub body: String,
845 pub labels: Vec<String>,
846 /// Commands that must pass once the change is made.
847 pub checks: Vec<String>,
848 /// The files it will most likely change.
849 pub files: Vec<String>,
850 /// The positions, counting from 1, of earlier issues in the plan that
851 /// have to be merged first. An agent writes this as `depends_on`.
852 #[serde(alias = "depends_on")]
853 pub depends_on: Vec<u32>,
854 /// Its number, once the plan has been applied and it was kept.
855 pub number: Option<u32>,
856}
857
858/// An outcome someone wrote, and the issues an agent proposes to get there.
859#[derive(Clone, Debug, Serialize, Deserialize)]
860#[serde(rename_all = "camelCase")]
861pub struct Plan {
862 pub id: String,
863 pub repo_id: String,
864 /// The outcome wanted, as written.
865 pub brief: String,
866 pub status: PlanStatus,
867 /// The agent's account of how it split the work.
868 pub summary: String,
869 pub issues: Vec<PlannedIssue>,
870 /// Why it could not be written, when `status` is `failed`.
871 pub error: Option<String>,
872 pub author: User,
873 /// RFC 3339.
874 pub created_at: String,
875 /// RFC 3339.
876 pub finished_at: Option<String>,
877 /// Once applied: where each issue it opened stands now, in plan order.
878 /// Filled in by `get_plan` only.
879 #[serde(default)]
880 pub progress: Vec<IssueProgress>,
881 /// Questions and handoffs between the agents on its pull requests,
882 /// newest first. Filled in by `get_plan` only.
883 #[serde(default)]
884 pub exchanges: Vec<AgentMessage>,
885}
886
887/// Where one issue of an applied plan stands.
888#[derive(Clone, Debug, Serialize, Deserialize)]
889#[serde(rename_all = "camelCase")]
890pub struct IssueProgress {
891 pub number: u32,
892 pub title: String,
893 /// `blocked` (waiting on issues it depends on), `waiting` (for an
894 /// agent), `open` (nobody on it), one of the lifecycle stages
895 /// (`working`, `checking`, `reviewing`, `revising`, `catching_up`,
896 /// `queued`, `ready`, `needs_you`), `landed` or `closed`.
897 pub state: String,
898 /// One sentence about where it stands.
899 pub detail: String,
900 /// The issues it is waiting on that are still open.
901 pub blocked_by: Vec<u32>,
902 /// The pull request carrying it, the newest if several.
903 pub pull: Option<u32>,
904 /// Who or what is working on it, e.g. `g1t-agent`.
905 pub agent: Option<String>,
906}
907
908/// `start_plan`: records an outcome to plan for. Members of the
909/// repository's workspace only. Called by the runner service, which starts
910/// the sandbox. Returns `Outcome<PlanJob>`.
911#[derive(Debug, Serialize, Deserialize)]
912pub struct StartPlanArgs {
913 pub actor: User,
914 pub repo: RepoPath,
915 pub brief: String,
916}
917
918/// What a sandbox needs to write a plan.
919#[derive(Debug, Serialize, Deserialize)]
920#[serde(rename_all = "camelCase")]
921pub struct PlanJob {
922 pub plan_id: String,
923 /// Lets the sandbox, and nothing else, report this plan.
924 pub token: String,
925 pub brief: String,
926 pub repo: RepoPath,
927}
928
929/// `report_plan`: the plan a sandbox's agent wrote, or why it could not
930/// write one. Returns `Outcome<bool>`.
931#[derive(Debug, Serialize, Deserialize)]
932#[serde(rename_all = "camelCase")]
933pub struct ReportPlanArgs {
934 pub plan_id: String,
935 pub token: String,
936 #[serde(default)]
937 pub summary: String,
938 #[serde(default)]
939 pub issues: Vec<PlannedIssue>,
940 #[serde(default)]
941 pub error: Option<String>,
942}
943
944/// `get_plan`. Members only. Returns `Outcome<Plan>`. `list_plans` takes
945/// `ViewArgs` and returns `Outcome<Vec<Plan>>`, newest first.
946#[derive(Debug, Serialize, Deserialize)]
947pub struct PlanArgs {
948 pub repo: RepoPath,
949 pub viewer: Viewer,
950 pub id: String,
951}
952
953/// `apply_plan`: opens a plan's issues, each blocked by the ones it depends
954/// on. Members only, and once. Returns `Outcome<Plan>`, its issues now
955/// carrying their numbers.
956#[derive(Debug, Serialize, Deserialize)]
957pub struct ApplyPlanArgs {
958 pub actor: User,
959 pub repo: RepoPath,
960 pub id: String,
961 /// Queue every issue for a g1t agent.
962 #[serde(default)]
963 pub assign: bool,
964 /// The positions, counting from 1, of the issues to open. All of them
965 /// when absent.
966 #[serde(default)]
967 pub keep: Option<Vec<u32>>,
968}
969
970/// `queue_issue`: asks for a g1t agent to take an issue as soon as it can,
971/// or withdraws that. The author or a member may. Returns `Outcome<bool>`.
972#[derive(Debug, Serialize, Deserialize)]
973pub struct QueueIssueArgs {
974 pub actor: User,
975 pub repo: RepoPath,
976 pub number: u32,
977 pub queued: bool,
978}
979
980/// `ready_issues`: issues waiting for a g1t agent that can be given one
981/// now, in one repository or in all. Called by the runner service. Returns
982/// `Vec<ReadyIssue>`.
983#[derive(Debug, Default, Serialize, Deserialize)]
984#[serde(rename_all = "camelCase")]
985pub struct ReadyIssuesArgs {
986 #[serde(default)]
987 pub repo_id: Option<String>,
988}
989
990#[derive(Debug, Serialize, Deserialize)]
991pub struct ReadyIssue {
992 pub repo: RepoPath,
993 pub number: u32,
994 /// Who queued it, on whose say-so the agent works.
995 pub actor: User,
996}
997
998/// `update_pull`: changes who a pull request is assigned to and whose
999/// review is asked for. Each list given replaces the whole set. Whoever
1000/// opened it, or a member of the workspace, may. Returns `Outcome<Pull>`.
1001#[derive(Debug, Serialize, Deserialize)]
1002pub struct UpdatePullArgs {
1003 pub actor: User,
1004 pub repo: RepoPath,
1005 pub number: u32,
1006 #[serde(default)]
1007 pub assignees: Option<Vec<String>>,
1008 /// May include `g1t-agent`. Asking for its review does not by itself
1009 /// start one; the runner's `review` does.
1010 #[serde(default)]
1011 pub reviewers: Option<Vec<String>>,
1012}
1013
1014/// `start_checks`: begins a run of the acceptance checks for a pull request
1015/// that is ready for review. Called by the runner service, which starts the
1016/// sandbox. Returns `Outcome<CheckJob>`.
1017#[derive(Debug, Serialize, Deserialize)]
1018#[serde(rename_all = "camelCase")]
1019pub struct StartChecksArgs {
1020 pub pull_id: String,
1021}
1022
1023/// What a sandbox needs to carry out a check run.
1024#[derive(Debug, Serialize, Deserialize)]
1025#[serde(rename_all = "camelCase")]
1026pub struct CheckJob {
1027 pub run_id: String,
1028 /// Lets the sandbox, and nothing else, report this run's results.
1029 pub token: String,
1030 pub commands: Vec<String>,
1031 /// The repository holding the commit: the fork, or the repository itself.
1032 pub source: RepoPath,
1033 pub commit: String,
1034 /// Who opened the pull request, and so can read its source.
1035 pub author: User,
1036 /// Username of whoever wrote the checks: the issue's author.
1037 pub requested_by: String,
1038 pub repo: RepoPath,
1039 pub number: u32,
1040}
1041
1042/// `report_checks`: what a sandbox says about its run. With no results and
1043/// no error it has started. `skip` forgets the run, for one that will not
1044/// be carried out. Returns `Outcome<CheckRun>`.
1045#[derive(Debug, Serialize, Deserialize)]
1046#[serde(rename_all = "camelCase")]
1047pub struct ReportChecksArgs {
1048 pub run_id: String,
1049 pub token: String,
1050 #[serde(default)]
1051 pub results: Vec<CheckResult>,
1052 #[serde(default)]
1053 pub error: Option<String>,
1054 #[serde(default)]
1055 pub skip: bool,
1056}
1057
1058/// A pull request in progress, with where it lives.
1059#[derive(Debug, Serialize, Deserialize)]
1060pub struct ActivePull {
1061 pub pull: Pull,
1062 pub issue: Option<Issue>,
1063 /// Where it stands, for one g1t is seeing through.
1064 #[serde(default)]
1065 pub lifecycle: Option<Lifecycle>,
1066}
1067
1068/// `list_active_pulls`: drafts and open pull requests the viewer started,
1069/// most recently active first. Returns `Vec<ActivePull>`. Also
1070/// `list_assigned_issues`: open issues assigned to the viewer, most
1071/// recently changed first. Returns `Vec<Issue>`.
1072#[derive(Debug, Serialize, Deserialize)]
1073pub struct ViewerArgs {
1074 pub viewer: Viewer,
1075}
1076
1077/// `append_session`. Returns `Outcome<Appended>`.
1078#[derive(Debug, Serialize, Deserialize)]
1079pub struct AppendSessionArgs {
1080 pub actor: User,
1081 pub repo: RepoPath,
1082 pub number: u32,
1083 pub entries: Vec<NewSessionEntry>,
1084}
1085
1086#[derive(Debug, Serialize, Deserialize)]
1087pub struct Appended {
1088 pub count: u32,
1089}
1090
1091/// `start_review`: begins a review of a pull request by a g1t agent. Called
1092/// by the runner service, which starts the sandbox. Returns
1093/// `Outcome<ReviewJob>`.
1094#[derive(Debug, Serialize, Deserialize)]
1095#[serde(rename_all = "camelCase")]
1096pub struct StartReviewArgs {
1097 pub pull_id: String,
1098}
1099
1100/// What a sandbox needs to review a pull request.
1101#[derive(Debug, Serialize, Deserialize)]
1102#[serde(rename_all = "camelCase")]
1103pub struct ReviewJob {
1104 pub run_id: String,
1105 /// Lets the sandbox, and nothing else, report this review.
1106 pub token: String,
1107 /// The repository holding the commit: the fork, or the repository itself.
1108 pub source: RepoPath,
1109 pub commit: String,
1110 pub repo: RepoPath,
1111 pub default_branch: String,
1112 pub number: u32,
1113 pub title: String,
1114 pub description: String,
1115 /// The issue the pull request is for, which says what it should achieve.
1116 pub issue: Option<Issue>,
1117 /// Who opened the pull request, and so can read its source.
1118 pub author: User,
1119}
1120
1121/// A comment on one line, as a reviewing agent reports it.
1122#[derive(Debug, Serialize, Deserialize)]
1123pub struct ReviewComment {
1124 pub path: String,
1125 #[serde(default)]
1126 pub line: u32,
1127 pub body: String,
1128}
1129
1130/// `report_review`: the review a sandbox's agent wrote, or why it could not
1131/// write one. Returns `Outcome<bool>`.
1132#[derive(Debug, Serialize, Deserialize)]
1133#[serde(rename_all = "camelCase")]
1134pub struct ReportReviewArgs {
1135 pub run_id: String,
1136 pub token: String,
1137 #[serde(default)]
1138 pub verdict: Option<Verdict>,
1139 #[serde(default)]
1140 pub body: String,
1141 #[serde(default)]
1142 pub comments: Vec<ReviewComment>,
1143 /// The model that wrote it, by its public name.
1144 #[serde(default)]
1145 pub model: Option<String>,
1146 #[serde(default)]
1147 pub error: Option<String>,
1148}
1149
1150/// Lowercases, trims and de-duplicates labels, dropping empty ones.
1151/// Returns `None` if there are too many or one is too long.
1152pub fn normalize_labels(labels: &[String]) -> Option<Vec<String>> {
1153 const MAX_LABELS: usize = 10;
1154 const MAX_LABEL_CHARS: usize = 40;
1155 let mut normalized: Vec<String> = Vec::new();
1156 for label in labels {
1157 let label = label
1158 .split_whitespace()
1159 .collect::<Vec<_>>()
1160 .join(" ")
1161 .to_lowercase();
1162 if label.is_empty() || normalized.contains(&label) {
1163 continue;
1164 }
1165 if label.chars().count() > MAX_LABEL_CHARS {
1166 return None;
1167 }
1168 normalized.push(label);
1169 }
1170 (normalized.len() <= MAX_LABELS).then_some(normalized)
1171}
1172
1173#[cfg(test)]
1174mod tests {
1175 use super::normalize_labels;
1176
1177 fn labels(names: &[&str]) -> Vec<String> {
1178 names.iter().map(|name| (*name).to_owned()).collect()
1179 }
1180
1181 #[test]
1182 fn labels_are_lowercased_trimmed_and_unique() {
1183 assert_eq!(
1184 normalize_labels(&labels(&[" Bug ", "bug", "", "Good First Issue"])),
1185 Some(labels(&["bug", "good first issue"]))
1186 );
1187 }
1188
1189 #[test]
1190 fn too_long_or_too_many_labels_are_refused() {
1191 assert_eq!(normalize_labels(&["x".repeat(41)]), None);
1192 let many: Vec<String> = (0..11).map(|i| format!("label-{i}")).collect();
1193 assert_eq!(normalize_labels(&many), None);
1194 }
1195}
1196
1197
1198// --- Merge queue ----------------------------------------------------------
1199
1200/// Where a pull request in a merge queue stands.
1201#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
1202#[serde(rename_all = "snake_case")]
1203pub enum QueueState {
1204 /// Waiting for its turn to be tested.
1205 Waiting,
1206 /// Its combined state is being built and checked.
1207 Testing,
1208 /// Its combined state passed; it lands once everything ahead has.
1209 Passed,
1210 /// Its combined state failed, or would not merge. It left the queue.
1211 Failed,
1212 /// On the default branch.
1213 Landed,
1214 /// Taken out of the queue by a person, or closed.
1215 Removed,
1216}
1217
1218impl QueueState {
1219 pub fn as_str(self) -> &'static str {
1220 match self {
1221 QueueState::Waiting => "waiting",
1222 QueueState::Testing => "testing",
1223 QueueState::Passed => "passed",
1224 QueueState::Failed => "failed",
1225 QueueState::Landed => "landed",
1226 QueueState::Removed => "removed",
1227 }
1228 }
1229
1230 /// Still in the queue.
1231 pub fn is_active(self) -> bool {
1232 matches!(
1233 self,
1234 QueueState::Waiting | QueueState::Testing | QueueState::Passed
1235 )
1236 }
1237}
1238
1239/// One pull request's place in a merge queue.
1240#[derive(Clone, Debug, Serialize, Deserialize)]
1241#[serde(rename_all = "camelCase")]
1242pub struct QueueEntry {
1243 pub id: String,
1244 pub number: u32,
1245 pub title: String,
1246 /// Who or what made the pull request, e.g. `g1t-agent`.
1247 pub agent: String,
1248 pub state: QueueState,
1249 /// The pull requests merged ahead of it in the state being tested, in
1250 /// queue order. Empty when it was tested on the default branch alone.
1251 pub ahead: Vec<u32>,
1252 /// The default branch's commit the tested state was built on.
1253 pub base_commit: Option<String>,
1254 /// The tested state: the default branch with everything ahead and this.
1255 pub combined_commit: Option<String>,
1256 /// Why it failed: a merge conflict or what could not be run.
1257 pub error: Option<String>,
1258 /// The checks run against the tested state.
1259 pub results: Vec<CheckResult>,
1260 /// Username of whoever merged it into the queue: a person, or `g1t`.
1261 pub enqueued_by: String,
1262 /// RFC 3339.
1263 pub created_at: String,
1264 /// RFC 3339. When it landed or left.
1265 pub finished_at: Option<String>,
1266}
1267
1268/// A repository's merge queue: what is in it, in order, and what recently
1269/// left it.
1270#[derive(Clone, Debug, Serialize, Deserialize)]
1271#[serde(rename_all = "camelCase")]
1272pub struct QueueView {
1273 /// Whether the repository merges through the queue.
1274 pub enabled: bool,
1275 pub active: Vec<QueueEntry>,
1276 /// Newest first.
1277 pub recent: Vec<QueueEntry>,
1278}
1279
1280/// `queue`: a repository's merge queue. Returns `Outcome<QueueView>`.
1281#[derive(Debug, Serialize, Deserialize)]
1282pub struct QueueArgs {
1283 pub repo: RepoPath,
1284 pub viewer: Viewer,
1285}
1286
1287/// `queue_build`: the next batch to test for a repository, if nothing is
1288/// being tested now. Returns `Vec<QueueJob>`, one per entry, each testing
1289/// the default branch with that entry and everything ahead of it.
1290#[derive(Debug, Serialize, Deserialize)]
1291#[serde(rename_all = "camelCase")]
1292pub struct QueueBuildArgs {
1293 pub repo_id: String,
1294}
1295
1296/// One pull request in a state being tested: where its change is.
1297#[derive(Clone, Debug, Serialize, Deserialize)]
1298#[serde(rename_all = "camelCase")]
1299pub struct QueueStackItem {
1300 pub number: u32,
1301 pub title: String,
1302 /// The repository holding the change: its fork, or the repository.
1303 pub source: RepoPath,
1304 /// The branch of `source` holding it.
1305 pub branch: String,
1306 pub commit: String,
1307}
1308
1309/// What a sandbox needs to build and check one combined state.
1310#[derive(Clone, Debug, Serialize, Deserialize)]
1311#[serde(rename_all = "camelCase")]
1312pub struct QueueJob {
1313 pub entry_id: String,
1314 /// Lets the sandbox, and nothing else, report this state's result.
1315 pub token: String,
1316 pub repo: RepoPath,
1317 pub default_branch: String,
1318 /// The default branch's commit to build on.
1319 pub base_commit: String,
1320 /// Where to push the tested state, in the repository itself.
1321 pub branch: String,
1322 /// The pull requests to merge in, in order; the last is the entry.
1323 pub stack: Vec<QueueStackItem>,
1324 /// Every acceptance check of every pull request in the stack.
1325 pub checks: Vec<String>,
1326 /// The checks of issues already completed: the default branch's
1327 /// contract. One that fails on the base alone is not held against the
1328 /// entry.
1329 #[serde(default)]
1330 pub contract_checks: Vec<String>,
1331 /// Who the sandbox acts as: a member who can push the tested state.
1332 pub actor: User,
1333}
1334
1335/// `report_queue`: a sandbox's result for one combined state. Returns
1336/// `Outcome<QueueState>`.
1337#[derive(Debug, Serialize, Deserialize)]
1338#[serde(rename_all = "camelCase")]
1339pub struct ReportQueueArgs {
1340 pub entry_id: String,
1341 pub token: String,
1342 #[serde(default)]
1343 pub combined_commit: Option<String>,
1344 #[serde(default)]
1345 pub results: Vec<CheckResult>,
1346 /// Set when the state could not be built or checked.
1347 #[serde(default)]
1348 pub error: Option<String>,
1349 /// For a merge conflict: the pull request whose change it collided with.
1350 #[serde(default)]
1351 pub conflict_with: Option<u32>,
1352}
1353
1354
1355/// `locate_pull`: where a pull request lives, by its id, for a tool that
1356/// knows only the fork it is working in (`g1t.sh/pulls/<id>`). Returns
1357/// `Outcome<LocatedPull>`; not found for anyone who cannot see it.
1358#[derive(Debug, Serialize, Deserialize)]
1359pub struct LocatePullArgs {
1360 pub id: String,
1361 pub viewer: Viewer,
1362}
1363
1364#[derive(Clone, Debug, Serialize, Deserialize)]
1365#[serde(rename_all = "camelCase")]
1366pub struct LocatedPull {
1367 pub repo: RepoPath,
1368 pub number: u32,
1369 pub title: String,
1370 pub status: PullStatus,
1371}