blob: b866cea0066ccc6b8b2110c2a90c033d6c6b0400 [file] [log] [blame]
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +01001// Copyright 2020 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Copybara854996b2021-09-07 19:36:02 +00004
5// This file defines protobufs for issues and related business
6// objects, e.g., field values, comments, and attachments.
7
8syntax = "proto3";
9
10package monorail.v3;
11
Adrià Vilanova Martínezac4a6442022-05-15 19:05:13 +020012option go_package = "infra/monorailv2/api/v3/api_proto";
Copybara854996b2021-09-07 19:36:02 +000013
14import "google/api/field_behavior.proto";
15import "google/api/resource.proto";
16import "google/protobuf/timestamp.proto";
17
18// Represents a comment and any associated changes to an Issue.
19//
20// Comments cannot be Created or Updated through standard methods. The
21// OUTPUT_ONLY annotations here indicate fields that would never be provided
22// by the user even if these methods were made available.
23// Next available tag: 11.
24message Comment {
25
26 // The type of comment.
27 // Next available tag: 9
28 enum Type {
29 // The default comment type. Used if type is omitted.
30 UNSPECIFIED = 0;
31 // A standard comment on an issue.
32 COMMENT = 1;
33 // A comment representing a new description for the issue.
34 DESCRIPTION = 2;
35 }
36
37 // A file attached to a comment.
38 // Next available tag: 8
39 message Attachment {
40 // The name of the attached file.
41 string filename = 1;
42 // It is possible for attachments to be deleted (and undeleted) by the
43 // uploader. The name of deleted attachments are still shown, but the
44 // content is not available.
45 IssueContentState state = 2;
46 // Size of the attached file in bytes.
47 uint64 size = 3;
48 // The type of content contained in the file, using the IANA's media type
49 // https://www.iana.org/assignments/media-types/media-types.xhtml.
50 string media_type = 4;
51 // The URI used for a preview of the attachment (when relelvant).
52 string thumbnail_uri = 5;
53 // The URI used to view the content of the attachment.
54 string view_uri = 6;
55 // The URI used to download the content of the attachment.
56 string download_uri = 7;
57 }
58
59 // This message is only suitable for displaying the amendment to users.
60 // We don't currently offer structured amendments that client code can
61 // reason about, field names can be ambiguous, and we don't have
62 // old_value for most changes.
63 // Next available tag: 4
64 message Amendment {
65 // This may be the name of a built-in or custom field, or relative to
66 // an approval field name.
67 string field_name = 1;
68 // This may be a new value that overwrote the old value, e.g., "Assigned",
69 // or it may be a space-separated list of changes, e.g., "Size-L -Size-S".
70 string new_or_delta_value = 2;
71 // old_value is only used when the user changes the summary.
72 string old_value = 3;
73 }
74
75 option (google.api.resource) = {
76 type: "api.crbug.com/Comment"
77 pattern: "projects/{project}/issues/{issue}/comments/{comment}"
78 };
79
80 // Resource name of the comment.
81 string name = 1;
82 // The state of the comment.
83 IssueContentState state = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
84 // The type of comment.
85 Type type = 3;
86 // The text of the comment.
87 string content = 4;
88 // Resource name of the author of the comment.
89 string commenter = 5 [
90 (google.api.resource_reference) = { type: "api.crbug.com/User" },
91 (google.api.field_behavior) = OUTPUT_ONLY
92 ];
93 // The time this comment was added to the Issue.
94 google.protobuf.Timestamp create_time = 6
95 [(google.api.field_behavior) = OUTPUT_ONLY];
96 // Optional string full text of an email that caused this comment to be added.
97 string inbound_message = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
98 // The approval this comment is associated with, if applicable.
99 string approval = 8
100 [(google.api.resource_reference) = { type: "api.crbug.com/ApprovalValue" }];
101 // Any changes made to the issue in association with this comment.
102 repeated Amendment amendments = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
103 // Any attachments uploaded in association with this comment.
104 repeated Attachment attachments = 10
105 [(google.api.field_behavior) = OUTPUT_ONLY];
106}
107
108
109// Many values on an issue can be set either explicitly or by a rule.
110//
111// Note: Though Derivations are used as OUTPUT_ONLY, values including them
112// will still be ingested even though the Derivation is ignored.
113//
114// Next available tag: 3
115enum Derivation {
116 // The default derivation. This value is used if the derivation is omitted.
117 DERIVATION_UNSPECIFIED = 0;
118 // The value was explicitly set on the issue.
119 EXPLICIT = 1;
120 // Value was auto-applied to the issue based on a project's rule. See
121 // monorail/doc/userguide/project-owners.md#how-to-configure-filter-rules
122 RULE = 2;
123}
124
125
126// A value of a custom field for an issue.
127// Next available tag: 5
128message FieldValue {
129 // The project-defined field associated with this value
130 string field = 1 [
131 (google.api.resource_reference) = { type: "api.crbug.com/FieldDef" }];
132 // The value associated with the field.
133 // Mapping of field types to string value:
134 // ENUM_TYPE(int) => str(value)
135 // INT_TYPE(int) => str(value)
136 // STR_TYPE(str) => value
137 // USER_TYPE(int) => the user's resource name
138 // DATE_TYPE(int) => str(int) representing time in seconds since epoch
139 // URL_TYPE(str) => value
140 string value = 2;
141 // How the value was derived.
142 Derivation derivation = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
143 // Issues with phase-specific fields can have values for each phase.
144 string phase = 4;
145}
146
147// Documents and tracks a bug, task, or feature request within a Project.
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +0100148// Next available tag: 24
Copybara854996b2021-09-07 19:36:02 +0000149message Issue {
150 option (google.api.resource) = {
151 type: "api.crbug.com/Issue"
152 pattern: "projects/{project}/issues/{issue}"
153 };
154
155 // A possibly rule-derived component for the issue.
156 // Next available tag: 3
157 message ComponentValue {
Adrià Vilanova Martínezde942802022-07-15 14:06:55 +0200158 // AIP resource name of the component.
Copybara854996b2021-09-07 19:36:02 +0000159 string component = 1 [
160 (google.api.resource_reference) = { type: "api.crbug.com/ComponentDef" }
161 ];
162 // How the component was derived.
163 Derivation derivation = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
164 }
165
166 // A possibly rule-derived label for an issue.
167 // Next available tag: 3
168 message LabelValue {
169 // The label.
170 string label = 1;
171 // How the label was derived.
172 Derivation derivation = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
173 }
174
175 // A possibly rule-derived status for an issue.
176 // Next available tag: 3
177 message StatusValue {
178 // The status of the issue. Note that in rare cases this can be a
179 // value not defined in the project's StatusDefs (e.g. if the issue
180 // was moved from another project).
181 string status = 1;
182 // How the status was derived.
183 Derivation derivation = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
184 }
185
186 // A possibly rule-derived user value on an issue.
187 // Next available tag: 3
188 message UserValue {
189 // The user.
190 string user = 1
191 [(google.api.resource_reference) = { type: "api.crbug.com/User" }];
192 // How the user value was derived.
193 Derivation derivation = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
194 }
195
196 // Resource name of the issue.
197 string name = 1;
198 // A brief summary of the issue. Generally displayed as a user-facing title.
199 // TODO(monorail:6988): The UI limits summary length while the backend does
200 // not. Resolve this discrepancy.
201 string summary = 2;
202 // The state of the issue.
203 IssueContentState state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
204 // The current status of the issue.
205 StatusValue status = 4 [(google.api.field_behavior) = REQUIRED];
206 // The user who created the issue.
207 string reporter = 5 [
208 (google.api.resource_reference) = { type: "api.crbug.com/User" },
209 (google.api.field_behavior) = OUTPUT_ONLY
210 ];
211 // The user currently responsible for the issue. This user must be a member of
212 // the Project.
213 UserValue owner = 6;
214 // Additional users receiving notifications on the issue.
215 repeated UserValue cc_users = 7;
216 // Labels applied to the issue.
217 repeated LabelValue labels = 8;
218 // Components the issue is associated with.
219 repeated ComponentValue components = 9;
220 // Values for custom fields on the issue.
221 repeated FieldValue field_values = 10;
222 // An issue can be merged into another. If this value is set, the issue
223 // referred to should be considered the primary source for further updates.
224 IssueRef merged_into_issue_ref = 11;
225 // Issues preventing the completion of this issue.
226 repeated IssueRef blocked_on_issue_refs = 12;
227 // Issues for which this issue is blocking completion.
228 repeated IssueRef blocking_issue_refs = 13;
229 // The time the issue was reported.
230 google.protobuf.Timestamp create_time = 14
231 [(google.api.field_behavior) = OUTPUT_ONLY];
232 // The most recent time the issue was closed.
233 google.protobuf.Timestamp close_time = 15
234 [(google.api.field_behavior) = OUTPUT_ONLY];
235 // The most recent time the issue was modified.
236 google.protobuf.Timestamp modify_time = 16
237 [(google.api.field_behavior) = OUTPUT_ONLY];
238 // The most recent time a component value was modified.
239 google.protobuf.Timestamp component_modify_time = 17
240 [(google.api.field_behavior) = OUTPUT_ONLY];
241 // The most recent time the status value was modified.
242 google.protobuf.Timestamp status_modify_time = 18
243 [(google.api.field_behavior) = OUTPUT_ONLY];
244 // The most recent time the owner made a modification to the issue.
245 google.protobuf.Timestamp owner_modify_time = 19
246 [(google.api.field_behavior) = OUTPUT_ONLY];
247 // The number of attachments associated with the issue.
248 uint32 attachment_count = 20 [(google.api.field_behavior) = OUTPUT_ONLY];
249 // The number of users who have starred the issue.
250 uint32 star_count = 21 [(google.api.field_behavior) = OUTPUT_ONLY];
251 // Phases of a process the issue is tracking (if applicable).
252 // See monorail/doc/userguide/concepts.md#issue-approvals-and-gates
253 repeated string phases = 22 [
254 (google.api.field_behavior) = OUTPUT_ONLY];
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +0100255 // The issue tracker ID this Monorail issue migrated to.
256 string migrated_id = 23;
Copybara854996b2021-09-07 19:36:02 +0000257}
258
259// States that an issue or its comments can be in (aip.dev/216).
260// Next available tag: 4
261enum IssueContentState {
262 // The default value. This value is used if the state is omitted.
263 STATE_UNSPECIFIED = 0;
264 // The Issue or Comment is available.
265 ACTIVE = 1;
266 // The Issue or Comment has been deleted.
267 DELETED = 2;
268 // The Issue or Comment has been flagged as spam.
269 // Takes precedent over DELETED.
270 SPAM = 3;
271}
272
273// Specifies a column in an issues list view.
274// Next available tag: 2
275message IssuesListColumn {
276 // Column name shown in the column header.
277 string column = 1;
278}
279
280// Refers to an issue that may or may not be tracked in Monorail.
281// At least one of `issue` and `ext_identifier` MUST be set; they MUST NOT both
282// be set.
283// Next available tag: 3
284message IssueRef {
285 // Resource name of an issue tracked in Monorail
286 string issue = 1
287 [(google.api.resource_reference) = { type: "api.crbug.com/Issue" }];
288 // For referencing external issues, e.g. b/1234, or a dangling reference
289 // to an old 'codesite' issue.
290 // TODO(monorail:7208): add more documentation on dangling references.
291 string ext_identifier = 2;
292}
293
294// Documents and tracks an approval process.
295// See monorail/doc/userguide/concepts.md#issue-approvals-and-gates
296// Next available tag: 9
297message ApprovalValue {
298 option (google.api.resource) = {
299 type: "api.crbug.com/ApprovalValue"
300 pattern: "projects/{project}/issues/{issue}/approvalValues/{approval}"
301 };
302
303 // Potential states for an approval. Note that these statuses cause different
304 // sets of notifications. See monorail/doc/userguide/email.md
305 // Next available tag: 9
306 enum ApprovalStatus {
307 // The default approval status. This value is used if the status is omitted.
308 APPROVAL_STATUS_UNSPECIFIED = 0;
309 // No status has yet been set on this value.
310 NOT_SET = 1;
311 // This issue needs review from the approvers for this phase.
312 NEEDS_REVIEW = 2;
313 // This approval is not needed for this issue for this phase.
314 NA = 3;
315 // The issue is ready for the approvers to review.
316 REVIEW_REQUESTED = 4;
317 // The approvers have started reviewing this issue.
318 REVIEW_STARTED = 5;
319 // The approvers need more information.
320 NEED_INFO = 6;
321 // The approvers have approved this issue for this phase.
322 APPROVED = 7;
323 // The approvers have indicated this issue is not approved for this phase.
324 NOT_APPROVED = 8;
325 }
326
327 // The resource name.
328 string name = 1;
329 // The resource name of the ApprovalDef.
330 string approval_def = 2 [
331 (google.api.resource_reference) = { type: "api.crbug.com/ApprovalDef" },
332 (google.api.field_behavior) = OUTPUT_ONLY];
333 // The users able to grant this approval.
334 repeated string approvers = 3 [
335 (google.api.resource_reference) = { type: "api.crbug.com/User" }];
336 // The current status of the approval.
337 ApprovalStatus status = 4;
338 // The time `status` was last set.
339 google.protobuf.Timestamp set_time = 5 [
340 (google.api.field_behavior) = OUTPUT_ONLY];
341 // The user who most recently set `status`.
342 string setter = 6 [
343 (google.api.resource_reference) = { type: "api.crbug.com/User" },
344 (google.api.field_behavior) = OUTPUT_ONLY];
345 // The phase the approval is associated with (if applicable).
346 string phase = 7 [
347 (google.api.field_behavior) = OUTPUT_ONLY];
348 // FieldValues with `approval_def` as their parent.
349 repeated FieldValue field_values = 8;
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +0100350}