Skip to content

Refactor validation2 x - #325

Merged
mschwoer merged 74 commits into
refactor_validation2_Ifrom
refactor_validation2_X
Nov 19, 2026
Merged

mschwoer merged 74 commits into
refactor_validation2_Ifrom
refactor_validation2_X

Conversation

@mschwoer

Copy link
Copy Markdown
Contributor

Address review comments II

mschwoer and others added 30 commits November 18, 2026 17:54
`matching(regex, message)` replaces `pattern=`, whose pydantic message only
shows the regex: user initials and email, settings name. The Slurm memory and
time rules use it instead of their own validator methods.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`**fields: Any` cost static checking and completion at the call sites. A missing
or misspelled argument is now a TypeError at the call; the tests of misspelled
keywords are gone.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`shared.api_responses` loads alphakraken.<ENV_NAME>.yaml through
`shared.display_paths`; the image had neither the file nor pyyaml.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Both state the limits as literals. A value passing the input type but failing
in the model would come back as an error naming the model's fields.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The migration `_migrate_legacy_metrics_keys.py` renames them in the database,
and covers more keys than the read-time map did. Add it to the upgrade guide.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
It replaces the collected rule errors, and a client must not answer it with
"not found": the request refers to a record that does not exist.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`$` also matches before a trailing newline, so `re.match` let "x\n" pass. The
input types strip it first, but the check at job time runs on stored values.
Use `fullmatch`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`normalize_email` let pydantic's ValidationError through, which clients do not catch.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
It shared its name with pydantic's and mongoengine's ValidationError; a client
importing the wrong one would silently stop catching the errors of shared.db.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The Mongo model had a copy, used by project_owner and one old migration.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`project_settings.find` skips an assignment whose settings no longer exist
instead of raising, and the application never removes settings. Say so in
its docstring.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The defaults per software type were applied only as prefills of the settings
form. A caller leaving them out, or a user clearing the memory or time field,
stored an empty value, and the job ran with `--mem=`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…trics

A value named like a field of the metrics document (`type`, `created_at_`, ...)
or its id replaced the metadata, overwrote another document or raised an
untranslated TypeError. Insert with force_insert; reject such names and names
with `.` or `$` with an InvalidInputError.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It existed only once someone created it on the projects page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`projects.add` takes `allow_fallback`, like the assignment functions; the
projects page passes `is_admin()`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The local stdio setup in the deployment docs lacked ENV_NAME, so the server
crashed on start. The shared.db docstring claimed only writers need the file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The queryset update skipped the model's checks. Raise the limit of the status
details to 1024, to which the pipeline truncates them; with 512 every long
error would have made the failure callback fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mschwoer and others added 21 commits November 19, 2026 11:54
Leaving them out meant all instruments, the misspelled-key risk the caller
note in shared/db warned about. Now a caller must state them, `['*']` for all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The file remover writes all its errors into the details exactly when there
are too many; over 1024 characters the save failed and the ERROR status was
never written. `shared.db.status.update` truncates them now, with the same
helper as the raw file updates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- `project_owner`: an owner reference to a user that no longer exists
- `settings.create(archive_previous=True)`: archiving fails after the insert
- `translate_errors`: mongoengine's coding-error signals become DatabaseError

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The record, with its possibly large file info, was loaded only to log its old status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The migration left such keys alone, and since the webapp no longer merges the
duplicate columns, those documents kept an extra column. Keys with another
value are still left alone and reported. Add the first tests of the migration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`_to_raw_file_dict` and `_to_dict` differed only in the excluded keys; the
metrics and the backup path are added in one pass over the raw files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The error list is the same, as the project errors are collected before; the
else branch and the type ignore on the version go away.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guard against an empty id list was redundant, as `id__in=[]` matches
nothing, and the backend sort was repeated by the facade, whose project query
returns the newest first anyway.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uest

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Status records truncated too long details in the facade function, raw files in
their input type. `KrakenStatusUpdate` truncates them the same way and checks
the other field limits; the limit tests compare it with the model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NaN is not equal to itself, so a duplicate key with a NaN value was kept and
reported as a conflict. Also find the key holding the current name in one
expression.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both were 1024 and fed the same truncation; nothing meant them to diverge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from refactor_validation2_IX to refactor_validation2_VII November 19, 2026 14:38
Base automatically changed from refactor_validation2_VII to refactor_validation2_VI November 19, 2026 14:38
Base automatically changed from refactor_validation2_VI to refactor_validation2_V November 19, 2026 14:38
Base automatically changed from refactor_validation2_V to refactor_validation2_IV November 19, 2026 14:38
Base automatically changed from refactor_validation2_IV to refactor_validation2_III November 19, 2026 14:38
Base automatically changed from refactor_validation2_III to refactor_validation2_II November 19, 2026 14:38
Base automatically changed from refactor_validation2_II to refactor_validation2_I November 19, 2026 14:39
@mschwoer
mschwoer merged commit 18af787 into refactor_validation2_I Nov 19, 2026
3 of 4 checks passed
@mschwoer
mschwoer deleted the refactor_validation2_X branch November 19, 2026 14:39
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.

1 participant