Commit 406d589
fix(accent): address Copilot review feedback (refs #52)
Tighten the no-behavior-change refactor based on Copilot's review on
PR #52.
Active findings:
- pipeline.py: rename unused `ojad_surface` to `_ojad_surface` so F841
catches it if Ruff's unused-binding rule ever lands; the OJAD echo
string isn't consumed here.
- furigana.py: wrap `response.json()` in try/except. The docstring
promised malformed payloads would surface via the FuriganaResponse
envelope, but an invalid Content-Type / non-JSON body would have
raised through. Catch ValueError and return a 500 envelope.
- ojad.py: switch `raise e` -> bare `raise` and `logger.error(f"...")`
-> `logger.exception(...)` to preserve the original traceback.
- models.py: "describe" -> "describes" (x3 occurrences); "givent"
-> "given".
Low-confidence findings also addressed:
- align.py module docstring used to claim `punctuation_marks`,
`skip_marks`, and `clean_query` are consumed by alignment. They
aren't — they're carried over from the pre-refactor module for the
downstream PR #47 to use. Reword to reflect that.
- clean_query docstring overclaimed punctuation stripping; it only
filters ASCII letters. Reword + rename the local comprehension var
from `chr` to `char` to stop shadowing the builtin.
Verified:
uv run ruff check api/accent/ main.py # all passed
uv run ruff format --check api/accent/ main.py # 8/8 formatted
uv run mypy api/accent/ main.py # 8 files, no issues
POST /api/MarkAccent/ + /MarkFurigana/ routes still register
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent e625782 commit 406d589
5 files changed
Lines changed: 27 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
108 | | - | |
109 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
110 | 114 | | |
111 | | - | |
| 115 | + | |
112 | 116 | | |
113 | 117 | | |
114 | 118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
66 | 74 | | |
67 | 75 | | |
68 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
55 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
0 commit comments