refactor(sdk): remove unreachable branches and dead helpers - #42
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 + updatedis necessarily positive at that point. Go carried an equally unreachable stdin branch, since the default reader isos.Stdinand the preceding*os.Filetype assertion already covers it.The rest is dead weight:
bundleFileduplicated the exportedSkillFilefield for field;copySkillBundleDirhad no production caller (its only use is inlined into the golden test).NormalizedSkillBundle.fileswas a copy of itsBTreeMapvalues in the same order;normalize_bundle_pathround-tripped a split/join that is the identity.labelfield, pluslistSkillFilesandresolvePathwith no remaining callers.labelfield, plusdedupe,_has_install_writes,_coerce_output, a shadowingempty_install_report, and a_split_texthelper equivalent tostr.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.jsonis stable and cross-language parity holds.Scope Check
spec/hosts.jsonchanges. (spec/hosts.jsonuntouched.)Verification
make check