All posts

Your code runs on your machine, and so does ours

A task that a language model wrote a minute ago might be wrong. Its tests might pass for an empty file, or its own solution might fail them. A learner should never be the one to find that out. So each task is proved before it is shown, and since this year that proof happens on your computer and not on our server.

Two runs before you see a task

A task arrives with tests and with a solution you never get to see. Before the task exists for you, the extension runs the tests twice in a temporary folder outside your project.

The first run is against your project as it stands. It has to fail, because otherwise there is nothing left to do. The second run is against the solution. It has to pass, because otherwise the task cannot be solved. The folder, solution included, is deleted before anything is reported.

  1. First run

    The tests against your project as it stands. They have to fail.

  2. Second run

    The tests against the solution. They have to pass.

  3. Clean up

    The temporary folder is deleted, solution included.

  4. Report

    Counts, a duration and the last lines of output go to the server, which works out the verdict.

What happens before a task is shown to you.

Why not on the server

We used to run this check in a container on the server. Then a task passed there and failed for the learner, because the two environments differed by one library. Two environments that have to agree will sooner or later disagree.

Now there is one environment: yours. A task that passed the check passed it where you will work on it. As a side effect the server executes no code at all, neither generated code nor yours. It has no sandbox that could be escaped.

Numbers go back, a verdict does not

Your computer does not tell the server "passed". It reports what happened in each run: how many tests passed and failed, how long it took, and the last lines of the output. The server works out from those numbers whether the task holds.

If your computer could not run the check at all, for example because Python is missing, nothing is decided and the extension tells you what to install.

When a task fails the check

You do not see it. The model is asked again and shown what the runs printed. After a few attempts the course stops asking and explains the objective in a reading activity, so you always get something that works.

The check costs a few seconds per task. It starts while you are still looking at the task you just finished, so most of the time the next one is ready when you ask for it.