Skip to content

fix(judge): keep judgements by the job they judge, not by the workspace - #403

Draft
harenome wants to merge 6 commits into
ThinkFlowLab:mainfrom
harenome:fix/judgements-by-job
Draft

harenome wants to merge 6 commits into
ThinkFlowLab:mainfrom
harenome:fix/judgements-by-job

Conversation

@harenome

Copy link
Copy Markdown
Collaborator

Closes #362

Stacked on #402: its commits show here until #402 merges. Draft until #400 is fixed.

What

Judgements lived in the workspace's folder under the bare job id: deleting the workspace deleted them, a second workspace holding the job did not see them, and two jobs of one name shared one record. They are now kept in the user data directory under the job's identity (Job.uid, #399) and the trial's key, never in a job folder, which belongs to whatever produced it. Task-instruction scores are kept by dataset in judgements-tasks/, no longer as a task:<dataset> job.

Records kept in workspaces before still show, read in memory: a page writes nothing. Of two records for one trial the newer is shown, the other kept. Move judgements copies every workspace's old records once and leaves the old files; it is offered by a temporary dialog at a first page load and a row in Settings › Judges. Deleting a workspace keeps its judgements, and is refused while old records are not moved and a root cannot be read. Deleting a launch removes its jobs' judgements unless a copy of the job exists or a root cannot be read. A save holds a file lock.

Touches

backend · routes · templates and static · docs and site

Before and after

The Workspaces page's Delete dialog, for a workspace with judgements.

Before After
The dialog's line: "Its judgements (n) are deleted."

Move judgements: the dialog at a first page load, Not now and its toast, the Settings › Judges row, and the same section after Move.

Dialog Not now Settings row After Move

Verified

On main, the new app/ui_tests/test_judgement_follows_job.py fails:

FAIL: test_a_judgement_made_in_one_workspace_shows_in_another_and_outlives_it
AssertionError: False is not true : a judgement made in A does not show in B
FAIL: test_two_jobs_of_one_name_in_two_roots_keep_their_own_judgements
AssertionError: {'one': True, 'two': True} != {'one': True, 'two': False}

On this branch both pass. Also:

  • test_judge_adopt: old stores read under the job and left as they were; the newer of two records shown, both kept; earlier tries read under their trial; a store file cut short never written over.
  • test_judgement_follows_job: pages with an old store write nothing; Move checks the form token, copies once and leaves the old files; a workspace whose root cannot be read is not deleted.
  • test_run_delete, test_judge_cost, test_judge_store_race, test_task_judgement_slot: launch delete, calibration reads, the file lock, the task slot.
  • Backend suite (2879 tests) and route suite (667 tests) OK in a clean container.
  • In a browser, light and dark at 1280 and 390 wide: the dialog, Not now and its toast, the Settings row, Move, and neither afterwards.

Risk

  • A renamed folder of a job without a declared uid is a new job: its judgements no longer show under it. Today's store keys on the folder name, so no regression.
  • Until the move, a page also reads its workspace's old store.
  • The first-load dialog is a modal, against "a notice is a toast"; temporary migration UI, marked for removal.
  • A launch's Delete dialog says "up to N judgements": the delete keeps those of a job with a copy elsewhere.
  • A revert brings back the workspace store; records written meanwhile stay in the user data directory, unread.

…and moves

A new Nullius standard job declares a UUID, standard.uuid in its
config.json: a run resumed into the same folder keeps it, a merge makes a
new one. The reader exposes Job.uid and Job.uid_source: the declared id,
else a uuid5 derived from fixed facts of the files (format, folder name,
what ran, the start), else pending for a job with no trial and no start.
No path is a fact, so a copy or a move keeps the identity; old files are
never rewritten to gain one. Trial.key names a trial within it, a try by
its attempt.
…it move with the feed

A run resumed under the same name keeps the folder's uuid only when the earlier config names the same benchmark, plugged agent or capability, model and dataset; a job from before standard.uuid is given the uid it was read under. A Harbor job's start is read from result.json only, never from Nullius's feed, which may appear later; a feed that is not UTF-8 is read with replacement. A merge writes its config.json first and whole, so its result is never read without the merge's uuid. Imports' identity by folder name is marked as a known limit.
A judgement was kept in the workspace's own folder under the bare job id:
deleting the workspace deleted it, a second workspace holding the job did
not see it, and two jobs of one name shared one record. Judgements are
now Nullius's own record in the user data directory, under the job's
identity (Job.uid) and the trial's key, never in a job folder, which
belongs to whatever produced it.

- The same judgement shows in every workspace that holds the job.
- Records kept in a workspace before are copied in when its job is read,
  the old files left in place; of two records for one trial the newer is
  shown and the other kept beside it. Two jobs of one id in that
  workspace each get its record, as each showed it before.
- Deleting a workspace keeps its jobs' judgements and moves its old
  store into the user data directory whole.
- Deleting a launch removes its jobs' judgements, unless another folder
  of the same identity is found or a root cannot be read.
- Task-instruction scores are kept by dataset in judgements-tasks/, no
  longer as a job named task:<dataset>.
- A save holds a file lock, across processes.
…move them on request

A page that reads a job's judgements merges the records its workspace kept before with the user's store in memory and writes nothing. A save, a launch delete and a workspace delete still copy in the records of what they touch first. Move judgements (a dialog at a first page load, and a row in Settings > Judges) copies every workspace's old records into the user's store at once and records that it is done; the old files stay. A try's old record is read under its trial, filed under its try; a record copied once is never copied again; an old file that holds no object is skipped; a store file that cannot be read is never written over. The launch delete preview counts without copying and without looking for copies elsewhere; the delete itself does. A workspace with old records is not deleted while one of its roots cannot be read. Calibration reads the jobs at hand, not every record, and judging a job checks the form token first.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Judgements belong to a workspace, not to the job: deleting the workspace deletes them, and two workspaces keep two copies

1 participant