Skip to content

Do not report a changed worktree when there was no checkout to compare - #283

Closed
FredApps wants to merge 3 commits into
DiffCI:mainfrom
FredApps:fix/no-checkout-not-interference
Closed

FredApps wants to merge 3 commits into
DiffCI:mainfrom
FredApps:fix/no-checkout-not-interference

Conversation

@FredApps

@FredApps FredApps commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #278

When the observed path is not a git checkout, observe() refuses with no non-interference evidence and worktreeUnchanged: false. Three places read that as "the working tree changed - report this":

  • the console line (cli.ts)
  • the job summary (job-summary.ts)
  • the Action's PR comment (action/impact.mjs)

With the Action this happens on any job that checks out with path: and keeps the default repository-path.

Change

  • A new worktreeChangeSuspected(evidence) in report.ts returns true only when a before/after pair differs or captured evidence goes missing. With no evidence at all there was nothing to change. impact.mjs gets the same check inline, because it ships without dependencies.

  • The console line now says worktree not a git checkout, nothing to compare in that case. The job summary and the PR comment no longer show the warning.

  • worktreeUnchanged and narrowing are untouched. An unproven run still never narrows; there's an assertion for that in the new test.

  • Refusal hint (add3cc5): a path that isn't a git checkout used to refuse with "add fetch-depth: 0", which no history depth can fix. resolveCommitRangeFetchingHistory now checks git rev-parse --is-inside-work-tree first. When the path isn't a work tree, it says this path is not a git checkout: and names the setting that points DiffCI at the checkout:

    • GitHub Actions: the Action's repository-path, i.e. the checkout step's path:
    • Azure: the DiffCIObserve task's repositoryPath
    • GitLab and local runs: --repo

    Real shallow clones keep their fetch-depth: 0, GIT_DEPTH and fetchDepth hints; the existing shallow-history and context tests still pass.

Tests (fail on main, pass here):

  • tests/action-impact.test.ts: a refused report with no evidence gets no warning in the comment. HEAD moved, or evidence lost, still gets the warning.
  • packages/diffci-cli/tests/client/job-summary.test.ts: same for the job summary.
  • packages/diffci-cli/tests/client/observe.test.ts: a real observe() on a non-git temp directory returns REFUSED with worktreeUnchanged false, nothing suspected and no summary warning. It also asserts the reason says "not a git checkout" and doesn't mention fetch-depth. Also unit cases for the helper.
  • packages/diffci-cli/tests/client/shallow-history.test.ts › "points a path that is not a git checkout at repository-path, not fetch-depth": real git on a non-checkout temp dir, covering a GitHub pull_request event, Azure and local.

Local results

Observing a path that is not a git checkout (for example actions/checkout
with path: while the Action observes the workspace) refuses with no
non-interference evidence. worktreeUnchanged is false there, which the
console line, the job summary and the Action's PR comment all read as
'the working tree changed - report this'. Warn only when evidence shows a
difference or goes missing; worktreeUnchanged itself is unchanged, so such
a run still never narrows.

Fixes DiffCI#278

Signed-off-by: FredApps <[email protected]>
@FredApps

Copy link
Copy Markdown
Contributor Author

CI note: Merge gate smoke failed on this PR for a reason unrelated to the change. It's the existing dist-client rebuild race (#192, being fixed in #202).

  • This PR touches packages/diffci-cli/src, so the fast check selected 40 CLI test files and ran them in one parallel tsx --test call (job log).
  • check-plan-cli.test.ts › "bounds both inputs and rejects malformed UTF-8" got exit 1 where it expected 0. That test compiles dist-client in before, while plan-cli, mcp and cli-help rebuild the same directory in parallel.
  • The same file passes locally on this branch (14/14). It also passes in this PR's CLI package jobs on ubuntu and windows, which run the whole CLI suite.

I'm re-running CI with an empty commit.

…-depth

Observing a directory that is not a git checkout refused with the
'add fetch-depth: 0' hint, which no history depth fixes. Before the
shallow-history fetch, check whether the path is a work tree at all and,
if not, name the setting that points DiffCI at the checkout: the
Action's repository-path (the checkout step's path:), the Azure task's
repositoryPath, or --repo. Real shallow clones keep their deepen hints.

Refs DiffCI#278

Signed-off-by: FredApps <[email protected]>
@FredApps
FredApps marked this pull request as ready for review November 18, 2026 00:55
adityankale190895 pushed a commit that referenced this pull request Nov 18, 2026
#283)

A path that is not a git checkout was reported as "worktree CHANGED" and
pointed at fetch-depth. It now says the path is not a git checkout and
names repository-path. Only git's own "not a git repository" counts:
dubious ownership or a missing git binary keep the earlier reason.
Fixes #278.

Signed-off-by: FredApps <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@adityankale190895

Copy link
Copy Markdown
Member

Merged to main as adc64c9 (squashed, authorship kept). One change on top: only git's own not a git repository gives the "not a git checkout" reason. Dubious ownership or a missing git binary keep the earlier reason. makeGitRunner now returns git's stderr in an optional stderr field, used only for that check and never reported (a failed fetch can print a remote URL with credentials). There is a test for the dubious-ownership case. Thanks!

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.

observe: a path that isn't a git checkout is reported as 'worktree CHANGED - report this' (console, job summary, Action PR comment)

2 participants