Skip to content

Commit

Permalink
Merge branch 'GoogleChrome:main' into confidentiality
Browse files Browse the repository at this point in the history
  • Loading branch information
yanndago authored Dec 19, 2024
2 parents be2ff15 + 5b9a927 commit aa0f186
Show file tree
Hide file tree
Showing 33 changed files with 344 additions and 104 deletions.
2 changes: 2 additions & 0 deletions api/api_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
('doc_links', 'links'),
('editor_emails', 'emails'),
('enterprise_feature_categories', 'split_str'),
('enterprise_product_category', 'int'),
('ergonomics_risks', 'str'),
('explainer_links', 'links'),
('feature_notes', 'str'),
Expand Down Expand Up @@ -124,6 +125,7 @@
('ot_request_note', 'str'),
('ot_require_approvals', 'bool'),
('ot_stage_id', 'int'),
('ot_use_counter_bucket_number', 'int'),
('ot_webfeature_use_counter', 'str'),
('rollout_impact', 'int'),
('rollout_milestone', 'int'),
Expand Down
4 changes: 4 additions & 0 deletions api/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def stage_to_json_dict(
'ot_is_deprecation_trial': stage.ot_is_deprecation_trial,
'ot_owner_email': stage.ot_owner_email,
'ot_require_approvals': stage.ot_require_approvals,
'ot_use_counter_bucket_number': stage.ot_use_counter_bucket_number,
'ot_webfeature_use_counter': stage.ot_webfeature_use_counter,
'extensions': [],
'experiment_extension_reason': stage.experiment_extension_reason,
Expand Down Expand Up @@ -355,6 +356,7 @@ def feature_entry_to_json_verbose(
'category_int': fe.category,
'feature_notes': fe.feature_notes,
'enterprise_feature_categories': fe.enterprise_feature_categories or [],
'enterprise_product_category': fe.enterprise_product_category or ENTERPRISE_PRODUCT_CATEGORY_CHROME_BROWSER_UPDATE,
'stages': stage_info['all_stages'],
'accurate_as_of': _date_to_str(fe.accurate_as_of),
'creator_email': fe.creator_email,
Expand Down Expand Up @@ -491,6 +493,7 @@ def feature_entry_to_json_verbose(
},
},
'enterprise_feature_categories': fe.enterprise_feature_categories or [],
'enterprise_product_category': fe.enterprise_product_category or ENTERPRISE_PRODUCT_CATEGORY_CHROME_BROWSER_UPDATE,
'standards': {
'spec': fe.spec_link,
'maturity': {
Expand Down Expand Up @@ -532,6 +535,7 @@ def feature_entry_to_json_basic(fe: FeatureEntry,
'summary': fe.summary,
'unlisted': fe.unlisted,
'enterprise_impact': fe.enterprise_impact,
'enterprise_product_category': fe.enterprise_product_category or ENTERPRISE_PRODUCT_CATEGORY_CHROME_BROWSER_UPDATE,
'breaking_change': fe.breaking_change,
'confidential': fe.confidential,
'first_enterprise_notification_milestone': fe.first_enterprise_notification_milestone,
Expand Down
3 changes: 3 additions & 0 deletions api/converters_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def test_feature_entry_to_json_basic__normal(self):
'blink_components': ['Blink'],
'first_enterprise_notification_milestone': 100,
'enterprise_impact': ENTERPRISE_IMPACT_NONE,
'enterprise_product_category': 0,
'breaking_change': False,
'is_released': True,
'milestone': None,
Expand Down Expand Up @@ -192,6 +193,7 @@ def test_feature_entry_to_json_basic__feature_release(self):
'blink_components': ['Blink'],
'first_enterprise_notification_milestone': 100,
'enterprise_impact': ENTERPRISE_IMPACT_NONE,
'enterprise_product_category': 0,
'breaking_change': False,
'is_released': True,
'milestone': True,
Expand Down Expand Up @@ -295,6 +297,7 @@ def test_feature_entry_to_json_verbose__normal(self):
'unlisted': False,
'api_spec': False,
'enterprise_impact': ENTERPRISE_IMPACT_NONE,
'enterprise_product_category': 0,
'shipping_year': 2024,
'breaking_change': False,
'is_released': True,
Expand Down
1 change: 1 addition & 0 deletions api/legacy_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def feature_to_legacy_json(f: Feature) -> dict[str, Any]:
d['id'] = None
d['category'] = FEATURE_CATEGORIES[f.category]
d['enterprise_feature_categories'] = f.enterprise_feature_categories
d['enterprise_product_category'] = f.enterprise_product_category
d['category_int'] = f.category
if f.feature_type is not None:
d['feature_type'] = FEATURE_TYPES[f.feature_type]
Expand Down
5 changes: 5 additions & 0 deletions api/stages_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def setUp(self):
# requests obtaining information about the stage.
ot_request_note='Additional info',
ot_owner_email='ot_owner@example.com',
ot_use_counter_bucket_number=11,
ot_webfeature_use_counter='kExampleUseCounter',
milestones=MilestoneSet(desktop_first=100),
experiment_goals='To be the very best.',
Expand Down Expand Up @@ -144,6 +145,7 @@ def setUp(self):
'ot_owner_email': None,
'ot_require_approvals': False,
'ot_setup_status': 1,
'ot_use_counter_bucket_number': None,
'ot_webfeature_use_counter': None,
'experiment_extension_reason': None,
'experiment_goals': 'To be the very best.',
Expand Down Expand Up @@ -247,6 +249,7 @@ def test_get__valid_with_extension(self):
'ot_is_deprecation_trial': False,
'ot_owner_email': None,
'ot_require_approvals': False,
'ot_use_counter_bucket_number': None,
'ot_webfeature_use_counter': None,
'announcement_url': None,
'enterprise_policies': [],
Expand Down Expand Up @@ -299,6 +302,7 @@ def test_get__valid_with_extension(self):
'ot_is_deprecation_trial': False,
'ot_owner_email': None,
'ot_require_approvals': False,
'ot_use_counter_bucket_number': None,
'ot_webfeature_use_counter': None,
'announcement_url': None,
'enterprise_policies': [],
Expand Down Expand Up @@ -358,6 +362,7 @@ def test_get__valid_with_extension(self):
'ot_is_deprecation_trial': True,
'ot_owner_email': 'ot_owner@example.com',
'ot_require_approvals': True,
'ot_use_counter_bucket_number': 11,
'ot_webfeature_use_counter': 'kExampleUseCounter',
'rollout_details': None,
'rollout_impact': 2,
Expand Down
10 changes: 10 additions & 0 deletions client-src/css/forms-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,4 +275,14 @@ export const FORM_STYLES = [
width: 30%;
height: 1.5em;
}
.choices label {
font-weight: bold;
}
.choices div {
margin-top: 1em;
}
.choices p {
margin: 0.5em 1.5em 1em;
}
`];
2 changes: 1 addition & 1 deletion client-src/elements/chromedash-form-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ export class ChromedashFormField extends LitElement {
id="id_${this.name}_${value}"
name="${fieldName}"
value="${value}"
.checked="${value === fieldValue}"
.checked="${value === Number(fieldValue)}"
type="radio"
required
@change=${this.handleFieldUpdated}
Expand Down
1 change: 1 addition & 0 deletions client-src/elements/chromedash-guide-editall-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ export class ChromedashGuideEditallPage extends LitElement {
.feature=${formattedFeature}
?forEnterprise=${formattedFeature.is_enterprise_feature}
@form-field-update="${this.handleFormFieldUpdate}"
class="${field === 'enterprise_product_category' ? 'choices' : ''}"
>
</chromedash-form-field>
`;
Expand Down
1 change: 1 addition & 0 deletions client-src/elements/chromedash-guide-metadata-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export class ChromedashGuideMetadataPage extends LitElement {
.feature=${formattedFeature}
?forEnterprise=${formattedFeature.is_enterprise_feature}
@form-field-update="${this.handleFormFieldUpdate}"
class="${field === 'enterprise_product_category' ? 'choices' : ''}"
>
</chromedash-form-field>
`;
Expand Down
18 changes: 6 additions & 12 deletions client-src/elements/chromedash-guide-new-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@ export class ChromedashGuideNewPage extends LitElement {
box-shadow: 0 0 0 var(--sl-focus-ring-width)
var(--sl-input-focus-ring-color);
}
.choices label {
font-weight: bold;
}
.choices div {
margin-top: 1em;
}
.choices p {
margin: 0.5em 1.5em 1em;
}
.process-notice {
margin: var(--content-padding-half) 0;
padding: var(--content-padding-half);
Expand Down Expand Up @@ -211,7 +200,12 @@ export class ChromedashGuideNewPage extends LitElement {
${!this.isEnterpriseFeature
? renderFormField('feature_type_radio_group', 'choices')
: nothing}
${formFields.map(field => renderFormField(field))}
${formFields.map(field =>
renderFormField(
field,
field === 'enterprise_product_category' ? 'choices' : null
)
)}
</chromedash-form-table>
<input
type="submit"
Expand Down
10 changes: 0 additions & 10 deletions client-src/elements/chromedash-ot-creation-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ export class ChromedashOTCreationPage extends LitElement {
...SHARED_STYLES,
...FORM_STYLES,
css`
.choices label {
font-weight: bold;
}
.choices div {
margin-top: 1em;
}
.choices p {
margin: 0.5em 1.5em 1em;
}
#overlay {
position: fixed;
width: 100%;
Expand Down
4 changes: 4 additions & 0 deletions client-src/elements/form-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as enums from './form-field-enums';
export interface FormattedFeature {
category: number;
enterprise_feature_categories: string[];
enterprise_product_category: number;
feature_type: number;
intent_stage: number;
accurate_as_of: boolean;
Expand Down Expand Up @@ -81,6 +82,7 @@ export function formatFeatureForEdit(feature: Feature): FormattedFeature {
enterprise_feature_categories: Array.from(
new Set(feature.enterprise_feature_categories || [])
).map(x => parseInt(x).toString()),
enterprise_product_category: feature.enterprise_product_category,
feature_type: feature.feature_type_int,
intent_stage: feature.intent_stage_int,

Expand Down Expand Up @@ -177,6 +179,7 @@ export const ENTERPRISE_NEW_FEATURE_FORM_FIELDS = [
'owner',
'editors',
'enterprise_feature_categories',
'enterprise_product_category',
'first_enterprise_notification_milestone',
'enterprise_impact',
'confidential',
Expand Down Expand Up @@ -233,6 +236,7 @@ export const FLAT_ENTERPRISE_METADATA_FIELDS: MetadataFields = {
'owner',
'editors',
'enterprise_feature_categories',
'enterprise_product_category',
'enterprise_impact',
'confidential',
'first_enterprise_notification_milestone',
Expand Down
27 changes: 27 additions & 0 deletions client-src/elements/form-field-enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,33 @@ export const FEATURE_TYPES: Record<
],
};

export const ENTERPRISE_PRODUCT_CATEGORY: Record<
string,
[number, string, string | HTMLTemplateResult]
> = {
ENTERPRISE_PRODUCT_CATEGORY_CHROME_BROWSER_UPDATE: [
0,
'Chrome Browser update',
'New features, performance improvements, security fixes and minor updates addressing security vulnerabilities and bugs. These features apply to both consumers and enterprises.',
],
ENTERPRISE_PRODUCT_CATEGORY_CHROME_ENTERPRISE_CORE: [
1,
'Chrome Enterprise Core (CEC)',
'These features allow IT administrators to manage Chrome browser settings, policies, apps and extensions across an organization from a central location (Admin Console).',
],
ENTERPRISE_PRODUCT_CATEGORY_CHROME_ENTERPRISE_PREMIUM: [
2,
'Chrome Enterprise Premium (CEP, paid SKU)',
'These features add advanced security and enhanced controls for organizations with more custom needs e.g. data masking functionality.',
],
};

export const ENTERPRISE_PRODUCT_CATEGORY_DISPLAYNAME: Record<number, string> = {
0: 'Chrome Browser update', // ENTERPRISE_PRODUCT_CATEGORY_CHROME_BROWSER_UPDATE
1: 'Chrome Enterprise Core (CEC)', // ENTERPRISE_PRODUCT_CATEGORY_CHROME_ENTERPRISE_CORE
2: 'Chrome Enterprise Premium (CEP, paid SKU)', // ENTERPRISE_PRODUCT_CATEGORY_CHROME_ENTERPRISE_PREMIUM
};

// ***********************************************************************
// Stage type values for each process. Even though some of the stages
// in these processes are similar to each other, they have distinct enum
Expand Down
10 changes: 10 additions & 0 deletions client-src/elements/form-field-specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
DT_MILESTONE_FIELDS,
ENTERPRISE_FEATURE_CATEGORIES,
ENTERPRISE_IMPACT,
ENTERPRISE_PRODUCT_CATEGORY,
FEATURE_CATEGORIES,
FEATURE_TYPES,
FEATURE_TYPES_WITHOUT_ENTERPRISE,
Expand Down Expand Up @@ -491,6 +492,15 @@ export const ALL_FIELDS: Record<string, Field> = {
"Miscellaneous".`,
},

enterprise_product_category: {
type: 'radios',
name: 'enterprise_product_category',
choices: ENTERPRISE_PRODUCT_CATEGORY,
label: 'Enterprise product category',
help_text: html` Select the appropriate category.`,
check: (_value, getFieldValue) => checkFeatureNameAndType(getFieldValue),
},

feature_type: {
type: 'select',
disabled: true,
Expand Down
7 changes: 7 additions & 0 deletions client-src/elements/queriable-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import {type HTMLTemplateResult} from 'lit';
import {
ENTERPRISE_PRODUCT_CATEGORY,
FEATURE_CATEGORIES,
FEATURE_TYPES,
IMPLEMENTATION_STATUS,
Expand Down Expand Up @@ -193,6 +194,12 @@ export const QUERIABLE_FIELDS: QueryField[] = [
doc: 'Feature category',
choices: FEATURE_CATEGORIES,
},
{
name: 'enterprise_product_category',
kind: ENUM_KIND,
doc: 'Enterprise product category',
choices: ENTERPRISE_PRODUCT_CATEGORY,
},
{
name: 'feature_type',
kind: ENUM_KIND,
Expand Down
4 changes: 4 additions & 0 deletions client-src/elements/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {FORMS_BY_STAGE_TYPE, FormattedFeature} from './form-definition.js';
import {
ENTERPRISE_FEATURE_CATEGORIES_DISPLAYNAME,
ENTERPRISE_IMPACT_DISPLAYNAME,
ENTERPRISE_PRODUCT_CATEGORY_DISPLAYNAME,
OT_MILESTONE_END_FIELDS,
OT_SETUP_STATUS_OPTIONS,
PLATFORMS_DISPLAYNAME,
Expand Down Expand Up @@ -278,6 +279,9 @@ export function getFieldValueFromFeature(
value = feature[fieldName];
}

if (fieldName === 'enterprise_product_category' && value !== undefined) {
return ENTERPRISE_PRODUCT_CATEGORY_DISPLAYNAME[value];
}
if (fieldName === 'enterprise_feature_categories' && value) {
return value.map(
categoryId => ENTERPRISE_FEATURE_CATEGORIES_DISPLAYNAME[categoryId]
Expand Down
2 changes: 2 additions & 0 deletions client-src/js-src/cs-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
* @property {number} [ot_setup_status]
* @property {string} [ot_request_note]
* @property {number} [ot_stage_id]
* @property {number} [ot_use_counter_bucket_number]
* @property {string} [experiment_extension_reason]
* @property {string} [finch_url]
* @property {string} [rollout_details]
Expand Down Expand Up @@ -199,6 +200,7 @@
* @property {string[]} search_tags
* @property {string} [feature_notes]
* @property {string[]} enterprise_feature_categories
* @property {number} enterprise_product_category
* Metadata: Process information
* @property {string} feature_type
* @property {number} feature_type_int
Expand Down
9 changes: 2 additions & 7 deletions internals/approval_defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,9 @@ def set_vote(feature_id: int, gate_type: int | None, new_state: int,
new_vote.key.delete()
return None

old_gate_state = gate.state
state_was_updated = update_gate_approval_state(gate, votes)
slo_was_updated = slo.record_vote(gate, votes)
slo_was_updated = slo.record_vote(gate, votes, old_gate_state)
if state_was_updated or slo_was_updated:
gate.put()
return gate.state
Expand Down Expand Up @@ -459,11 +460,5 @@ def update_gate_approval_state(gate: Gate, votes: list[Vote]) -> bool:
if new_state == gate.state:
return False
gate.state = new_state
if votes:
gate.requested_on = min(v.set_on for v in votes)

# Starting a review resets responded_on.
if new_state in (Vote.REVIEW_REQUESTED, Vote.NA_REQUESTED):
gate.responded_on = None

return True
5 changes: 5 additions & 0 deletions internals/core_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@
IWA: 'Isolated Web Apps-specific API',
}


ENTERPRISE_PRODUCT_CATEGORY_CHROME_BROWSER_UPDATE = 0
ENTERPRISE_PRODUCT_CATEGORY_CHROME_ENTERPRISE_CORE = 1
ENTERPRISE_PRODUCT_CATEGORY_CHROME_ENTERPRISE_PREMIUM = 2

FEATURE_TYPE_INCUBATE_ID = 0
FEATURE_TYPE_EXISTING_ID = 1
FEATURE_TYPE_CODE_CHANGE_ID = 2
Expand Down
Loading

0 comments on commit aa0f186

Please sign in to comment.