Skip to content

Refactor validation2 xi - #327

Merged
mschwoer merged 62 commits into
refactor_validation2_VIIIfrom
refactor_validation2_XI
Nov 19, 2026
Merged

mschwoer merged 62 commits into
refactor_validation2_VIIIfrom
refactor_validation2_XI

Conversation

@mschwoer

Copy link
Copy Markdown
Contributor

Address review comments III

mschwoer and others added 27 commits November 18, 2026 18:17
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>
The 0.12.0 migration renames the keys in the database, cf. the upgrade guide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It only returned `id`, so the same value had two names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It raised a bare StopIteration, while the webapp pages render.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
UserUpdate required the messenger id so that leaving it out could not clear
it; `users.update` requires the argument itself since it has explicit
parameters. With a default there, NewUser no longer overrides the field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The domain RawFile has `id` as its first field, so it comes first anyway.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assignments always hold lists; the mapper builds them with `list(...)`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`scopes` keeps its explicit None check: an empty list must be rejected, not
become all instruments.

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

claude Bot commented Nov 19, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

mschwoer and others added 2 commits November 19, 2026 09:51
The settings are passed between the processor tasks by unique name instead of
database id, so a run started before the deploy fails afterwards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An archived or deleted project cannot be changed, so its assignments could
never be removed, and settings assigned to it could never be deleted. Those
assignments never apply again, as archiving and deleting are final.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mschwoer and others added 28 commits November 19, 2026 10:47
An invisible character such as a zero-width space, or a lookalike letter,
passed the email rule, so a second user with the same-looking email could be
added. The Mongo model uses the same rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- drop the alias of gradient_length that mapped the name to itself
- update the stale comment on dropping empty columns, which only raw files use
- convert missing numeric prefills once, instead of a second NaN loop

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moved unchanged from test_raw_files.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
All other rules sit in the domain types and the shared.db facade. The
backend checked the values against the model instead; `RawFileUpdate` states
the same limits, and the limit test compares them with the model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`*_errors` returns a list, `_check_*` raises: `users.check_active` becomes
`users.owner_errors`, `settings._check_active` becomes `_check_status_change`,
and the settings check of `assign` becomes `_settings_errors`. A record that a
write refers to but is not active gets one message for users, projects and
settings, via `inactive_errors`.

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

`update_to_latest` raised on a missing newer version before checking the
project, so a caller not allowed to change the fallback project was told
there is no newer version. Like `assign`, it now reports all rule errors
together, the project errors first; `assign` lists them first as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since raw file updates are checked, status details over 1024 characters were
rejected and the intended status was not written. Only the failure callback
and the processor truncated; the handler did not. `RawFileUpdate` now
truncates them for every writer, and the two truncations in the pipeline go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A creating call raised NotFoundError for a reference that does not exist, so
it dropped the other rule errors and meant something else than on reads; every
client had to translate it. It is now one more entry of the InvalidInputError,
and NotFoundError only means that the addressed record does not exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
@mschwoer
mschwoer merged commit 4c3291a into refactor_validation2_VIII Nov 19, 2026
@mschwoer
mschwoer deleted the refactor_validation2_XI branch November 19, 2026 14:38
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