Skip to content

fix(ci): resolve_linked_issue.sh no longer matches keywords mid-sentence - #230

Merged
libravault-xyz merged 2 commits into
devfrom
fix/resolve-linked-issue-prose-regex
Aug 17, 2026
Merged

libravault-xyz merged 2 commits into
devfrom
fix/resolve-linked-issue-prose-regex

Conversation

@libravault-xyz

@libravault-xyz libravault-xyz commented Aug 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Closes #228.

Live on PR #225: qa-agent.yml tried to verify it against issue 223's
acceptance criteria — completely unrelated (PR #225 is a CI pipeline-infra
change; issue 223 is a separate feature, actually addressed by the
separate PR #224). Root cause: PR #225's own body mentioned, in passing
prose, "PR #224 (which fixes issue 223)" — background context, not PR
#225's own closing keyword — and resolve_linked_issue.sh's regex matched
it anyway, treating it as PR #225's linked issue. qa-agent caught the
resulting mismatch itself and evaluated the PR on its own merits instead
of forcing an irrelevant checklist onto it, but flagged the pairing for a
human.

Confirmed: this isn't just our script being loose

Checked closingIssuesReferences via the GitHub GraphQL API — GitHub's
own real closing-keyword parser is exactly this naive too. It had
genuinely linked PR #225 as a closing reference for issue 223, meaning
merging it as originally worded would have auto-closed the wrong issue a
second time. That's a footgun in GitHub's own parser this script can't
fix — but resolve_linked_issue.sh's actual job (telling
dev-agent/qa-agent/principal-review which issue's acceptance criteria a
PR should be judged against) is a stricter question than "what would
GitHub technically auto-close," so matching GitHub's looser behavior here
isn't worth keeping.

Fix

Anchors the keyword to the start of its (trimmed) line, stripping
optional markdown list/heading/blockquote markers first — matches how
every real PR in this pipeline already writes it ("Closes #N" alone on
its own line) and rejects mid-sentence mentions.

Also cleaned up PR #225's own body to stop tripping this (an early draft
of that cleanup's own explanation ironically re-triggered the same match
— fixed too, by spelling out issue numbers as prose instead of #N where
the sentence isn't an actual closing keyword).

Risk

.github/scripts/** is not in agent-policy.yml's sensitive_paths —
should classify risk:low (small diff, no sensitive-path match). Shared
by all three pipeline workflows, so a regression here would affect every
future PR's issue-linking, not just this one; see test plan below for
what was actually checked.

Test plan

No bats/pytest harness exists for .github/scripts/* in this repo (same
gap principal review noted on PR #225) — verified by hand against real
PR bodies via gh pr view, running the updated script directly:

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

Live on PR #225: qa-agent.yml tried to verify it against issue #223's
acceptance criteria, completely unrelated (#225 is a CI pipeline-infra
fix; #223 is a separate feature closed by the separate PR #224). Root
cause: PR #225's own body mentioned, in passing prose, "PR #224 (which
fixes #223)" - background context, not PR #225's own closing keyword -
and the shared regex matched it anyway. qa-agent caught the mismatch
itself and evaluated the PR on its own merits, but flagged it as a
process signal.

Confirmed via the GitHub GraphQL API (closingIssuesReferences) that
this isn't just our script being loose - GitHub's own real
closing-keyword parser is exactly this naive too: it had linked PR #225
as a genuine closing reference for issue #223, meaning merging it would
have auto-closed the wrong issue a second time. That's a footgun in
GitHub's parser this script can't fix, but resolve_linked_issue.sh's
actual job (telling dev-agent/qa-agent/principal-review which issue's
acceptance criteria a PR should be judged against) is a stricter
question than "what would GitHub technically auto-close" - matching
GitHub's looser behavior here isn't worth keeping.

Anchors the keyword to the start of its (trimmed) line, stripping
optional markdown list/heading/blockquote markers first - matches how
every real PR in this pipeline already writes it ("Closes #N" alone on
its own line) and rejects mid-sentence mentions. Verified against real
PR bodies: #224 still resolves to 223, #229 still resolves to 227, #221
(pre-existing pipeline PR) still resolves to 4, #225 now correctly
resolves to nothing.

Also cleaned up PR #225's own body to stop tripping this (both the
original phrasing and, ironically, an early draft of this explanation
itself re-triggered the same match).

Closes #228

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@libravault-xyz libravault-xyz added risk:low Principal review classified this PR as low risk status:needs-qa PR open, awaiting qa-agent verification labels Aug 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📱 iOS Build Status: PASSED

✅ iOS Simulator Build & Unit Tests - success
✅ Android Core Modules - success

iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those.

View run details

@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

QA verification — PR #230 vs issue #228

Issue #228 acceptance criteria (bug report; no explicit checklist, so
judged against the fix requirements spelled out in the issue body):

What I ran:

  1. Re-implemented the script's sed+grep pipeline standalone and tested it
    against both the real cases and the mid-sentence case from the issue:
  2. Ran .github/scripts/resolve_linked_issue.sh directly against real PR
    bodies via gh pr view, matching every claim in the PR's test plan:
  3. Confirmed .github/scripts/** is not in agent-policy.yml's
    sensitive_paths (only .github/workflows/** is) — risk:low is the
    correct classification.
  4. ./gradlew testDebugUnitTest --continue — BUILD SUCCESSFUL in 5m 18s, 415 actionable tasks, no failures. (Diff is bash-only; this
    confirms no unrelated regression, not fix-specific coverage.)
  5. Test-coverage gap (no bats/pytest harness for .github/scripts/*,
    verification is by-hand against real PR data) matches the precedent
    principal review already set on PR fix(ci): add deterministic backstop for PRs opened outside the pipeline #225 for this exact file category
    — not a new gap introduced by this PR.
  6. Commit hygiene: single commit, Conventional Commits subject
    (fix(ci): ...), branch name fix/resolve-linked-issue-prose-regex
    follows convention.

No regressions found in related areas — find_linked_pr.sh's dependency
on resolve_linked_issue.sh is call-through, not duplicated logic, so it
can't drift.

QA verdict: PASS

@github-actions github-actions Bot removed the status:needs-qa PR open, awaiting qa-agent verification label Aug 17, 2026
@libravault-pipeline-bot libravault-pipeline-bot Bot added the status:needs-review QA passed, awaiting principal-review-agent label Aug 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Principal review — PR #230

Risk label: risk:low — verified current. Single commit (fe57abc), no commits landed after the label was set. Re-ran .github/scripts/classify_pr_risk.py origin/dev fix/resolve-linked-issue-prose-regex locally: diff is 27 changed lines and touches no sensitive path → risk:low, matching the applied label. .github/scripts/** is genuinely absent from agent-policy.yml's sensitive_paths (only .github/workflows/** is listed there) — confirmed by reading the policy file directly, not by trusting the PR description's claim.

CI: JVM Tests, iOS Simulator build, Android build, and QA Agent verify all show SUCCESS on the real check-run data (gh pr view --json statusCheckRollup), not just the PR's/QA's say-so. UI Tests (Emulator) shows SKIPPED, consistent with a bash-only diff. No continue-on-error masking anywhere in this diff (it's not a workflow file).

Correctness — verified by hand, not by reading the diff and believing it:

Minor nit (not blocking): the new comment block (lines 43-45) says the \b word-boundary is what prevents disclosed #45/enclosed #123 from matching — but now that the pattern is anchored with ^ immediately before it (line start, after the sed strip), the ^ anchor alone already prevents any mid-string substring match; \b is redundant in the new form (harmless, but the comment's causal claim is slightly stale). Not a functional bug — worth a follow-up comment tweak, not worth blocking on.

AGENTS.md test-coverage rule: No bats/pytest harness exists for .github/scripts/* in this repo — this is a pre-existing, previously-litigated gap (principal review explicitly accepted the same gap for this same file category on PR #225, and QA's report on this PR notes the same precedent). The by-hand verification against real PR bodies plus synthetic cases matches that established bar; not treating this as a new gap introduced by this PR.

No new networking dependency, no sensitive-path touches, no agent-policy.yml/.claude/agents/** changes.

Verdict: auto-merge (risk:low, no CONFIRMED findings).

@github-actions github-actions Bot added status:approved-auto-merge Principal review passed, risk:low — will auto-merge status:needs-human-merge Principal review done, requires human merge decision and removed status:needs-review QA passed, awaiting principal-review-agent status:approved-auto-merge Principal review passed, risk:low — will auto-merge labels Aug 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Auto-merge failed (see the workflow run log for the exact error) — routed to a human instead of leaving this stuck on status:approved-auto-merge.

@github-actions

Copy link
Copy Markdown
Contributor

📱 iOS Build Status: PASSED

✅ iOS Simulator Build & Unit Tests - success
✅ Android Core Modules - success

iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those.

View run details

@libravault-xyz
libravault-xyz merged commit 262673f into dev Aug 17, 2026
7 checks passed
libravault-xyz added a commit that referenced this pull request Aug 17, 2026
Rebased on top of #230, which already fixed #228's core bug (line-start
anchoring instead of a bare \b match). This adds what #230 didn't cover:

- resolve_linked_issue.sh now explicitly rejects PR bodies with more
  than one distinct closing-issue line, instead of silently taking the
  first match via `head -1` — every downstream caller only supports a
  single linked issue, so ambiguity now fails loudly (consistent with
  the script's existing "fail loudly, don't guess" stance on gh
  failures) rather than picking one guess and dropping the other.
- Refactors the matching logic into resolve_from_body() so it can be
  tested without a live `gh` call; adds test_resolve_linked_issue.sh
  (13 cases: the real PR #225 false-positive, #230's synthetic cases
  bullet/heading/indented/blockquote, mid-sentence rejection, the
  disclosed/enclosed substring guard, and the new ambiguity rejection).
  No bats/pytest harness exists for .github/scripts/* in this repo —
  #230's own PR body noted the same gap — so this is a standalone
  script matching how the sibling scripts here are invoked.
- Updates dev-agent.md's PR-body guidance and the two "Could not
  resolve..." operator-facing messages in dev-agent.yml/qa-agent.yml to
  say the closing line must stand on its own, so future dev-agent PRs
  don't unknowingly write it in prose and fall through to "no linked
  issue" (safe, just misses the automatic QA/review advance).

Closes #228
libravault-xyz added a commit that referenced this pull request Aug 17, 2026
…#232)

Rebased on top of #230, which already fixed #228's core bug (line-start
anchoring instead of a bare \b match). This adds what #230 didn't cover:

- resolve_linked_issue.sh now explicitly rejects PR bodies with more
  than one distinct closing-issue line, instead of silently taking the
  first match via `head -1` — every downstream caller only supports a
  single linked issue, so ambiguity now fails loudly (consistent with
  the script's existing "fail loudly, don't guess" stance on gh
  failures) rather than picking one guess and dropping the other.
- Refactors the matching logic into resolve_from_body() so it can be
  tested without a live `gh` call; adds test_resolve_linked_issue.sh
  (13 cases: the real PR #225 false-positive, #230's synthetic cases
  bullet/heading/indented/blockquote, mid-sentence rejection, the
  disclosed/enclosed substring guard, and the new ambiguity rejection).
  No bats/pytest harness exists for .github/scripts/* in this repo —
  #230's own PR body noted the same gap — so this is a standalone
  script matching how the sibling scripts here are invoked.
- Updates dev-agent.md's PR-body guidance and the two "Could not
  resolve..." operator-facing messages in dev-agent.yml/qa-agent.yml to
  say the closing line must stand on its own, so future dev-agent PRs
  don't unknowingly write it in prose and fall through to "no linked
  issue" (safe, just misses the automatic QA/review advance).

Closes #228
@libravault-xyz
libravault-xyz deleted the fix/resolve-linked-issue-prose-regex branch August 18, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Principal review classified this PR as low risk status:needs-human-merge Principal review done, requires human merge decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

resolve_linked_issue.sh matches 'fixes #N' in incidental prose, not just an intentional closing keyword

1 participant