Skip to content

chore: remove dead code left by the v1.0 single-entrypoint refactor - #1676

Open
GautamSharma99 wants to merge 3 commits into
anthropics:mainfrom
GautamSharma99:chore/remove-dead-code
Open

chore: remove dead code left by the v1.0 single-entrypoint refactor#1676
GautamSharma99 wants to merge 3 commits into
anthropics:mainfrom
GautamSharma99:chore/remove-dead-code

Conversation

@GautamSharma99

Copy link
Copy Markdown
Contributor

Fixes #1668 (items 1–3). 167 deletions, no insertions.

Three independent commits, ordered least to most contentious, so any of them can be dropped without touching the others:

Commit Removes
49b1663 checkTriggerAction + the now-unused @actions/core import
d90aa6c updateTrackingComment (comments/update-with-branch.ts)
39aaabf src/entrypoints/prepare.ts

Item 4 from the issue — the dead ALLOWED_TOOLS / DISALLOWED_TOOLS exports in create-prompt/index.ts — is not touched. Its trailing comment says it is kept so an H1 report's pointed-to file stays in sync with the live fix, and only maintainers can judge whether that still holds.

On the question I raised in #1668

I asked whether prepare.ts was retained deliberately before sending a deletion. Since I couldn't get an answer first, I went looking for evidence rather than assuming. It points to "left behind", and I'd rather show the work than ask you to take my word:

It has already drifted from the code that runs. The v1.0 refactor (#898) both moved the action to a single run.ts entrypoint and introduced WorkflowValidationSkipError handling. run.ts got it; prepare.ts never did:

Behaviour run.ts prepare.ts
WorkflowValidationSkipError handling yes no
skipped_due_to_workflow_validation_mismatch output yes no
Propagates GITHUB_TOKEN / GH_TOKEN to env yes no

So it isn't a redundant-but-equivalent copy; it is a stale description of the prepare phase. Anyone reading it to understand that phase gets the wrong answer.

Keeping it costs real maintenance. #1590 (acb0385, 4 Aug 2026) applied the workflow_run collaborator-permission change to prepare.ts and run.ts in parallel — a maintainer paid for the same change twice, and only one copy could ever execute. That is precisely the hazard this removes.

If it is being kept on purpose — a downstream consumer, or a documented manual invocation I couldn't find — drop commit 39aaabf and the other two still stand on their own.

Verification

$ grep -rn "entrypoints/prepare\|updateTrackingComment\|checkTriggerAction\|update-with-branch\|contains_trigger" \
    --exclude-dir=node_modules --exclude-dir=.git .
(no output)

Nothing anywhere in the repo — source, tests, workflows, docs, action.yml — still refers to any removed symbol or file. contains_trigger is included above because it was the only output checkTriggerAction produced, and it is not declared in action.yml.

  • bun test — 920 pass, 0 fail
  • bun run typecheck — clean
  • bun run format:check — clean

One thing I deliberately left

Deleting update-with-branch.ts leaves createBranchLink in comments/common.ts with no production caller, though test/comments-common.test.ts still covers it. Its siblings createJobRunLink and createCommentBody are still used by create-initial.ts.

I left it rather than expanding scope: removing it means deleting test cases too, and it's a generic link-formatting helper that a maintainer may want to keep alongside its siblings. Happy to remove it and the corresponding tests if you'd prefer — say the word and it's a one-line follow-up.

checkTriggerAction had no callers. run.ts calls checkContainsTrigger
directly, and the `contains_trigger` output the wrapper set is not declared
in action.yml, so nothing consumed it either.

Removing it leaves @actions/core unused in this module, so that import goes
too.
updateTrackingComment had no callers. Updating the tracking comment with a
branch link is now handled by updateCommentLink in
src/entrypoints/update-comment-link.ts, via checkAndCommitOrDeleteBranch.

Its helpers in comments/common.ts are left in place: createJobRunLink and
createCommentBody are still used by create-initial.ts, and createBranchLink
remains exported and covered by test/comments-common.test.ts.
prepare.ts is an unreferenced duplicate of run.ts's prepare phase. Nothing
imports it, action.yml does not invoke it, and no test covers it. The v1.0
refactor (anthropics#898) moved the action to a single run.ts entrypoint and stopped
referencing it, but left the file behind.

It has already drifted from the code that actually runs. run.ts gained
WorkflowValidationSkipError handling and the
skipped_due_to_workflow_validation_mismatch output in that same refactor,
and propagates GITHUB_TOKEN/GH_TOKEN into the environment; prepare.ts has
none of these. So the copy is not merely redundant — it is a stale
description of the prepare phase.

Keeping it also costs real maintenance: anthropics#1590 applied the workflow_run
collaborator-permission change to prepare.ts and run.ts in parallel, so a
maintainer paid twice for a change only one of which could ever execute.
That is the hazard this removes — a plausible-looking file where a
prepare-phase fix can be made with no runtime effect.

CLAUDE.md already documents run.ts as the single entrypoint.
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.

Dead code from the v1.0 single-entrypoint refactor: orphaned src/entrypoints/prepare.ts and three unused exports

1 participant