codeforboston / windfall-elimination

Windfall Elimination Provision Awareness Project: improving the experience of retirees around an obscure Social Security rule affecting 8+ states (previously https://ssacalculator.org)
https://windfall-develop.netlify.app/
MIT License
24 stars 45 forks source link

Approach for Troubleshooting the "Future Earnings" assumptions page, WASM module #328

Open thadk opened 3 years ago

thadk commented 3 years ago

Describe the bug The "future earnings" page has been hidden on the live site because the substantial functionality is not quite ready. We load a open source C++ WebAssembly module and we interface with it using the Pia file format we produce from the user input. For the simpler input (birthdate, earnings, pension) the file format works well. But when we have to also specify assumptions about the future, it throws an error cryptically #234

Maybe we are passing in a line of conflicting information somehow in the file format we are generating, or we are passing in too much information.

The root of the issue is the code block after this line: https://github.com/codeforboston/windfall-elimination/blob/develop/src/library/pia/index.ts#L101

To Reproduce Steps to reproduce the behavior:

  1. run the app with GATSBY_SHOW_FUTURE_EARNINGS_PAGE=true npm start to enable the feature toggle. Lowercase true is important.
  2. Put in a birthdate that is not past their 70th birthday (e.g. not from year 1943 ... 1957 is good.) The assumptions sections at issue is only relevant if the person may be yet to retire.
  3. Load the https://www.dropbox.com/s/7y55twj8c1dfs1j/Windfall_App_Sample_20.xml?raw=1&dl=1 (downloadable from front/home page) into the earnings page
  4. Continue to the "future earnings" page which should have appeared if you followed step 1.
  5. Choose use percentage only. Provide 0.01 percent.
  6. Open your developer tools
  7. Continue to the results page

Expected behavior Change the birth date to 1943 to see the basic correct behavior for the same input. The results page provides a value for the detailed calculator that is distinct from the windfall calculator.

Screenshots Windfall Awareness calculator value

image

Detailed calculator failed to produce a value (it did not update, see error in devtools at right)

image

Additional context I believe we can troubleshoot this issue in 2 ways.

  1. a. The first way is to make 5-20 copies of piaFormat at https://github.com/codeforboston/windfall-elimination/blob/develop/src/library/pia/index.ts#L101. b. each copy should have slightly different values put into that copy using its setter functions. These can take inspiration using different subsets and modifications from the existing values that are currently hard coded. c. then pass each of them into the line where the WASM module crashes (https://github.com/codeforboston/windfall-elimination/blob/develop/src/library/pia/index.ts#L146). If one of them succeeds without the Uncaught (in promise) 5399408 - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch. then we make note of it and we can start troubleshooting.

  2. I have not yet made a build of AnyPIAJS withDISABLE_EXCEPTION_CATCHING=2 but I may try to do that too. This might show a more helpful error.

Thank you @alexjcode for help writing this up!