feat(engine): implement prompt reader #81

Merged
fuzzy merged 3 commits from feature/0017-implement-prompt-reader into main 2026-07-05 13:53:15 +00:00
Owner

What

Implement prompt reader that reads prompt.md from job directories and raises JobError on missing/unreadable prompts.

Why

Foundation for job execution - the LLM client needs a prompt to process.

Testing

  • 44 unit tests pass (5 new for prompt reader)
  • Pre-commit hooks pass
  • Coverage: 76%

Breaking Changes

None.

Closes #0015
Closes #0016
Closes #0017

## What Implement prompt reader that reads `prompt.md` from job directories and raises `JobError` on missing/unreadable prompts. ## Why Foundation for job execution - the LLM client needs a prompt to process. ## Testing - [x] 44 unit tests pass (5 new for prompt reader) - [x] Pre-commit hooks pass - [x] Coverage: 76% ## Breaking Changes None. Closes #0015 Closes #0016 Closes #0017
Read prompt.md from job directories with proper error handling
for missing or unreadable files.
Closes #0015
Closes #0016
Cover successful reads, multiline content, missing prompt,
empty directory, and nonexistent path.
docs: mark Phase 2 Task 1 complete
All checks were successful
CI / test (pull_request) Successful in 52s
CI / lint (pull_request) Successful in 1m20s
3512fd48c5
Prompt reader with error handling for missing prompts done.
Closes #0017
the.auditor left a comment

Automated Review — PR #81

Result: APPROVED


Small, focused PR. The read_prompt() function is correct and well-tested.

  • Correctness: Existence check before read, JobError on missing/unreadable, proper encoding, exception chaining with from e.
  • Completeness: Closes #15–#17. ROADMAP updated.
  • Test coverage: 5 tests covering present, multiline, missing, and nonexistent paths.
  • Error handling: JobError for both missing file and OSError on read.

Suggestions (non-blocking)

  1. tests/unit/test_prompt.py:4-12 — Import style inconsistency. Path is imported under TYPE_CHECKING while the rest of the test suite (test_config.py, test_discovery.py) imports it at module level. Also, from kronai... imports placed after the TYPE_CHECKING block differs from the project convention (real imports first, TYPE_CHECKING last). Minor, but worth aligning.

  2. src/kronai/engine.py:32msg = f"Prompt file not found in {job_path}" includes the full path in the error message. Same path-leakage concern as issue #74 — consider using job_path.name if logging user-visible paths is a concern.

## Automated Review — PR #81 **Result: APPROVED** --- Small, focused PR. The `read_prompt()` function is correct and well-tested. - **Correctness**: Existence check before read, `JobError` on missing/unreadable, proper encoding, exception chaining with `from e`. - **Completeness**: Closes #15–#17. ROADMAP updated. - **Test coverage**: 5 tests covering present, multiline, missing, and nonexistent paths. - **Error handling**: `JobError` for both missing file and OSError on read. ### Suggestions (non-blocking) 1. **`tests/unit/test_prompt.py:4-12`** — Import style inconsistency. `Path` is imported under `TYPE_CHECKING` while the rest of the test suite (`test_config.py`, `test_discovery.py`) imports it at module level. Also, `from kronai...` imports placed after the `TYPE_CHECKING` block differs from the project convention (real imports first, TYPE_CHECKING last). Minor, but worth aligning. 2. **`src/kronai/engine.py:32`** — `msg = f"Prompt file not found in {job_path}"` includes the full path in the error message. Same path-leakage concern as issue #74 — consider using `job_path.name` if logging user-visible paths is a concern.
fuzzy merged commit 3512fd48c5 into main 2026-07-05 13:53:15 +00:00
fuzzy deleted branch feature/0017-implement-prompt-reader 2026-07-05 13:53:16 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/kronai!81
No description provided.