Page MenuHomePhabricator

FunctionViewerDetailsSidebar: CreateZObject page is loaded with implementation or tester but the associated function is not pre-populated
Closed, ResolvedPublicBUG REPORT

Description

Description

Steps to reproduce:

  1. Go to any function (ex: https://wikifunctions.beta.wmflabs.org/wiki/Z10018)
  2. Navigate to the details tab
  3. Click on the "create a new implementation" or "create a new test" button

Observed behavior:

  • the createZObject page is loaded with implementation or tester but the associated function is not pre-populated

Screenshot 2022-11-18 at 10.04.37 AM.png (413×889 px, 54 KB)

Expected behavior (Acceptance criteria):

  • the function is preset

Devices and Design (URLs or screenshots, if applicable):

  • Desktop: ...
  • Small screens/mobile: ...

Completion checklist

Event Timeline

Teleosteen added a subscriber: gengh.

@gengh @JKieserman May I start working on it or should I wait first? I see that the task needs to be triaged first.

Jdforrester-WMF renamed this task from FunctionViewerDetailsSidebar: <Short one-liner describing the problem> to FunctionViewerDetailsSidebar: CreateZObject page is loaded with implementation or tester but the associated function is not pre-populated.Nov 22 2022, 7:40 PM

Change 864782 had a related patch set uploaded (by Teleosteen; author: Teleosteen):

[mediawiki/extensions/WikiLambda@master] Fix functions for tests and implementations are not preselected

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

Change 864783 had a related patch set uploaded (by Teleosteen; author: Teleosteen):

[mediawiki/extensions/WikiLambda@master] Implement tests

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

I made 2 patches:

  • the first is the implementation;
  • the second are the tests;

For the second, I upgraded some node modules in order to have a convenient method (otherwise I could not figure how to test well my patch). And it was a bit hard, so I made a separate commit, in case the tests need to be reworked correctly.

Also 2 questions:

  • I changed an instance of <z-object-selector> to a <z-reference> in ZImplementation.vue. What are the differences between the two of them?
  • If this change is right, I wonder if therefore we could not even replace this code in ZImplementation.vue:
			<z-reference
				v-if="!viewmode && zFunction && implMode && isFunctionLabelReady"
				class="ext-wikilambda-zimplementation__function-selector"
				:search-type="Constants.Z_FUNCTION"
				:placeholder="$i18n( 'wikilambda-function-typeselector-label' ).text()"
				:zobject-id="zFunction.id"
				:zobject-key="zFunction.value"
			></z-reference>
			<template v-else>
				<z-reference
					v-if="zFunction.value"
					:zobject-key="zFunction.value"
					:readonly="true"
				></z-reference> ...
                        </template>

by this one:

			<z-reference
				v-if="zFunction"
				class="ext-wikilambda-zimplementation__function-selector"
                                :readonly="viewmode || !implMode || !isFunctionLabelReady"
				:search-type="Constants.Z_FUNCTION"
				:placeholder="$i18n( 'wikilambda-function-typeselector-label' ).text()"
				:zobject-id="zFunction.id"
				:zobject-key="zFunction.value"
			></z-reference>

The z-object-selector is more generic and can handle any kind of change in its parent (eg a changeType, adding a language etc). However, how z-object-selector is implemented in ZImplementation it is indeed the same as a z-reference update (updating setZObjectValue). So it could be refactored, and then yes I agree even further refactored as per your suggestion above.
@JKieserman to confirm all please!

I made the refactoration (with the hope @JKieserman will approve that move :) )

Change 864783 abandoned by Teleosteen:

[mediawiki/extensions/WikiLambda@master] Tests that functions for tests and implementations are preseleted

Reason:

Patch squashed into 864782

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

Jdforrester-WMF subscribed.

This is now fixed due to the replacement of these old code paths, and I think our selenium test ("CUJ 5") now asserts that the function is selected via the ImplementationForm.getFunctionExplorerName().

Change 864782 abandoned by Jforrester:

[mediawiki/extensions/WikiLambda@master] Fix functions for tests and implementations are not preselected

Reason:

Now fixed a different way, see comment on task.

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