Skip to content

feat: validate input image before creating output dirs#6

Merged
rasros merged 1 commit into
mainfrom
feat/validate-image-early
Jul 10, 2026
Merged

feat: validate input image before creating output dirs#6
rasros merged 1 commit into
mainfrom
feat/validate-image-early

Conversation

@rasros

@rasros rasros commented Jul 10, 2026

Copy link
Copy Markdown
Owner

What

Previously run_vector_search called storage.initialize() (which creates the <name>/runs/<timestamp>/nodes/ output tree) before loading the reference image. A missing or corrupt input therefore left an empty project directory behind on every failed invocation.

Now the image is loaded and validated first; storage.initialize() only runs once the input is known-good. On failure, nothing is written to disk.

_load_image is also hardened to distinguish the two failure modes:

  • missing path → FileNotFoundError (rendered by main.py as Error: input image not found: <path>)
  • exists but not decodable → ValueError: input image could not be read as an image: <path> (...) (rendered as a clean Error: line)

Together with PR #5 this closes the missing-image handling: clean message and no stray directories.

Tests

Added two fast tests (no LLM/workers reached, so unmarked) asserting a missing path raises FileNotFoundError and a corrupt file raises ValueError, and that in both cases storage.project_dir is never created. Full suite: 363 passed.

@rasros rasros merged commit 1975eee into main Jul 10, 2026
1 check passed
@rasros rasros deleted the feat/validate-image-early branch July 10, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant