sillsdev / languageforge-lexbox

Lexbox, SIL linguistic data hub
MIT License
7 stars 2 forks source link

Fix JWT out-of-sync detection middleware and move it into LexQueries #1218

Closed myieye closed 1 week ago

myieye commented 2 weeks ago

Resolves #1180

This PR moves the JWT refreshing code into LexQueries. It's no longer quite as generic as it was before (i.e. it won't automatically trigger based on GQL types), but it's much less magical, not so tricky to wire-up and easier to test.

The middleware was pretty buggy before. The unit tests should demonstrate that it handles every situation we're expecting our users to maybe land in.

Also, previously we used the old token for the scope of the request and only refreshed it at the end. Now we look for updates up front and use the current state for the scope of the GQL Query.

Projecting a few Id's and UserId's lets us write less complicated code, so I thought it was worth it.

myieye commented 2 weeks ago

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @myieye and the rest of your teammates on Graphite Graphite

github-actions[bot] commented 2 weeks ago

C# Unit Tests

90 tests   90 :white_check_mark:  5s :stopwatch: 14 suites   0 :zzz:  1 files     0 :x:

Results for commit 41479915.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 2 weeks ago

UI unit Tests

12 tests  Β±0   12 :white_check_mark: Β±0   0s :stopwatch: Β±0s  4 suites Β±0    0 :zzz: Β±0   1 files   Β±0    0 :x: Β±0 

Results for commit 41479915. ± Comparison against base commit 9a099a3b.

:recycle: This comment has been updated with latest results.