chore(cmd): consolidate boolean params into options structs#88
chore(cmd): consolidate boolean params into options structs#88
Conversation
a65949a to
071e6cf
Compare
|
Claude finished @boneskull's task in 1m 37s —— View job Code Review
This is a solid readability improvement — the call sites for Minor Issues1.
OpenWeb: st.Web, // CascadeOptions.Web → SubmitOptions.OpenWebThis will trip up anyone reading the field side-by-side. Pick one name and use it in both structs. Since 2. Partial adoption of
// uses ghClient, root, trunk, remoteBranches, s — not pCtx.*
if err := ghClient.UpdatePRBase(existingPR, parent); err != nil { ... }
if err := ghClient.GenerateAndPostStackComment(root, b.Name, trunk, existingPR, remoteBranches); err != nil { ... }
maybeMarkPRReady(ghClient, existingPR, b.Name, parent, trunk, s)This is inconsistent: the create path uses 3. func createPRForBranch(g *git.Git, ctx prContext, branch, base string) (int, bool, error) {
func adoptExistingPR(ctx prContext, branch, base string) (int, error) {
func adoptExistingPRDirect(ctx prContext, branch, base string, existingPR *github.PR) (int, error) {
Nits
SummaryThe core refactoring is clean and clearly motivated. The |
Functions like `doCascadeWithState` and `doSubmitPushAndPR` had accumulated so many boolean parameters that call sites were impossible to read without counting argument positions. Closes #26. Changes: - `CascadeOptions` replaces 8 positional params on `doCascadeWithState` (DryRun, Operation, UpdateOnly, OpenWeb, PushOnly, Branches, StashRef, Worktrees) - `SubmitOptions` replaces 4 boolean params on `doSubmitPushAndPR` and `doSubmitPRs` (DryRun, UpdateOnly, OpenWeb, PushOnly) - `prContext` bundles the 6 shared read-only params threaded through `createPRForBranch`, `adoptExistingPR`, and `adoptExistingPRDirect` (ghClient, cfg, root, trunk, remoteBranches, s) - `pCtx` used as the parameter name for `prContext` (avoids shadowing the `context.Context` convention for `ctx`) - OpenWeb naming is now consistent across both options structs - All callers updated across cascade.go, submit.go, sync.go, and continue.go
071e6cf to
60ddc98
Compare
|
Claude finished @boneskull's task in 1m 32s —— View job Code Review
All three items from the previous review have been addressed in this update. Here's the rundown: 1.
2. Consistent
3. All three helpers ( One remaining minor observation
maybeMarkPRReady(pCtx.ghClient, existingPR, b.Name, parent, pCtx.trunk, pCtx.s)Not a blocker. These are small leaf helpers and widening their signatures to accept Summary All substantive feedback from the first review has been incorporated cleanly. The PR is ready to merge from a code quality standpoint. |
Summary
Implements #26. Functions like
doCascadeWithStateanddoSubmitPushAndPRhad accumulated so many boolean parameters that call sites were unreadable without counting argument positions.CascadeOptions— replaces 8 positional params ondoCascadeWithState(DryRun,Operation,UpdateOnly,Web,PushOnly,AllBranches,StashRef,Worktrees)SubmitOptions— replaces 4 boolean params ondoSubmitPushAndPRanddoSubmitPRs(DryRun,UpdateOnly,OpenWeb,PushOnly)prContext— bundles the 6 shared read-only params threaded throughcreatePRForBranch,adoptExistingPR, andadoptExistingPRDirectAll callers updated across
cascade.go,submit.go,sync.go, andcontinue.go.Closes #26
Test plan
make test)make lint)