Repository navigation
Description
Architecture Finding
Type: tech-debt (missing CI gate)
Affected area: repo-wide — src/components/, src/app/, scripts/
Cross-file duplicated boilerplate keeps recurring across this repo, and it
has only ever been caught by manual per-session scanning, not by CI. At
least 19 distinct "extract shared X" / dedupe PRs have already merged, each
in a different pair of files/packages, including:
- refactor: extract shared fetchAllPages helper for REST pagination #7313 — shared
fetchAllPageshelper for REST pagination - Consolidate duplicate PrometheusRule alert definitions into alerts.yaml #7317 — consolidated duplicate PrometheusRule alert definitions
- refactor: extract shared readFileWithinRoot path-containment guard #7325 — shared
readFileWithinRootpath-containment guard - test: dedupe mockWindow/restoreWindow helpers into windowTestUtils #7337 — deduped
mockWindow/restoreWindowtest helpers - refactor: dedupe TRACKED_REPOS across leaderboard generator scripts #7352 — deduped
TRACKED_REPOSacross leaderboard generator scripts - refactor: merge duplicate url.ts test coverage into one file #7368 — merged duplicate
url.tstest coverage into one file - refactor: extract shared getEnglishUrl into src/lib/url.ts #7382 — shared
getEnglishUrlintosrc/lib/url.ts - refactor: extract shared MobileNavLink component for mobile nav #7384 — shared
MobileNavLinkcomponent - refactor: extract shared TOCItem type and useIsDarkMounted hook #7411 — shared
TOCItemtype anduseIsDarkMountedhook - refactor: extract shared useHydratedTheme hook #7421 — shared
useHydratedThemehook - refactor: extract shared ChevronDownIcon for navbar dropdown toggles #7427 — shared
ChevronDownIconfor navbar dropdown toggles - refactor: extract shared ComingSoonHero component #7435 — shared
ComingSoonHerocomponent - refactor: extract shared FloatingDataParticles component #7442 — shared
FloatingDataParticlescomponent - refactor: extract shared ContactCard component #7449 — shared
ContactCardcomponent - refactor: extract shared NewsletterForm component #7451 — shared
NewsletterFormcomponent - refactor: consolidate duplicate versions test coverage #7453 — consolidated duplicate versions test coverage
- refactor: extract shared BackToTopButton from Footer/DocsFooter #7478 — shared
BackToTopButtonfrom Footer/DocsFooter - refactor: extract shared SuccessCheckmarkIcon from marketplace plugin modals #7488 — shared
SuccessCheckmarkIconfrom marketplace plugin modals
A fresh jscpd --min-lines 10 --min-tokens 50 scan of src/, scripts/
(excluding *.test.ts(x), CSS, and vendor/) still finds 0.67% duplicated
lines across 14 clone pairs today, several not yet reviewed, e.g.:
app/docs/page-map.tsduplicated againstapp/sitemap.ts(project-list
mapping logic)components/docs/DocsNavbar.tsxduplicated against
components/navbar/NavbarLogo.tsxcomponents/docs/MobileTOC.tsxduplicated against
components/docs/TableOfContents.tsxcomponents/navbar/MobileCommunitySection.tsxduplicated against
components/navbar/MobileContributeSection.tsxcomponents/Footer.tsxduplicated againstcomponents/docs/DocsFooter.tsx
at three more sites beyond the already-fixed back-to-top button (refactor: extract shared BackToTopButton from Footer/DocsFooter #7478)
(CSS duplication in app/globals.css and the CommunityDropdown/
ContributeDropdown pair were already reviewed in a prior scan and judged
lower-value/riskier to extract — excluded from this finding.)
Impact
Without an automated gate, every one of the 19 fixes above was found by
manual scanning rather than CI feedback, and new duplication (the five
sites above) accumulates between scans instead of being caught at PR time.
Recommendation
A companion PR adds .jscpd.json (1.0% threshold — just above the current
0.67% baseline so it fails on new duplication while giving headroom to
land a few more of the sites above before ratcheting down) and an
npm run duplication-check script that runs it.
Wiring this into CI still needs a .github/workflows/*.yml edit, which
this agent's token cannot push (no workflows permission at the
contributor tier). The exact addition needed, as a new step in an
existing lint-style job (or its own job — a sequencing choice left to
maintainer preference):
- name: Duplication check
run: npm run duplication-checkThis needs a human or an ISSUES_PRS_MERGE-tier agent to apply, since the
diff touches .github/workflows/.
Risk: governance (workflow-file permission ceiling at this agent's tier;
not a design call this agent can make).
Filed by architect agent (ACMM L6 — full mode)
— hive: agent=architect backend=copilot model=claude-opus-4.7 copilot=1.0.88
Activity
hivecommons-hive commentedon Oct 22, 2026
A merged PR referenced this issue without closing it. Carrying the remainder back here so the issue timeline shows what is still open.
Remainder from the PR body:
workflow-file CI wiring for the duplication-check
step requires a token with
workflowspermission, which this agent's tierdoes not have
This comment is edited in place by the task-list sweep on every cycle; it is not duplicated.
hivecommons-hive commentedon Oct 22, 2026
What to reply
/hive done: you did the step only you can do; Hive re-checks it and closes the issue once it is verified/hive approve: go with the recommendation/hive decision <your instructions>: go ahead, following your instructions/hive help: show these againIf what this issue waited on has been done (a merged fix, or an action taken outside this repository), a maintainer can reply
/fixedto close it as completed; Hive clears its park labels.Only a maintainer with write access can un-park; everything else is ignored. Full command reference: https://github.com/hivecommons/hive/blob/v5/src/docs/maintainer-commands.md.
clubanderson commentedon Oct 24, 2026
/hive decision Yes — add a jscpd ratchet gate, same tool and config in both kubestellar/docs (#7491, config PR #7492 merged) and kubestellar/console-kb (#3869, config PR #3870 merged); do not introduce a second duplication tool. Design: (1) commit a
jscpd-baseline.jsonwith the current clone count from the merged config; (2) aduplication-checkCI job runs jscpd and fails only if the clone count increases vs. baseline (never on existing debt); (3)continue-on-error: true(warning-only) for the first 2 weeks after the workflow lands, then flip to enforcing in a one-line follow-up; (4) a PR that lowers duplication updates the baseline downward in the same PR. The hive prepares the baseline file + npm script + exact workflow YAML; the owner pushes the.github/workflows/file since the hive token lacksworkflowsscope. Cross-linked: #7491 ↔ kubestellar/console-kb#3869. Labelledhold(owner push) +triage/accepted.hivecommons-hive commentedon Oct 27, 2026
Adding
kubestellar/console's instances to this accepted ruling (jscpd ratchet gate, same tool/config,continue-on-errorwarm-up per the decision above).Console has no
.jscpd.jsonand a current ad-hocjscpd --min-lines 10 --min-tokens 50scan ofpkg/,cmd/finds 411 clones / 5.39% duplicated tokens, concentrated inpkg/store'ssqlite_*.gorow-scan-loop pattern recurring acrossgpu/rewards/stellar*/userstables (already partly addressed:ListTeams/GetUserTeamsdedup merged via #24573/#24574).Filing the config-only PR for console now (same shape as docs #7492 / console-kb #3870's
.jscpd.json+ script):Decision taken by hive: applying the ruling on kubestellar/docs#7491. The CI-wiring step under.github/workflows/is the same owner-only remainder as docs/console-kb.— hive: agent=architect backend=copilot model=claude-opus-4.7 copilot=1.0.88
hivecommons-hive commentedon Oct 31, 2026
Applying this ruling in another repo in scope: kubestellar/console-marketplace
has the same pattern (19+ "extract shared X" / dedupe PRs merged over time,
every one found by manual architect scanning, no automated gate). Filed
kubestellar/console-marketplace#1030 (gate application + owner-only
workflow-wiring step) and opened kubestellar/console-marketplace#1031
(companion PR:
.jscpd.json+jscpd-baseline.json+scripts/jscpd-ratchet.mjs,baseline 10 clones today).
— hive: agent=architect backend=copilot model=claude-opus-4.7 copilot=1.0.88
chore: add jscpd duplication ratchet gate (#1031)
hivecommons-hive commentedon Oct 31, 2026
Applying this ruling in another repo in scope: kubestellar/homebrew-tap has
the same pattern (8+ "dedupe duplicated test helper/regex" PRs merged over
time — #704, #710, #743, #745, #756, #757/#758 — every one found by manual
architect scanning, no automated gate). Filed
kubestellar/homebrew-tap#767 (gate application + owner-only
workflow-wiring step) and opened kubestellar/homebrew-tap#768 (companion
PR:
.jscpd.json+jscpd-baseline.json+scripts/jscpd-ratchet.mjs,baseline 1 clone today). Note: unlike docs/console-marketplace, test files
are intentionally included in this repo's scan scope since that's where
its recurring duplication actually lives.
— hive: agent=architect backend=copilot model=claude-opus-4.7 copilot=1.0.88
chore: add jscpd duplication ratchet gate (#768)