Skip to content

fix(ci): keep the drift-checked SLM agent mirror out of the duplication scan (#16401) - #16402

Merged
mrveiss merged 2 commits into
mainfrom
issue-16401-dup-guard-mirror
Sep 13, 2026
Merged

mrveiss merged 2 commits into
mainfrom
issue-16401-dup-guard-mirror

Conversation

@mrveiss

@mrveiss mrveiss commented Sep 11, 2026 •

Copy link
Copy Markdown
Owner

Closes #16401.

Single-issue rationale: this unblocks base's duplication-guard for every SLM agent change. It's the ignore change plus a test, and the pin follows from this PR's own CI measurement.

Thinking Path

  • Train-g went red on duplication-guard: the SLM scope measured 4740 lines against its 4729 pin. The only changed clone pairs were the SLM agent files and their mandatory Ansible mirror (autobot-slm-backend/ansible/roles/slm_agent/files/slm/agent/), which detect_agent_code_drift_test.py requires to be byte-identical. So every agent change adds clones and trips the absolute pin, and it always will.
  • The drift test already guarantees the mirror equals its source, so scanning it adds nothing.

What Changed

  • .github/workflows/duplication-guard.yml: the SLM scope's jscpd -i list gains **/ansible/roles/slm_agent/files/**, citing the drift test. SLM_MAX_DUP_LINES stays at 4729 in this commit. It's an absolute count (ci(duplication-guard): the percentage ratchet fails PRs that delete unique code, so gate on the absolute duplicated-line count #16319) that can only come from a real jscpd run.
  • New repo_tests/duplication_guard_excludes_agent_mirror_test.py: it parses the workflow's real -i list and asserts that the pattern matches the mirror, doesn't match the canonical source, and doesn't widen to a sibling role.
  • docs/developer/RATCHET_BASELINES.md: a scope boundary note.

Verification

  • This PR changes only the workflow, a test and a doc, and it's 0 behind base, so its first duplication-guard run measures base with the mirror excluded.
  • A follow-up commit lowers SLM_MAX_DUP_LINES to that figure, with the run ID recorded beside it as the workflow already does. That figure must be below 4729; otherwise the exclusion didn't take.
  • No repo code was run locally.

Model Used

Claude Opus 5 as coordinator; a devops-engineer subagent implemented it.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: a7f2275b-ae54-4c71-856c-8b57ba42c33f


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.

@github-actions

Copy link
Copy Markdown
Contributor

Notice: 29 open PRs — past the runaway threshold (25)

There is no PR queue limit, and this is not a request to defer this PR. Work proceeds one issue at a time without a cap on open PRs; review capacity is the constraint.

This notice only means the count is high enough to be worth a glance for a runaway — something opening PRs in a loop, or a merge pipeline that has stalled so nothing is draining.

Currently open:

If the queue is draining normally, ignore this. Otherwise:

  1. Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
  2. Merge the ones whose CI has finished and review has passed: gh pr merge <number> --squash --delete-branch
  3. Look for a loop opening near-identical PRs

Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.

@github-actions

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No new hardcoded values of either class — ssot and other both block.

Known backlog in pipeline-scripts/hardcoded_values_baseline.txt is suppressed and tracked in #14371.

@mrveiss

mrveiss commented Sep 11, 2026

Copy link
Copy Markdown
Owner Author

Measured SLM scope with the mirror excluded: duplication-guard run 34632034006 (job 103370927070), on this PR's head. The PR was 0 behind base affea4b38, and it changes only the workflow, a test and a doc, so the figure is base with the mirror excluded.

measured:  2945 duplicated lines (129 clones, 258231 lines scanned in 754 files)
pin:       4729 duplicated lines

That's under the old pin by 1784 lines, so the exclusion took. A follow-up commit sets SLM_MAX_DUP_LINES: '2945', citing this run ID next to it.

mrveiss added a commit that referenced this pull request Sep 12, 2026
@mrveiss mrveiss added this to the v0.9.0 milestone Sep 12, 2026
@mrveiss

mrveiss commented Sep 12, 2026

Copy link
Copy Markdown
Owner Author

Content review: approve.

Correct fix and correctly scoped exclusion: **/ansible/roles/slm_agent/files/** added to the SLM-scope jscpd ignore list, since that tree is a drift-test-enforced (detect_agent_code_drift_test.py) byte-identical mirror of autobot-slm-backend/slm/agent/ — duplication between mandatory-identical copies isn't something anyone can act on. Pin re-derived (4729→2945) via an actual re-measurement with the mirror excluded, not just a subtracted estimate — matches RATCHET_BASELINES.md rule 3 ("derive the population a second way before freezing").

duplication_guard_excludes_agent_mirror_test.py is well-targeted: parses the real workflow YAML and translates the glob to regex rather than asserting a literal substring, and separately checks (a) the mirror path matches, (b) the canonical source does NOT match (exclusion isn't too broad), (c) an unrelated sibling role's mirrored files do NOT match (exclusion hasn't silently widened past the one path #16401 justifies, since siblings have no drift-test guarantee).

closingIssuesReferences=[16401], matches its own Closes #16401. CI green. Ready.

@mrveiss
mrveiss merged commit 375624a into main Sep 13, 2026
72 checks passed
@mrveiss
mrveiss deleted the issue-16401-dup-guard-mirror branch September 13, 2026 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci(duplication-guard): the SLM scope counts the drift-checked agent mirror, so every agent change fails the absolute pin

1 participant