Commit 18dd708
committed
fix(feedback): address 3 self-review findings
1. **webbrowser.open return value silently dropped on headless boxes**
The command printed "Opening GitHub in your browser..." and exited 0
even when webbrowser.open returned False (no GUI, no $BROWSER, CI
runner, container without DISPLAY). Now we capture the return value,
surface "no browser available — copy the URL above" to stderr, and
only print "Opened GitHub in your browser." after a confirmed True
return.
2. **_openkb_version was the third copy of the same logic**
openkb/__init__.py exports __version__ via importlib.metadata with
fallback "0.0.0+unknown"; openkb/agent/chat.py wraps it as
_openkb_version(); cli.py was re-implementing it with fallback
"unknown" — already drifted. Replaced with the same one-liner used
in chat.py: `from openkb import __version__; return __version__`.
Now all three call sites agree.
3. **type prompt hung in non-TTY contexts (regression of PR #48)**
PR #48 introduced _stdin_is_tty() specifically because adding a
prompt without a TTY check broke automation pipelines. PR #53's
second prompt (asking for feedback type) repeated the same pattern.
Now it skips the prompt when stdin isn't a TTY and falls through to
`--type other`. Pipes / CI work without flags now:
echo "..." | openkb feedback "msg" # works, type=other, no label
4 new regression tests:
- test_feedback_skips_type_prompt_when_stdin_is_not_a_tty
- test_feedback_warns_when_webbrowser_open_returns_false
- test_feedback_confirms_when_webbrowser_open_succeeds
- test_openkb_version_helper_matches_package_version
331 tests pass (327 prior + 4 new).1 parent 9ca0270 commit 18dd708
2 files changed
Lines changed: 100 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1150 | 1150 | | |
1151 | 1151 | | |
1152 | 1152 | | |
1153 | | - | |
1154 | | - | |
1155 | | - | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
1156 | 1159 | | |
1157 | | - | |
1158 | | - | |
1159 | | - | |
1160 | | - | |
1161 | | - | |
| 1160 | + | |
| 1161 | + | |
1162 | 1162 | | |
1163 | 1163 | | |
1164 | 1164 | | |
| |||
1253 | 1253 | | |
1254 | 1254 | | |
1255 | 1255 | | |
1256 | | - | |
1257 | | - | |
1258 | | - | |
1259 | | - | |
1260 | | - | |
1261 | | - | |
1262 | | - | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
1263 | 1270 | | |
1264 | 1271 | | |
1265 | 1272 | | |
| |||
1268 | 1275 | | |
1269 | 1276 | | |
1270 | 1277 | | |
1271 | | - | |
1272 | | - | |
| 1278 | + | |
1273 | 1279 | | |
1274 | 1280 | | |
1275 | 1281 | | |
1276 | 1282 | | |
1277 | | - | |
| 1283 | + | |
1278 | 1284 | | |
1279 | 1285 | | |
1280 | 1286 | | |
1281 | 1287 | | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
| 199 | + | |
199 | 200 | | |
200 | 201 | | |
201 | 202 | | |
| |||
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
0 commit comments