Page MenuHomePhabricator

PFQSG Books example fails reproducibly on both Referata and sandbox.SMW
Closed, ResolvedPublic

Description

summary

The canonical tutorial for Page Forms is the Books example in the Page Forms Quick Start Guide (PFQSG). It is unfortunately currently (as of 1 Dec 2016) broken, in that

  1. Form:Book (or its localized equivalent--see below section=replication on sandbox.SMW) does not present as defined in Template:Book. For details, see procedure step=4.1. in either following replication section.
    1. authors field has label=Authors not Author(s)
    2. genres field has label=Genres not Genre(s)
    3. (serious) genres field inputtype is text not checkboxes
  2. Books created with that form fail to match the schema defined in Template:Book (although the correct labels are restored). For details, see procedure step=7.1. in either following replication section.
    1. Form:Book allows user to input data not in the enum defined in Template:Book.
    2. field with label=Author(s) is blank rather than redlinked, despite
      • author having been input during the Book creation process.
      • Template:Book having been edited exactly as described in step#=6 of the Books example.
  3. Authors created with Form:Author fail to match the schema defined in Template:Author. For details, see procedure step=7.1. in either following replication section.
    1. field with label=Books by this author is blank, despite the user having created a book by this author in the previous step of the procedure.

Furthermore, this breakage can be replicated both on Referata and sandbox.SMW: see replication sections following.

choice of replication site

The breakage can currently (as of 1 Dec 2016) be replicated on either site. The procedure is essentially the same; the only procedural differences between the two are

  • the default localization on sandbox.SMW is French, which changes page names.
  • one cannot presently create a new/fresh workspace on sandbox.SMW, whereas one can create new "sites" on Referata.

The latter consideration probably makes Referata preferable as a vehicle for testing the breakage (and verifying candidate fixes), since the new sites are presumably isolated. (Note: this is an assumption which should be verified!) But sandbox.SMW may be preferred by testers who require up-to-date platform dependencies (versions of, e.g., database, PHP, MediaWiki, Semantic MediaWiki), since (as noted here) it

is designed to always run on the latest release candidate or stable version of MediaWiki core as well as the installed extensions, except for most of the semantic extensions which run on master.

Testers seeking to replicate on sandbox.SMW should probably first contact its administrators to obtain privileges needed to delete pages created by the procedure (see section=replication on sandbox.SMW below for a list), or have them delete any existing pages prior to testing.

replication on Referata

The following replication procedure is adapted (for greater exactness and speed of replication) from the Books example.

1. Create a new test wiki. I used URL=page-schemas-test2.referata.com for my testrun, and links below are in that domain.

2. Create properties with [[http://page-schemas-test2.referata.com/wiki/Special:CreateProperty|Special:CreateProperty]]:

2.1. [[http://page-schemas-test2.referata.com/wiki/Property:Was_written_by|name=Was written by]], type=Page
2.2. [[http://page-schemas-test2.referata.com/wiki/Property:Has_genre|name=Has genre]], type=Text, allowed values=Art,Cookbook,Fiction,History,Poetry,Science
2.3. [[http://page-schemas-test2.referata.com/wiki/Property:Was_published_in_year|name=Was published in year]], type=Number
2.4. [[http://page-schemas-test2.referata.com/wiki/Property:Has_number_of_pages|name=Has number of pages]], type=Number
2.5. [[http://page-schemas-test2.referata.com/wiki/Property:Is_from_country|name=Is from country]], type=Text

3. Create templates with [[http://page-schemas-test2.referata.com/wiki/Special:CreateTemplate|Special:CreateTemplate]]:

3.1. Create template=Book (not linked here due to subsequent edit):

3.1.1. Set template name=Book, set to define category=Books
3.1.2. 1st field: set name=Authors, the label=Author(s), semantic property=Was written by, check box allowing field to hold a list of values, click button=Add field
3.1.3. 2nd field: set name=Genres, label=Genre(s), semantic property=Has genre, check box to allow list of values, click button=Add field
3.1.4. 3rd field: set name=Year, label=Year of publication, semantic property=Was published in year, click button=Add field
3.1.5. 4th field: set name=Number of pages, label=Number of pages, semantic property=Has number of pages
3.1.6. Click button=Save page

3.2. Create [[http://page-schemas-test2.referata.com/wiki/Template:Author|template=Author]]

3.2.1. Set template name=Author, set to define category=Authors
3.2.2. 1st field: set name=Country, the label=Country of origin, semantic property=Is from country
3.2.3. In section=Aggregation, set Semantic property=Was written by , Title for list=Books by this author
3.2.4. Click button=Save page

4. Create forms with [[http://page-schemas-test2.referata.com/wiki/Special:CreateForm|Special:CreateForm]]:

4.1. Create [[http://page-schemas-test2.referata.com/wiki/Form:Book|form=Book]]

4.1.1. Set form name=Book, set template name=Book, click button=Add
4.1.2. Note form's presentation mismatches settings made above to Template:Book:

  1. field=Authors has label=Authors not Author(s)
  2. field=Genres has label=Genres not Genre(s)
  3. (serious) field=Genres field inputtype is text not checkboxes

4.1.3. Click button=Save page

4.2. [[http://page-schemas-test2.referata.com/wiki/Form:Author|Create form=Author]]

4.2.1. Set form name=Author, set template name=Author, click button=Add
4.2.2. Click button=Save page

5. Create categories with [[http://page-schemas-test2.referata.com/wiki/Special:CreateCategory|Special:CreateCategory]]:

5.1. Create [[http://page-schemas-test2.referata.com/wiki/Category:Books|category=Books]]

5.1.1. Set category name=Books, set form name=Book, click button=Save page

5.2. Create [[http://page-schemas-test2.referata.com/wiki/Category:Authors|category=Authors]]

5.2.1. Set category name=Authors, set form name=Author, click button=Save page

6. Edit Template:Book to enable redlinking to forms:

6.1. In editing area, find text=

{{#arraymap:{{{Author|}}}|,|x|[[Was written by::x]]}}

6.2. Replace with text=

{{#arraymap:{{{Author|}}}|,|x|{{#formredlink:target=x|form=Author}}{{#set:Was written by=x}}}}

6.3. Click button=Save page

7. Create data using forms:

7.1. Create Book using Form:Book

7.1.1. Set page title=The Quiet American, click button=Create or edit
7.1.2. In subsequent form UI, note same presentation problems as previous:

  1. authors field has label=Authors not Author(s)
  2. genres field has label=Genres not Genre(s)
  3. (serious) genres field inputtype is text not checkboxes

7.1.3. Set author=Graham Greene, genre=this should be an enum not a text!, year=1955, pages=123, free text=

This Book was created using the PFQSG example @ https://www.mediawiki.org/wiki/Extension:Page_Forms/Quick_start_guide#Example .
It fails as previously noted (using Referata) @ https://sourceforge.net/p/semediawiki/mailman/message/35528533/ section='test run 2'

7.1.4. Click button=Save page. Note problems with resulting data page:

  1. (serious) field=Author(s) is blank
  2. (serious) field=Genre(s) has warning icon: hover=

Error
"this should be an enum not a text!" is not in the list (Art, Cookbook, Fiction, History, Poetry, Science) of allowed values for the "Has genres" property

7.2. Create Author using Form:Author

7.2.1. Set page title=Graham Greene, click button=Create or edit
7.2.2. In subsequent form UI, set author country=Britain, free text=

A giant of 20th-century literature.

7.2.3. Click button=Save page. Note problems with resulting data page:

  1. (serious) field=Books by this author is blank

replication on sandbox.SMW

The procedure to replicate the Books example on sandbox.SMW is almost identical to that on Referata (in previous section), excepting that

  • the default localization on sandbox.SMW is French, which changes page names.
  • one cannot presently create a new/fresh workspace on sandbox.SMW, whereas one can create new "sites" on Referata.

1. Delete the following pages if previously created:

https://sandbox.semantic-mediawiki.org/wiki/Attribut:Was_written_by
https://sandbox.semantic-mediawiki.org/wiki/Attribut:Has_genre
https://sandbox.semantic-mediawiki.org/wiki/Attribut:Was_published_in_year
https://sandbox.semantic-mediawiki.org/wiki/Attribut:Has_number_of_pages
https://sandbox.semantic-mediawiki.org/wiki/Attribut:Is_from_country
https://sandbox.semantic-mediawiki.org/wiki/Modèle:Book
https://sandbox.semantic-mediawiki.org/wiki/Modèle:Author
https://sandbox.semantic-mediawiki.org/wiki/Formulaire:Book
https://sandbox.semantic-mediawiki.org/wiki/Formulaire:Author
https://sandbox.semantic-mediawiki.org/wiki/Catégorie:Books
https://sandbox.semantic-mediawiki.org/wiki/Catégorie:Authors
https://sandbox.semantic-mediawiki.org/wiki/The_Quiet_American
https://sandbox.semantic-mediawiki.org/wiki/Graham_Greene

This can be done by requesting from the site's administrators either

  • that the above pages be deleted by the existing administrators.
  • to receive rights/group=Administrators, then running (e.g.) DeleteBatch oneself.

2. Create properties with [[https://sandbox.semantic-mediawiki.org/wiki/Spécial:CreateProperty|Spécial:CreateProperty]]:

2.1. [[https://sandbox.semantic-mediawiki.org/wiki/Attribut:Was_written_by|name=Was written by]], type=Page
2.2. [[https://sandbox.semantic-mediawiki.org/wiki/Attribut:Has_genre|name=Has genre]], type=Text , allowed values=Art, Cookbook, Fiction, History, Poetry, Science
2.3. [[https://sandbox.semantic-mediawiki.org/wiki/Attribut:Was_published_in_year|name=Was published in year]], type=Number
2.4. [[https://sandbox.semantic-mediawiki.org/wiki/Attribut:Has_number_of_pages|name=Has number of pages]], type=Number
2.5. [[https://sandbox.semantic-mediawiki.org/wiki/Attribut:Is_from_country|name=Is from country]], type=Text

3. Create templates with [[https://sandbox.semantic-mediawiki.org/wiki/Spécial:CreateTemplate|Spécial:CreateTemplate]]:

3.1. Create template=Book (not linked here due to subsequent edit):

3.1.1. Set template name=Book, set to define category=Books
3.1.2. 1st field: set name=Authors, the label=Author(s), semantic property=Was written by, check box allowing field to hold a list of values, click button=Add field
3.1.3. 2nd field: set name=Genres, label=Genre(s), semantic property=Has genre, check box to allow list of values, click button=Add field
3.1.4. 3rd field: set name=Year, label=Year of publication, semantic property=Was published in year, click button=Add field
3.1.5. 4th field: set name=Number of pages, label=Number of pages, semantic property=Has number of pages, click button=Add field
3.1.6. Click button=Save page

3.2. Create [[https://sandbox.semantic-mediawiki.org/wiki/Modèle:Author|template=Author]]

3.2.1. Set template name=Author, set to define category=Authors
3.2.2. 1st (and only) field: set name=Country, the label=Country of origin, semantic property=Is from country
3.2.3. Click button=Save page

4. Create forms with [[https://sandbox.semantic-mediawiki.org/wiki/Spécial:CreateForm|Spécial:CreateForm]]:

4.1. Create [[https://sandbox.semantic-mediawiki.org/wiki/Formulaire:Book|form=Book]]

4.1.1. Set form name=Book, set template name=Book, click button=Add
4.1.2. Note form's presentation mismatches settings made above to Template:Book:

  1. authors field has label=Authors not Author(s)
  2. genres field has label=Genres not Genre(s)
  3. (serious) genres field inputtype is text not checkboxes

4.1.3. Click button=Save page

4.2. Create [[https://sandbox.semantic-mediawiki.org/wiki/Formulaire:Author|form=Author]]

4.2.1. Set form name=Author, set template name=Author, click button=Add
4.2.2. Click button=Save page

5. Create categories with [[https://sandbox.semantic-mediawiki.org/wiki/Spécial:CreateCategory|Spécial:CreateCategory]]:

5.1. Create [[https://sandbox.semantic-mediawiki.org/wiki/Catégorie:Books|category=Books]]

5.1.1. Set category name=Books, set form name=Book, click button=Save page

5.2. Create [[https://sandbox.semantic-mediawiki.org/wiki/Catégorie:Authors|category=Authors]]

5.2.1. Set category name=Authors, set form name=Author, click button=Save page

6. Edit Template:Book to enable redlinking to forms:

6.1. In editing area, find text={{#arraymap:{{{Author|}}}|,|x|[[Was written by::x]]}}
6.2. Replace with text={{#arraymap:{{{Author|}}}|,|x|{{#formredlink:target=x|form=Author}}{{#set:Was written by=x}}}}
6.3. Click button=Save page

7. Create data using forms:

7.1. Create Book using Form:Book

7.1.1. Set page title=The Quiet American, click button=Create or edit
7.1.2. In subsequent form UI, note same presentation problems as previous:

  1. authors field has label=Authors not Author(s)
  2. genres field has label=Genres not Genre(s)
  3. (serious) genres field inputtype is text not checkboxes

7.1.3. Set author=Graham Greene, genre=this should be an enum not a text!, year=1955, pages=123, free text=

This Book was created using the PFQSG example @ https://www.mediawiki.org/wiki/Extension:Page_Forms/Quick_start_guide#Example .
It fails as previously noted (using Referata) @ https://sourceforge.net/p/semediawiki/mailman/message/35528533/ section='test run 2'

7.1.4. Click button=Save page. Note problems with resulting data page:

  1. (serious) field=Author(s) is blank
  2. (serious) field=Genre(s) has warning icon: hover=

Error
"this should be an enum not a text!" is not in the list (Art, Cookbook, Fiction, History, Poetry, Science) of allowed values for the "Has genres" property

7.2. Create Author using Form:Author

7.2.1. Set page title=Graham Greene, click button=Create or edit
7.2.2. In subsequent form UI, set author country=Britain, free text=

A giant of 20th-century literature.

7.2.3. Click button=Save page. Note problems with resulting data page:

  1. (serious) field=Books by this author is blank

etiology

Previous testing suggests that this regression (presuming the Books example previously worked)

  1. may be due to editing Template:Book, as discussed here (section=conclusion). I will incorporate this material into this issue as soon as feasible.
  2. is probably not due to platform versions, as it is reproducible both on the more up-to-date sandbox.SMW as well as the more downlevel Referata.

Event Timeline

Ah, yes - there was indeed a real bug with the parsing of arraymap calls that contain set calls within them - I guess I had never tested that. I just checked in a fix, so now the "checkboxes" input shows up correctly.

As for the other "serious" bugs - they seem to be due to this edit you made, where you inadvertently changed the parameter "Authors" to "Author":

http://page-schemas-test2.referata.com/w/index.php?title=Template:Book&diff=12&oldid=6

Yaron_Koren claimed this task.

I'm marking this as "Resolved" - I don't know if all the listed issues here have been fixed, but if there are any still remaining, please create separate bug reports for them.

As for the other "serious" bugs - they seem to be due to this edit you made, where you inadvertently changed the parameter "Authors" to "Author":

http://page-schemas-test2.referata.com/w/index.php?title=Template:Book&diff=12&oldid=6

That wasn't inadvertent: that's because every version of the example tells the user to change

{{#arraymap:{{{Author|}}}|,|x|[[Was written by::x]]}}

to

{{#arraymap:{{{Author|}}}|,|x|{{#formredlink:target=x|form=Author}}{{#set:Was written by=x}}}}

But I'll be sure to check whether Author or Authors gets generated when I verify the fix.

I verified the fix in current Referata using this site. The fix therefore seems to be in Page Forms 4.0.2 commit ID=b071fb1, which is the version currently on Referata. I'll make a separate bug for the field-label problems, which remain unfixed.

field-label bug=T152763. Feel free to triage minor.