Okay so this one is a messy one... It's mostly a result of me having a beer and poking around so there are lots of mistakes and experiments but hopefully we can see some good in it. On hindsight, I really should have broken this PR to smaller ones.
But some of the efforts were experimental and it was really hard to check if a solution worked when there were so many intermittent failures.
Any how, here are some scribbles of a mad man.
There are still some outstanding intermittent test issues
in some rare cases, click bindings doesn't complete 100% as in dom has click event binding but function doesn't run. I think somewhere in the knockout initialization is not completed? This one was a strange one and checking for click even binding and binding definitely was there. But associated function never fired. It is super rare so hard to debug but have seen this couple of times.
on the topic of click, I don't even remember all the different types of experiments I've ran and failed.
unitests are also bit dodgy. I haven't looked in to it yet but it seems minor and put simple retries for now but it's something to look into.
It is also possible that when the back end triggers events, front end receives the event, triggers a fetch, but fetch fails to reflect the changes. I think in resource restriction will aggravate these types of the race conditions and hopefully we can make ungit faster and reduce these types of race conditions.
Some times socket IO event doesn't get delivered. In example below, event has been triggered from the backend evident by the logging of emitting working-tree-changed to sockets, manually triggered. But from UI this was never received for whatever reason. Socket IO does make a claim about temporary failures, which makes sense.
✔ updateBranches button with one branch (362ms)
[server] 2022-02-16T03:43:23.705Z - info: POST /api/testing/createfile
[server] 2022-02-16T03:43:23.731Z - info: /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/test-temp-dir2022116-2442-1ahxe66.pqbsg/testfile2.txt triggered workdir refresh for /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/test-temp-dir2022116-2442-1ahxe66.pqbsg
2022-02-16T03:43:23.750Z - debug: Waiting for visible: ".files .file .btn-default"
[server] 2022-02-16T03:43:24.028Z - info: GET /api/branches?path=%2Fprivate%2Fvar%2Ffolders%2F24%2F8k48jl6d249_n_qfxwsl6xvm0000gn%2FT%2Ftest-temp-dir2022116-2442-1ahxe66.pqbsg&socketId=0
[server] 2022-02-16T03:43:24.030Z - info: GET /api/refs?path=%2Fprivate%2Fvar%2Ffolders%2F24%2F8k48jl6d249_n_qfxwsl6xvm0000gn%2FT%2Ftest-temp-dir2022116-2442-1ahxe66.pqbsg&remoteFetch=%5Bobject%20Object%5D&socketId=0
[ui log] 2022-02-16T03:43:24.070Z - debug: ignoring redraw for same BranchesViewModel payload.
[server] 2022-02-16T03:43:24.250Z - info: emitting working-tree-changed to sockets, manually triggered
1) add second branch
[server] 2022-02-16T03:43:29.801Z - info: POST /api/testing/cleanup
[server] 2022-02-16T03:43:29.828Z - info: Cleaned up: {"files":0,"dirs":1}
2022-02-16T03:43:29.868Z - info: UNGIT SERVER EXITED
many of the components API calls are switched to async await.
Added some typescript. There are some files that are in typescripts now.
Since typescript add, admittedly build can be bit slow, especially with the weaker computers. I suspect this is due to lots of redundant type inferences it has to do to each of the components because they are packaged separately using custom build. This is something to look into later. Maybe a unified transfile file?
Way dialog was open and passing in values was bit unreliable. Because of many knockout bindings and event triggers, user's click decisions had some probabilities that it may not be set in time. It was bit drastic, but I've ripped out the whole thing and began using signals to handle dialogs and it is now in modal in typescript.
It was once suspected that redrawing dom whil testin was running was the cause of the instabilities. So there was an attempt to make entire event handling async and set a flag when all operations are done. But didn't wasn't wasn't the problem and it was later reverted somewhat.
There were improvement on how loggings are done. So now we can either do ungit.logger.info(...) or use const logger = require('../source/utils/logger'); to log out.
ungit.__app is now set to components/app.js. This is pretty handy for debugging.
there are lots of improvements at click tests.
setApiListener(...) is to wait for specific api calls and responses to ensure it is called and received expected response
clickOnNode(...) for some clicks events, currentActionContext() is expected to be set and this is to add check for it
ensureRedraw(...) essentially waits for /gitlog call to be made and responded, there for drawing git nodes
there are some manual awaits
most are to slow down and prevent clicking around too fast and reduce the chance of clickbinding not initializing in time
Okay so this one is a messy one... It's mostly a result of me having a beer and poking around so there are lots of mistakes and experiments but hopefully we can see some good in it. On hindsight, I really should have broken this PR to smaller ones. But some of the efforts were experimental and it was really hard to check if a solution worked when there were so many intermittent failures.
Any how, here are some scribbles of a mad man.
There are still some outstanding intermittent test issues
emitting working-tree-changed to sockets, manually triggered
. But from UI this was never received for whatever reason. Socket IO does make a claim about temporary failures, which makes sense.many of the components API calls are switched to async await.
Added some typescript. There are some files that are in typescripts now.
Since typescript add, admittedly build can be bit slow, especially with the weaker computers. I suspect this is due to lots of redundant type inferences it has to do to each of the components because they are packaged separately using custom build. This is something to look into later. Maybe a unified transfile file?
Way dialog was open and passing in values was bit unreliable. Because of many knockout bindings and event triggers, user's click decisions had some probabilities that it may not be set in time. It was bit drastic, but I've ripped out the whole thing and began using signals to handle dialogs and it is now in modal in typescript.
It was once suspected that redrawing dom whil testin was running was the cause of the instabilities. So there was an attempt to make entire event handling async and set a flag when all operations are done. But didn't wasn't wasn't the problem and it was later reverted somewhat.
There were improvement on how loggings are done. So now we can either do
ungit.logger.info(...)
or useconst logger = require('../source/utils/logger');
to log out.ungit.__app
is now set tocomponents/app.js
. This is pretty handy for debugging.there are lots of improvements at click tests.
setApiListener(...)
is to wait for specific api calls and responses to ensure it is called and received expected responseclickOnNode(...)
for some clicks events,currentActionContext()
is expected to be set and this is to add check for itensureRedraw(...)
essentially waits for/gitlog
call to be made and responded, there for drawing git nodes