Skip to main content
Sandbox Coding tasks often use a hidden test for grading: after the Agent changes the code, the eval writes the test file into the Sandbox and runs it. Passing the test means passing the task. That test file is the grading standard itself—changing it changes the task, so old results can no longer be trusted. Read it with loadText, and NiceEval includes the file contents in that eval’s fingerprint. Change one byte and the next run reruns this eval automatically while other evals keep using their cache. Reading the same content with fs.readFile leaves NiceEval unaware that the read happened. Change the test file and the cache still hits, so you see a conclusion made against the old test.

Steps

  1. Keep the criteria files in the repository with the eval:
  2. Read them at the module top level of the .eval.ts file:
    A project-root-relative string works too: loadText("evals/fixtures/react-datepicker/pr-6058/tests/run-tests.sh"). loadText accepts a URL directly; you do not need to import node:url.
  3. Write the files into the Sandbox and execute them in test(t):
Change datepicker_test.test.tsx and run the same command again. Only this eval reruns, which verifies that the fingerprint took effect.

Notes

  • loadText must be at module top level. Cache reuse is decided before execution. Reading it inside test(t) happens too late, so NiceEval reports an error telling you to move it to the top level.
  • Read Agent output with t.sandbox, not loadText. Files created by the Agent inside the Sandbox are evidence for this run and vary each time; they do not belong in the fingerprint. Read them with await t.sandbox.readText(path), then pass the returned string to t.check.
  • Use loadYaml / loadJson when criteria are structured data such as a case table. See Data-driven Testing.