From 4706ac2a37bd4b6d6cbb77d37c2dd55326139114 Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Wed, 16 Aug 2023 11:53:58 -0300 Subject: [PATCH] fix: Restore old handling of draft-iesg state Missing state -> idexists, idexists -> idexists, anything else becomes pub. --- ietf/sync/rfceditor.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ietf/sync/rfceditor.py b/ietf/sync/rfceditor.py index 2e6861959..ce0cf2da2 100644 --- a/ietf/sync/rfceditor.py +++ b/ietf/sync/rfceditor.py @@ -475,11 +475,20 @@ def update_docs_from_rfc_index( draft_changes.append(change) rfc_changes.append(change) - # Draft should be in the "pub" or "approved" draft-iesg state - complain otherwise + # Always set the "draft-iesg" state. This state should be set for all drafts, so + # log a warning if it is not set. What should happen here is that ietf stream + # RFCs come in as "rfcqueue" and are set to "pub" when they appear in the RFC index. + # Other stream documents should normally be "idexists" and be left that way. The + # code here *actually* leaves "draft-iesg" state alone if it is "idexists" or "pub", + # and changes any other state to "pub". If unset, it changes it to "idexists". + # This reflects historical behavior and should probably be updated, but a migration + # of existing drafts (and validation of the change) is needed before we change the + # handling. prev_iesg_state = draft.get_state("draft-iesg") if prev_iesg_state is None: log(f'Warning while processing {doc.name}: {draft.name} has no "draft-iesg" state') - elif prev_iesg_state.slug != "pub": + new_iesg_state = State.objects.get(type_id="draft-iesg", slug="idexists") + elif prev_iesg_state.slug not in ("pub", "idexists"): if prev_iesg_state.slug != "rfcqueue": log( 'Warning while processing {}: {} is in "draft-iesg" state {} (expected "rfcqueue")'.format( @@ -487,6 +496,10 @@ def update_docs_from_rfc_index( ) ) new_iesg_state = State.objects.get(type_id="draft-iesg", slug="pub") + else: + new_iesg_state = prev_iesg_state + + if new_iesg_state != prev_iesg_state: draft.set_state(new_iesg_state) draft_changes.append(f"changed {new_iesg_state.type.label} to {new_iesg_state}") e = update_action_holders(draft, prev_iesg_state, new_iesg_state)