Skip to content

fix(repo-fleet-hygiene): keep analysis after moved-identity - #2629

Merged
kyle-sexton merged 1 commit into
mainfrom
cursor/fix-fleet-moved-identity-analysis-f8b0
Aug 14, 2026
Merged

fix(repo-fleet-hygiene): keep analysis after moved-identity#2629
kyle-sexton merged 1 commit into
mainfrom
cursor/fix-fleet-moved-identity-analysis-f8b0

Conversation

@kyle-sexton

Copy link
Copy Markdown
Contributor

Closes #2600

Summary

On a moved-identity checkout, the audit emitted github-remote-moved and silently skipped branch/worktree analysis, dropping genuine HIGH findings.

Fix

Continue branch and worktree analysis after github-remote-moved; do not silent-skip local facts that do not depend on the remote identity being current.

Verification

See audit-fleet.test.sh on PR checks.

Related

Refs #2597 — fleet hygiene epic.

Open in Web Open in Cursor 

github-remote-moved evidence now states that branch/worktree classification
continues against the resolved full_name, and the collector fixture requires
exact-OID merged findings from that identity so a silent skip cannot regress.

Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
@cursor

cursor Bot commented Aug 14, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@kyle-sexton
kyle-sexton enabled auto-merge (squash) August 14, 2026 22:54
@claude

claude Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 23s —— View job


Security review complete ✅

  • Gather context (PR diff, changed files)
  • Check skip gate
  • Review changed files for security-relevant issues
  • Adversarially validate any candidate findings
  • Post final results

No security issues found.

This PR removes a premature return in analyze_repo() (audit-fleet.sh) so that branch/worktree analysis continues after a github-remote-moved finding, instead of silently skipping local classification. The rest of the diff is docs (SKILL.md, confidence-model.md, CHANGELOG.md), an eval expectation update, a version bump, and expanded test fixtures in audit-fleet.test.sh.

Checked specifically:

  • The resolved identity (expected_actual, GitHub's full_name from GET /repos/{owner}/{repo}) now flows into github_repo and downstream gh pr list --repo "github.com/$github_repo" ... calls (audit-fleet.sh#L1275). This value is passed as a discrete --repo argument (not shell-interpolated/eval'd), so there's no command-injection surface, and it originates from GitHub's own API response rather than attacker-controlled input.
  • emit_finding/print_field (audit-fleet.sh#L871-L886) write output via printf '%s: ' with values as arguments, not interpolated into format strings — no injection via finding text.
  • run_bounded_gh continues to allowlist-gate probes and strip/pin sensitive gh env vars before invocation (audit-fleet.sh#L276-L291); unchanged by this PR.
  • No GitHub Actions workflow files, permissions, auth, or credential handling touched.
  • Plugin remains read-only (no branch/worktree deletion); this fix only extends reporting coverage, it doesn't add any mutating behavior.

This is a code-quality/correctness fix (restoring dropped findings), not a security-relevant change — findings scope check confirmed no logic flaws, injection surfaces, or trust-boundary issues introduced.

Branch: cursor/fix-fleet-moved-identity-analysis-f8b0

@github-actions

Copy link
Copy Markdown

Last security-reviewed head: 0e4fe63b47d3cb9ed76be88dbc1435456dcc3535. On the next push, the relevance gate compares only the commits since this SHA; delete this comment to force a full re-review.

@kyle-sexton
kyle-sexton merged commit d7d71c7 into main Aug 14, 2026
39 checks passed
@kyle-sexton
kyle-sexton deleted the cursor/fix-fleet-moved-identity-analysis-f8b0 branch August 14, 2026 23:01
@claude

claude Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 26s —— View job


Code review skipped

This PR is already merged (state: MERGED), so per the /review:code-review skip gate ("PR is closed or not open") no review is performed — there's no open PR left to review or post findings against.

@github-actions

Copy link
Copy Markdown

Claude has reviewed this PR 1 time. The lane skips further automatic reviews after 5; deleting this comment resets the count.

kyle-sexton added a commit that referenced this pull request Aug 15, 2026
…#2689)

Closes #2687

## Summary

A branch carrying exact-OID merged-PR evidence that is **also
protected** fell through both arms of the `pr_match` block and emitted
nothing. The `merged-worktree` arm requires a non-main worktree; the
`merged-local-branch` arm requires `protected=false`. A branch attached
to the main worktree, or the canonical checkout's current branch,
satisfies neither — so the strongest merge evidence the collector holds
was computed and then discarded.

The tell that this was an oversight rather than a protection rule: the
weaker `merged-pr-tip-drift` immediately below carries no protection
guard at all and does emit. Silence on the strong path read as "nothing
merged" rather than "merged, but protected".

## Fix

Adds an `else` arm emitting `LOW merged-protected-branch`, naming the PR
number, the matching `headRefOid`, and which protection applies.

The protection rule is unchanged. The new kind is deliberately absent
from `branch_action_kind()` — which matches only `merged-local-branch` —
so it is reported and can never become a cleanup candidate, inflate the
rollup candidate count, or enter the action plan.

Documented in `reference/confidence-model.md`; the repo already gates on
every emitted kind appearing in that tier table, and that gate caught
the omission during development.

## Verification

Replaying the exact conditions the collector evaluates, across all five
reachable input shapes:

```
BEFORE:
  unattached, unprotected            HIGH merged-local-branch
  attached to NON-main worktree      HIGH merged-worktree
  attached to MAIN worktree          <NOTHING EMITTED>
  current branch, unattached         <NOTHING EMITTED>
  no merged PR                       <NOTHING EMITTED>

AFTER:
  unattached, unprotected            HIGH merged-local-branch
  attached to NON-main worktree      HIGH merged-worktree
  attached to MAIN worktree          LOW merged-protected-branch
  current branch, unattached         LOW merged-protected-branch
  no merged PR                       <NOTHING EMITTED>
```

Two cases go from silent to reported; the other three are
byte-identical, so no existing classification changes.

Also run: `bash -n` clean, `shellcheck -x` clean, `markdownlint-cli2` 0
errors on the reference doc.

## What I could not verify, stated plainly

**The full `audit-fleet.test.sh` suite does not complete on Windows
under Git Bash.** It exceeded 500s here with no buffered output; two
independent earlier attempts hit the same wall at a 9-minute budget. So
the decision-table evidence above comes from isolating the arm, not from
a suite run.

I drafted a fixture assertion and then **reverted it**, because I could
not run the suite to confirm it, and an unvalidated fixture edit to a
shared harness risks breaking CI for everyone else. The shape a
follow-up needs: a branch attached to the main worktree (index 0 of the
worktree porcelain list) that is **not** the default branch, plus a
matching row in the PR fixture table. Note the default branch cannot be
used — it is excluded from merge-evidence collection upstream, which I
discovered by trying it first.

That suite's Windows runtime is worth its own issue; it is now the
second finding this session that could not be closed by running the
tests that exist.

No version bump or CHANGELOG entry — a consolidating bump is landing
separately, and parallel PRs staging the same version collide on
`check-changelog-parity.sh --check-order`.

## Related

Supersedes the mechanism described in #2600, which was closed by #2629
against a moved-identity stop that does not exist. That fix is real but
addresses a different path; this defect survived it, which is why the
symptom recurred after the issue was closed.

N/A
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.

repo-fleet-hygiene: branch and worktree analysis is silently skipped on a moved-identity checkout, dropping a genuine HIGH finding

2 participants