Skip to content

Add tempfile and improve git error handling - #38

Merged
MikeGarde merged 2 commits into
mainfrom
fix/37-pr-git-error
Aug 14, 2026
Merged

Add tempfile and improve git error handling#38
MikeGarde merged 2 commits into
mainfrom
fix/37-pr-git-error

Conversation

@MikeGarde

Copy link
Copy Markdown
Owner
  • Add tempfile as a dev-dependency in Cargo.toml to enable temporary file handling in tests
  • Update Cargo.lock to lock tempfile and its transitive dependencies for reproducible CI
  • Improve src/git.rs error handling to include git's stderr when present, falling back to exit status if not
  • Make staged_diff_for_file robust when run from subdirectories by anchoring the pathspec to the repo root with :/path; document this behavior
  • Extend tests/git.rs with a focused test for staged_diff_for_file and staged_files from a subdirectory; add helper repo_with_staged_nested_file to create a temp repo with a nested staged change
  • Update imports in tests to include staged_diff_for_file and staged_files to exercise staging-related functionality

- Add `tempfile` as a dev-dependency in `Cargo.toml` to enable temporary file handling in tests
- Update `Cargo.lock` to lock `tempfile` and its transitive dependencies for reproducible CI
- Improve `src/git.rs` error handling to include git's `stderr` when present, falling back to exit status if not
- Make `staged_diff_for_file` robust when run from subdirectories by anchoring the pathspec to the repo root with `:/path`; document this behavior
- Extend `tests/git.rs` with a focused test for `staged_diff_for_file` and `staged_files` from a subdirectory; add helper `repo_with_staged_nested_file` to create a temp repo with a nested staged change
- Update imports in tests to include `staged_diff_for_file` and `staged_files` to exercise staging-related functionality
- devops/render-release-notes.sh: Extend release notes to cover Amazon Linux (musl) installation with a dedicated section and a one-shot install command that downloads the linux-musl tarball for the current architecture and installs to /usr/local/bin.
- devops/render-release-notes.sh: Acknowledge the need for a musl-compatible build and document a curl | tar approach for easy installation on Amazon Linux.
- src/config.rs: Add request_timeout_secs with default 90s across default, file, repo, and environment sources; extend Config and FileConfig to store and propagate the new timeout.
- src/config.rs: Introduce u64-based resolution paths (get_u64, file_u64, env_u64) to align with existing numeric config handling.
- src/config.rs: Ensure proper precedence and log the decision source (Hardcoded/FileDefault/FileRepo/Env) when resolving the timeout.
- src/llm/ollama.rs: Add configurable HTTP timeout and latency timing for Ollama requests; include explicit request/response timing logs for streaming and non-streaming paths.
- src/llm/ollama.rs: Skip real Ollama /api/tags validation to reduce network dependency; defer model listing to a separate command.
- src/llm/ollama.rs: Update tests to reflect the new timeout parameter and adjusted tags behavior for compatibility.
- src/llm/openai.rs: Add configurable HTTP timeout via timeout_secs to OpenAiClient::new, replacing the hard-coded 90s timeout.
- src/llm/openai.rs: Add timing instrumentation to log non-stream OpenAI response times and total streaming response time for observability.
- src/llm/openai.rs: Update tests to pass the new timeout parameter when constructing the client.
- src/main.rs: Instrument performance timing around file summarization, commit message generation, and PR message generation; expose elapsed durations in user-visible output.
- src/main.rs: Apply minor formatting/bracing/whitespace adjustments with no functional impact.
- src/setup.rs: Wire cfg.request_timeout_secs through to OpenAiClient and OllamaClient constructors; include timeout value in debug logs for both providers.
Token usage: prompt=4924, completion=5829, total=10753
@MikeGarde
MikeGarde merged commit 7079ffd into main Aug 14, 2026
3 checks passed
@MikeGarde
MikeGarde deleted the fix/37-pr-git-error branch August 14, 2026 13:09
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