You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Review feedback from PRs #13167, #13168, #13170, and #13171 that was deferred to post-merge follow-ups on the sm/add-skills-command branch.
Follow-up tasks
PR #13168 - Refactor HTTP client injection to use factory pattern
Remove direct opts.client injection in publish command. Use the standard factory pattern (opts.HttpClient returning a stubbed client) instead of injecting a client field directly on the options struct. This keeps test-awareness out of command code.
"We do not inject HTTP clients for testing in this way. Basically, the test function creates a stubbed HTTP client and make the factory function (opts.HttpClient) return that. That way you never need to involve the test-aware mindset in the command code."
"I would rather change testName to either name or about."
Investigate case-sensitivity in skill name deduplication. Determine what should happen when two skill names differ only in casing (e.g. MySkill vs myskill).
Refactor dedup map to use typed struct keys. Replace string-concatenated map keys with a typed struct key for the deduplication map. More idiomatic Go and avoids potential key collision issues.
Replace real git usage in tests with command stubs. The publish tests use real git commands which is not the standard pattern. Use run.CommandStubber to register expected git commands and their outputs instead.
"This is real git in tests and we do not do it for many reasons. Instead you should do what is done in other commands, which is to create a command stub, and then register the commands and the stubbed outputs."
Simplify remote selection using gitClient.Remotes ordering. The Remotes method already returns remotes in a preferred order (upstream, github, origin, rest). The manual origin-preference logic could be simplified.
"gitClient.Remotes returns an ordered list of remotes with this ordering (if they exist): upstream, github, origin, (the rest). If that ordering makes sense for you to follow, you can simplify this function."
Fix push icon timing. The push icon is shown before the push operation completes. Either remove the icon or show SuccessIcon only after push succeeds.
Context
Review feedback from PRs #13167, #13168, #13170, and #13171 that was deferred to post-merge follow-ups on the
sm/add-skills-commandbranch.Follow-up tasks
PR #13168 - Refactor HTTP client injection to use factory pattern
opts.clientinjection in publish command. Use the standard factory pattern (opts.HttpClientreturning a stubbed client) instead of injecting a client field directly on the options struct. This keeps test-awareness out of command code.PR #13170 - Search deduplication improvements
Rename
testNamefield tonamein test struct. Indiscovery_test.go, the test struct fieldtestNameshould follow the standard naming convention.Investigate case-sensitivity in skill name deduplication. Determine what should happen when two skill names differ only in casing (e.g.
MySkillvsmyskill).Fix whitespace indentation. Line 578 in
search.gois indented with spaces instead of tabs.Refactor dedup map to use typed struct keys. Replace string-concatenated map keys with a typed struct key for the deduplication map. More idiomatic Go and avoids potential key collision issues.
PR #13171 - Auto-push and test infrastructure
Replace real git usage in tests with command stubs. The publish tests use real git commands which is not the standard pattern. Use
run.CommandStubberto register expected git commands and their outputs instead.Simplify remote selection using
gitClient.Remotesordering. TheRemotesmethod already returns remotes in a preferred order (upstream, github, origin, rest). The manual origin-preference logic could be simplified.Fix push icon timing. The push icon is shown before the push operation completes. Either remove the icon or show
SuccessIcononly after push succeeds.