Skip to content

chore: remove unused Worker artifacts#179

Open
risu729 wants to merge 2 commits into
jdx:mainfrom
risu729:remove-unused-worker-artifacts
Open

chore: remove unused Worker artifacts#179
risu729 wants to merge 2 commits into
jdx:mainfrom
risu729:remove-unused-worker-artifacts

Conversation

@risu729
Copy link
Copy Markdown
Contributor

@risu729 risu729 commented May 10, 2026

What changed

  • Delete worker/index.ts, the stale Worker entrypoint that is no longer referenced by the active root wrangler.jsonc.
  • Delete web/wrangler.jsonc, a stale per-web-directory worker config with a different worker name and bindings not used by the root deployment flow.
  • Remove worker/** from deploy path filters and remove worker/**/* from root TypeScript/hk globs.
  • Remove recordUsage() from scripts/github-token.js because it posts to /api/token/usage, but that route is absent and current token checkout/rate-limit handling uses /api/token and /api/token/rate-limit.

History

  • c2f0eb18 (init, 2025-12-15) added worker/index.ts as the original Cloudflare Worker entrypoint and added recordUsage() with a planned /api/token/usage flow.
  • f7fc9576 (feat: migrate all routes from Worker to Astro SSR, 2025-12-17) moved the Worker route handlers into Astro pages and deleted most worker/routes/* files, but left worker/index.ts behind as a wrapper.
  • a3c67db9 (fix: point wrangler directly to Astro output, 2025-12-17) first stopped using worker/index.ts as the root wrangler entrypoint by pointing main at Astro output. Later, 389d6a5a (Finish Astro 6 Cloudflare runtime migration, 2026-05-01) made src/worker.ts the active custom wrapper for Astro 6. Those commits changed the active entrypoint but did not remove the old worker file, deploy path filter, or TypeScript/hk globs.
  • 573b0782 (feat: migrate web frontend to Astro SSR, 2025-12-17) added web/wrangler.jsonc for the web package. The deploy workflow has continued to build web and deploy from the repository root, and root wrangler.jsonc is now the canonical Cloudflare config, so the web-local wrangler config became a stale parallel config.
  • The token_usage table is created and then dropped by the historical migration list in src/migrations.ts, and no active Astro route serves /api/token/usage. That makes recordUsage() dead while leaving get-token and mark-rate-limited intact for the active token pool.

Why this is safe

The active deployment path is .github/workflows/deploy.yml -> npm run build -w web -> cloudflare/wrangler-action from the repo root -> root wrangler.jsonc -> src/worker.ts. None of those steps references worker/index.ts or web/wrangler.jsonc.

The active token manager API still exists and is not removed here: /api/token, /api/token/rate-limit, token admin pages, src/database.ts, the DB binding, and token migrations remain. This PR only removes the unused helper for a route that does not exist.

GitHub App/webhook cleanup is intentionally split out to #181. This PR leaves scripts/deploy.sh, /webhooks/github, and GitHub App secret declarations/comments alone so Worker-entrypoint cleanup can be reviewed independently.

Compatibility boundaries

This PR does not remove legacy mise version endpoints, /api/track, /api/tools/:tool, Python precompiled .gz endpoints, token manager API routes, src/database.ts, the DB binding, admin token pages, or historical migrations.

Current mise clients moved from root version endpoints to /tools/:tool.toml in jdx/mise#7378, and install tracking moved from /api/track to /api/tools/:tool in jdx/mise#9527. Those compatibility endpoints are intentionally left in place because old mise versions may still call them.

Recent removal of src/pipelines.ts / MISE_VERSIONS_STREAM means this cleanup also does not preserve obsolete Pipeline references.

Validation

Passed:

  • npm run test:js
  • npm run test:shell
  • bunx tsc --noEmit
  • npm run build -w web
  • git diff --check
  • rg found no remaining references to worker/index, web/wrangler, api/token/usage, or recordUsage.

Known unrelated local failure:

  • cd web && bunx tsc --noEmit fails on upstream's unchanged TypeScript 6 baseUrl deprecation before project checking. The production web build passes.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 10, 2026

Greptile Summary

This PR removes stale Cloudflare Worker artifacts (worker/index.ts, web/wrangler.jsonc) and scrubs their references from path filters, TypeScript/hk globs, and the github-token.js script. All changes in the diff are correct: src/worker.ts (referenced by the root wrangler.jsonc) is the active entrypoint, so deleting worker/index.ts and the per-web wrangler config is safe.

  • worker/index.ts and web/wrangler.jsonc deleted; active entrypoint and deploy config confirmed in src/worker.ts + root wrangler.jsonc.
  • recordUsage() and the fs import removed from scripts/github-token.js; the /api/token/usage route is absent and the backing token_usage table has been dropped.
  • The PR description claims scripts/deploy.sh and web/src/pages/webhooks/github.ts are also removed, but neither is in the diff; GITHUB_APP_ID/GITHUB_PRIVATE_KEY/GITHUB_WEBHOOK_SECRET references remain in web/env.d.ts and root wrangler.jsonc.

Confidence Score: 5/5

Safe to merge; all deleted and modified files are confirmed unused, with no impact on the active worker entrypoint or deployment pipeline.

Every deletion is backed by cross-checked evidence: src/worker.ts is the live entrypoint, the root wrangler.jsonc is the live deploy config, and no callers of recordUsage() remain. The only gap is that two files mentioned in the PR description (scripts/deploy.sh, web/src/pages/webhooks/github.ts) were not actually deleted in this diff, but their presence does not affect runtime behavior.

scripts/deploy.sh and web/src/pages/webhooks/github.ts are described as deleted in the PR but still exist; no files in the actual diff need special attention.

Important Files Changed

Filename Overview
.github/workflows/deploy.yml Removes worker/** from path filters; correct since the active entrypoint is under src/, not worker/.
hk.pkl Removes worker/**/*.ts from the tsc glob; consistent with the deletion of worker/.
scripts/github-token.js Removes recordUsage() function, fs import, and the record-usage action from the CLI; the /api/token/usage route is absent and the token_usage table has been dropped.
tsconfig.json Removes worker/**/* from the TypeScript include glob; correct after worker/ directory deletion.
web/wrangler.jsonc Deleted stale per-web-subdirectory wrangler config; deployment uses the root wrangler.jsonc pointing to src/worker.ts.
worker/index.ts Deleted unused Cloudflare Worker entrypoint; the active entrypoint confirmed as src/worker.ts via root wrangler.jsonc.

Reviews (2): Last reviewed commit: "Keep GitHub App cleanup separate" | Re-trigger Greptile

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request removes the Cloudflare Worker implementation and associated GitHub App integration components. Key changes include the deletion of the worker directory, the removal of the GitHub webhook handler, and the decommissioning of the recordUsage functionality in scripts/github-token.js. Additionally, several GitHub-related environment variables and secrets have been removed from the configuration and type definitions. I have no feedback to provide as there were no review comments.

@risu729 risu729 changed the title Remove unused Worker and deployment artifacts Remove unused Worker artifacts May 11, 2026
@risu729
Copy link
Copy Markdown
Contributor Author

risu729 commented May 11, 2026

Follow-up commit cac864a narrows this PR to Worker/config cleanup only. The GitHub App webhook/deploy-script cleanup from the original draft was restored here and split into #181, so this PR now deletes only worker/index.ts, web/wrangler.jsonc, stale worker path/glob references, and the dead recordUsage() helper.

@risu729 risu729 changed the title Remove unused Worker artifacts chore: remove unused Worker artifacts May 11, 2026
@risu729 risu729 marked this pull request as ready for review May 11, 2026 11:41
Copilot AI review requested due to automatic review settings May 11, 2026 11:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes stale Cloudflare Worker artifacts and related tooling references that are no longer part of the active Astro SSR + root wrangler.jsonc deployment flow, and trims dead token-manager helper code for an unimplemented /api/token/usage endpoint.

Changes:

  • Delete the obsolete Worker entrypoint (worker/index.ts) and the stale per-web wrangler.jsonc.
  • Narrow TypeScript / hk tsc globs to exclude removed Worker sources.
  • Remove the unused recordUsage() helper and related CLI/action references from scripts/github-token.js.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
worker/index.ts Deletes the deprecated Worker entrypoint wrapper.
web/wrangler.jsonc Removes a stale, unused per-package Wrangler config.
tsconfig.json Removes worker/**/* from root TypeScript include globs.
scripts/github-token.js Removes dead recordUsage() helper and related exports/messages.
hk.pkl Updates hk tsc glob to only cover src/**/*.ts.
.github/workflows/deploy.yml Removes worker/** from deploy workflow path filters.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants