refactor: remove dead EditPageLink.tsx duplicating DocsSourceActions security logic - #145
Conversation
…logic EditPageLink.tsx was only imported by its own test file; DocsLayout.tsx renders DocsSourceActions.tsx instead, which supersedes it. The dead file kept an independent copy of security-sensitive path-sanitization and GitHub-edit-URL validation logic, risking silent drift from the live implementation. Signed-off-by: architect <architect@hive.kubestellar.io>
Signed-off-by: architect <architect@hive.kubestellar.io>
Signed-off-by: architect <architect@hive.kubestellar.io>
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "architect" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will automatically remove the |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for hivecommons-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Read the tree at main, not just the diff. Looks correct to me.
EditPageLink(default + named exports) is imported nowhere except its own test — the onlyEditPageLinkreferences in the repo aresrc/__tests__/EditPageLink.test.tsxand the component itself.- The one named export,
buildGitHubEditUrl, is not shared:DocsSourceActions.tsx:29declares its own private (non-exported)buildGitHubEditUrl, used atDocsSourceActions.tsx:106. So nothing loses behaviour here; the PR body's "duplicated security logic" description matches what the files contain. DocsLayout.tsxrendersDocsSourceActions, as the body says.- Coverage: deleting a 100%-covered file can lower global percentages, so I ran
npx vitest run --coverageon this head: 77/77 files, 726/726 tests, all files 77.93% lines / 71.62% branches / 77.16% funcs / 79.31% stmts — comfortably above thevitest.config.ts:27thresholds (68/54/65/67).
No findings. Pure dead-code removal; safe to merge from my read.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Refactor
Removes
src/components/docs/EditPageLink.tsxand its testsrc/__tests__/EditPageLink.test.tsx. The component is dead code: it isimported only by its own test, while production rendering
(
DocsLayout.tsx) usesDocsSourceActions.tsx, which supersedes it.The dead file carried an independently maintained copy of
security-sensitive logic (
STATIC_EDIT_BASE_URLS,isValidGitHubEditUrl(),buildGitHubEditUrl()including path-traversalsanitization) that also lives in
DocsSourceActions.tsx. A future fix tothe live validation/sanitization logic would not propagate here, leaving a
stale, still-passing copy that gives false confidence.
Verified:
npm run type-check,npm test(726/726 passing), andnpm run lint(0 errors, pre-existing warnings only) all pass with thefiles removed. No other file imports
EditPageLink.Closes #144
Filed by architect agent (ACMM L5 — hold-gated mode). Hold-gated: human review required.
— hive: agent=architect backend=copilot model=claude-sonnet-5 copilot=1.0.88