Skip to content

Use git-discovered repo root for Rust xtask repo-level checks #546

Description

@flyingrobots

Summary

Several Wesley Rust xtask repo-level checks derive their root from std::env::current_dir() / env::current_dir(). Move repo-root discovery to a shared Rust helper backed by git rev-parse --show-toplevel, and reserve cwd for behavior that intentionally means invocation directory.

Problem

env::current_dir() is not a repository-root contract. Release checks, docs checks, manifest checks, and other repo-level guards become brittle when invoked from a subdirectory, an IDE runner, an agent harness, or a nested workspace command.

Wesley already uses Git root discovery in some code paths, such as schema diff path handling. The missing piece is consolidating repo-level xtask checks onto the same posture.

Evidence

Current scan found env::current_dir() repo-root-style uses in xtask/src/main.rs, including release manifest checks, required-file checks, backlog checks, docs checks, node-retirement ledger checks, docs truth checks, and forbidden-literal checks. Wesley CLI also has a Git-root helper for schema diff (git rev-parse --show-toplevel), which is the preferred shape for repo-root semantics.

Desired Outcome

  • Repo-level Rust xtask checks resolve the checkout root with Git discovery.
  • Cwd remains injectable/explicit only where invocation directory semantics are intended.
  • Checks can be run from nested directories without misreading paths relative to the nested cwd.
  • Failure outside a Git checkout is explicit and actionable.

Acceptance Criteria

  • A regression test or command witness proves a representative repo-level xtask check works when invoked from a nested directory.
  • xtask has one shared repo-root discovery boundary for repo-level checks.
  • Existing root-invocation behavior remains unchanged.
  • Crate-local tests using CARGO_MANIFEST_DIR are left alone unless they are actually asserting repo-root semantics.

Related Local Backlog

Wesley already has local ambient runtime-environment debt documented in docs/method/backlog/bad-code/RUNTIME_cli-runtime-environment-port.md; this issue is the narrower Rust repo-root slice.

Activity

  1. coderabbitai commented on Jun 3, 2026

    @coderabbitai
    🔗 Related PRs

    #369 - fix(holmes): make CLI tests deterministic by disabling git activity [merged]
    #497 - chore(release): v0.0.1 [merged]
    #521 - Add Rust IR performance baseline [merged]
    #526 - feat: add rust-native doctor command [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. added
    triage:bad-codeDebt intake that still needs scheduling, closure, or a repo move
    on Jun 24, 2026
  3. flyingrobots commented on Jun 25, 2026

    @flyingrobots
    OwnerAuthor

    Triage decision: keep this in Wesley and move it out of the inbox into lane:v0.4.0 / Goalpost: Make It Boring.

    Rationale: Git-discovered repo-root handling makes xtask checks invocation-stable and belongs in platform boring-work.

    This is scheduled core Wesley work now, not an inbox item. The triage label is being removed as part of this state change.

  4. added
    v0.4.0Scheduled work for the v0.4.0 release.
    and removed
    triage:bad-codeDebt intake that still needs scheduling, closure, or a repo move
    on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    legend:PLATFORMPlatform/infrastructure workv0.4.0Scheduled work for the v0.4.0 release.

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions