Skip to content

ci: handle renamed files in the unslop gate's baseline diff - #9

Merged
EvanAgee merged 3 commits into
mainfrom
fm/fm-unslop-ci-gate
Aug 20, 2026
Merged

EvanAgee merged 3 commits into
mainfrom
fm/fm-unslop-ci-gate

Conversation

@EvanAgee

@EvanAgee EvanAgee commented Aug 20, 2026 •

Copy link
Copy Markdown
Owner

Intent

Add a changed-files unslop CI gate to firstmate (.github/workflows/unslop.yml) that catches newly introduced AI slop without flagging pre-existing findings. Gate only supported JS/TS files a PR changes (diff against base branch), not the whole repo; no-op pass when no code files changed. Baseline ratchet: fail the build ONLY on error-tier gateable findings the PR newly introduces; pre-existing error-tier findings stay report-only even in touched files. An unslop execution failure or unreadable report is announced loudly in the job log but does NOT block the pull request (non-blocking); no oxlint runtime-failure enforcement. Keep it fast: changed-files scope, pinned analyzers [email protected] and [email protected], cached npm. Renamed files must not break the base-report diff: resolve each changed file base path through the git rename map and scan pre-rename content at the head path so base/head dedupe keys compare like for like; the dedupe key must be stable regardless of which representative file unslop picks. CONTRIBUTING.md documents the gate and its non-blocking analyzer-failure behavior. Ship through no-mistakes and resolve all actionable CodeRabbit review threads on the PR.

What Changed

  • The unslop PR gate now resolves each changed file through the git rename map: it binds HEAD_SHA, reads the pre-rename content from the base commit with git show, and writes it at the head path in a synthetic base tree (replacing the git worktree add checkout), so base and head dedupe keys compare like for like for renamed files.
  • The dedupe key now strips @...> location annotations from finding messages with a gsub, so the key stays stable regardless of which representative file unslop reports.
  • The wake-queue lock-reclaim test now emits an explicit pass line when the subshell-vs-parent leg is skipped (no BASHPID), so the skipped leg is visible in the result instead of over-claiming a full pass.

Risk Assessment

✅ Low: Both prescribed fixes are applied and verified by live simulation (rename-map loop in a scratch repo, gsub via jq); the change is confined to one workflow file plus a truthful test-message tweak, and all source-verifiable intent criteria are satisfied.

Testing

Ran the changed wake-queue shell test (all pass) and end-to-end exercised the actual workflow gate scripts with the pinned analyzers in a scratch repo across seven scenarios covering rename dedupe, pre-existing report-only behavior, new-slop blocking, no-code skip, non-blocking analyzer failure, and before/after regression proofs for both fixed bugs; every scenario produced the intended exit code and log output.

Evidence: Gate simulation transcript (rename, pre-existing, new-slop, no-code, analyzer-fail, old-script regression)

Source: Gate simulation transcript (rename, pre-existing, new-slop, no-code, analyzer-fail, old-script regression)

extracted run scripts
==================================================================
SCENARIO rename (BASE=f883cbed1 HEAD=beb51dbd5)
==================================================================
Supported code changed; unslop will run.
Scanning 2 changed code file(s):
  ./lib/invoices.js
  ./src/orders.js
Findings in changed files at head (all severities):
[
  {
    "category": "exact-clone",
    "engine": "clone",
    "message": "Exact duplicate: <export@/tmp/unslop-gate-test.yUHTPk/repo/src/orders.js:1>",
    "locations": [
      {
        "file": "/tmp/unslop-gate-test.yUHTPk/repo/src/orders.js",
        "startLine": 1,
        "startCol": 0,
        "endLine": 23,
        "endCol": 1
      },
      {
        "file": "/tmp/unslop-gate-test.yUHTPk/repo/lib/invoices.js",
        "startLine": 1,
        "startCol": 0,
        "endLine": 23,
        "endCol": 1
      }
    ],
    "confidence": 0.99,
    "similarity": 0,
    "ruleId": "exact-clone",
    "tier": "A",
    "severity": "error",
    "gateable": true,
    "fragmentNames": [
      "<export@/tmp/unslop-gate-test.yUHTPk/repo/src/orders.js:1>",
      "<export@/tmp/unslop-gate-test.yUHTPk/repo/lib/invoices.js:1>"
    ]
  }
]
No newly introduced error-tier gateable findings; pre-existing findings stay report-only.
-- gate step exit code: 0 (expected 0)
SCENARIO rename: OK
==================================================================
SCENARIO preexisting (BASE=f883cbed1 HEAD=0be1dc90d)
==================================================================
Supported code changed; unslop will run.
Scanning 2 changed code file(s):
  ./lib/invoices.js
  ./lib/orders.js
Findings in changed files at head (all severities):
[
  {
    "category": "exact-clone",
    "engine": "clone",
    "message": "Exact duplicate: <export@/tmp/unslop-gate-test.yUHTPk/repo/lib/invoices.js:1>",
    "locations": [
      {
        "file": "/tmp/unslop-gate-test.yUHTPk/repo/lib/invoices.js",
        "startLine": 1,
        "startCol": 0,
        "endLine": 23,
        "endCol": 1
      },
      {
        "file": "/tmp/unslop-gate-test.yUHTPk/repo/lib/orders.js",
        "startLine": 1,
        "startCol": 0,
        "endLine": 23,
        "endCol": 1
      }
    ],
    "confidence": 0.99,
    "similarity": 0,
    "ruleId": "exact-clone",
    "tier": "A",
    "severity": "error",
    "gateable": true,
    "fragmentNames": [
      "<export@/tmp/unslop-gate-test.yUHTPk/repo/lib/invoices.js:1>",
      "<export@/tmp/unslop-gate-test.yUHTPk/repo/lib/orders.js:1>"
    ]
  }
]
No newly introduced error-tier gateable findings; pre-existing findings stay report-only.
-- gate step exit code: 0 (expected 0)
SCENARIO preexisting: OK
==================================================================
SCENARIO newslop (BASE=f883cbed1 HEAD=fd74a3dfc)
==================================================================
Supported code changed; unslop will run.
Scanning 2 changed code file(s):
  ./lib/copy_one.js
  ./lib/copy_two.js
Findings in changed files at head (all severities):
[
  {
    "category": "exact-clone",
    "engine": "clone",
    "message": "Exact duplicate: <export@/tmp/unslop-gate-test.yUHTPk/repo/lib/copy_two.js:1>",
    "locations": [
      {
        "file": "/tmp/unslop-gate-test.yUHTPk/repo/lib/copy_two.js",
        "startLine": 1,
        "startCol": 0,
        "endLine": 23,
        "endCol": 1
      },
      {
        "file": "/tmp/unslop-gate-test.yUHTPk/repo/lib/copy_one.js",
        "startLine": 1,
        "startCol": 0,
        "endLine": 23,
        "endCol": 1
      }
    ],
    "confidence": 0.99,
    "similarity": 0,
    "ruleId": "exact-clone",
    "tier": "A",
    "severity": "error",
    "gateable": true,
    "fragmentNames": [
      "<export@/tmp/unslop-gate-test.yUHTPk/repo/lib/copy_two.js:1>",
      "<export@/tmp/unslop-gate-test.yUHTPk/repo/lib/copy_one.js:1>"
    ]
  }
]
Error-tier gateable findings not present in these files at base commit f883cbed1b75f4916c7d14c5eb999f1982404ab8:
{"rule":"exact-clone","message":"Exact duplicate: <export>","files":["lib/copy_one.js","lib/copy_two.js"]}
::error::This pull request introduces new error-tier gateable AI-slop findings
-- gate step exit code: 1 (expected 1)
SCENARIO newslop: OK
==================================================================
SCENARIO nocode (BASE=f883cbed1 HEAD=f95812157)
==================================================================
No supported code files changed; skipping unslop.
-- gate step skipped: has_code=false (expected skipped)
SCENARIO nocode: OK
==================================================================
SCENARIO analyzer-fail (BASE=f883cbed1 HEAD=beb51dbd5)
==================================================================
Supported code changed; unslop will run.
Scanning 2 changed code file(s):
  ./lib/invoices.js
  ./src/orders.js
unslop: simulated crash
::error::unslop could not produce a machine-readable report (scan of /tmp/unslop-gate-test.yUHTPk/repo exited with status 3); the slop gate did not evaluate this pull request and is passing without gating it
-- gate step exit code: 0 (expected 0)
SCENARIO analyzer-fail: OK
==================================================================
REGRESSION CHECK: old gate script on the rename scenario
==================================================================
==================================================================
SCENARIO rename-oldscript (BASE=f883cbed1 HEAD=beb51dbd5)
==================================================================
Supported code changed; unslop will run.
Scanning 2 changed code file(s):
  ./lib/invoices.js
  ./src/orders.js
Findings in changed files at head (all severities):
[
  {
    "category": "exact-clone",
    "engine": "clone",
    "message": "Exact duplicate: <export@/tmp/unslop-gate-test.yUHTPk/repo/src/orders.js:1>",
    "locations": [
      {
        "file": "/tmp/unslop-gate-test.yUHTPk/repo/src/orders.js",
        "startLine": 1,
        "startCol": 0,
        "endLine": 23,
        "endCol": 1
      },
      {
        "file": "/tmp/unslop-gate-test.yUHTPk/repo/lib/invoices.js",
        "startLine": 1,
        "startCol": 0,
        "endLine": 23,
        "endCol": 1
      }
    ],
    "confidence": 0.99,
    "similarity": 0,
    "ruleId": "exact-clone",
    "tier": "A",
    "severity": "error",
    "gateable": true,
    "fragmentNames": [
      "<export@/tmp/unslop-gate-test.yUHTPk/repo/src/orders.js:1>",
      "<export@/tmp/unslop-gate-test.yUHTPk/repo/lib/invoices.js:1>"
    ]
  }
]
Preparing worktree (detached HEAD f883cbe)
HEAD is now at f883cbe base with pre-existing exact-clone slop
Error-tier gateable findings not present in these files at base commit f883cbed1b75f4916c7d14c5eb999f1982404ab8:
{"rule":"exact-clone","message":"Exact duplicate: <export@src/orders.js:1>","files":["lib/invoices.js","src/orders.js"]}
::error::This pull request introduces new error-tier gateable AI-slop findings
-- gate step exit code: 1 (expected 1)
SCENARIO rename-oldscript: OK
ALL SCENARIOS PASSED
Evidence: Dedupe-key line-shift transcript (new script passes, old script false-fails)

Source: Dedupe-key line-shift transcript (new script passes, old script false-fails)

==================================================================
LINESHIFT with new gate script (BASE=f883cbed1 HEAD=8e6aeb417)
==================================================================
Supported code changed; unslop will run.
Scanning 2 changed code file(s):
  ./lib/invoices.js
  ./lib/orders.js
Findings in changed files at head (all severities):
[
  {
    "category": "exact-clone",
    "engine": "clone",
    "message": "Exact duplicate: <export@/tmp/unslop-gate-test.yUHTPk/repo/lib/orders.js:3>",
    "locations": [
      {
        "file": "/tmp/unslop-gate-test.yUHTPk/repo/lib/orders.js",
        "startLine": 3,
        "startCol": 0,
        "endLine": 25,
        "endCol": 1
      },
      {
        "file": "/tmp/unslop-gate-test.yUHTPk/repo/lib/invoices.js",
        "startLine": 1,
        "startCol": 0,
        "endLine": 23,
        "endCol": 1
      }
    ],
    "confidence": 0.99,
    "similarity": 0,
    "ruleId": "exact-clone",
    "tier": "A",
    "severity": "error",
    "gateable": true,
    "fragmentNames": [
      "<export@/tmp/unslop-gate-test.yUHTPk/repo/lib/orders.js:3>",
      "<export@/tmp/unslop-gate-test.yUHTPk/repo/lib/invoices.js:1>"
    ]
  }
]
No newly introduced error-tier gateable findings; pre-existing findings stay report-only.
-- new gate exit code: 0 (expected 0)
LINESHIFT new: OK
==================================================================
LINESHIFT with old gate script (BASE=f883cbed1 HEAD=8e6aeb417)
==================================================================
Supported code changed; unslop will run.
Scanning 2 changed code file(s):
  ./lib/invoices.js
  ./lib/orders.js
Findings in changed files at head (all severities):
[
  {
    "category": "exact-clone",
    "engine": "clone",
    "message": "Exact duplicate: <export@/tmp/unslop-gate-test.yUHTPk/repo/lib/orders.js:3>",
    "locations": [
      {
        "file": "/tmp/unslop-gate-test.yUHTPk/repo/lib/orders.js",
        "startLine": 3,
        "startCol": 0,
        "endLine": 25,
        "endCol": 1
      },
      {
        "file": "/tmp/unslop-gate-test.yUHTPk/repo/lib/invoices.js",
        "startLine": 1,
        "startCol": 0,
        "endLine": 23,
        "endCol": 1
      }
    ],
    "confidence": 0.99,
    "similarity": 0,
    "ruleId": "exact-clone",
    "tier": "A",
    "severity": "error",
    "gateable": true,
    "fragmentNames": [
      "<export@/tmp/unslop-gate-test.yUHTPk/repo/lib/orders.js:3>",
      "<export@/tmp/unslop-gate-test.yUHTPk/repo/lib/invoices.js:1>"
    ]
  }
]
Preparing worktree (detached HEAD f883cbe)
HEAD is now at f883cbe base with pre-existing exact-clone slop
Error-tier gateable findings not present in these files at base commit f883cbed1b75f4916c7d14c5eb999f1982404ab8:
{"rule":"exact-clone","message":"Exact duplicate: <export@lib/orders.js:3>","files":["lib/invoices.js","lib/orders.js"]}
::error::This pull request introduces new error-tier gateable AI-slop findings
-- old gate exit code: 1 (expected 1)
LINESHIFT old: OK
LINESHIFT SCENARIOS PASSED
Evidence: Repeatable E2E driver script

Source: Repeatable E2E driver script

#!/usr/bin/env bash
# End-to-end simulation of .github/workflows/unslop.yml:
# extracts the real `run` scripts from the workflow YAML and executes them
# against a scratch git repo, with the pinned analyzers on PATH.
set -euo pipefail

TMP="$1"       # scratch root (analyzers already installed under $TMP/tools)
WT="$2"        # project worktree (source of the workflow YAML)
export PATH="$TMP/tools/node_modules/.bin:$PATH"

# --- extract the two run scripts from the workflow (head + base versions) ---
git -C "$WT" show dc48fe5:.github/workflows/unslop.yml > "$TMP/unslop-head.yml"
git -C "$WT" show 63ca758:.github/workflows/unslop.yml > "$TMP/unslop-base.yml"
python3 - "$TMP" <<'PY'
import yaml, sys
tmp = sys.argv[1]
for tag, path in (("new", tmp+"/unslop-head.yml"), ("old", tmp+"/unslop-base.yml")):
    wf = yaml.safe_load(open(path))
    steps = wf["jobs"]["unslop"]["steps"]
    changed = next(s for s in steps if s.get("id") == "changed")
    gate = next(s for s in steps if s.get("name", "").startswith("Report findings"))
    open(f"{tmp}/step-changed-{tag}.sh", "w").write(changed["run"])
    open(f"{tmp}/step-gate-{tag}.sh", "w").write(gate["run"])
print("extracted run scripts")
PY

# --- scratch repo with pre-existing slop at the base commit ---
REPO="$TMP/repo"
rm -rf "$REPO"
git init -q "$REPO"
cd "$REPO"
git config user.email "[email protected]"
git config user.name "gate-test"

mkdir -p lib
cat > lib/orders.js <<'EOF'
export function formatOrderSummary(order, options) {
  const lines = [];
  const currency = options && options.currency ? options.currency : "$";
  lines.push(`Order ${order.id} for ${order.customer.name}`);
  for (const item of order.items) {
    const price = (item.cents / 100).toFixed(2);
    if (item.qty > 1) {
      lines.push(`${item.qty} x ${item.name} @ ${currency}${price}`);
    } else {
      lines.push(`${item.name} ${currency}${price}`);
    }
  }
  const totalCents = order.items.reduce((sum, item) => sum + item.cents * item.qty, 0);
  const total = (totalCents / 100).toFixed(2);
  lines.push(`Total: ${currency}${total}`);
  if (order.coupon) {
    lines.push(`Coupon applied: ${order.coupon.code} (-${order.coupon.percent}%)`);
  }
  if (order.notes && order.notes.length > 0) {
    lines.push(`Notes: ${order.notes.join("; ")}`);
  }
  return lines.join("\n");
}
EOF
# pre-existing slop: invoices.js is an exact clone of orders.js
cp lib/orders.js lib/invoices.js
cat > lib/clean.js <<'EOF'
export function double(n) {
  return n * 2;
}
EOF
echo "# scratch" > README.md
git add -A
git commit -qm "base with pre-existing exact-clone slop"
BASE=$(git rev-parse HEAD)

# --- scenario branches ---
# 1. rename: move orders.js and touch its clone partner; no new slop
git checkout -qB sc-rename "$BASE"
mkdir -p src
git mv lib/orders.js src/orders.js
printf '\n// touched by this PR\n' >> lib/invoices.js
git add -A
git commit -qm "rename orders.js, touch invoices.js"
HEAD_RENAME=$(git rev-parse HEAD)

# 2. preexisting: touch both clone halves in place; no rename, no new slop
git checkout -qB sc-preexisting "$BASE"
printf '\n// touched a\n' >> lib/orders.js
printf '\n// touched b\n' >> lib/invoices.js
git add -A
git commit -qm "touch files that already carry slop"
HEAD_PREEXISTING=$(git rev-parse HEAD)

# 3. newslop: add a brand-new clone pair
git checkout -qB sc-newslop "$BASE"
cp lib/orders.js lib/copy_one.js
cp lib/orders.js lib/copy_two.js
git add -A
git commit -qm "introduce new duplicated code"
HEAD_NEWSLOP=$(git rev-parse HEAD)

# 4. nocode: only a markdown change
git checkout -qB sc-nocode "$BASE"
echo "docs only" >> README.md
git add -A
git commit -qm "docs only"
HEAD_NOCODE=$(git rev-parse HEAD)

run_pipeline() {
  local tag="$1" head="$2" want_gate_rc="$3" extra_path="${4:-}"
  local rt gh_out rc
  rt=$(mktemp -d "$TMP/runner-$tag.XXXX")
  gh_out="$rt/gh-output"; : > "$gh_out"
  git -C "$REPO" checkout -q "$head"
  echo "=================================================================="
  echo "SCENARIO $tag (BASE=${BASE:0:9} HEAD=${head:0:9})"
  echo "=================================================================="
  (
    cd "$REPO"
    export RUNNER_TEMP="$rt" GITHUB_OUTPUT="$gh_out" GITHUB_WORKSPACE="$REPO"
    export BASE_SHA="$BASE" HEAD_SHA="$head"
    [ -n "$extra_path" ] && export PATH="$extra_path:$PATH"
    bash "$TMP/step-changed-${5:-new}.sh"
  )
  if grep -q '^has_code=true$' "$gh_out"; then
    rc=0
    (
      cd "$REPO"
      export RUNNER_TEMP="$rt" GITHUB_OUTPUT="$gh_out" GITHUB_WORKSPACE="$REPO"
      export BASE_SHA="$BASE" HEAD_SHA="$head"
      [ -n "$extra_path" ] && export PATH="$extra_path:$PATH"
      bash "$TMP/step-gate-${5:-new}.sh"
    ) || rc=$?
    echo "-- gate step exit code: $rc (expected $want_gate_rc)"
  else
    rc="skipped"
    echo "-- gate step skipped: has_code=false (expected $want_gate_rc)"
  fi
  if [ "$rc" = "$want_gate_rc" ]; then
    echo "SCENARIO $tag: OK"
  else
    echo "SCENARIO $tag: MISMATCH (got $rc, want $want_gate_rc)"
    exit 1
  fi
}

# fake analyzer that always crashes, for the non-blocking failure scenario
FAKEBIN="$TMP/fakebin"
mkdir -p "$FAKEBIN"
printf '#!/bin/sh\necho "unslop: simulated crash" >&2\nexit 3\n' > "$FAKEBIN/unslop"
chmod +x "$FAKEBIN/unslop"

run_pipeline rename        "$HEAD_RENAME"      0
run_pipeline preexisting   "$HEAD_PREEXISTING" 0
run_pipeline newslop       "$HEAD_NEWSLOP"     1
run_pipeline nocode        "$HEAD_NOCODE"      skipped
run_pipeline analyzer-fail "$HEAD_RENAME"      0 "$FAKEBIN"

# regression proof: the OLD gate script (base commit) wrongly fails the rename
echo "=================================================================="
echo "REGRESSION CHECK: old gate script on the rename scenario"
echo "=================================================================="
run_pipeline rename-oldscript "$HEAD_RENAME" 1 "" old

echo "ALL SCENARIOS PASSED"
Evidence: Repeatable line-shift driver script

Source: Repeatable line-shift driver script

#!/usr/bin/env bash
# Dedupe-key stability: the clone's start line shifts between base and head,
# so the finding message's <name@path:line> reference differs. The new gsub
# must keep the key stable; the old script (no gsub) must false-positive.
set -euo pipefail
TMP="$1"
export PATH="$TMP/tools/node_modules/.bin:$PATH"
REPO="$TMP/repo"
cd "$REPO"
BASE=$(git rev-parse sc-rename~1)

git checkout -qB sc-lineshift "$BASE"
# push the clone in orders.js down two lines; touch invoices.js so both
# clone halves are in the changed set
printf '// prologue line one\n// prologue line two\n' | cat - lib/orders.js > lib/orders.tmp
mv lib/orders.tmp lib/orders.js
printf '\n// touched\n' >> lib/invoices.js
git add -A
git commit -qm "shift clone start line"
HEAD=$(git rev-parse HEAD)

run_one() {
  local tag="$1" want="$2"
  local rt gh_out rc
  rt=$(mktemp -d "$TMP/runner-lineshift-$tag.XXXX")
  gh_out="$rt/gh-output"; : > "$gh_out"
  echo "=================================================================="
  echo "LINESHIFT with $tag gate script (BASE=${BASE:0:9} HEAD=${HEAD:0:9})"
  echo "=================================================================="
  (
    cd "$REPO"
    export RUNNER_TEMP="$rt" GITHUB_OUTPUT="$gh_out" GITHUB_WORKSPACE="$REPO"
    export BASE_SHA="$BASE" HEAD_SHA="$HEAD"
    bash "$TMP/step-changed-$tag.sh"
  )
  rc=0
  (
    cd "$REPO"
    export RUNNER_TEMP="$rt" GITHUB_OUTPUT="$gh_out" GITHUB_WORKSPACE="$REPO"
    export BASE_SHA="$BASE" HEAD_SHA="$HEAD"
    bash "$TMP/step-gate-$tag.sh"
  ) || rc=$?
  echo "-- $tag gate exit code: $rc (expected $want)"
  [ "$rc" = "$want" ] || { echo "LINESHIFT $tag: MISMATCH"; exit 1; }
  echo "LINESHIFT $tag: OK"
}

run_one new 0
run_one old 1
echo "LINESHIFT SCENARIOS PASSED"
Evidence: Key rename-scenario outcome
SCENARIO rename: OK (new gate exit 0 — pre-existing clone deduped through rename map)
SCENARIO rename-oldscript: OK (old gate exit 1 — reproduced the pre-fix false failure)
LINESHIFT new: OK (exit 0) / LINESHIFT old: OK (exit 1 — gsub dedupe-key fix is decisive)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

🔧 **Rebase** - 1 issue found → auto-fixed ✅
  • ⚠️ .github/workflows/unslop.yml - merge conflict rebasing onto origin/main

🔧 Fix applied.
✅ Re-checked - no issues remain.

🔧 **Review** - 2 issues found → auto-fixed ✅
  • 🚨 .github/workflows/unslop.yml:140 - The rename-map loop reads git diff --name-status -z &#34;$BASE_SHA...$HEAD_SHA&#34;, but the "Report findings and gate" step's env block (lines 78-79) defines only BASE_SHA; HEAD_SHA exists only in the first step's env (line 24). The script runs under set -euo pipefail, and an unbound variable inside a process substitution kills only the subshell: bash prints 'HEAD_SHA: unbound variable' to the log, the while loop reads nothing, and the parent script continues (reproduced locally). Result: base_path_for is always empty, renamed files fall back to their head path, git cat-file -e &#34;$BASE_SHA:$rel&#34; fails for them, they are excluded from the base scan, and their pre-existing error-tier findings are reported as newly introduced — the exact false CI failure this commit claims to durably fix, and a required behavior in the user intent ('Renamed files must not break the base-report diff'). Fix: add HEAD_SHA: ${{ github.event.pull_request.head.sha }} to the step env at line 79. Optional hardening: write the name-status diff to a file first (as the first step does for name-only) so a git failure is loud instead of silently yielding an empty map.
  • ℹ️ .github/workflows/unslop.yml:112 - gsub(&#34;@[^&gt;]*&#34;; &#34;&#34;) strips from any '@' to the next '>' or to end-of-message. unslop 0.1.7's message templates always bracket the representative token (&lt;name@file:line&gt;, &lt;function@%d&gt;), so gsub(&#34;@[^&gt;]*&gt;&#34;; &#34;&gt;&#34;) would normalize the same tokens while not consuming an unbracketed '@' (e.g. a decorator or package@version quoted in a message) plus all trailing text. The current form can only over-collapse dedupe keys, letting a genuinely new finding dedupe against an unrelated pre-existing one (false negative; it can never falsely block). Low risk given observed templates; tightening is a safe mechanical hardening.

🔧 Fix: bind HEAD_SHA in gate step; tighten dedupe-key gsub
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-wake-queue.test.sh (full file, all tests pass including the changed self-held-lock test)
  • End-to-end simulation: extracted the real run scripts from .github/workflows/unslop.yml (target commit dc48fe5) and executed them against a scratch git repo with pinned [email protected] and [email protected] on PATH
  • Scenario rename: pre-existing exact-clone slop, one clone half renamed (R100) + partner touched → gate exit 0 (pre-existing finding correctly deduped through the rename map)
  • Scenario preexisting: both slop files touched in place, no rename → gate exit 0 (report-only)
  • Scenario newslop: PR adds a new duplicated-code pair → gate exit 1 with ::error annotation
  • Scenario nocode: markdown-only change → has_code=false, gate step skipped
  • Scenario analyzer-fail: unslop replaced with a crashing stub → gate exit 0 with loud ::error (non-blocking)
  • Regression proof: the base-commit (63ca758) gate script run on the same rename scenario exits 1 (false positive) — fails before the fix, passes after
  • Dedupe-key stability proof: clone start line shifted two lines → new script (with gsub) exits 0, old script exits 1 on the line-number-bearing key
  • Verified CONTRIBUTING.md documents the gate and its non-blocking analyzer-failure behavior
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Summary by CodeRabbit

  • Bug Fixes

    • Improved analysis reporting by removing duplicate findings and ensuring renamed files are compared correctly.
    • Enhanced comparison of current and base versions for more consistent results.
    • Clarified lock test output when a platform-specific check is skipped.
  • Tests

    • Preserved existing lock-handling assertions while improving test status messages.

A renamed file's head path does not exist at the base commit, so the old base-scan skipped it and treated every pre-existing gateable finding in that file as newly introduced. Materialize each changed file's base content (resolved through the git rename map) at its head path in a temporary base tree so base and head dedupe keys compare like for like. Also strip the @file:line location from clone messages so the dedupe key stays stable regardless of which representative file unslop picks when the base and head scan sets differ.
When BASHPID is unavailable the subshell-vs-parent lock leg was skipped, but the final pass still claimed the parent-hold guarantee, overstating coverage. Move the full-coverage pass into the executed branch and give the skip branch an honest skip-aware message.
@coderabbitai

coderabbitai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bf4a7611-f9bc-4a71-abe1-3dc05d9f54b3

📥 Commits

Reviewing files that changed from the base of the PR and between 63ca758 and dc48fe5.

📒 Files selected for processing (2)
  • .github/workflows/unslop.yml
  • tests/fm-wake-queue.test.sh

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The unslop workflow now reconstructs base contents at head paths, maps renamed files, preserves copied-file behavior, and normalizes finding keys. The lock test updates messages for environments without BASHPID while keeping lock assertions unchanged.

Changes

Unslop workflow reporting

Layer / File(s) Summary
Base-tree reconstruction and finding normalization
.github/workflows/unslop.yml
The reporting step receives HEAD_SHA. Analyzer messages are normalized before deduplication. A temporary base tree reconstructs base contents at head paths and maps renamed files while leaving copied files unmapped.

Lock test output

Layer / File(s) Summary
Lock test result reporting
tests/fm-wake-queue.test.sh
The no-BASHPID path reports a passing skipped leg with an explanatory message. The supported path reports success inside its conditional branch. Lock assertions remain unchanged.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to dc48f

The CI gate improves renamed-file handling and keeps analyzer failures non-blocking, while the related test output remains truthful. No actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

  • EvanAgee/firstmate#6: Introduced the unslop workflow and related lock test behavior refined by this pull request.

Suggested reviewers: kunchenguid

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: handling renamed files in the unslop gate baseline diff.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fm/fm-unslop-ci-gate

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@EvanAgee
EvanAgee merged commit ff9c1b2 into main Aug 20, 2026
26 of 27 checks passed
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.

1 participant