Page MenuHomePhabricator

Navigating directly to an edit link has all blank fields
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

What happens?:

All fields are empty

What should have happened instead?:

Fields are populated with the existing data.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.: v1.0.0-42072d; Google Chrome Version 101.0.4951.67 (Official Build) (64-bit)

Event Timeline

bd808 triaged this task as High priority.May 21 2022, 7:21 PM
bd808 moved this task from Backlog to Groomed/Ready on the Toolhub board.
bd808 subscribed.

I think this may be caused by the EditTool/EditAnnotations components mounted in EditToolOrAnnotations.vue blocking via v-if on toolFromVuex instead of on tool.

The problem seems related to this note from the docs:

v-model will ignore the initial value, checked or selected attributes found on any form elements. It will always treat the current bound JavaScript state as the source of truth. You should declare the initial value on the JavaScript side, using the data option.

For some reason, when EditToolOrAnnotations.vue is accessed through the "Edit Tool" button, the tool() computed property is called twice, and it's upon the second call that the form fields get populated. Navigating directly to the edit link only triggers one call, and the fields remain empty. That things work in the first case seems more like a fluke than anything.

None of the possible fixes to this are great, especially since the form has lots of fields. An option would be to fetch the values in the mounted component of the EditTool/EditAnnotations components, and feed them to the components data object, but this is a rather cumbersome task. If anyone has a better idea, I'm all ears.

Slst2020 removed a project: User-Slst2020.
Slst2020 subscribed.

I can reproduce the bug in production which is running revision rWTHU23e2d4f804d1: dev: Use patched elasticsearch library. I cannot reproduce however on the demo server which is currently running revision rWTHU5dbae1cb4aa5: ui: Increase test coverage. There are 44 commits between these two data points and I have not yet attempted a bisect to figure out which change incidentally fixed the form initialization problem.

bd808 moved this task from Groomed/Ready to Review on the Toolhub board.
bd808 added a subscriber: Raymond_Ndibe.

git bisect points to rWTHU418b17da7cf7: ui: disable certain annotation fields for certain users as the commit that fixed this bug. My test while bisecting was a hard reload of http://localhost:8000/tools/cd/edit. If the form was populated after the reload that counts as the "new" working behavior. If the form showed no data and validation errors that counts as the "old" broken behavior.

$ git bisect start
status: waiting for both good and bad commits
$ git bisect old 23e2d4f804d138f65296d56fe21819046488023a
status: waiting for bad commit, 1 good commit known
$ git bisect new 5dbae1cb4aa5722c24f4d336c51a27bfd2532abd
Bisecting: 22 revisions left to test after this (roughly 5 steps)
[9978dee139c2d18bcbfeee33e0c770d333d9aef9] dev: update elasticsearch python dependencies for 7.x compatibility
$ git bisect terms
Your current terms are old for the old state and new for the new state.
$ git bisect old
Bisecting: 11 revisions left to test after this (roughly 4 steps)
[caedd56dfd4f653c5a9b58fee059ddab06dbe1ad] ui(edit): Add taxonomy fields to toolinfo edit components
$ git bisect new
Bisecting: 5 revisions left to test after this (roughly 3 steps)
[91a9b602e7794f2593ac91da445526cde2e979c9] Localisation updates from https://translatewiki.net.
$ git bisect new
Bisecting: 2 revisions left to test after this (roughly 1 step)
[418b17da7cf7744ed28ed73f13fa35030bda712b] ui: disable certain annotation fields for certain users
$ git bisect new
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[38e66f28644b4ad31945e94c10400911d82620e1] crawler: Increase toolinfo.json read timeout
$ git bisect old
418b17da7cf7744ed28ed73f13fa35030bda712b is the first new commit
commit 418b17da7cf7744ed28ed73f13fa35030bda712b
Author: Ndibe Raymond Olisaemeka <rolisaemeka-ctr@wikimedia.org>
Date:   Tue Apr 26 05:30:34 2022 +0100

    ui: disable certain annotation fields for certain users

    * Refactor EditAnnotations.vue so that corresponding
      fields in the core toolinfo record that have already
      been provided by the toolhub tool owner are in the
      form but disabled for non tool owners.
    * Refactor EditTool.vue so that corresponding fields in
      the annotations layer that have already been provided
      by the community are present in the form but can also
      be edited by the toolhub tool owner.

    Bug: T305891
    Change-Id: I0c52688f477287d30781661d9c304a04cfc74257

 vue/src/components/common/InputWidget.vue    |  8 +++
 vue/src/components/tools/EditAnnotations.vue | 88 ++++++++++++++++++++++------
 vue/src/components/tools/EditTool.vue        | 36 +++++++++++-
 vue/src/views/EditToolOrAnnotations.vue      | 15 ++---
 4 files changed, 118 insertions(+), 29 deletions(-)

Assigning to @Raymond_Ndibe as the author of the change that fixed the bug. I am going to leave this open and in the "review" column on the Toolhub workboard until these changes are deployed to production or at minimum documented in progress report on meta.

Change 868183 had a related patch set uploaded (by BryanDavis; author: Bryan Davis):

[operations/deployment-charts@master] toolhub: bump container to 2022-12-14-185830-production

https://gerrit.wikimedia.org/r/868183

Change 868183 merged by jenkins-bot:

[operations/deployment-charts@master] toolhub: bump container to 2022-12-14-185830-production

https://gerrit.wikimedia.org/r/868183