Commit e733c8f
fix: reject ambiguous --source/--track, clear index cache on throw
- ingest_knowledge: --track is repeatable but --source writes to exactly one
index, so taking args.tracks[0] let argument order silently decide the
destination. That combination is now an argparse error. The --source help
also claimed it "overrides --track" while --index-name documented the
default as the track index; rewritten so the precedence (--index-name, else
the single --track, else the default track) is stated once. Multiple --track
without --source is unaffected.
- moss-vscode: clearIndexCache() only ran in the else-branch, so a rebuild()
that threw after deleting the previous documents — from readFileForIndex()
or addDocs() — jumped to catch and left the on-disk cache describing
documents that no longer exist. Moved into a finally keyed on
indexer.isIndexed(), which the throw path cannot skip.
Verified: argparse across 6 invocations (multi-track rejected with exit 2,
single track honoured, --index-name precedence intact, multi-track still fine
without --source); and the try/catch/finally shape across cancelled, thrown
and successful runs — the throw path now clears, the success path still does
not.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent a6d31ec commit e733c8f
2 files changed
Lines changed: 26 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
247 | 251 | | |
248 | 252 | | |
249 | 253 | | |
| |||
263 | 267 | | |
264 | 268 | | |
265 | 269 | | |
266 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
267 | 279 | | |
268 | 280 | | |
269 | 281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | 504 | | |
513 | 505 | | |
514 | 506 | | |
| |||
519 | 511 | | |
520 | 512 | | |
521 | 513 | | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
522 | 526 | | |
523 | 527 | | |
524 | 528 | | |
| |||
0 commit comments