Lucas_Werkmeister_WMDE added a comment.

  Also haven’t had luck trying to produce an edit conflict by editing the form 
and then removing it:
  
    (async function() {
      const api = new mw.Api();
      const { id: lexemeId, lastrevid: revisionId } = ( await 
api.postWithEditToken( {
        action: 'wbeditentity',
        new: 'lexeme',
        data: JSON.stringify( {
          lexicalCategory: 'Q11',
          language: 'Q11',
          lemmas: {
            en: { language: 'en', value: `T326768 ${new Date().toISOString()}` 
},
          },
          forms: [ {
            add: '',
            representations: {
              en: { language: 'en', value: `T326768 ${new 
Date().toISOString()}` },
            },
            grammaticalFeatures: [],
          } ],
        } ),
        summary: 'T326768',
      } ) ).entity;
      const formId = `${lexemeId}-F1`;
      await api.postWithEditToken( {
        action: 'wbleditformelements',
        formId: formId,
        data: JSON.stringify( {
          representations: {
            en: { language: 'en', value: `T326768 (edited) ${new 
Date().toISOString()}` },
          },
          grammaticalFeatures: [],
        } ),
        baserevid: revisionId,
      } );
      await api.postWithEditToken( {
        action: 'wblremoveform',
        id: formId,
        baserevid: revisionId,
      } );
    })();
  
  Those edits actually all succeed.
  
  The strange thing is that line 174 of LexemePatcher.php 
<https://gerrit.wikimedia.org/g/mediawiki/extensions/WikibaseLexeme/+/a1fec7ad4c/src/Domain/Diff/LexemePatcher.php#174>
 (the second line of the stack trace) is the second line here:
  
    case $formDiff instanceof ChangeFormDiffOp:
        $form = $lexeme->getForm( $formDiff->getFormId() );
        if ( $form !== null ) {
                $this->formPatcher->patch( $form, $formDiff );
        }
        break;
  
  `Lexeme::getForm()` can’t actually return `null`, so maybe that `if ( $form 
!== null )` should just be turned into a try/catch for the 
`OutOfRangeException` we’re seeing here. But I don’t understand why the 
`wblremoveform` request would end up in this code at all – `$formDiff` should 
be a `RemoveFormDiff`, not a `ChangeFormDiffOp`, I think.

TASK DETAIL
  https://phabricator.wikimedia.org/T326768

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE
Cc: Lucas_Werkmeister_WMDE, ItamarWMDE, Michael, Aklapper, jeena, 
Astuthiodit_1, karapayneWMDE, Invadibot, maantietaja, Akuckartz, darthmon_wmde, 
Rosalie_WMDE, Nandana, Lahi, Gq86, GoranSMilovanovic, Mahir256, QZanden, 
LawExplorer, _jensen, rosalieper, Scott_WUaS, Verdy_p, Wikidata-bugs, aude, 
Jdforrester-WMF, Mbch331, Jay8g
_______________________________________________
Wikidata-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to