Skip to content

refactor(core): remove dead branches and codify a no-dead-code rule - #354

Merged
totollygeek merged 2 commits into
masterfrom
claude/marketplace-codex-gemini-setup-ksau6v
Aug 13, 2026
Merged

refactor(core): remove dead branches and codify a no-dead-code rule#354
totollygeek merged 2 commits into
masterfrom
claude/marketplace-codex-gemini-setup-ksau6v

Conversation

@totollygeek

@totollygeek totollygeek commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What & why

The coverage push (#352) surfaced branches that can never execute. This PR removes the genuinely dead ones and writes the policy down so the distinction stays sharp.

Dead code removed — by making the impossible state unrepresentable, not by deleting guards:

  • cli.ts parseParallel now takes string: its one call site always passes the sliced text after the parallel flag's equals sign, so the undefined arm could never run.
  • ci.ts jobBootstrap now requires its CiPinResolver: it is only called from the resolver-present branch of withPins, so both the optional call and the DEFAULT_ZUKE_ACTION fallback were unreachable there. The pipeline-level fallback, which is reachable, stays.
  • ci_schedule.ts caseList now excludes the wildcard from its parameter type: memberTest answers the wildcard before ever building a membership list, so that arm was dead.
  • ci.ts pathForField JSDoc claimed a lowercase field name reduces to the provider default — the match is deliberately case-sensitive so camelCase word boundaries are never split, and the doc now says what the code does.

Deliberately NOT removed: runtime-unreachable narrowing that the type system forces — a nullish-coalescing fallback after a map lookup, an instanceof-Error check inside a catch, an undefined check after an array find. Deleting those would require the banned non-null assertion or an as cast; they are the cost of guideline 1, not dead code.

The rule, codified in three places: coding guideline 10 in AGENTS.md — the full statement, including that an uncoverable branch is the signal to delete the branch, not to feed the coverage gate — mirrored as coding standard 6 in CONTRIBUTING.md, and a new checklist line in the PR template.

Related issues

Follow-up to #352 — acts on the dead-code observations from its coverage review.

Checklist

  • The PR title is a Conventional Commit (type(scope): summary).
  • deno task ci passes locally (lint, fmt, type-check, tests, spell).
  • Tests were added or updated; coverage stays at 95%+ (lines and branches) — 98.4% lines and 97.5% branches; the existing suites cover the tightened signatures.
  • Docs updated in the same PR (AGENTS.md, CONTRIBUTING.md, PR template, the corrected pathForField JSDoc).
  • Public API changes were regenerated with ./zuke apiDocs — not applicable, all changed functions are module-internal.
  • No any, no as casts or ! non-null assertions in src/ (narrow with type guards instead).
  • No dead code: unreachable branches and can't-fire fallbacks are removed, with types tightened so the impossible state is unrepresentable.
  • The code is written using AI assisted coding.

🤖 Generated with Claude Code

https://claude.ai/code/session_019As9A3ugixLQiAvcat1ZKk

The coverage push surfaced arms that can never run: parseParallel's
undefined case (its one call site always slices a string), the
job-level bootstrap fallback behind an optional resolver that is never
absent (the parameter is now required), and caseList's wildcard arm
that memberTest answers before ever calling it (the parameter type now
excludes it). pathForField's doc claimed a lowercase field name reduces
to the provider default when the match is deliberately case-sensitive
to protect camelCase word boundaries — the doc now says what the code
does.

The distinction the new rule draws: narrowing the type system forces is
not dead code — the no-as/no-non-null style demands it — but a branch
still unreachable once types are as tight as the call sites allow gets
deleted, never covered for the gate's sake. Recorded as coding
guideline 10 in AGENTS.md, mirrored in CONTRIBUTING.md and the PR
checklist.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019As9A3ugixLQiAvcat1ZKk
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Zuke AI review

🔎 security review — review

Score: 0/10 · Severity: none · 0 finding(s)

Tokens: 24311 in · 35 out · 24346 total

Budget: 24,346 tokens of 500,000 tokens

No security issues were introduced by these documentation and type-tightening changes.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Zuke AI review

🔎 generic review — review

Score: 0/10 · Severity: none · 0 finding(s)

Tokens: 11771 in · 184 out · 11955 total

Budget: 40,305 tokens of 500,000 tokens

Refuted by verification (not reported):

Finding Reason
Removed bootstrap fallback now relies entirely on resolver presence The change removes the optional parameter and the fallback only because jobBootstrap is now only called from the resolver-present path, and the existing comment plus the new required pins: CiPinResolver type make the missing-resolver failure path unreachable in the shown code.

The patch is mostly documentation and type-tightening; the only code change worth flagging is a narrowly scoped API assumption that removes a fallback path and could surface as a hard failure if the surrounding invariant ever regresses.

A workflow re-run reuses the original event payload, so the lint kept
judging the pre-edit description.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019As9A3ugixLQiAvcat1ZKk
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Zuke AI review

🔎 security review — review

Score: 0/10 · Severity: none · 0 finding(s)

Tokens: 24311 in · 37 out · 24348 total

Budget: 24,348 tokens of 500,000 tokens

No security-relevant issues were introduced by this documentation and type-tightening diff.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Zuke AI review

🔎 generic review — review

Score: 0/10 · Severity: none · 0 finding(s)

Tokens: 11771 in · 174 out · 11945 total

Budget: 40,302 tokens of 500,000 tokens

Refuted by verification (not reported):

Finding Reason
Removed default bootstrap fallback can now surface an undefined action if resolver returns nothing jobBootstrap now requires a CiPinResolver and the only remaining pins(ZUKE_ACTION) call is guarded by the comment’s stated resolver-present branch, so there is no reachable path in the shown code where pins is absent or the action becomes undefined.

The patch is mostly documentation and type-tightening, with one small API change that appears internally consistent but slightly reduces fallback robustness.

@totollygeek
totollygeek merged commit 036be6d into master Aug 13, 2026
12 checks passed
@totollygeek
totollygeek deleted the claude/marketplace-codex-gemini-setup-ksau6v branch August 13, 2026 13:06
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