phetsims / paper-land

Build and explore multimodal web interactives with pieces of paper!
https://phetsims.github.io/paper-land/
MIT License
10 stars 1 forks source link

Programs not saving to database #202

Closed terracoda closed 1 week ago

terracoda commented 6 months ago

Copied Programs not Saving I copied my X and X squared programs Tuesday around 4 pm CT, and then when I loaded PP the next morning they were not there. I assumed I had missed a step or had done something wrong. I copied them all again, and just noticed my copies did not stick. The database looks the same as it did this morning.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'ts-creator-tests'
  2. Copy the X Tile program
  3. Change the auto-generated number
  4. Save Program and send to Play ground
  5. They copied program should exist and work.
  6. Quit Paper Playground
  7. Quit everything
  8. Re-start and re-open and copy might not be there.

I just happened to have taken a screenshot this afternoon while making copies. You can see I have copies of X Tiles:

Screenshot 2023-11-15 at 11 38 43 AM

I don't have those or the rest of my copies anymore.

jessegreenberg commented 6 months ago

I just reproduced the problem with the tactiles project. It is another case of the payload being too large, we are getting this response back from the server: "413 (Payload Too Large)"

So it seems we cannot save the entire project all at once. This one is going to be tricker than #188 because the projects table only has one entry for the project data - a JSON object for the entire thing. We will probably have to change the table or edit the saved JSON without reloading the whole thing.

jessegreenberg commented 6 months ago

The above commit is working well, its in a feature branch chunk-saves. Before merging into main I want to

jessegreenberg commented 6 months ago

Look for other places where this payload error can happen.

Inspecting the api, here is where this can happen again potentially:

Could also happen if the user tries to upload massive image/audio files.

The size limits are way bigger for receiving data from the server. Since our entire db is less than 1mb, we don't have to worry about this when loading data from the db.

In summary, one of these is from the original paper programs code and the rest are not likely enough to hit to prioritize right now (IMO). However this may be something @brettfiedler wants to track for project management. I think this is most likely to happen again for massive programs (where a single program has >200 components or tons of custom code).

jessegreenberg commented 6 months ago

Lots of testing of save/load for existing projects.

I tested by

jessegreenberg commented 6 months ago

This was merged into main. I did some spot checking on main and it is OK.

jessegreenberg commented 6 months ago

@brettfiedler can you please review https://github.com/phetsims/paper-land/issues/202#issuecomment-1814735146 and let me know if there is anything else you would like to do here? For example, place a limit on the number of components a single program can have or something like that? Or spend more time chunking up the data within each program?

brettfiedler commented 1 week ago

Opened a new issue in #250 to track future occurences.