/agent-traffic-control:parallel-pr-template-fork-duplicates-moved-sectionfrom agent-traffic-control
Diagnose silent semantic duplication after two parallel PRs ship. Use when: (1) one PR (the **mover**) relocates a section/component/block from template X to template Y (X loses it, Y gains it), (2) a sibling PR (the **forker**), authored against pre-mover main, creates / promotes / copies template Z from the OLD version of X (when X still contained the section), (3) both PRs squash-merge without textual conflict because they touch different files, (4) after both deploy, the section appears on BOTH the mover's destination Y AND on the forker's route Z. Symptom is user-visible: "I see this radar / card / nav block in two places, why?" Root cause is structural — git's textual 3-way merge can't see that file Z ⊆ pre-mover-X. Fix: hand-delete the section from one location (usually the forker's), update tests if any asserted on the duplicate render. Prevention: when the mover merges first, rebase the forker BEFORE squash and audit any moved sections; or add a cross-route uniqueness test (`grep -c "<section-id>"` across primary routes ≤ 1). Sibling to `route-orphan-fetch-after-template-carveout` (covers within-PR template/handler drift; this skill covers across-PR template duplication).
Trending skills
7-day visitors to each skill page
Ships in agent-traffic-control. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Two PRs ship within hours of each other. Neither shows a textual merge conflict. Both pass tests. Both deploy cleanly. After deploy, a user reports "this section is appearing in two places now — that's wrong, right?"
The mechanism is structural, not textual:
<section>...</section> from template X.html
to template Y.html. X loses the block; Y gains it.X.html into a new template
Z.html (e.g., the route is moving up in the IA, or the page is being
split). The fork is literal — Z.html was authored as a near-copy of X.html
as it existed before the mover landed.X lost a block (mover), Y gained it (mover), Z
was added (forker). No 3-way merge conflict.Z was forked from a snapshot of X that still contained the
section. So after both ship, the block lives in BOTH Y and Z.The user sees the duplication immediately. Code review on each PR in isolation wouldn't have caught it — each diff was correct against its own base.
ALL of these are typically true:
+ lines for Z look very similar to (or are a literal copy of)
the pre-mover version of X.<h2>Feature Snapshot</h2> or
id="feature-radar-chart" appears on /route-y AND /route-z).# 1. Identify the moved section's stable identifier (id / class / heading text).
SECTION_ID="feature-radar-chart" # or "<h2>Feature Snapshot</h2>" etc.
# 2. Grep ALL templates for that identifier on main HEAD.
grep -rln "$SECTION_ID" path/to/templates/
# Expected pre-incident: exactly 1 hit (the mover's destination).
# Incident: 2+ hits (mover's destination AND forker's new template).
# 3. Confirm via rendered HTML with the framework's test client (mock mode):
python3 -c "
from app import app
with app.test_client() as c:
for route in ['/route-y', '/route-z', '/legacy-x']:
r = c.get(route)
n = r.data.decode().count('$SECTION_ID')
print(f'{route}: count={n}')
"
# Want: exactly one route renders count=1; others = 0.
# Incident: two routes render count=1.
If grep shows the identifier in two templates AND two routes render it, you've reproduced the duplication.
# Find the mover and the forker by timeline:
gh pr list --repo OWNER/REPO --state merged --limit 30 \
--json number,title,mergedAt,files \
--jq '.[] | "\(.mergedAt) #\(.number) \(.title)"' | head -20
# Look for two PRs merged close in time where:
# - one says "move/relocate X" or "promote X to Y"
# - the other says "fork/copy X to Z" or "promote X to top-level"
The forker is usually the one that copy-pasted from a stale base. The mover is usually first by merge timestamp (because the forker would have noticed the conflict if it were the other way around).
Hand-delete the duplicate from one location. Usually the forker's template — because the mover's destination is the canonical home of the section per the new IA.
- <h2>Feature Snapshot</h2>
- <p>Compare up to six pipeline-stage segments...</p>
- <div id="feature-radar-chart" class="radar-chart"></div>
+ {# Section moved to <Y.html> by PR #A (#mover-issue). The earlier PR #B
+ (#forker-issue) inherited an older snapshot before the move — drop
+ the orphan section here so it lives only on the canonical route. #}
If any tests assert on the duplicate render (e.g., a test for /route-z
that calls assert "Feature Snapshot" in html), update them too.
If a downstream JS bootstrap (e.g., radar.js self-bootstraps on
document.getElementById('feature-radar-chart')) was relying on the duplicate
for some reason, check that the JS still finds its target on the canonical
route only.
# Re-run the diagnostic. Want exactly one template + one route now.
grep -rln "$SECTION_ID" path/to/templates/ # → 1 file
python3 -c "..." # → 1 route renders, others 0
# Run cross-cutting route tests to make sure no regressions:
pytest tests/test_<route_y>.py tests/test_<route_z>.py
Three layers, in order of cheapness:
Rebase the forker onto current main BEFORE squash-merging if any other PR touched a related file in the interim. The squash-merge command's "Mergeable" indicator is a TEXTUAL check; it does NOT detect semantic-section duplication.
Add a cross-route uniqueness invariant test for any section/component that has a single canonical home:
# tests/test_unique_sections.py
import pytest
PRIMARY_ROUTES = ["/", "/actions", "/drivers", "/monitor", "/library/explorer", ...]
UNIQUE_SECTIONS = {
"Feature Snapshot": "/library/explorer",
"Pipeline by Score": "/",
# ...
}
@pytest.mark.parametrize("title,canonical", UNIQUE_SECTIONS.items())
def test_section_appears_on_canonical_route_only(client, title, canonical):
hits = []
for route in PRIMARY_ROUTES:
if title in client.get(route).data.decode():
hits.append(route)
assert hits == [canonical], (
f"{title!r} should appear only on {canonical}, found on: {hits}"
)
This invariant catches the duplication at PR-CI time, regardless of which PR gets merged first.
PR-author audit checklist when promoting / forking a template: search the most recent N merges to main for any "move section X to file Y" patterns. If any apply to the source template you're forking, port the move forward in your PR.
Architecture:
the-dashboard-service Cloud Run service serves multiple dashboard routes.Two of those PRs collided semantically:
<h2>Feature Snapshot</h2>
<div> from library_methods.html; added them to library_explorer.html.drivers.html as a near-copy of the
pre-#296 library_methods.html (which still had the radar block).
Also flipped /library/methods to a 302-redirect handler (→ /drivers).GitHub squash-merge of #303 reported "Mergeable" because the textual diff was:
+ templates/drivers.html (new file)- {old library_methods.html content} / + {redirect handler} (in app.py)~ templates/library_methods.html (other minor changes)No textual collision with library_explorer.html (which #296 had modified).
Result: /library/explorer shows the radar (PR #296 ✓), and /drivers ALSO
shows the radar (PR #303's literal copy of pre-#296 library_methods.html).
User-visible: "this looks nothing like the mockup; I see Feature Snapshot twice." Tests stayed green because each route had its own test file and neither asserted cross-route uniqueness.
Diagnostic:
grep -rln 'feature-radar-chart' <analytics_pkg>/cloudrun/<dashboard_app>/templates/
# → drivers.html (incident)
# → library_explorer.html
Render confirmation:
DASHBOARD_USE_MOCK=true python3 -c "
from app import app
with app.test_client() as c:
for r in ['/drivers', '/library/explorer']:
h = c.get(r).data.decode()
print(r, 'count:', h.count('feature-radar-chart'))
"
# /drivers count: 1
# /library/explorer count: 1
Fix: deleted the radar <div> block from drivers.html (lines 90-103),
replaced with a {# moved to /library/explorer per IA brief / PR #296 #}
comment. Drive-by: updated test_library_methods_does_not_call_get_feature_snapshot
to expect the post-#303 redirect-shape (302 → /drivers) instead of the stale
200 it had.
Shipped as PR #317 (cat7-7dq), squash-merged + redeployed pulse rev
00010-bt2. Post-fix render: /drivers count = 0; /library/explorer
count = 1.
pr-conflict-from-mid-flight-merges — the textual sibling: two PRs touch
the same lines and git flags mergeStateStatus: DIRTY. This skill
documents the silent (non-textual) failure mode of the same scenario.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub wan-huiyan/agent-traffic-control --plugin agent-traffic-control118 skills in this plugin
/agent-refusal-with-evidence-beats-literal-complianceA dispatched agent that does exactly what you asked can ship a defect you would
have stopped yourself, because it can see something at the worksite that you
could not see when you wrote the brief. Use when: (1) you are writing a brief
that prescribes a specific fix, threshold, wording or value rather than the
outcome you want; (2) an agent reports that it did not do what you asked and
you are deciding whether that is insubordination or judgement; (3) an agent
asserts "this is fine" or "not needed" with no measurement behind it; (4) you
are reviewing overnight output and want to know which decisions were checked
and which were assumed. Two halves, and both are needed: give the agent
explicit permission to satisfy the INTENT of an instruction while refusing its
letter, and REQUIRE the evidence with the refusal — what it built or measured,
what that showed, what it did instead. Evidence is the whole difference between
a refusal you can bank and one you have to re-litigate. Four agents correctly
declined an instruction in a single run; one built the suggested fix, measured
that it turned a silent safe refusal into a permanently red pipeline, and
reverted it unpushed.
/auto-merge-rearms-while-agent-live-kill-then-disarm-verifyDisarming auto-merge on a PR whose agent is still running does not hold it —
the agent re-arms within minutes and the PR merges, because arming is a step in
the agent's brief and disarming is not an instruction to the agent at all. Use
when: (1) you want to STOP a pull request from merging that an agent opened and
armed, for review, for a rethink, or because it is landing into a queue you are
trying to drain; (2) a PR you disarmed merged anyway; (3) you are telling agents
which PRs are on hold and want the hold to be enforced rather than announced;
(4) you are about to run `gh pr merge --disable-auto` and have not decided what
to do about the agent. The order is KILL THE AGENT FIRST, THEN DISARM, THEN
VERIFY the disarm by reading `autoMergeRequest` back — a disarm you did not read
back is not a hold. The stronger form needs no ordering at all: convert the PR
to a draft with `gh pr ready --undo`. A draft cannot merge whatever any agent
does to it, so the hold survives an agent you missed, an agent that restarts,
and an agent you did not know about.
/batch-member-cites-a-path-only-a-non-member-addsYou wrote something correct that the default reader cannot reach: a batch member citing a
path only a NON-member adds, or a rule, ruling or ledger sitting on an unlanded branch.
/batch-merge-subject-is-not-evidence-a-member-landedYou are about to close, delete the branch of, or mark as landed a pull
request because a batch, roll-up or merge-train commit on the target branch
names it in the subject line, and because the member's own commits all
predate that merge by wall clock. Neither of those is evidence. A batch
branch is assembled at some moment BEFORE it merges, so anything the member
pushed after assembly is outside it, and the subject records INTENT at
assembly time rather than CONTENT at merge time. Use before closing a
member, when an ancestry check against a squashed batch says no, or when a
member's branch still shows commits ahead of the target. Compare file
content against the target branch instead, expecting exactly one legitimate
difference: the shared aggregate file every member appends to.
/check-a-stale-branch-is-not-undoing-newer-main-workA branch built on an out-of-date main is about to merge, or has merged, and may undo work
that landed since. Use when a green, conflict-free PR deletes files you never touched,
newer values or a whole redesign vanish after a sibling PR merged, rows of a shared ledger
(tracker, registry, CHANGELOG) disappear or revert, or when `git diff main...HEAD` or a
reviewer says your small PR touches dozens of files you did not change.
/ci-leg-skipping-moves-minutes-it-does-not-remove-themYou are about to propose, price or approve a CI cost saving that works by
making a job or matrix leg SKIP on pull requests — a path filter, a safe
list, a changed-files gate, an exemption list. Check first whether the
pipeline runs a complement or backstop on merge, on push, or nightly:
many do, and then the legs a pull request skipped are exactly the legs some
later run executes, so a branch that goes green once and merges bills the
same total either way and the wall clock does not move at all. Use when
pricing a filter change, when a percentage saving is quoted with no basis,
or when choosing between filtering legs and batching pull requests. The
question that separates money from bookkeeping is whether the change
removes RUNS or merely moves LEGS.