GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Clean up deferred issue update helper by BagToad · Pull Request #13584 · cli/cli

Conversation

@BagToad

@BagToad BagToad commented Jun 4, 2026

Copy link
Copy Markdown
Member

Description

Address two unresolved review threads from #13411: tighten the deferredUpdateIssueOptions helper to stop returning a partial struct on error, and document the asymmetric handling of --type and --remove-type in gh issue edit.

Key Points

  • The helper in pkg/cmd/issue/create/create.go and pkg/cmd/issue/edit/edit.go used to return a partially-populated api.DeferredUpdateIssueOptions alongside the error on every failure path. Callers already discard the struct when err is non-nil, so the partial value was invisible in practice but invited future misuse. The fix returns a zero-value struct on error so the contract matches reality.
  • The hasDeferredFlags block in gh issue edit lists --remove-type but not --type. That is intentional (the set form flows through Editable.IssueType.Edited and is picked up by Editable.Dirty()), but the split is non-obvious. A comment now makes the reasoning explicit.

Notes for reviewers

Two atomic commits, both reviewable on their own:

  1. refactor(issue): drop half-baked return value from deferredUpdateIssueOptions - the contract tightening across create.go and edit.go.
  2. docs(issue): clarify --type handling in edit hasDeferredFlags - comment only, no behavior change.

No new tests: the refactor preserves end-to-end behavior, and existing run-function table tests (Test_createRun, Test_editRun) already cover the affected paths.

Additional Context

  • Issues 2.0: review feedback round #13411 is the merged PR where these threads originated; this PR closes out the two follow-ups that were deferred at merge time.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
BagToad and others added 2 commits June 4, 2026 10:03
@BagToad
refactor(issue): drop half-baked return value from deferredUpdateIssu…
3e5d9e3
…eOptions

The deferredUpdateIssueOptions helper in both create and edit returned a
partially-populated DeferredUpdateIssueOptions struct alongside the error
on every failure path. Callers always discard the struct on err, so the
partial value is invisible today but invites future misuse.

Return a zero-value struct on error so the contract matches reality.

Co-authored-by: Copilot <[email protected]>
@BagToad
docs(issue): clarify --type handling in edit hasDeferredFlags
432e648
The --type (set) and --remove-type flags both prevent dropping into
interactive mode, but they take different paths: --type lights up
Editable.IssueType.Edited (covered by Editable.Dirty()), while
--remove-type is the only type signal that has to be listed in
hasDeferredFlags. Add a comment so the asymmetry stops surprising
reviewers.

Co-authored-by: Copilot <[email protected]>
@BagToad
BagToad requested a review from a team as a code owner June 4, 2026 16:09
@BagToad
BagToad requested review from babakks and Copilot June 4, 2026 16:09
Copilot started reviewing on behalf of BagToad June 4, 2026 16:09
View session
Copilot AI reviewed Jun 4, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens the contract of the deferredUpdateIssueOptions helper used by gh issue create and gh issue edit so it no longer returns a partially-populated api.DeferredUpdateIssueOptions when returning an error, and it documents why --type is intentionally excluded from hasDeferredFlags in gh issue edit.

Changes:

  • Return a zero-value api.DeferredUpdateIssueOptions{} on all error paths in deferredUpdateIssueOptions (create/edit) to avoid leaking partial structs.
  • Add an explanatory comment in gh issue edit clarifying the asymmetric handling of --type vs --remove-type in hasDeferredFlags.
Show a summary per file
File Description
pkg/cmd/issue/edit/edit.go Documents hasDeferredFlags behavior and ensures deferred update option helper returns a zero-value struct on error.
pkg/cmd/issue/create/create.go Ensures deferred update option helper returns a zero-value struct on error.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@BagToad
BagToad enabled auto-merge (squash) June 4, 2026 16:13
babakks
babakks approved these changes Jun 4, 2026
View reviewed changes
@BagToad
BagToad merged commit 0faf4b0 into trunk Jun 4, 2026
19 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@BagToad
BagToad deleted the bagtoad/kw-issues-2-0-deferred-cleanup branch June 4, 2026 16:54
@BrewTestBot BrewTestBot mentioned this pull request Jun 10, 2026
gh 2.94.0 Homebrew/homebrew-core#287368
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@babakks babakks babakks approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@BagToad @babakks
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.