Migrate and write additional fields for FeatureEntry and Stage (#2318)

* Handle final fields

Add `announcement_url` to the Stage kind, and populate entities in the migration using the `ready_for_trial_url` field. Additionally, migrate the `experiment_timeline` field for FeatureEntry.

* Update guide.py
This commit is contained in:
Daniel Smith 2022-10-11 18:56:48 +02:00 коммит произвёл GitHub
Родитель 773c73afd5
Коммит b4fa4daf5a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 11 добавлений и 15 удалений

Просмотреть файл

@ -1271,6 +1271,7 @@ class Stage(ndb.Model):
experiment_extension_reason = ndb.TextProperty() experiment_extension_reason = ndb.TextProperty()
intent_thread_url = ndb.StringProperty() intent_thread_url = ndb.StringProperty()
origin_trial_feedback_url = ndb.StringProperty() origin_trial_feedback_url = ndb.StringProperty()
announcement_url = ndb.StringProperty()
@classmethod @classmethod
def get_feature_stages(cls, feature_id: int) -> dict: def get_feature_stages(cls, feature_id: int) -> dict:

Просмотреть файл

@ -171,7 +171,8 @@ class MigrateFeaturesToFeatureEntries(FlaskHandler):
('devrel_emails', 'devrel'), # Renamed ('devrel_emails', 'devrel'), # Renamed
('debuggability', 'debuggability'), ('debuggability', 'debuggability'),
('doc_links', 'doc_links'), ('doc_links', 'doc_links'),
('sample_links', 'sample_links')] ('sample_links', 'sample_links'),
('experiment_timeline', 'experiment_timeline')]
return handle_migration(Feature, FeatureEntry,kwarg_mapping, return handle_migration(Feature, FeatureEntry,kwarg_mapping,
self.special_handler) self.special_handler)
@ -244,8 +245,8 @@ class MigrateStages(FlaskHandler):
stage = Stage(stage_type=STAGE_BLINK_PROTOTYPE, stage = Stage(stage_type=STAGE_BLINK_PROTOTYPE,
intent_thread_url=feature.intent_to_implement_url, **kwargs) intent_thread_url=feature.intent_to_implement_url, **kwargs)
stage.put() stage.put()
stage = Stage(stage_type=STAGE_BLINK_DEV_TRIAL, stage = Stage(stage_type=STAGE_BLINK_DEV_TRIAL, milestones=devtrial_mstones,
milestones=devtrial_mstones, **kwargs) announcement_url=feature.ready_for_trial_url, **kwargs)
stage.put() stage.put()
stage = Stage(stage_type=STAGE_BLINK_EVAL_READINESS, **kwargs) stage = Stage(stage_type=STAGE_BLINK_EVAL_READINESS, **kwargs)
stage.put() stage.put()
@ -269,7 +270,7 @@ class MigrateStages(FlaskHandler):
intent_thread_url=feature.intent_to_implement_url, **kwargs) intent_thread_url=feature.intent_to_implement_url, **kwargs)
stage.put() stage.put()
stage = Stage(stage_type=STAGE_FAST_DEV_TRIAL, milestones=devtrial_mstones, stage = Stage(stage_type=STAGE_FAST_DEV_TRIAL, milestones=devtrial_mstones,
**kwargs) announcement_url=feature.ready_for_trial_url, **kwargs)
stage.put() stage.put()
stage = Stage(stage_type=STAGE_FAST_ORIGIN_TRIAL, milestones=ot_mstones, stage = Stage(stage_type=STAGE_FAST_ORIGIN_TRIAL, milestones=ot_mstones,
intent_thread_url=feature.intent_to_experiment_url, intent_thread_url=feature.intent_to_experiment_url,
@ -289,7 +290,7 @@ class MigrateStages(FlaskHandler):
stage = Stage(stage_type=STAGE_PSA_IMPLEMENT, **kwargs) stage = Stage(stage_type=STAGE_PSA_IMPLEMENT, **kwargs)
stage.put() stage.put()
stage = Stage(stage_type=STAGE_PSA_DEV_TRIAL, milestones=devtrial_mstones, stage = Stage(stage_type=STAGE_PSA_DEV_TRIAL, milestones=devtrial_mstones,
**kwargs) announcement_url=feature.ready_for_trial_url, **kwargs)
stage.put() stage.put()
stage = Stage(stage_type=STAGE_PSA_SHIPPING, milestones=ship_mstones, stage = Stage(stage_type=STAGE_PSA_SHIPPING, milestones=ship_mstones,
intent_thread_url=feature.intent_to_ship_url, intent_thread_url=feature.intent_to_ship_url,
@ -304,7 +305,7 @@ class MigrateStages(FlaskHandler):
stage = Stage(stage_type=STAGE_DEP_PLAN, **kwargs) stage = Stage(stage_type=STAGE_DEP_PLAN, **kwargs)
stage.put() stage.put()
stage = Stage(stage_type=STAGE_DEP_DEV_TRIAL, milestones=devtrial_mstones, stage = Stage(stage_type=STAGE_DEP_DEV_TRIAL, milestones=devtrial_mstones,
**kwargs) announcement_url=feature.ready_for_trial_url, **kwargs)
stage.put() stage.put()
stage = Stage(stage_type=STAGE_DEP_DEPRECATION_TRIAL, milestones=ot_mstones, stage = Stage(stage_type=STAGE_DEP_DEPRECATION_TRIAL, milestones=ot_mstones,
**kwargs, intent_thread_url=feature.intent_to_experiment_url, **kwargs, intent_thread_url=feature.intent_to_experiment_url,

Просмотреть файл

@ -133,7 +133,7 @@ class MigrateFeaturesToFeatureEntriesTest(testing_config.CustomTestCase):
'safari_views_notes', 'web_dev_views_notes', 'other_views_notes', 'safari_views_notes', 'web_dev_views_notes', 'other_views_notes',
'security_risks', 'security_review_status', 'privacy_review_status', 'security_risks', 'security_review_status', 'privacy_review_status',
'ergonomics_risks', 'wpt', 'wpt_descr', 'webview_risks', 'ergonomics_risks', 'wpt', 'wpt_descr', 'webview_risks',
'debuggability', 'doc_links', 'sample_links'] 'debuggability', 'doc_links', 'sample_links', 'experiment_timeline']
# (Feature field, FeatureEntry field) # (Feature field, FeatureEntry field)
RENAMED_FIELDS = [('creator', 'creator_email'), RENAMED_FIELDS = [('creator', 'creator_email'),

Просмотреть файл

@ -206,6 +206,8 @@ class FeatureEditHandler(basehandlers.FlaskHandler):
if self.touched('ready_for_trial_url'): if self.touched('ready_for_trial_url'):
feature.ready_for_trial_url = self.parse_link( feature.ready_for_trial_url = self.parse_link(
'ready_for_trial_url') 'ready_for_trial_url')
update_items.append(('ready_for_trial_url',
self.parse_link('ready_for_trial_url')))
if self.touched('intent_to_experiment_url'): if self.touched('intent_to_experiment_url'):
feature.intent_to_experiment_url = self.parse_link( feature.intent_to_experiment_url = self.parse_link(
@ -456,14 +458,6 @@ class FeatureEditHandler(basehandlers.FlaskHandler):
feature.ff_views_notes = self.form.get('ff_views_notes') feature.ff_views_notes = self.form.get('ff_views_notes')
update_items.append(('ff_views_notes', self.form.get('ff_views_notes'))) update_items.append(('ff_views_notes', self.form.get('ff_views_notes')))
# TODO(jrobbins): Delete after the next deployment
if self.touched('ie_views'):
feature.ie_views = int(self.form.get('ie_views'))
if self.touched('ie_views_link'):
feature.ie_views_link = self.parse_link('ie_views_link')
if self.touched('ie_views_notes'):
feature.ie_views_notes = self.form.get('ie_views_notes')
if self.touched('safari_views'): if self.touched('safari_views'):
feature.safari_views = int(self.form.get('safari_views')) feature.safari_views = int(self.form.get('safari_views'))
update_items.append(('safari_views', int(self.form.get('safari_views')))) update_items.append(('safari_views', int(self.form.get('safari_views'))))