Fix #015 (nested-JSON 500) and #016 (ragged CSV data loss)

#015 — deeply nested JSON raised RecursionError (a RuntimeError, not
ValueError) and became an unhandled 500 on two paths:
- json-kind content validation now catches RecursionError -> 400.
- Added a custom DRF EXCEPTION_HANDLER
  (artifacts/exception_handlers.py, wired via REST_FRAMEWORK) mapping
  otherwise-unhandled RecursionError -> 400, covering the parser-level
  crash on deeply nested request bodies (metadata etc.) too.

#016 — wrap_csv_viewer handed Grid.js rows without reconciling width to the
header, so over-long rows silently dropped cells. Now normalizes every row
to the max width: long rows widen the columns (auto-named "Column N"),
short rows pad with "". No cell is dropped.

Both verified live; 4 regression tests added. 106 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
peter 2026-09-03 10:57:07 +01:00
parent 5c53643349
commit 5f872b4b32
6 changed files with 110 additions and 7 deletions

View file

@ -57,6 +57,12 @@ TEMPLATES = [
WSGI_APPLICATION = "daybook_project.wsgi.application"
REST_FRAMEWORK = {
# Maps deeply-nested-JSON RecursionErrors (raised in DRF's parser, before
# view validation) to a 400 instead of an unhandled 500. See issue #015.
"EXCEPTION_HANDLER": "artifacts.exception_handlers.daybook_exception_handler",
}
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",