Skip to content

refactor(bugs): simplify concat-gotchas.sh - #15352

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14422-43011759467-1
Nov 11, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14422-43011759467-1

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #14422

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Simplified plugins/bugs/scripts/concat-gotchas.sh without changing its behavior. The awk extractor's two fence branches (open and inside a fence) are merged into one, so the shared if (insec) print line; next is written once. The redundant BEGIN initialisation and a match() call used only as a boolean test are dropped. In the shell part, three if-blocks become one-line guards, a dead || return 0 is removed (without pipefail the substitution's status is trim_body's, which always exits 0), and the per-iteration break is hoisted into one if \[\[ -n "$root" \]\] around the loop. I did not reuse the shared lib/config-root.sh resolver: its path comparison differs slightly, and docs/contracts/config-cascade/README.md records that this script classifies the root inline and does not source the resolver, so switching would be a behavior and contract change, not a simplification.

Not verified

  • plugins/bugs/scripts/concat-gotchas.test.sh could not be run directly in this lane (Bash limited to the named wrappers); check-affected's summary does not name which suites it ran, so the test suite is left to the PR's CI
  • ai-slop detect.sh (the deterministic detector) could not be run in this lane; the fragment line was checked against the rubric only
  • ci-status green: left to the PR's CI

Fix

  • plugins/bugs/scripts/concat-gotchas.sh: merged duplicated awk fence branches, dropped redundant BEGIN block and boolean match(), replaced if-blocks with one-line guards, removed dead || return 0, hoisted the root check out of the layer loop (net 107 to 97 lines)
  • .changes/bugs/work-resolve-issue-issue-14422-43011759467-1-30191e2c.md: new patch fragment, ### Changed / - Internal simplification, no behavior change.

Verification

The runner ran each check from the base copy against dcc9b6e:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 11 fragments valid (run before and after tidy)
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 13 passed, 6 skipped over 2 changed files (run before and after tidy)
  • fresh-context review subagent over the full diff: no behavior differences found in any hunk (awk short-circuit/RLENGTH, uninitialised vars, substitution exit status, git rev-parse failure paths all checked)
  • tidy (code-tidying:tidy-diff) over the 8 changed hunks: no further edits; no comments in the changed lines, no residue, fragment text kept verbatim as the issue requires
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43011759467

Left out: the items under Not verified.

Related

#14422

Merge-Risk: max=MEDIUM demote=false head=dcc9b6eb73d70601def8c21c2958bf13a2e677a0 rubric=8.4.2 rater=claude-opus-5-5 checker=claude-opus-5-5

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed dcc9b6eb73d70601def8c21c2958bf13a2e677a0: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15352 (refactor(bugs): simplify concat-gotchas.sh)

I found no security issues.

Scope. I read every hunk of both changed files, and I read plugins/bugs/scripts/concat-gotchas.sh in full at head:

  • .changes/bugs/work-resolve-issue-issue-14422-43011759467-1-30191e2c.md is a new changelog fragment. It is prose only.
  • plugins/bugs/scripts/concat-gotchas.sh is a refactor of the awk Gotchas extractor and the root and layer guards.

Neither file matches a trusted-path glob. The diff touches no trust control, merge hold, kill switch, token request, plugin manifest or standing instruction.

What I checked

  • Awk extractor. The two fence branches are now one. Short-circuiting fence || match(...) leaves RLENGTH alone only while a fence is already open, and nothing reads RLENGTH then. Opening a fence, closing it and stopping at the section boundary (^##?[[:space:]]) behave as before, so the extracted text stays the same.
  • Root classification. The script runs under set -u only, with no set -e (L10). The guards that now fit on one line (L71, L85, L97) can't end the script early. When git rev-parse fails, the substitution still leaves root empty.
  • Home check. A root that is $HOME or an ancestor of it still drops the team and personal layers. The -ef check that skips a layer which is the user file is also still there. So ~/.claude/bugs.md can't be read a second time as the team layer, and the set of files read is the same as before.
  • Removed || return 0. Without pipefail, the substitution's exit status is trim_body's, so removing it changes nothing. The script still ends with exit 0.

No new input reaches the script, and no new file or path is read. The script's output still goes only to the skill's precompute context, as it did before.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed dcc9b6eb73d70601def8c21c2958bf13a2e677a0: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #15352, refactor(bugs): simplify concat-gotchas.sh

No findings. I read both changed files in full (the script and the changelog fragment) and the whole head file of plugins/bugs/scripts/concat-gotchas.sh.

Behavior-equivalence check (closing issue #14422, "Behavior is unchanged")

The script runs with only set -u (no set -e, no pipefail, see concat-gotchas.sh#L10). That is what keeps each rewrite safe:

  • Merged awk fence branches (L19-L29): || short-circuits, so match() runs only when fence is 0. RLENGTH is read only in the !fence branch, straight after that match. The open, close and print-when-insec paths give the same results as before.
  • Dropped BEGIN: awk variables that were never set count as 0/"", so fence and insec start false as before. delim_len and delim_ch are read only after they are set.
  • match() → ~ at L32: nothing reads RSTART/RLENGTH after that line before the next fence match sets them again.
  • Removed || return 0 at L57: without pipefail, the substitution's exit status is trim_body's, and that awk always exits 0. So the removed branch could never run.
  • One-line guards at L71, L85 and L97: with no set -e, a non-zero status from the [[ ]] / || / && lists cannot end the script. When git fails, $(git rev-parse --show-toplevel 2>/dev/null) prints nothing, so root still ends up empty. The final exit 0 keeps the exit code at 0.
  • Root check moved out of the loop (L89-L95): before, the loop hit break on its first pass when root was empty, so this is the same.

Acceptance criteria

  • Behavior unchanged: met on reading (above). concat-gotchas.test.sh has cases that would fail if it broke: fence handling (heading inside a fence, a fenced block kept whole), an empty or missing section, a root outside a git work tree, a root equal to home (also up to case), and cascade order. The one path no test runs is the fallback to git rev-parse --show-toplevel when CLAUDE_PROJECT_DIR is unset. The rewrite there is trivially equivalent, so I am not counting it as a gap.
  • Edits only the listed file plus a fragment, and stays well under 400 lines / 15 files: met.
  • Fragment: bump: patch with body ### Changed / - Internal simplification, no behavior change.: met.
  • ci-status green: left to CI. I did not check it, and the author's verification notes are their own claims, which I did not confirm.

Other

  • No .claude/rules/ paths: glob matches the changed files. No plugin manifest changed. Neither changed file matches a TRUSTED PATHS glob.
  • No embedded instructions found in the PR context.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head dcc9b6eb73d70601def8c21c2958bf13a2e677a0, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for dcc9b6e

The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file.

Capture artifact: pr-capture-15352-dcc9b6eb73d70601def8c21c2958bf13a2e677a0, expires on 2026-12-11.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit d946768 Nov 11, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14422-43011759467-1 branch November 11, 2026 12:54
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit d94676843d5a0b23cf158e529729e2b5cd8dfe61; later checks count it verified from this comment.

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.

Simplify the concat-gotchas.sh bugs plugin code

0 participants