Skip to content

fix(state): stop reconcile from matching (#N) commit-mention as issue merge - #1048

Merged
admarble merged 2 commits into
mainfrom
feature/1044-fix-state-reconcile-marks-an-open-issue-merged-whe
Sep 11, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/1044-fix-state-reconcile-marks-an-open-issue-merged-whe

Conversation

@admarble

@admarble admarble commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • isIssueMergedIntoMain's Method 2 fallback matched any commit subject containing (#N) — a squash-merge form that records the PR number, not the issue number — so an unrelated PR's title that merely mentioned an issue in prose (e.g. docs: wave-2 plan — node 09 (#1030), ...) was read as proof issue fix(sync): dry-run lists files apply never writes — the template walk maps templates/opencode/** to .claude/opencode/** (phantom drift nag in serve; update plants unrendered {{PHASE}} files) #1030 was merged, even with its own feature branch unmerged and its PR still open.
  • Dropped the (#N) grep pattern from Method 2; kept the two merge-commit-anchored forms (Merge #N, Merge ...#N) which only match actual merge-commit subjects.
  • Added src/lib/workflow/pr-status.test.ts (previously zero coverage) with real-git temp-repo tests for the false positive and the surviving true-positive paths.
  • Added an AC-3 regression test to state-cleanup.test.ts proving reconcileStateAtStartup leaves an in_progress issue with an open PR untouched in this exact scenario.

Pre-PR AC Verification

AC Description Status Evidence
AC-1 isIssueMergedIntoMain(N) returns false for a commit that merely mentions (#N) ✅ Implemented src/lib/workflow/pr-status.test.ts — "AC-1: returns false when main has a squash commit that merely mentions (#N)..."
AC-2 Existing true-positive paths (Merge #N commit, merged feature branch, merged linked PR) still return true ✅ Implemented pr-status.test.ts — AC-2a/AC-2b/AC-2c cases, all green
AC-3 reconcileStateAtStartup leaves an in_progress issue with an open PR untouched ✅ Implemented src/lib/workflow/state-cleanup.test.ts — "AC-3 (#1044): leaves in_progress untouched with an open PR..."
AC-4 Full suite green ✅ Implemented npm run build && npm test — 6330 passed; 3 pre-existing failures unrelated to this diff (see Test plan)

Mutation-verified: AC-1 — restored the (#N) grep pattern in pr-status.ts; src/lib/workflow/pr-status.test.ts > pr-status.ts (#1044) > isIssueMergedIntoMain > AC-1: returns false when main has a squash commit that merely mentions (#N) and the issue's branch is unmerged failed; restored.

Mutation-verified: AC-3 — restored the (#N) grep pattern in pr-status.ts; src/lib/workflow/state-cleanup.test.ts > reconcileStateAtStartup escalation > AC-3 (#1044): leaves in_progress untouched with an open PR when main only has an unrelated squash commit mentioning the issue number failed; restored.

Test plan

  • npx vitest run src/lib/workflow/pr-status.test.ts → 4 passed
  • npx vitest run src/lib/workflow/state-cleanup.test.ts → 12 passed (including new AC-3 case)
  • npm run build → passes
  • npm run lint → passes
  • npm test (full suite) → 6330 passed, 3 failed. All 3 failures are in files this PR does not touch (src/lib/workflow/batch-executor.test.ts, src/commands/__tests__/prompt-wait.test.ts, __tests__/integration/relay-hook.integration.test.ts) and reproduce identically when run in isolation on this same worktree, confirming they are pre-existing/environmental, not caused by this change.

Closes #1044

Post-QA (AC_MET_BUT_NOT_A_PLUS) — runner fold-in, ea605e3

  • QA's headline gap folded in: the surviving Merge.*#N form was unanchored, so #104 matched Merge pull request #1043 … by numeric prefix — reproducible on today's main. Both remaining patterns are now -E regexes ending in ([^0-9]|$); regression case AC-1b covers 104 vs 1043 (false) and 1043 itself (true).
  • The real-git describe runs with a 15s timeout instead of the unit project's 5s default (QA's flake-profile note).
  • Left as noted: checkPRMergeStatus OPEN/null branches have no direct case here; the three darwin-local failures QA saw at both HEAD and base are the known pre-existing set, not this diff.

Mutation-verified: AC-1 — removed the ([^0-9]|$) end-anchor from both Merge patterns in isIssueMergedIntoMain; src/lib/workflow/pr-status.test.ts > AC-1b: returns false when a merge commit's PR number merely starts with the issue number (numeric-prefix collision) failed; restored.

t and others added 2 commits September 10, 2026 21:03
… merge (#1044)

isIssueMergedIntoMain's Method 2 fallback matched any commit subject
containing "(#N)" — a squash-merge form that records the PR number, not
the issue number. An unrelated PR's title referencing an issue in prose
was read as proof the issue was merged, even with its own feature branch
unmerged and its PR still open. Drop that grep pattern; keep the two
merge-commit-anchored forms (`Merge #N`, `Merge ...#N`).

Entire-Checkpoint: 935a4a5217c0
…st for the numeric-prefix collision

Second-pass QA: `Merge.*#104` still matched `Merge pull request #1043 …` by
numeric prefix — the same PR-vs-issue confusion as the removed `(#N)` form.
Both remaining patterns are now extended regexes ending in `([^0-9]|$)`.
Regression test covers issue 104 vs PR 1043 (false) and 1043 itself (true);
the real-git describe gets a 15s timeout instead of the unit default.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_0147heJNRw8wBBujPGMqxDpR
@admarble
admarble merged commit e0a25c0 into main Sep 11, 2026
6 checks passed
@admarble
admarble deleted the feature/1044-fix-state-reconcile-marks-an-open-issue-merged-whe branch September 11, 2026 05:19
admarble added a commit that referenced this pull request Sep 20, 2026
…s outside the diff need an issue number (#1101)

* chore(hooks): allow anchored env|grep in the env-dump guard; red tests outside the diff need an issue number

pre-tool.sh (all three copies): a bare env/printenv piped into a grep whose pattern starts with ^ is a prefix-scoped listing, not a dump. It is how a phase checks for the orchestrator's own SEQUANT_* vars leaking into the suite (#1086). Bare env, printenv, export and an unanchored env | grep TOKEN still block. 8 new cases per hook copy in the integration test.

exec and qa skills (all three copies): a failing test in a file the diff never touched must be re-run with the SEQUANT_* vars unset, settled against base in the same worktree, and named in the PR body with an issue number. PRs #1036, #1042 and #1048 wrote 'pre-existing, unrelated' for the same three failures; none filed, and the same failures stopped the #1060 gate a week later.

Entire-Checkpoint: 2ebe233c071c

* chore(skills): unset every SEQUANT_* var generically so the exec skill passes the relay isolation guard (AC-16)

Entire-Checkpoint: 02360586d1fc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant