Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

Sending your lab results: dsoxlab push or export

By updated

Improve this page

Logo DSOXLab

A lab passed with dsoxlab check stays on your machine: the site only sees it after a sending that you trigger yourself. There are two routes. With an account, dsoxlab login then dsoxlab push send your attempts to that account. Without an account, dsoxlab export writes a file that you import in your browser. This lesson is for anyone who has already passed a lab and wants to find their score in "My learning". You will see what each route carries, then which one to choose.

What you will learn

  • Say where dsoxlab records a result before any sending.
  • Connect your machine to your account with dsoxlab login.
  • See what would leave with dsoxlab push --dry-run, then send it with dsoxlab push.
  • Write your results to a file with dsoxlab export.
  • Import that file into "My learning" without an account.
  • Choose between sending to the account and the file.

Prerequisites

Where are your results recorded before any sending?

Every attempt graded by dsoxlab check or dsoxlab submit is written to the .dsoxlab.db file of the catalogue, on your machine, and nowhere else. This file sits at the root of the catalogue you play. Progress is therefore specific to each catalogue: the same lab played in two copies of the catalogue produces two separate histories.

check and submit never send anything. A learner who replays a lab ten times would otherwise produce ten writes to their account, and a sending triggered by a learning command would make data leave the machine without being asked. So sending is a separate step, which you type.

When a check or a submit records an attempt in a terminal, dsoxlab may remind you of the sending commands, with dsoxlab push --dry-run to see first what would leave. It only does so if the catalogue provides for sending, through a learning.sync block in its meta.yml. This reminder appears only once on your machine, all catalogues combined, and it sends nothing.

What does a sending carry, and what does it never carry?

A sending carries attempts, not your progress. Each attempt carries the identifier of the catalogue and of the lab, the date, the score, the verdict, the state of each criterion, the hints taken and, for a mock exam, its verdict. The site then computes for itself what this changes for your trophies and your path.

The document contains nothing about your machine: no path, no host name, no user name. The login token is never written to the catalogue or to the document.

Some attempts never leave, and dsoxlab counts them and names them at the end of the sending, for example:

  • those of a lab that is no longer in the catalogue (renamed, moved or removed);
  • those of a lab of type validation, which defends a guide and grades nobody;
  • those with a field outside what the site accepts.

None of these cases is a failure. The attempts stay in .dsoxlab.db, which the sending does not modify.

When the sending exceeds the site's size limits, dsoxlab first lightens the oldest attempts: it sends them without their detail, and says so. The detail stays in .dsoxlab.db. If the sending is still too big, dsoxlab refuses it before sending it, or the portal refuses it, and the file of the route without an account then serves as a fallback.

How do you send your results to your account?

With an account, three commands are enough: dsoxlab login once, then dsoxlab push whenever you want to send, and dsoxlab logout to forget the session on this machine. They only work if the catalogue declares where to send, in a learning.sync block of its meta.yml. A catalogue you wrote yourself does not declare it until you have added it. The role of each command is summarised in The main dsoxlab commands.

Signing in with dsoxlab login

dsoxlab login opens the portal's sign-in page in your browser, the portal being the site's service that holds the accounts. The terminal also prints the sign-in URL, in case the browser does not open, then waits. You sign in in the browser: the landing page shows a code, and that code is what the terminal is waiting for.

Terminal window
dsoxlab login
ℹ Open this URL in a browser and sign in. The page you land on shows your code:
copy it, and paste it below.
https://<portal>/oauth2/authorize?response_type=code&client_id=<identifier>&redirect_uri=…&scope=…&state=…&code_challenge=…&code_challenge_method=S256
Paste the address the browser ends up on, read from its address bar (or just the code):
✔ Signed in to https://<portal>.
ℹ The session is kept under XDG_STATE_HOME, readable by you only, and never in the catalog. dsoxlab logout forgets it.

The URL is shortened here: yours is longer. At the "Paste the address…" prompt, paste the code that the landing page shows. The terminal also accepts the whole address where the browser ended up, read from its address bar. Copy one or the other in full: a truncated address, or one rewritten by the terminal when pasting, makes the sign-in fail. Run dsoxlab login again in that case. Nothing is sent as long as you have pasted nothing.

Then look for the line that starts with ✔ Signed in to: it names the portal you are signed in to (shortened here). Check that it is the portal of the site you use, because the catalogue chooses which site the sign-in goes to. Without this line, push will answer that it has no session. The second line mentions XDG_STATE_HOME, a variable from the XDG specification that names the folder where a program keeps its state data. By default, dsoxlab keeps the session there, in ~/.local/state/dsoxlab/sessions/: one file per portal, readable by you alone, and never in the catalogue.

On a machine without a browser, for example a server reached over SSH, add --no-browser. The output is the same, but dsoxlab does not try to open the browser: you open the URL on another machine, then paste the code or the landing address into this terminal.

Terminal window
dsoxlab login --no-browser

Seeing what would leave with push --dry-run

dsoxlab push --dry-run counts the attempts that would leave and stops there. Nothing leaves your machine, and no session is required: you can run it even before having played login.

Terminal window
dsoxlab push --dry-run
ℹ 2 attempt(s) would be sent. Nothing has left this machine.

Read the announced number of attempts, then the warnings that may follow. Each warning names a reason for a gap and the number of attempts concerned: these are the ones that will never appear on the account. The command needs the catalogue to declare learning.sync, like push does: if it does not, the command says so, which is the quickest way to know whether your catalogue can send.

Sending with dsoxlab push

dsoxlab push first reads what the account already holds, adds what is missing, then writes the result. It is a merge, never an overwrite: the account may contain attempts played on another machine, and they stay.

Terminal window
dsoxlab push
✔ 2 attempt(s) added. The account now holds 2, at revision 22.

The output says how many attempts were added and how many the account now holds. If an attempt was already on the account, it is left as it is, and the output says so.

Running dsoxlab push again without a new attempt is safe. dsoxlab notes that the account already holds exactly the same attempts, writes nothing and says so.

✔ The account already held exactly these 2 attempt(s): nothing written, revision 22 unchanged.
ℹ 2 attempt(s) were already on the account, and were left as they are.

The revision is the version number of the "lab results" part of your account. It goes up at every write, wherever the write comes from, and stays the same when nothing is written. It does not count your attempts: the 22 in these examples depends on the account's history, yours will be different.

The diagram follows a complete sending, from login to the write. Look at two things: the learning.sync declaration is read before any call to the portal, and dsoxlab reads the account's attempts before writing to it, which is what makes the merge possible.

A learner runs dsoxlab login: the CLI obtains an authorization code from the portal using Authorization Code with PKCE, then a local session. On dsoxlab push, it drops the attempts that cannot be published, reads the account's attempts, then writes the merge under a revision condition.Portal,evidence APIPortal, OAuthsign-indsoxlab onthe machineLearnerThe catalogdeclareslearning.syncAttemptsskipped: labmissing fromcatalog, labof typevalidationdsoxlab loginAuthorization Code +PKCE S256authorization codecode + PKCE verifierlocal session boundto api, domain, clientdsoxlab pushread the attempts already held by theaccountattempts and current revisionmerged write, conditional on therevisionaccount up to date
The catalogue declares learning.sync, without which none of these steps takes place. Source · SVG
Esc to close, + and − to zoom, scroll to move around. 100 %

Three terms in the diagram come from the OAuth sign-in, and you have nothing to configure. "Authorization Code" is the method where the portal first returns a code, which dsoxlab then exchanges for a session. PKCE protects that exchange: dsoxlab keeps a single-use secret, the verifier, and only shows it to the portal at the end. As for the session "bound to api, domain, client", it is only valid for the portal that issued it, which explains the "session from another portal" message in the troubleshooting section.

Finding your results on the site

The sending fills your account, not a browser directly. A browser linked to the same account syncs when you open "My learning" (at most once a minute and per tab), or when you click "Sync now" in the "Account" block of the "My data" tab. Your attempts then arrive on the "DSOXLab results" row of that tab, which shows the number of results ("1 lab result" or "3 lab results"), the number of practices and proofs passed, and the date of the last import. They also count in "My path" and in the trophies. The detail of what the site does with this data is in Progress and data.

Forgetting the session with dsoxlab logout

dsoxlab logout deletes the session file of this machine. It does not revoke the token on the site's side: for that, sign out of the site in your browser. On a shared machine, do both.

Terminal window
dsoxlab logout
✔ Local session for https://<portal> forgotten.
ℹ This only erases the local file. To revoke the token itself, sign out from the portal in your browser.

A dsoxlab push run afterwards answers ✘ No session for this portal: dsoxlab login opens one. and returns code 1. With no session open on this machine, logout says so and deletes nothing:

Terminal window
dsoxlab logout
ℹ No local session for this portal: nothing to do.
ℹ This only erases the local file. To revoke the token itself, sign out from the portal in your browser.

How do you send your results without an account?

Without an account, dsoxlab export writes your results to a JSON file, and you import that file into "My learning". No sign-in, no network, and no learning.sync block in the catalogue: the file route works on every catalogue.

Writing the file with dsoxlab export

Without an option, dsoxlab export writes the document to standard output, that is, to the terminal. To get a file, give it a name with -o. With --lab <identifier>, the file only contains the last attempt of that lab; without this option, it contains the whole history of the catalogue. The file is JSON: its count field gives the number of results, and the results list contains them. Your numbers depend on your catalogue and on what you played in it.

Terminal window
dsoxlab export -o history.json
ℹ 3 result(s) written to history.json

The confirmation gives the number of results written and the path of the file. dsoxlab never overwrites an existing file unless you ask for it with an option, which its error message names: a proof replaced in silence is a proof lost. It also refuses to write through a symbolic link.

Importing the file into My learning

Open "My learning" on the site, "My data" tab. The "DSOXLab results" row has the "Import DSOXLab results" button. Choose the file: the browser reads it in place, without sending it anywhere, then opens a confirmation screen. It is titled "DSOXLab result detected" and says, for a single result, the catalogue, the lab, its type, the number of passed checks with the verdict, and the date. Nothing is added until you click "Add to my learning"; "Ignore" keeps nothing. If the file was already imported, the screen states that these results will not be added twice.

This route has a limit to know about: without an account linked to this browser, the import only fills the browser where you do it. Another browser, or another device, will see nothing until you import the same file there.

The file can travel from one machine to another like any file: that is what helps when the machine that plays the labs cannot reach the site.

Exercise: reading an export, a dry-run sending and an import

This exercise produces a results file, reads what a dry-run sending announces, then shows the file to the site. It assumes a passed lab. Steps 1, 2 and 4 work on every catalogue; step 3 needs a catalogue that declares learning.sync, but neither an account nor a session. The numbers in step 3 come from your catalogue and are not those of the lesson's examples.

Reading an export, a dry-run sending and an import Exercise 1 of 1 · ~10 min · terminal and browser

You have passed a lab, and you want to see what a sending would contain, then what the site does with your file. The first three steps are played in the lab's catalogue.

Write a lab's last attempt

Write to proof.json the last attempt of the lab you have just passed, then open the file and find the validated field.

Run the write again on the same file

Run the same command again without changing anything. Read the error message: it says what to add to replace the file.

Do a dry-run sending

Run the sending in trial mode, read the announced number of attempts and the sentence that says what has left the machine.

Import the file into My learning

In "My learning", "My data" tab, import proof.json on the "DSOXLab results" row. Read the Result line of the confirmation screen, then click "Ignore" if you do not want to keep this result.

A hint 1 / 2

dsoxlab export limits the file to one lab with an option that takes the lab's identifier, and writes to a file with another one.

A hint 2 / 2

The trial mode of push is an option of the command, not a separate command.

I have tried: show the solution

First step: dsoxlab export --lab <identifier> -o proof.json. The file contains a single row in results, the last attempt of the lab, and its validated field is true since you have just passed the lab.

ℹ 1 result(s) written to proof.json

Second step: without --force, dsoxlab refuses to overwrite the file and names the option. With --force, the file is replaced.

$ dsoxlab export --lab <identifier> -o proof.json
✘ proof.json already exists.
ℹ A proof replaced in silence is a proof lost. Pass --force to overwrite it, or choose another name.
$ dsoxlab export --lab <identifier> -o proof.json --force
ℹ 1 result(s) written to proof.json

Third step: dsoxlab push --dry-run announces how many attempts would leave and states that nothing has left the machine. The announced number is that of the attempts recorded in your catalogue: each check and each submit adds one, so yours may differ from the example.

ℹ 2 attempt(s) would be sent. Nothing has left this machine.

Fourth step: the confirmation screen opens under the title "DSOXLab result detected". Its Result line gives the number of passed checks followed by the verdict: "Passed via DSOXLab" for a passed lab, so the answer is "passed". "Ignore" closes the screen without recording anything; "Add to my learning" records the result in this browser.

Account or file: which one to choose?

Choose the account if you play labs often from a machine that can reach the site, the file in the other cases. Both routes bring your attempts to the site; they differ in what they require and in where the result arrives.

Your situationRecommended routeWhy
You play regularly and want to avoid the fileAccount: login then pushOne more step after check, no file to move
You work on several machinesAccountpush merges the attempts of each machine into the same account
You do not want an accountFile: exportNothing leaves your browser or your machine
The machine running the labs cannot reach the site (closed network, server)FileThe file can be copied by any means
Machine without a browserFile, or account with login --no-browserBoth work; the sign-in ends on another machine

The two routes can be combined: an imported file does not prevent a sending to the account afterwards.

Troubleshooting

dsoxlab's error messages name the cause and say what to do; this table covers the cases of this lesson. None of them loses your results: they stay in .dsoxlab.db.

SymptomCauseSolution
push or login says the catalogue declares no synchronizationThe catalogue's meta.yml has no learning.sync blockUse dsoxlab export and the file import, or ask the catalogue's author to add the block
push says there is no session for this portaldsoxlab login has not been played on this machinedsoxlab login, then dsoxlab push
push says the session has expired and could not be renewedThe local session is out of datePlay dsoxlab login again
push says the session comes from a different portalThis catalogue declares a different portal from the one of the saved sessionThe catalogue chooses which portal the sign-in goes to: only sign in again if you trust this catalogue, otherwise you would hand a session to another site
The announced number of attempts is 0, or smaller than expectedNo attempt recorded in this catalogue, or attempts dropped (lab gone, validation lab)Check the current catalogue, read the warnings, play dsoxlab check again
login fails after the pasteThe pasted address or code is truncated or rewritten on pastingCopy it in full from the landing page or the address bar, then run login again
The portal does not answerNetwork down or site unavailablePlay dsoxlab push again when the site answers: nothing was written, so the sending can be replayed safely
export -o refuses to writeThe file already exists, or it is a symbolic linkIf the file exists, add --force. If it is a symbolic link, choose another file name, because --force does not get around it

A sending refused because it is still too big, even lightened, is worked around with the file route: dsoxlab export -o proof.json.

Key points

  • dsoxlab check and dsoxlab submit record to the catalogue's .dsoxlab.db and never send anything; a sending carries attempts, with no path, host name or user name.
  • With an account: dsoxlab login once (paste the code from the landing page, with --no-browser if the machine has no browser), dsoxlab push --dry-run to look, dsoxlab push to send, dsoxlab logout to forget the session.
  • These commands need a learning.sync block in the catalogue's meta.yml; push --dry-run says whether yours declares one.
  • push merges with what the account already holds and writes nothing when everything is already there.
  • Without an account: dsoxlab export -o file.json, then "Import DSOXLab results" in "My data", with the "Add to my learning" confirmation screen.
  • Without a linked account, the import only fills the browser where it is done; sending to the account feeds every linked browser.

Knowledge check

Check that you have the essentials of this guide. The questions only cover what has just been explained here.

Knowledge check

Check what you have learned with this interactive quiz

6 questions
6 min
70% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer