refactor: resolve the project through selectors.ResolveProject - #667
Open
NickJosevski wants to merge 1 commit into
Open
refactor: resolve the project through selectors.ResolveProject#667NickJosevski wants to merge 1 commit into
NickJosevski wants to merge 1 commit into
Conversation
Nine commands hand-rolled the same "prompt for the project when it wasn't named, look it up when it was, error out in automation mode" block. It was copy-paste rather than parallel evolution — the comment "project name is already provided, fetch the object because it's needed for further questions" appeared verbatim eight times. They now call selectors.ResolveProject. Behaviour is unchanged: callers that echo the resolved project still do so on the same condition (the project came from the command line, so no prompt was shown), and automation-mode validation still runs before any API call — release delete in particular must reject a missing --version before looking the project up. release-progression allow and prevent are deliberately left alone. They have no lookup branch at all, so adopting the helper there would change behaviour rather than just deduplicate; they are separately buggy and want their own fix. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.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.
Nine commands hand-rolled the same block: prompt for the project when it wasn't named, look it up when it was, error out in automation mode. It was copy-paste, not parallel evolution — the comment
// project name is already provided, fetch the object because it's needed for further questionsappeared verbatim 8 times.They now call
selectors.ResolveProject, which #609 adds next to theProject/FindProjectprimitives it composes.release/{create,deploy,delete,list},runbook/{list,run},runbook/snapshot/list,channel/{create,list}— 9 files, -109 net lines.Behaviour is unchanged
Project <name>still do, on the same condition — the project came from the command line, so no prompt was shown.release deletein particular must reject a missing--versionbefore looking the project up; its existing test asserts no project request is made, and caught me when I first got this wrong.Not adopted:
release-progression allow/preventThese are the only two remaining
selectors.Projectcallers. They have no lookup branch at all — when--projectis supplied,selectedProjectstaysnil. Adopting the helper would change behaviour rather than just deduplicate, so they're left alone.They're also independently broken.
allow.godereferences thatnil:PromptMissingruns whenever!opts.NoPrompt, sooctopus release-progression allow --project Xpanics interactively.prevent.gohas the same missing branch and passes anilproject toSelectRelease. Confirmed(*projects.Project)(nil).GetName()panics. Worth its own fix + regression tests rather than being smuggled into a refactor.Note on base
Based on
nj/channel-list-view-delete(#609), which adds the helper. Retarget tomainonce that merges.