Skip to content

[Agent tooling] worktree_guard follow-ups from the PR #1851 review: submodule fixture, path flavour, strict expectations, ADR note #1855

Description

@Chris0Jeky

Residuals from the PR #1851 review (worktree_guard substance validation, #1833):

  1. Substance check 1 (linked-worktree gitdir containment) has no failing test. Deleting the whole case "$_wt_gitdir" in "$_wt_worktrees_dir"/* block leaves the suite green (35/35) — every rejected fixture is caught by check 2 alone. The isolating case exists: a git submodule work tree has a .git pointer file resolving exactly to its own git dir, so only check 1 rejects it. Add a submodule fixture so the check has a test that can fail.
  2. WT_GIT_DIR is exported in MSYS flavour (/c/...) while WT_REPO_ROOT is Windows flavour (C:/...) in the sh guard under Git for Windows (also visible in the FATAL diagnostic). Nothing consumes WT_GIT_DIR today; it is a trap for the first consumer that hands it to a native Windows tool. Normalize or document.
  3. Contradictory HEAD expectations resolve silently. WT_EXPECT_HEAD=detached + WT_EXPECT_BRANCH=foo (and the ps1 equivalents) ignores the branch instead of erroring. A setup-error exit (2) would be more fail-closed.
  4. expect_sh_output asserts only the NOTE substring, never the exit code — a guard that printed the NOTE then failed would still pass that case. Cheap to tighten.
  5. Test-harness robustness: if both mktemp -d forms fail, FIXTURE_ROOT is empty and fixtures land at /primary, /bare.git, ... Guard the mktemp result.
  6. docs/WORKTREE_AGENT_PROTOCOL.md:14 is stale — "Other roots are allowed only when the coordinator explicitly names them and updates guard configuration" no longer matches the substance-validated guard. (Coordinator docs sweep may fix this line first; keep the box here until it lands.)
  7. Consider a short ADR recording the boundary change (path-shape markers demoted to advisory; substance validation now the gate). Repo CLAUDE.md names automation safety boundaries as ADR triggers; the net effect is strictly stronger, which is why PR fix(worktree): validate worktree guards by substance, not path shape #1851 shipped without one.

Source: PR #1851 fresh-context review (non-blocking items 1–7). None merge-relevant.

Activity

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

    Priority IIIValuable but unscheduled: residuals, tech-debt, performance, depth work.hardeningReliability, safety, operability, and production-readiness improvements.tech-debtDebt cleanup or deferred engineering quality work with limited product-surface change.testingTest coverage, harnesses, regression prevention, and verification pipeline work.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions