Skip to content

feat(rev-list): add rev-list command#347

Open
marshawcoco wants to merge 24 commits intoweb3infra-foundation:mainfrom
marshawcoco:feat/rev-list
Open

feat(rev-list): add rev-list command#347
marshawcoco wants to merge 24 commits intoweb3infra-foundation:mainfrom
marshawcoco:feat/rev-list

Conversation

@marshawcoco
Copy link
Copy Markdown
Contributor

@marshawcoco marshawcoco commented Apr 9, 2026

Summary

  • add a new libra rev-list [SPEC] command and wire it into the CLI
  • resolve the target revision with existing revision parsing and list all reachable commits in reverse committer-timestamp order
  • support human, --json, --machine, and --quiet output modes, plus focused integration coverage for the new command

Test plan

  • cargo +nightly fmt --all
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test (deferred to Linux/server environment)

🤖 Generated with Claude Code

marshawcoco and others added 18 commits March 31, 2026 17:22
Add bisect module that uses binary search to find the commit that
introduced a bug between a known "good" and "bad" state.

Features:
- bisect start [--bad <rev>] [--good <rev>] - initialize session
- bisect bad [<rev>] - mark commit as containing the bug
- bisect good [<rev>] - mark commit as working correctly
- bisect reset [<rev>] - end session and restore original HEAD
- bisect skip [<rev>] - skip untestable commits
- bisect log - show current bisect state

Also fixes SQLite connection string parsing on Windows by normalizing
paths with \?\ prefix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…arnings

- Use restore::restore_to_file in bisect checkout to properly handle LFS pointers
- Make restore_to_file public in restore.rs for reuse
- Fix clippy manual_strip lint by using strip_prefix instead of slicing
- Add #[cfg(unix)] to platform-specific imports to resolve unused warnings
- Fix unused variable in bisect_test.rs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add rev-parse with CLI and integration coverage, and include Windows-focused test/runtime fixes needed to keep the command workflow stable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Stabilize Windows CI-related tests by normalizing orchestrator paths, avoiding the unimplemented Windows sandbox, and relaxing symlink-sensitive fixtures. Also fix local MCP DB path setup and test helpers that depend on HOME/USERPROFILE overrides.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Complete rev-parse integration with stable error handling and non-ambiguous short hash resolution, and make Windows task worktrees fall back to copying .libra storage when symlink privileges are unavailable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix the remaining workspace storage helper references, make rev-parse --abbrev-ref HEAD return structured errors on HEAD lookup failures, restore the Windows restricted sandbox default, and update the README command support table.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Use fallible branch lookups in rev-parse abbrev-ref resolution so branch storage failures surface as structured fatal errors, and gate the Windows storage copy helper to Windows and test builds to keep clippy clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Use an explicit repo database path for cloud env resolution so local config still loads after tests or callers change the process cwd.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add the missing cfg-gated test imports and align the cloud/config changes with rustfmt so the command_test target builds cleanly in CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update the D1 global config error assertion to match the current config resolution wrapper while remaining compatible with adjacent connection-style messages.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Build tag command test repositories through the direct add/commit helpers instead of parse_async so the force-tag cases start from a reliably committed repo.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add a minimal rev-list implementation that resolves a single revision, walks reachable commits, and supports json/machine/quiet output for CLI automation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e7244ef349

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Guard rev-parse and rev-list before resolving revisions so they return the standard repo-not-found CLI error instead of leaking lower-level failures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marshawcoco marshawcoco changed the title feat: add rev-list command feat(rev-list): add rev-list command Apr 9, 2026
@genedna genedna requested a review from Copilot April 9, 2026 06:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Git-compatible revision inspection commands to Libra’s CLI (rev-parse, rev-list) and expands integration coverage, while also refactoring config/env resolution and improving Windows portability in AI workspace + path handling.

Changes:

  • Add libra rev-parse and libra rev-list commands and wire them into the CLI dispatch.
  • Add new integration tests for rev-parse and rev-list; refactor some existing command tests to use shared helpers.
  • Refactor config DB lookups for env resolution and harden Windows behavior for AI worktrees/snapshots and path rendering.

Reviewed changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/command/tag_test.rs Adjust imports (unix cfg) for test utilities.
tests/command/show_ref_test.rs Switch to shared run_libra_command helper for invoking the binary.
tests/command/rev_parse_test.rs New integration tests for rev-parse output modes and error codes.
tests/command/rev_list_test.rs New integration tests for rev-list behavior and output modes.
tests/command/reset_test.rs Import cleanup / cfg adjustments.
tests/command/mod.rs Registers new integration test modules; adds dead_code allowances for stdin helpers.
tests/command/fetch_test.rs Import cleanup for PathBuf usage.
tests/command/branch_test.rs Import cleanup (but currently breaks compilation; see comment).
src/utils/d1_client.rs Test expectation broadened for updated config DB error wording.
src/internal/tui/diff.rs Make path-display tests platform-neutral (avoid hard-coded /workspace/...).
src/internal/config.rs Extract resolve_env_for_target and consolidate local/global config DB reads.
src/internal/ai/workspace_snapshot.rs Make symlink-based test resilient on Windows without symlink privilege.
src/internal/ai/tools/utils.rs Make path validation tests use temp dirs instead of fixed absolute paths.
src/internal/ai/orchestrator/workspace.rs Add Windows symlink privilege fallback for populating repo storage; update tests accordingly.
src/internal/ai/orchestrator/policy.rs Normalize rendered paths (currently done unconditionally; see comment).
src/internal/ai/orchestrator/executor.rs Minor test assertion ordering tweak.
src/internal/ai/claudecode/common.rs Remove Windows-specific DB path string rewriting before connecting.
src/command/tag.rs Refactor test setup to use internal helpers, but currently swallows failures (see comment).
src/command/rev_parse.rs New rev-parse implementation with JSON/machine/quiet support.
src/command/rev_list.rs New rev-list implementation using reachable commits and timestamp sorting.
src/command/mod.rs Export new command modules.
src/command/fetch.rs More robust home dir resolution for vault tmp dir creation.
src/command/cloud.rs Allow resolving config/env using an explicit local DB path to avoid cwd drift.
src/cli.rs Register new CLI subcommands and dispatch to their execute_safe.
README.md Update “pending commands” list (but still lists rev-list; see comment).
.claude-ci-test.log Adds a large local test log artifact (should not be committed; see comment).

marshawcoco and others added 2 commits April 9, 2026 14:39
Tighten path rendering semantics on Unix, make tag test setup fail fast, remove the committed CI log artifact, and update the README command list to match rev-list support.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Re-add the branch test fs import behind cfg(unix) so the permission-based assertions compile without introducing unused imports on other platforms.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9445867d74

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9445867d74

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Bind explicit-db local secret decryption to the target repository instead of cwd state, and cover cloud config resolution with encrypted values after cwd drift.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5cfec2f2a6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Preserve explicit-db secret decryption for legacy repos and reject ignored SPEC input for --show-toplevel so the remaining review regressions are covered.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e48859731b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Prevent rev-parse from silently ignoring --short when paired with abbrev-ref or show-toplevel by making those clap options mutually exclusive.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@genedna
Copy link
Copy Markdown
Member

genedna commented Apr 10, 2026

请把你提的两个 PR 合并为一个,先提一个小 PR ,把 处理 working dir 和 tmp dir 的部分先修复。然后再提一个 PR 实现两个命令。

@marshawcoco
Copy link
Copy Markdown
Contributor Author

Per review, I split this work into a smaller prerequisite PR and a follow-up command PR. The working-dir/tmp-dir fixes are now in #348. I'll retarget or reopen the command-only PR after #348 lands so the revision command changes stay isolated.

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.

3 participants