Skip to content

feat: Phase 2.7 quality improvements#14

Merged
TrekMax merged 8 commits into
mainfrom
improve/doc-error-ci-concurrency
Apr 11, 2026
Merged

feat: Phase 2.7 quality improvements#14
TrekMax merged 8 commits into
mainfrom
improve/doc-error-ci-concurrency

Conversation

@TrekMax

@TrekMax TrekMax commented Apr 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • Doc-tests: Add runnable examples to core public APIs across 6 crates (1 → 9 doc-tests)
  • Unified diagnostics: Derive miette::Diagnostic on VcsError with actionable help hints, completing the miette migration
  • CI coverage: Add cargo-llvm-cov + Codecov upload job to CI workflow
  • Configurable concurrency: east update reads update.jobs from config instead of hardcoded Semaphore(8), set via east config set --int update.jobs N
  • Docs: Phase 2.7 dev notes (EN + zh-CN), README status update, fix unnatural Chinese wording

Test plan

  • cargo test --workspace — all ~164 tests pass (including 9 new doc-tests)
  • cargo clippy --workspace — zero warnings
  • Verify Codecov integration after merge to main

Tianshuang Ke added 6 commits April 11, 2026 14:04
Add runnable examples to ConfigValue, ConfigStore, Remote, Project,
Manifest::from_yaml_str, Workspace, Git, and CommandRegistry.
Doc-tests go from 1 to 9 across the workspace.
Add miette dependency to east-vcs and derive Diagnostic on VcsError
with actionable help hints. Completes the miette migration started
in Phase 2.5 — all library crates now produce rich diagnostics.
Add a coverage job using cargo-llvm-cov to generate LCOV output
and upload to Codecov. Upload failures do not block CI.
Read update.jobs from the layered config to control the max number
of concurrent git operations in east update. Falls back to 8 if
not set. Users configure it with: east config set --int update.jobs N
Add phase-2.7.md and phase-2.7.zh-CN.md covering doc-tests, miette
unification, CI coverage, and configurable concurrency. Bump README
status to Phase 2.7.
Replace "住在" (literal translation of "lives in") with "存放于",
and "钳位" with "限制为最小" for more natural technical Chinese.
Copilot AI review requested due to automatic review settings April 11, 2026 06:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Phase 2.7 quality improvements across the Rust workspace: expands doc-test coverage for core public APIs, completes miette diagnostics adoption for east-vcs, adds CI coverage reporting, and makes east update concurrency configurable, with accompanying documentation/README updates.

Changes:

  • Add runnable doc examples (doctests) to core public APIs across multiple crates.
  • Derive miette::Diagnostic for east-vcs::VcsError and add actionable help hints.
  • Add a CI coverage job using cargo-llvm-cov and Codecov; make east update read update.jobs from config.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
README.md Updates status to Phase 2.7 and adds a Phase 2.7 bullet.
README.zh-CN.md Updates status to Phase 2.7 and refines Phase wording in zh-CN.
docs/dev/phase-2.7.md Adds Phase 2.7 development notes (EN).
docs/dev/phase-2.7.zh-CN.md Adds Phase 2.7 development notes (zh-CN).
docs/dev/phase-2.6.zh-CN.md Wording refinement (zh-CN).
docs/design/phase-2.6.zh-CN.md Wording refinement (zh-CN).
crates/east-workspace/src/workspace.rs Adds a Workspace doc example/doctest.
crates/east-vcs/src/git.rs Adds a Git doc example/doctest.
crates/east-vcs/src/error.rs Migrates VcsError to miette::Diagnostic + help hints.
crates/east-vcs/Cargo.toml Adds miette dependency via workspace.
crates/east-manifest/src/model.rs Adds doc examples for Remote, Project, and Manifest::from_yaml_str.
crates/east-config/src/value.rs Adds ConfigValue doc example/doctest.
crates/east-config/src/store.rs Adds ConfigStore doc examples/doctests.
crates/east-command/src/registry.rs Adds CommandRegistry::from_manifest doc example/doctest.
crates/east-cli/src/main.rs Reads update.jobs from config to set update concurrency.
.github/workflows/ci.yml Adds coverage job (llvm-cov + Codecov upload).
Cargo.lock Records miette dependency for east-vcs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

/// let sha = Git::head(Path::new("./repo")).await?;
/// let dirty = Git::is_dirty(Path::new("./repo")).await?;
/// # Ok(())
/// # }

Copilot AI Apr 11, 2026

Copy link

Choose a reason for hiding this comment

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

The doc example starts a fenced Rust code block (no_run) but never closes it with a terminating line. This can break rustdoc rendering and may prevent the snippet from being recognized as a doctest; add the closing fence before pub struct Git;.

Suggested change
/// # }
/// # }
/// ```

Copilot uses AI. Check for mistakes.
Comment thread crates/east-vcs/src/error.rs Outdated
pub enum VcsError {
/// A git command failed with a non-zero exit code.
#[error("git command failed in {path}: {stderr}")]
#[error("git command failed in {path}")]

Copilot AI Apr 11, 2026

Copy link

Choose a reason for hiding this comment

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

VcsError::GitFailed no longer includes the git stderr in its Display message. The CLI formats failures with {e}, so this change will hide the most useful debugging context (e.g., auth failures, missing refs); consider including stderr (possibly trimmed/truncated) in the error text or otherwise ensuring it’s surfaced in user-facing output.

Suggested change
#[error("git command failed in {path}")]
#[error("git command failed in {path}: {stderr}")]

Copilot uses AI. Check for mistakes.
Comment thread crates/east-vcs/src/error.rs Outdated
Comment on lines +11 to +17
#[error("git command failed in {path}")]
#[diagnostic(help("check that the repository exists and the revision is valid"))]
GitFailed {
/// Working directory or target path.
path: PathBuf,
/// The stderr output from git.
#[source_code]

Copilot AI Apr 11, 2026

Copy link

Choose a reason for hiding this comment

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

#[source_code] is intended for source text that can be spanned/labeled in miette reports; using it for arbitrary git stderr is unusual and (without labels) may not display anything useful. Consider removing #[source_code] here, or switching to a more appropriate diagnostic field/format (e.g., keep stderr in the main error message or attach it as a note/help).

Suggested change
#[error("git command failed in {path}")]
#[diagnostic(help("check that the repository exists and the revision is valid"))]
GitFailed {
/// Working directory or target path.
path: PathBuf,
/// The stderr output from git.
#[source_code]
#[error("git command failed in {path}: {stderr}")]
#[diagnostic(help("check that the repository exists and the revision is valid"))]
GitFailed {
/// Working directory or target path.
path: PathBuf,
/// The stderr output from git.

Copilot uses AI. Check for mistakes.
Comment thread crates/east-cli/src/main.rs Outdated
let cfg = Config::load_with_provider(&provider).into_diagnostic()?;
cfg.get("update.jobs")
.and_then(|v| v.as_i64())
.map_or(DEFAULT_CONCURRENT_GIT, |n| n.max(1) as usize)

Copilot AI Apr 11, 2026

Copy link

Choose a reason for hiding this comment

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

n.max(1) as usize will silently truncate/wrap for very large update.jobs values (and would behave differently on 32-bit targets). Prefer converting with usize::try_from(n) and clamping/saturating on overflow so invalid config values don’t yield surprising semaphore sizes.

Suggested change
.map_or(DEFAULT_CONCURRENT_GIT, |n| n.max(1) as usize)
.map_or(DEFAULT_CONCURRENT_GIT, |n| {
let n = n.max(1);
usize::try_from(n).unwrap_or(usize::MAX)
})

Copilot uses AI. Check for mistakes.
Tianshuang Ke added 2 commits April 11, 2026 14:22
- Close doc-test fenced code block on Git struct
- Restore stderr in VcsError::GitFailed display message and remove
  incorrect #[source_code] attribute
- Use usize::try_from instead of bare `as usize` cast for update.jobs
  to avoid silent truncation on 32-bit targets
Fixes clippy::redundant_closure_for_method_calls under pedantic.
@TrekMax TrekMax merged commit c7d6027 into main Apr 11, 2026
9 checks passed
@TrekMax TrekMax deleted the improve/doc-error-ci-concurrency branch April 11, 2026 06:28
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.

2 participants