Closed moT01 closed 2 years ago
The file-based progress storing feature has been added just a moment ago and it's probably not tested well yet. We pass CODEROAD_SESSION_STORAGE_PATH to the containers already @ShMcK . Could you check? I believe that's what caused the bug to appear. Once this works, tutorials progress will be stored across sessions @moT01
Edit: To debug:
Can you change the CODEROAD_SESSION_STORAGE_PATH
to a relative path, like "../.local"? That removes the failure to load.
In the meantime, I'll look into why it's not writing to the directory.
I changed the path for the Coderoad storage file to a relative one. Let us know if it fixed the issue @moT01
My main account is a little stuck right now. When I load up pretty much any tutorial, it goes to the CodeRoad loading screen:
I believe it's cause I have previously created containers with the names of those tutorials.
On my second account, I believe I haven't previously created those containers and it loaded up the first two tutorials I tried. Then, when I went to load the first one again, it showed that start up screen. So, I think the initial loading is working - just having issues continuing. It does seem to be loading the same container properly, so that's good.
I'm running out of tutorial names to open that will create new containers to test things - that dashboard to delete those old containers would be nice 😉
Looks like the progress reading across sessions is broken right now @ShMcK. I will enable deleting old projects for you @moT01. As for the 'restart the project' button, it's mostly ready. We're doing some infrastructure tests right now. We plan to finish it right after that.
Coderoad v0.17.2 does not read the progress correctly @ShMcK
Steps to reproduce:
Note:
@AdamZaczek I don't think the issue is CodeRoad related.
On launching a tutorial and completing the first lesson. It works (step 10.10)
On relaunching a tutorial and completing the second lesson. It works (step 20.10).
Created and ran a new unrelated project in a new container.
Re-run the original project. The file changes are not up to date (see step 10.10 instead of 20.10)
I suspect:
- users are allowed one active container at a time? If I launch a new container while another one is open, the first container is shut down. Yes - File changes in a container are preserved while the container is live, so I can reload the container and progress is up-to-date. Yes - BUT when a container is rebuilt, the container might launch with an older set of file changes. This is why I see an older version of progress. OR perhaps only the file changes in codeally/.local may be stale. No, I actually have the correct progress when I do:
cd ../../codeally/.local && cat coderoad_position.json
The progress file is there. It's just that the tutorial doesn't launch for me, as in the screenshot:
@AdamZaczek new container restarts should auto-start in v0.17.3.
The logic checked for local storage first, then fell back to the file. I changed it to check the file first, then fallback to local storage.
This doesn't work for us, no matter what we try @ShMcK. Now it doesn't open the tutorial so we always have the state from the previously attached screenshot.
@AdamZaczek
For the auto-launch to occur, it requires an existing history or a CODEROAD_TUTORIAL_URL
.
When I open the link (https://codeally.io/embed/?repoUrl=https://github.com/freeCodeCamp/learn-git-by-building-an-sql-reference-object&envVariables=CODEROAD_WEBHOOK_TOKEN=ofiasjdflasjdflkajsd) it no longer includes the tutorial url variable. Do you know if that is a recent change?
To check for the variable, run:
printenv | grep CODEROAD
If the missing URL is not the cause, let's set up a call sometime soon to sort this one out.
We did some digging. To recap:
When we add a completely new project from the link: The CODEROAD_TUTORIAL_URL variable is there Coderoad does not auto-launch. Coderoad works after manually starting.
When we continue an existing new project from the link: Some env variables, like CODEROAD_TUTORIAL_URL, are missing. Coderoad does not auto-launch. Coderoad does not work.
Auto launching is not affected by CODEROAD_TUTORIAL_URL missing. We will see if fixing CODEROAD_TUTORIAL_URL resolves the issue with Coderoad not working after launching manually.
Continuing tutorial works, thanks @ShMcK!
Now, it's only auto-launching that does not work yet.
@AdamZaczek I believe I found the cause. The activation event expects "codeally.json", which doesn't match on "codeAlly.json". The filename seems to have changed.
I tried changing the activation event to workspaceContains:/code[aA]lly.json
. There are no docs on the pattern matching here, but I've found it does not use a typical regex.
I could add both patterns, or one of them, @AdamZaczek let me know which you prefer?
"workspaceContains:/codeally.json",
"workspaceContains:/codeAlly.json"
Otherwise, the easiest fix could be to maintain the previous file naming. The change on my end is minimal as well, so no worries there.
If you want to test the functionality to verify it will work:
Edit the extension package.json on line 79 via the terminal. Use a pattern that matches on the codeAlly.json file.
To edit the extension file with Nano:
nano ../../codeally/.local/share/code-server/extensions/coderoad.coderoad-0.17.3/package.json
Call the ">Developer: Reload Window" action (cmd+shift+P).
CodeRoad should auto-launch.
Awesome! We need to go for "workspaceContains:/codeAlly.json". Having "workspaceContains:/codeally.json" as an activation event as well will not hurt though!
I made a pull request @ShMcK: https://github.com/coderoad/coderoad-vscode/pull/556
Should be resolved with the release of 0.17.4.
There is still issue with saving progress.
Despite having CODEROAD_SESSION_STORAGE_PATH=../../codeally/.local
env set and files created properly there, refreshing the editor makes CodeRoad start from the beginning.
Moreover, after refresh it either stops working or behaves strangely until clicking the "Reset" button.
I can confirm, something works really strange @ShMcK 🤔 It seems like Coderoad overrides the progress file. Progress is there, I refresh the page, progress is gone. Screenshot:
To reproduce:
Thanks for looking into this so hard everyone. I was off last week, so I'm still getting caught up. Let me know if you need anything.
There's a line of logic that says "if a tutorial doesn't have an id, there is no tutorial". That tutorial does not have an id.
I can change that line to look for a tutorial version instead, I think that would be preferable.
It should auto-launch now and preserve the content on refresh in v0.18.3.
I also added ".freeCodeCamp" to files that trigger auto-launching to make this work. Ideally these files should be in a variable, but I think it should be fine for now.
Awesome, thanks @ShMcK ! We're adding the new coderoad to tutorials today.
I was having an issue loading CodeRoad (0.17.2, but this issue probably started at 0.16.0 or 0.17.0) in the docker container we have set up to run tutorials locally. Basically, I would launch CodeRoad and it would auto load my last tutorial, and none of the files were there to continue the tutorial. And there was no way to start over - not even by rebuilding the container, strangely. I know we need something like this to work for continuing tutorials, and perhaps this will work on CodeAlly. I dug into it a little bit to try and figure out how it works - CR is using some kind of local storage in VS Code to save some sort of state or tutorial or something. And I think it may write something to a file as a second way to save the state - or maybe it only does that. Not sure exactly, but it's something along those lines.
I see three methods at the moment for running tutorials
Locally, without docker (I really never use this method) Current behavior: -I open a workspace, start a tutorial -If I open the same workspace, it will continue the tutorial where I left off (auto load) -I can start new tutorial by creating a new workspace
Not that big of an issue here. I can't start a different tutorial within a workspace - I have to create a new one. If a workspace breaks - maybe I delete the files or something, it's pretty much stuck.
Locally, with docker (using the rdb-alpha repo) Current behavior: Similar to the above, except the container always loads the same workspace. So if it breaks, it's pretty stuck.
It's not an immediate issue. I pinned the container to use 0.15.1 for now, so it doesn't auto load the tutorials. We could probably just leave it like that if we have to.
CodeAlly Not sure exactly how it will work on CodeAlly. Does each container (tutorial) have its own workspace? That could potentially work - I can see people getting stuck if they delete the files there. There is a plan do have a CodeAlly dashboard where users can delete the containers I believe, so there would be that fallback.
I'm not sure what the solution is. Maybe we need some way for users to clear the storage? Or a way to truly start over if someone gets stuck - maybe a pop-up when continuing a tutorial, "Do you want to continue where you left off?" I know there already is something like that when running local tutorials. I don't see a clear solution that would work for all these methods at the moment. I'll keep pondering, maybe something will come.