Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Old instance of the sheetworker

1734576546
Jiboux
Pro
Sheet Author
Compendium Curator
Hello community, I have had a very strange bug report on my custom sheet/sheetworker where I would need some guidance. In the Earthdawn character sheet, I have a functionality that generates a text summary in an Attribute that sums up all the XP expenditures done for the character. For clarity purpose the function is called UpdateLPSummary, and writes a full text in an attribute attr_LPSummary. As an example for better understanding it looks like this: Last June I release a version 3.3 of my sheet, where I did modifications on the way this report was generated, and in its v3.3 updateLPTransac does not generate anymore the line that is circled. Couple of weeks ago a user made me a bug report with screen captures, and I could see the report in attr_LPSummary still showing this line, and he told me that after making some changes in the character the line had disappeared. My interpretation at the time was that on this particular character the updateLPSummary() had not run since June, and so he still had an outdated value in attr_LPSummary, and when he made the change, updateLPSummary() v3.3 was triggered and overwrote the value... End of story... Except that he contacted me back, and showed me some new screen capture, where the circled line had re-appeared on this very same character... There is absolutely no way that the v3.3 code can generate this line ( it is easy to track as there are some very specific strings of text that are not present in the code anymore), so the only way that this line could be back is the the previous version of updateLPSummary would have run again and overwritten attr_LPSummary... I now that there are instances of the sheet HTML and sheetworker that can run on different machines ( my understanding is that the sheetworker runs on the clients, and that when triggered by the API on roll20 servers)... Is there any possibility that on older instance of the sheetworker would be running "somewhere" ? Is there any way I could verify this theory ?
1734584088
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
There's no way for two versions of a sheet to run. Things to check: Is the code in the repo the version you think it is? Does the old code exist in the sheet somewhere? Maybe it was commented out and got uncommented? As an aside, your screenshot didn't post.
1734585327
GiGs
Pro
Sheet Author
API Scripter
To add to Scott's last line: if the screensahot was meant to show code, post the code itself. Never post a screenshot of code. It really limits people's ability to help you.
1734614890
Jiboux
Pro
Sheet Author
Compendium Curator
Hello Scott and GiGs, Thanks for the support as always. There's no way for two versions of a sheet to run. Are you sure of that ? Reason I made this hypothesis is that I have seen while testing in the custom sheet sandbox that when you load a new HTML, you can immediately see the right logs of the sheetworker in the console except in the API console. If you load a new HTML and you trigger a sheetworker via API, the sheetworker logs will go in the API console instead of the normal browser console, and here you can see that the logs do not reflect the code you just loaded. You need to restart the API before the logs are correct, which indicate me that for example the API buffers the sheetworkers when starting... I don't tell this is what is happening here, but this is what led me to the hypothesis that there are buffered version of the sheetworker code, and there may be somewhere a version that is not up to date. Is the code in the repo the version you think it is? Well this is where it gets spooky. I the results I have stuff that prove that either we have the old or the new code. The user showed me that he had the sequence oldcode=>newcode=>oldcode=>newcode newcode can't generate the "stuff" of the old code, and vice-versa, so seeing the result of newcode demonstrates me it runs somewhere, but seeing that it reverted back to oldcode results shows me that the oldcode has run again after the newcode
1734615785
Jiboux
Pro
Sheet Author
Compendium Curator
For better understanding of the markers of oldcode vs newcode, some examples: extracts of attr_LPSummary generated by newcode *********************** LEGEND POINTS REPORT *********************** Spell Flame Flash Circle 1 LP-Cost 100 Spell Restrain Entity Circle 7 LP-Cost 2100 SpellKnack Astral Lance Circle 1 LP-Cost 100 Credit for 1 Free Spell per Circle (Optional Rule) for Discipline Nethermancer Circle 2 LP-Credit 200 Credit for 1 Free Spell per Circle (Optional Rule) for Discipline Nethermancer Circle 3 LP-Credit 300 Credit for 1 Free Spell per Circle (Optional Rule) for Discipline Nethermancer Circle 4 LP-Credit 500 Credit for 1 Free Spell per Circle (Optional Rule) for Discipline Nethermancer Circle 5 LP-Credit 800 Credit for 1 Free Spell per Circle (Optional Rule) for Discipline Nethermancer Circle 6 LP-Credit 1300 Credit for 1 Free Spell per Circle (Optional Rule) for Discipline Nethermancer Circle 7 LP-Credit 2100 extract of LP_Summary generated by oldcode *********************** LEGEND POINTS REPORT *********************** Multidiscipline to 2nd Discipline 0 Discipline Talents to be purchased when lowest Circle was 5 extra LP-Cost: 0 Spell Restrain Entity Circle 7 LP-Cost 2100 Spell Astral Lance Circle 1 LP-Cost 100 Credit for 1 Free Spell per Circle (Optional Rule) for Discipline Nethermancer Circle 7 LP-Credit 5300 Note the 3 differences: The multidiscipline line with 0 at the end disappeared Some Spells prefixed by SpellKnack instead of Spell The Credit for 1 Free Spell line is now one per Circle, instead of just one line with the total For better understanding of the code below, s is the variable that will end up being posted in attr_LPSummary //newcode the line is only posted if it doesn't result in 0                     if(inc>0) s+= "Multidiscipline to 2nd Discipline " + getInt(values,"LP-D2-Talents") + " Discipline Talents to be purchased when lowest Circle was " + getInt(values,"LP-D2-Circle") + " extra LP-Cost: " +  inc +"\n"; //oldcode                     s+= "Multidiscipline to 2nd Discipline " + getInt(values,"LP-D2-Talents") + " Discipline Talents to be purchased when lowest Circle was " + getInt(values,"LP-D2-Circle") + " extra LP-Cost: " +  inc +"\n"; //newcode the prefix is the Type of the entry, while in the old code it was a static "Spell                       s+=PackEntry("",inc,values[buildPre( "SP", sparray[ i ] ) + "Name"],rnk,"Circle", values[buildPre( "SP", sparray[ i ] ) + "Type"]||"Spell" ); //oldcode                       s+=PackEntry("",inc,values[buildPre( "SP", sparray[ i ] ) + "Name"],rnk,"Circle", "Spell" ); //newcode the line posting is inside the for loop                         for(let j=(i==0?2:1); j<=rnk; j++) {                           inc+=fibocost[j];   //For first discipline, first circle no free spell                           s+="Credit for 1 Free Spell per Circle (Optional Rule) for Discipline "+values[pre+"Name"] + " Circle " + j+ " LP-Credit "+fibocost[j] +"\n";                         } //old code the for sums up the value, but the line posting is outside the for loop                         for(let j=(nbsc==1?2:1); j<=rnk; j++) inc+=fibocost[j];   //For first SC discipline, first circle no free spell                         s+="Credit for 1 Free Spell per Circle (Optional Rule) for Discipline "+values[pre+"Name"] + " Circle " + values[pre+"Circle"]+ " LP-Credit "+inc +"\n"; All those are pretty strong markers that the result is from the oldcode or newcode, so I have a very high level of confidence that if I see the results above, it marks the last version of the code to be either the old or the new... So remain my question : how is it possible that the old code has run after the new ( note also about isn't there a duplicate somewhere, the "Multidiscipline to" line is quite remarkable to search, and is nowhere else in the code)
1734622020

Edited 1734622858
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Jiboux said: Hello Scott and GiGs, Thanks for the support as always. There's no way for two versions of a sheet to run. Are you sure of that ? Reason I made this hypothesis is that I have seen while testing in the custom sheet sandbox that when you load a new HTML, you can immediately see the right logs of the sheetworker in the console except in the API console. If you load a new HTML and you trigger a sheetworker via API, the sheetworker logs will go in the API console instead of the normal browser console, and here you can see that the logs do not reflect the code you just loaded. You need to restart the API before the logs are correct, which indicate me that for example the API buffers the sheetworkers when starting... I don't tell this is what is happening here, but this is what led me to the hypothesis that there are buffered version of the sheetworker code, and there may be somewhere a version that is not up to date Sorry I should have been more clear. It's not possible to have two versions of the sheet running in live. In dev, there are some API bugs that can cause multiple states to run  temporarily , but these can't cause old sheet code to run for deployed code (API or sheet).
1734623540

Edited 1734623634
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I do see what you mean about the code in the repo being unable to produce these results. That would certainly seem to indicate that something is drastically wrong. Is the user seeing the same output from the old code each time? or is it updated to match the new state of the character? And does the old output show up after causing a change to the sheet? or does it show up when the sheet is opened?
1734626049
Jiboux
Pro
Sheet Author
Compendium Curator
These are interesting question, for now I have not been able to narrow it down ( only this user has reported it). It is interesting info that what I had witnessed in the sandbox that led to this theory is known to be only on the dev server... I'll keep asking the user info to sort of narrow it down...  The said report is something that has a lot of different trigger event as it tracks all the expenditures in XP of your character (i.e. anytime some character progression is made that changes a value that costs XP, the report is updated)... What happens is the user at some point wants to refer to the report, see that it is wrong ( i.e. something wrong happened in one of the times it was triggered), and he makes another change, and now it is correct again... Also it is worth mentioning that in the sequence oldcode(1)=>newcode=>oldcode(2)=>newcode, the 2 newcode displayed values are not exactly identical ( which would exclude an hypothesis that there would be some kind of "ghost value" for the Attribute that would come back and overwrite... oldcode(1) and oldcode(2) statuses have different values for attr_LPSummary, which confirms that somehow, the oldcode of the sheetworker has run and calculated despite not being the one on the repo anymore)
1734629457
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
There are only a few things that I can think of: There's some bug on Roll20's backend that is somehow serving old and new sheet code at the same time. I have no idea how this would happen since that should also change the html of the sheet which should cause pretty obvious visual changes. The user has an api installed that is reverting or changing the sheet's attributes There is some sort of weird caching issue that is keeping the old sheet code around The user is using custom sheet code instead of using the sheet from the dropdown selection and has somehow combined the old and new code All of these are pretty unlikely, but the normal functioning of the sheet service doesn't allow two versions of the sheet code to run. Roll20 had to go through some pretty extreme hoops to get the dual 2014/2024 D&D sheet feature to run and even then, there's no way for multiple versions of the sheet to run for the same character. If you can replicate the behavior in a live game of your own, then submit a bug report to Roll20. If you can't replicate the behavior, then I'd ask the user to use the character vault to move their character to a game of yours. You can then see if the behavior continues for you in your game and you can transmogrify that character into your sheet sandbox to try and diagnose the issue.