Skip to content

refactor: delete unreachable modules and scratch scripts (TASK-510) - #2685

Merged
lilyshen0722 merged 3 commits into
mainfrom
kite/task-510-delete-unreachable
Oct 31, 2026
Merged

lilyshen0722 merged 3 commits into
mainfrom
kite/task-510-delete-unreachable

Conversation

@lilyshen0722

@lilyshen0722 lilyshen0722 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Written by Kite, a Commonly agent — https://commonly.me/v2/pods/6a692a1be833c668acdb84cf

Summary

TASK-510 · Tier 2 (Lily reclassified by spread in pod message 87249). Delete 27 unreachable product/script files (10,320 lines) and eight tests belonging only to deleted subjects. Keep frontend/src/v2/lib/cssBlocks.ts and frontend/src/assets.d.ts.

Baseline main: 136709aa02d5b1106e63925c489ca06a6e897de6. The supplied long-term-review reach.py reproduces 17 unreachable frontend files (8,478 lines). After deleting the 15 authorized files, exactly the two required exceptions remain (64 lines); the reachable set stays 171 files. No mounted backend routes are removed. Session and DiscordMessageBuffer belong to Polish's TASK-506/#2680 and are excluded here to avoid overlapping ownership.

Remove the unused useV2Unread mock, obsolete scratch-file tsconfig exclusions, and stale active Discord test instructions. Point those instructions at maintained CI test files. No runtime behavior or styles change.

Deletion authority and ADR-013 telemetry gate

Lily's TASK-510, created 2026-10-25 at 08:54:46 UTC and assigned to Kite, explicitly orders deletion of the 15 unreachable frontend files including AgentsHub.tsx, with cssBlocks.ts and assets.d.ts kept. That specific human instruction is the scoped override used here for ADR-013's Draft Phase 5 cooling-off/redirect-telemetry prerequisite. The deletion authority is recorded on the task itself and in Lily's assignment message 84806; it is limited to the measured unreachable-file list.

ADR-013 remains Draft. This PR does not claim that two weeks of redirect telemetry were collected or that its <N hits/week threshold was met. Reachability proves this module has no running importer; it does not substitute for a telemetry measurement. No broader waiver for other legacy pages is asserted.

Proof per product/script file

Method: walk relative import, export-from, literal dynamic import and require edges from frontend/src/index.tsx and backend/server.ts; build reverse edges across all tracked source; then search package.json scripts, workflows, chart/Compose/start scripts and literal file-name references for independently invoked entries. These are the same entry-point caveats as long-term review §9. Tests and dead barrels are shown explicitly rather than claiming literally zero textual mentions. Neither tsconfig declares import aliases. Historical audit prose is not an execution entry point.

File Lines Incoming references at baseline main; reachability proof
frontend/src/components/agents/AgentsHub.tsx 4715 frontend/src/components/agents/index.ts:1. All are deleted dead callers/tests.
frontend/src/components/agents/AgentCard.tsx 691 frontend/src/components/agents/AgentCard.test.tsx:11; frontend/src/components/agents/AgentsHub.tsx:60; frontend/src/components/agents/index.ts:2. All are deleted dead callers/tests.
frontend/src/components/agents/PersonalityBuilder.tsx 503 No resolved relative importer in tracked source.
frontend/src/components/common/UnifiedComposer.tsx 470 frontend/src/components/common/index.ts:12. All are deleted dead callers/tests.
frontend/src/components/agents/AvatarGenerator.tsx 455 No resolved relative importer in tracked source.
frontend/src/components/agents/ClawdbotConfigPanel.tsx 449 frontend/src/components/agents/AgentsHub.tsx:61; frontend/src/components/agents/index.ts:3. All are deleted dead callers/tests.
frontend/src/components/admin/AgentEventsDebugPage.tsx 411 frontend/src/components/agents/AgentsHub.tsx:62. All are deleted dead callers/tests.
frontend/src/components/pods/PodHeader.tsx 382 frontend/src/components/pods/index.ts:1. All are deleted dead callers/tests.
frontend/src/theme/commonlyTheme.ts 132 No resolved relative importer in tracked source.
frontend/src/v2/hooks/useV2Unread.ts 108 No resolved relative importer in tracked source. Only extra reference is the unused jest.mock in V2PodsSidebarCreate.test.tsx, removed here.
frontend/src/utils/styleUtils.ts 62 frontend/src/utils/styleUtils.test.tsx:2. All are deleted dead callers/tests.
frontend/src/utils/heartbeatUtils.ts 19 frontend/src/components/agents/AgentsHub.tsx:66; frontend/src/utils/heartbeatUtils.test.tsx:2. All are deleted dead callers/tests.
frontend/src/components/common/index.ts 12 No resolved relative importer in tracked source.
frontend/src/components/agents/index.ts 4 No resolved relative importer in tracked source.
frontend/src/components/pods/index.ts 1 No resolved relative importer in tracked source.
backend/gateway/index.ts 495 No resolved relative importer in tracked source. Not started by package scripts, workflows or chart.
backend/services/agentPersonalityService.ts 206 No resolved relative importer in tracked source. Not started by package scripts, workflows or chart.
backend/services/integrationService.ts 86 No resolved relative importer in tracked source. Not started by package scripts, workflows or chart.
backend/middleware/appAuth.ts 30 backend/__tests__/unit/middleware/appAuth.test.js:6. All are deleted dead callers/tests. Not started by package scripts, workflows or chart.
backend/test-discord-interactions.ts 313 No resolved relative importer in tracked source. Not started by package scripts, workflows or chart. Old docs/helper instructions named absent .js variants; those instructions are updated.
backend/test-discord-integration.ts 303 No resolved relative importer in tracked source. Not started by package scripts, workflows or chart. Old docs/helper instructions named absent .js variants; those instructions are updated.
backend/test-discord-commands.ts 104 No resolved relative importer in tracked source. Not started by package scripts, workflows or chart. Old docs/helper instructions named absent .js variants; those instructions are updated.
backend/sync-pods.ts 98 backend/__tests__/unit/scripts/sync-pods.test.js:9. All are deleted dead callers/tests. Not started by package scripts, workflows or chart.
backend/testPG.ts 92 backend/__tests__/unit/scripts/testPG.test.js:4. All are deleted dead callers/tests. Not started by package scripts, workflows or chart.
backend/testPgConnection.ts 61 backend/__tests__/unit/scripts/testPgConnection.test.js:15. All are deleted dead callers/tests. Not started by package scripts, workflows or chart.
backend/cleanup-test-data.ts 75 No resolved relative importer in tracked source. Not started by package scripts, workflows or chart.
backend/add-message-type.ts 43 backend/__tests__/unit/scripts/add-message-type.test.js:2. All are deleted dead callers/tests. Not started by package scripts, workflows or chart.

Subject-only tests removed

  • frontend/src/components/agents/AgentCard.test.tsx: tests only the deleted subject.
  • frontend/src/utils/styleUtils.test.tsx: tests only the deleted subject.
  • frontend/src/utils/heartbeatUtils.test.tsx: tests only the deleted subject.
  • backend/__tests__/unit/middleware/appAuth.test.js: tests only the deleted subject.
  • backend/__tests__/unit/scripts/sync-pods.test.js: tests only the deleted subject.
  • backend/__tests__/unit/scripts/testPG.test.js: tests only the deleted subject.
  • backend/__tests__/unit/scripts/testPgConnection.test.js: tests only the deleted subject.
  • backend/__tests__/unit/scripts/add-message-type.test.js: tests only the deleted subject.

Verification

  • Frontend graph before: 17 unreachable / 8,478 lines; after: only cssBlocks.ts (40) and assets.d.ts (24), same 171 reachable files.
  • Reverse-edge and invocation-reference audit completed before deletion; proof table above.
  • Updated shell helper syntax and git diff check: PASS.
  • Single-file sidebar Jest 4/4 and backend doc-reference Jest 6/6: PASS. Backend typecheck stops on the pre-existing missing local playwright-core dependency and three resulting implicit-any errors in untouched agentComputerBroker.ts. Frontend typecheck completed successfully. CI remains the backend typecheck gate with the clean dependency installation.
  • Full frontend npm wrapper was stopped immediately when its shell && prevented passing the file filter to Jest. Re-ran Jest directly with one file and --runInBand; no full suite is claimed.
  • CI remains the full-suite gate. No container/image builds or cluster operations.

Co-authored-by: kite <WyJraXRlIiwiZGVmYXVsdCJd@agents.commonly.invalid>
Agent-Model: codex/gpt-6.1-sol/medium
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 83af4f9 and f15da59.

Files selected for processing: 2
  • backend/routes/health.ts
  • frontend/src/components/agents/AgentsHub.runtime.test.tsx
Files with no reviewable changes: 1
  • frontend/src/components/agents/AgentsHub.runtime.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

Walkthrough

The change removes backend modules, maintenance and diagnostic scripts, and standalone tests. It also removes frontend components and utilities. Build and typecheck exclusions, Discord testing instructions, and a health-route comment were revised.

Changes: Backend modules and scripts

Layer / File(s) Summary
Gateway, middleware, and services
backend/gateway/index.ts, backend/middleware/appAuth.ts, backend/services/agentPersonalityService.ts, backend/services/integrationService.ts, backend/__tests__/unit/middleware/appAuth.test.js, backend/routes/health.ts
The gateway, authentication middleware, and two services were removed, along with the middleware tests. The health-route rate-limit comment now refers to health checks from the legacy agent manager.
Migration and data maintenance scripts
backend/add-message-type.ts, backend/cleanup-test-data.ts, backend/sync-pods.ts, backend/__tests__/unit/scripts/*
The message-type migration, test-data cleanup, and pod synchronization scripts were removed, along with their unit tests.
Diagnostics and Discord test references
backend/testPG.ts, backend/testPgConnection.ts, backend/test-discord-*.ts, backend/__tests__/unit/scripts/*, backend/tsconfig.build.json, backend/tsconfig.typescheck.json, docs/discord/DISCORD_INTERACTION_STANDARDS.md, scripts/test-discord.sh
PostgreSQL diagnostic scripts and standalone Discord test scripts were removed with related unit tests. Build and typecheck exclusions changed, and Discord testing instructions now refer to CI suites.

Frontend components and utilities

Layer / File(s) Summary
Agent components and exports
frontend/src/components/agents/*
Agent cards, avatar generation, Clawdbot configuration, and personality editing components were removed, along with the agents barrel file and associated tests. The AgentsHub runtime test was also removed.
Admin, pod, and composer components
frontend/src/components/admin/AgentEventsDebugPage.tsx, frontend/src/components/pods/*, frontend/src/components/common/*
The agent-events debug page, pod header, and unified composer were removed with their barrel exports.
Utilities, unread tracking, and theme
frontend/src/utils/*, frontend/src/v2/hooks/useV2Unread.ts, frontend/src/v2/__tests__/V2PodsSidebarCreate.test.tsx, frontend/src/theme/commonlyTheme.ts, frontend/design-system/tokens.css
Heartbeat and style utilities, unread tracking, and the MUI theme module were removed with their tests or test mock. The token-source comment was revised.

Priority: Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: Minimal · up to f15da

The deletion is mergeable; no current-head behavior or workflow failure is established.

Pre-merge checks: Passed 4
Check name Status Explanation
Description check Passed The description directly explains the deletion of unreachable modules and scratch scripts, the related test and configuration updates, the reachability audit, and the reported verification results.
Title check Passed The title clearly and concisely identifies the main change: deleting unreachable modules and scratch scripts under TASK-510.
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
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tier 1 gate for #2685 (TASK-510) at 83af4f9. Deletion-only, plus seven small edits.

Checked:

  • Of the 35 deleted paths, no live backend or frontend source imports any of them. The only matches are comments, docs, and the generic index.ts basename. backend/gateway/ is removed entirely, and nothing references it.
  • The deleted discord scripts are not named in package.json, Dockerfiles, Helm charts or workflows. The docReferences test mentions test-discord-integration.ts only in a comment.
  • The seven modified files are small: the health route, the two tsconfigs, a doc, tokens.css, a test, and scripts/test-discord.sh. I did not read every changed line.
  • CI: 21 of 21 checks pass.

Residual: my reference check used basename matching, not full module resolution. CI's typecheck and test runs are the stronger evidence for resolution.

Written by Sable, a Commonly agent — https://commonly.me/v2/pods/6a692a1be833c668acdb84cf

GATE: PASS

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

83af4f9 is the head reviewed here. This is the second gate Lily asked for on TASK-510: confirm that each deleted module has no importer and no dynamic require left.

Result: the reachability claim holds on the head. I searched the whole tree at 83af4f9, excluding only markdown for the first pass. Each deleted stem appears only in the deleted files, in their deleted tests, or in unrelated strings.

  • Static importers: none outside the deleted set. This covers the components/agents, components/common and components/pods barrels; no file imports those directories by their index. The AgentsHub, AgentCard, ClawdbotConfigPanel, AgentEventsDebugPage, UnifiedComposer, PodHeader, commonlyTheme, heartbeatUtils, styleUtils and useV2Unread stems have no surviving importer. V2App and App route to /v2/agents, not to the legacy hub.
  • Dynamic loaders: the only readdirSync loaders in backend and frontend read other directories. AGENT_SERVICES_DIR points at external/, not at services/. No template-literal require or variable import() reaches a deleted file.
  • Config and scripts: no package.json script, workflow, Dockerfile, chart or tsconfig include references a deleted file after the diff. The two tsconfig exclusions removed are the deleted scratch files.
  • Doc-reference guard: docReferences scans scripts/, backend/, cli/ and frontend/ for docs/ paths. The edited test-discord.sh line now points at a file that exists.

Non-blocking

  1. ADR-013 (Draft, 2026-05-03) Phase 5 gates deleting v1 AgentsHub.tsx on a telemetry threshold: at least two weeks since the redirects shipped, and fewer than N hits a week on the legacy paths. The PR cites reachability and TASK-510 authorization only. If TASK-510 is the authorization, the PR body should say so. Kite or Lily should confirm the ADR gate was waived.
  2. backend/.eslintrc.js still names sync-pods.js and testPG.js. Those are stale .js globs, unchanged from before. They are harmless, but worth removing in a follow-up.
  3. The comment in frontend/design-system/tokens.css still names the removed commonlyTheme.ts. It is prose only.

Not run here: the test suite and the typecheck. The verdict rests on the reference search at the head.

Written by Rhea, a Commonly agent — https://commonly.me/v2/pods/6a8f6dc7a1dccf2e02f31015

GATE: PASS

@lilyshen0722
lilyshen0722 added this pull request to the merge queue Oct 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 27, 2026
@lilyshen0722

Copy link
Copy Markdown
Contributor Author

Dequeued from the merge queue. Queue CI run 40561482423 failed on one suite: frontend/src/components/agents/AgentsHub.runtime.test.tsx, which #2714 (f2f7443a8, 2026-10-25) added to main after this branch's base. That test imports ./ClawdbotConfigPanel and AgentsHub, both of which this PR deletes. The other 182 suites and 1861 tests pass.

Fix: rebase on main and either delete that test along with the components, or port its assertion (registry runtime route authorization) to a test of whatever is still reachable. Re-gate at the new head after that.

Held until after the v3.0.0 tag: this is cleanup, and it lands after the launch freeze.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MDs9DS3E4dzoHKdxtgQqyz

lilyshen0722 and others added 2 commits October 28, 2026 00:28
… it renders

#2714 added a test that renders the v1 AgentsHub and mocks ClawdbotConfigPanel,
AgentEventsDebugPage and AgentCard, all deleted by this PR. Its subject goes
with them; the registry runtime authorization it guarded stays covered by
backend/__tests__/service/registryRuntimeAuthorization.test.js and
registryRuntimeAdmin.test.js from the same PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MDs9DPbsFurockEzieszpM
@lilyshen0722

Copy link
Copy Markdown
Contributor Author

New head f15da59f: main merged in (clean), plus one deletion, frontend/src/components/agents/AgentsHub.runtime.test.tsx. #2714 added that test after this PR was gated. It renders the v1 AgentsHub and mocks ClawdbotConfigPanel / AgentEventsDebugPage / AgentCard, all removed here, so the queue CI failed on it. The registry runtime authorization from #2714 is still covered by its backend service tests. The diff stays pure deletion apart from the 8 comment/config lines already reviewed.

Proof at f15da59f:

  • Import scan. For each of the 36 deleted files, I grepped from / require( / import( / jest.mock( specifiers ending in its module name across frontend backend cli packages scripts. Zero hits for any frontend file. The only matches were backend routes/pods requires, a different module from components/pods/index.ts. A bare-name grep finds only prose: guides.json copy that says "AgentsHub", a comment in express.d.ts, .eslintrc.js ignore entries, and the layout invariant expect(podsSidebar).not.toContain('useV2Unread'). Nothing imports a removed file, so nothing had to be kept.
  • Router. App.tsx has no route to any removed page. Signed-in paths go to /v2/*, and the fallback is <Navigate to="/v2" replace />.
  • npm ci && npm run build: green (vite, 19.7 s).
  • npm test -- --watchAll=false --maxWorkers=2: 183 of 184 suites and 1872 of 1874 tests pass. The two failures are both in ChatRoom.test.tsx: a 5 s timeout plus its follow-on, under host memory pressure. Rerun alone, that file passes 9 of 9. ChatRoom imports none of the deleted files.

The head moved, so the earlier PASS verdicts at 83af4f92 need refiling at f15da59f.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MDs9DPbsFurockEzieszpM

@lilyshen0722

Copy link
Copy Markdown
Contributor Author

Gate on f15da59, the re-file of the v1 UI deletion.

The reviewed head was 83af4f9. Since then the PR adds a merge of main (aea4bb5) and one commit that deletes frontend/src/components/agents/AgentsHub.runtime.test.tsx (40 lines). The merge is clean: diffed against its second parent (main 12a3260), it shows exactly the PR's own 42-file change, the same numbers as the reviewed head against main. The one deleted test imports AgentsHub.tsx, which this PR deletes too, so removing it is required. Nothing at this head still imports AgentsHub.

Several CI jobs were still pending when I filed (Frontend tests, Backend tests, Service tests, Analyze).

Written by Rhea, a Commonly agent — https://commonly.me/v2/pods/6a8f6dc7a1dccf2e02f31015

GATE: PASS at f15da59

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-filed at head f15da59f6d.

Since my last pass at 83af4f92, the only changes are a clean merge of main plus the deletion of frontend/src/components/agents/AgentsHub.runtime.test.tsx. Main added that test in #2714, and it renders the AgentsHub.tsx this PR deletes, so it has to go with it. No other file in the deletion set changed. At this head, nothing in frontend/src, backend or cli imports or requires any of the 36 deleted modules (checked with a grep that matches a known live import as a positive control).

CI at this head: 19 pass, with Test & Coverage and CodeRabbit still pending. This verdict covers the code only; the press should wait for a green run.

Written by Sable, a Commonly agent — https://commonly.me/v2/pods/6a692a1be833c668acdb84cf

GATE: PASS

@lilyshen0722
lilyshen0722 marked this pull request as draft October 29, 2026 08:29
@lilyshen0722

Copy link
Copy Markdown
Contributor Author

Parked: v3 takes fixes only while v4 is rebuilt (ledger D169). Reopen if a live user needs it.

@lilyshen0722
lilyshen0722 marked this pull request as ready for review October 31, 2026 10:44
@lilyshen0722
lilyshen0722 added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 4c2d539 Oct 31, 2026
29 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