[codex] fix euid_details hidden-section submits#222
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9ad25d18a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not isinstance(obj.json_addl, dict): | ||
| obj.json_addl = {} |
There was a problem hiding this comment.
Avoid clobbering non-null json_addl payloads
The new guard in save_json_addl_key resets obj.json_addl to {} for any non-dict value, which means a legacy or string-encoded JSON payload will be silently replaced and then committed when users submit hidden-section edits. Because other code paths explicitly handle string-backed json_addl (for example _container_event_payload in api/v1/containers.py), this can cause real metadata loss on existing records instead of just initializing missing data. Initialize only when json_addl is None (or parse known legacy formats) to avoid destructive writes.
Useful? React with 👍 / 👎.
Summary
/save_json_addl_keyso hidden-section submits oneuid_detailsaccept empty JSON payloads and preserve intended HTTP errorsobj.json_addlwhen absent before writing intopropertiesorcontrolled_propertiesRoot Cause
The hidden-section editors on
/euid_detailspost through/save_json_addl_key. That route treated empty{}payloads as missing because it used truthiness checks, and it converted intendedHTTPExceptionresponses into generic 500s.Impact
Edit PropertiesandEdit Template Formsubmits now succeed for valid payloads and return honest errors when the target object is missing.Validation
source ./activate xxyyzz && python -m pytest --no-cov tests/test_gui_endpoints.py -k save_json_addl_keysource ./activate xxyyzz && python -m ruff check tests/test_gui_endpoints.py