CCALI / a2jauthor

CALI A2JAuthor document automation authoring and viewing platform
https://www.a2jauthor.org
Other
4 stars 1 forks source link

bad Authors and Steps in XML #270

Closed janebitovi closed 2 years ago

janebitovi commented 2 years ago

for example:

<AUTHOR><NAME>setup</NAME></AUTHOR>
<AUTHOR><NAME>observable</NAME></AUTHOR>
<AUTHOR><NAME>_triggerChange</NAME></AUTHOR>
<AUTHOR><NAME>get</NAME></AUTHOR>
<AUTHOR><NAME>set</NAME></AUTHOR>
<AUTHOR><NAME>assign</NAME></AUTHOR>
<AUTHOR><NAME>update</NAME></AUTHOR>
<AUTHOR><NAME>assignDeep</NAME></AUTHOR>
<AUTHOR><NAME>updateDeep</NAME></AUTHOR>
<AUTHOR><NAME>_items</NAME></AUTHOR>
<AUTHOR><NAME>_each</NAME></AUTHOR>
<AUTHOR><NAME>splice</NAME></AUTHOR>
<AUTHOR><NAME>serialize</NAME></AUTHOR>
<AUTHOR><NAME>indexOf</NAME></AUTHOR>
<AUTHOR><NAME>lastIndexOf</NAME></AUTHOR>
<AUTHOR><NAME>join</NAME></AUTHOR>
<AUTHOR><NAME>reverse</NAME></AUTHOR>
<AUTHOR><NAME>slice</NAME></AUTHOR>
<AUTHOR><NAME>concat</NAME></AUTHOR>
<AUTHOR><NAME>forEach</NAME></AUTHOR>
<AUTHOR><NAME>replace</NAME></AUTHOR>
<AUTHOR><NAME>sort</NAME></AUTHOR>

and image

The person who notified us of this issue did not experience this part of it, but for me they show up in author too: image

Preliminary investigation likely found the main cause of the bad data, but it's such old code that it's not clear if something else changed recently to cause it or if this problem is present and just overlooked in many many guides...

A2J_Parser.js fn: exportXML_CAJA_from_CAJA: image it's doing for in loops instead of for of loops over canjs array-like lists so ultimately it's injecting prototype keys from the can-lists into the XML.

This could be easy to fix but also be difficult/impractical to clean up (or ignore) the existing bad data...

janebitovi commented 2 years ago

for in problem related to this is in a few places in the author code A2J_Parser.js :: exportXML_CAJA_from_CAJA :: ln 168 and 181 A2J_MobileFile.js :: guide2JSON_Mobile :: ln 114 and 129 A2J_Reports.js :: reportFull :: ln 202 and 222 and 297

We can use this regex search in an editor to quickly jump to the problems: for \(.*\bin\b.*\.(authors|steps)

much of this code is over 7 years old now but it wouldn't have shown up as a problem until the legacy/global author functions run against the canjs/appState guide because the properties authors and steps use a can list instead of plain js arrays in that case.

There was more to unpack in order to reproduce this reliably but recently we updated publish tab to use canjs and we still had to rely on legacy code for API calls. So that's when this started appearing

getting a fix in tonight so we can push it to production tomorrow