Handle UnbornBranch error for repos with no commits#148
Open
strix-tkellogg wants to merge 8 commits into
Open
Conversation
Add a `dura status` subcommand that shows daemon liveness and lists watched repositories, addressing issue #94. Features: - Shows whether `dura serve` is running with PID - Lists all watched repositories from config - Displays config file and cache directory paths - `--json` flag for machine-readable output - Exit code 0 when running, 1 when not running - Cross-platform PID liveness check via sysinfo crate Changes: - Cargo.toml: add sysinfo dependency - src/database.rs: add RuntimeLock::is_alive() with sysinfo-based process detection (replaces need for platform-specific code) - src/main.rs: add status subcommand, --json flag, status() handler - tests/status_test.rs: 6 integration tests covering all scenarios - tests/util/dura.rs: add run_output() helper for capturing full output Closes #94
When a repository has been initialized but has no commits yet, repo.head() returns ErrorCode::UnbornBranch. Previously this propagated as an error, causing noisy log spam every poll cycle. Now capture() handles unborn branches by: - Using "dura/unborn" as the branch name - Diffing against an empty tree (all files are new) - Creating the initial commit with no parents - Transitioning to normal branch naming once the user commits Also removes a leftover dbg!() macro from poll_guard.rs that printed to stderr on every change detection. Fixes #128 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- actions/checkout@v3 → v4 - actions/upload-artifact@v3 → v4 - actions-rs/toolchain@v1 → dtolnay/rust-toolchain@stable (actions-rs is archived) - actions-rs/cargo@v1 → direct cargo commands (actions-rs is archived) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Allow dead_code on Stats struct (log.rs) - Use next_back() instead of last() on DoubleEndedIterator (metrics.rs) - Use is_some_and() instead of map_or(false, ...) (snapshots.rs) - Add explicit lifetime annotation on GitRepoIter return (config.rs)
- non_minimal_cfg: #[cfg(all(unix))] → #[cfg(unix)] - needless_borrow: remove & from default_value arg - redundant_closure: unwrap_or_else(|| fn()) → unwrap_or_else(fn) - iter_kv_map: .iter().map(|(k,_)|...) → .keys().map(|k|...) - for_kv_map: for (k, _) in &map → for k in map.keys()
ntapi 0.3.6 has misaligned references to packed struct fields (E0793) which Rust 1.94 now rejects as a hard error. The 0.3.7 release fixes this. Transitive dep via tokio → mio 0.7.14. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ntapi 0.3.7 still had E0793 (misaligned packed struct references). Updating tokio pulls mio 0.8 which drops the ntapi 0.3.x dependency entirely, leaving only ntapi 0.4.3 which compiles clean. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
repo.head()returnsErrorCode::UnbornBranchfor repos with no commits, causing error spam every poll cyclecapture()now handles unborn branches: usesdura/unbornbranch name, diffs against empty tree, commits with no parentsdura/{head_id}branch namingdbg!()macro frompoll_guard.rsthat printed to stderr on every change detectionTest plan
unborn_branch_first_capture— verifies capture succeeds on init-only repounborn_branch_subsequent_capture— verifies incremental captures with no user commitsunborn_branch_transitions_to_normal— verifies switch fromdura/unbornto normal naming after first commitcargo new foo && dura serve— check thatfoono longer produces error log entries🤖 Generated with Claude Code