server: config save/content endpoints convert OSError and UnicodeDecodeError into raw 500s; inconsistent missing-file semantics (400/404/200)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Read the config endpoints in routes/config.py at the cited locations for /load, /reload, /content, /save, and /save-as, then check the ValidationIssue[] contract in client.ts:36-54. Trace the read, decode, and write failures alongside the existing status responses. Done means the endpoints handle these failures consistently and the validation response shape follows the documented contract; the issue leaves the exact error status choice open.
由索引模型根据 Issue 内容生成。
描述
Problem
Error handling across the config endpoints is inconsistent and leaks tracebacks:
save_config_endpoint:on_disk_hash = content_hash(config_path.read_text(encoding="utf-8"))(routes/config.py:458) — raisesUnicodeDecodeError/OSError→ unhandled 500 before the staleness guard can answer 409.write_text_atomic(config_path, payload.content)(config.py:471) raisesOSErroron read-only target/full disk → raw 500 traceback instead of an actionable 4xx; same insave_as_config_endpoint(config.py:540).GET /content'sconfig_path.read_text(encoding="utf-8")(config.py:405) 500s on non-UTF-8 files.- Missing-file semantics for the same situation differ per endpoint:
/load→ 400 (config.py:171),/content→ 404 (config.py:400-403),/reload→ 200{"reloaded": false}(config.py:337-339). - Validation-failure shape is heterogeneous:
/saveand/save-asput the issue list indetail(HTTPException(400, detail=issues)) while every other 4xx uses a string, and/validatereturns the same data as a 200 body — three shapes for one concern (the client compensates inapiError(),client.ts:36-54).
Suggested fix
- Wrap the write/read calls in
try/except OSError as e: raise HTTPException(422 or 500-with-detail, f"Cannot write configuration file: {e}"). - Pick one missing-file status (404) for all three endpoints.
- Keep the list-detail 400s but document them in one place (they are already the
ValidationIssue[]contract inclient.ts).
- 主要语言
- Python
- 星标
- 1
- 派生
- 1
- 平均合并
- 4 小时 46 分钟
- 30 天内合并 PR
- 55
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
falbany/ProFiles 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
falbany/ProFiles#187 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug frontend
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug frontend
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
bug frontend
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
相似的 Issue
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 86/100
aws-samples/sample-spec-driven-presentation-maker#648 ·
维护者通常 1 天内回复
-
firestore: enable live window.yaml pipeline system tests once add_window_fields is in production未关闭
难度 1/5 1 小时以内 新手友好度 64/100
googleapis/google-cloud-python#19115 ·
维护者通常 2 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复