Skip to content

refactor(sdk): remove unreachable branches and dead helpers - #42

Merged
samzong merged 1 commit into
mainfrom
refactor/remove-unreachable-branches
Sep 12, 2026
Merged

samzong merged 1 commit into
mainfrom
refactor/remove-unreachable-branches

Conversation

@samzong

@samzong samzong commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Dead-code removal across all four SDK ports. No observable behavior change.

Each port carried a post-summary early return for zero installed/updated targets that no input could reach: the preceding guards already return when the plan is entirely empty and when any conflict or error is present, so installed + updated is necessarily positive at that point. Go carried an equally unreachable stdin branch, since the default reader is os.Stdin and the preceding *os.File type assertion already covers it.

The rest is dead weight:

  • Go: bundleFile duplicated the exported SkillFile field for field; copySkillBundleDir had no production caller (its only use is inlined into the golden test).
  • Rust: NormalizedSkillBundle.files was a copy of its BTreeMap values in the same order; normalize_bundle_path round-tripped a split/join that is the identity.
  • TypeScript: unread label field, plus listSkillFiles and resolvePath with no remaining callers.
  • Python: unread label field, plus dedupe, _has_install_writes, _coerce_output, a shadowing empty_install_report, and a _split_text helper equivalent to str.splitlines().

Bundle content hashes are unchanged. A base-versus-current probe over a five-file nested bundle inserted out of lexicographic order produces an identical digest in Rust, matching the untouched Python implementation, so the value persisted in .kitup.json is stable and cross-language parity holds.

Scope Check

  • Stays within the v0.1 bundled-skill installer boundary.
  • Does not add marketplace, registry, private remote install, script execution, GUI, MCP server, or agent runtime behavior.
  • Updates golden cases for observable installer behavior changes. (No observable change; existing 89 cases pass unmodified across all four ports.)
  • Regenerates host constants after spec/hosts.json changes. (spec/hosts.json untouched.)

Verification

  • make check

Four ports carried a post-summary early return for zero installed/updated
targets that no input could reach: the preceding guards already return when
the plan is entirely empty and when any conflict or error is present, so
installed+updated is necessarily positive at that point.

Go carried an equally unreachable stdin branch, since the default reader is
os.Stdin and the preceding *os.File type assertion already covers it.

The rest is dead weight: Go's bundleFile duplicated the exported SkillFile
field for field, Rust's NormalizedSkillBundle kept a files vector that was a
copy of its BTreeMap values in the same order, and TS and Python carried an
unread label field plus helpers with no remaining callers.

Bundle content hashes are unchanged: a base-versus-current probe over a
multi-file bundle inserted out of lexicographic order produces an identical
digest, matching the untouched Python implementation.

Signed-off-by: samzong <samzong.lu@gmail.com>
@samzong
samzong merged commit 0bd2753 into main Sep 12, 2026
22 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