chore: rebase Mirus line onto upstream tea main (v0.16) #9
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
public/tea!9
Loading…
Reference in a new issue
No description provided.
Delete branch "sync/upstream-2026-10"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Rebases the Mirus release line onto upstream tea
main(v0.16.0+2, +81 commits over our April base).Landing: this is a rebase, so the history is linear and does not share commits with the current
release/mirus. Land it by force-updatingrelease/mirus(andmain) to this branch, not with a merge commit.Kept (rebased)
pr merge --delete-branch(adapted to upstream's request-contextPullMerge)fast-forward-onlydocumented in--style+mirusrelease lineDropped (superseded upstream)
mergeFailureReason(derives the actual refusal reason)main's "vendor all Go deps" workaround → upstream replaced the vanished go-authgate SDK with signet (#1081)Verification
go build,go vet,go test ./...all pass (integration tests needcommit.gpgsign=falsein env locally)~/.local/bin/tea(backuptea.pre-upstream-0.16); this PR was opened with it🤖 Generated with Claude Code
https://claude.ai/code/session_012S3mRY7CzPt8r9zhPWBZjz
## The bug `tea pulls create` and `tea pulls edit` print `• **Conflicting files**` for any open PR that the server reports as `mergeable: false`. But Gitea's API returns `mergeable: false` for **draft PRs by design** — drafts cannot be merged regardless of conflict state. The current code conflates "not mergeable for any reason" with "has file conflicts." ### Reproduction (gitea.com 1.26.0+dev) ``` $ tea pulls create --base main --head my-branch --title "WIP: clean diff" --description "..." # #N WIP: clean diff (open) ... • **Conflicting files** ← misleading • Maintainers are allowed to edit ``` The PR has no actual conflicts. The web UI shows it as draft + cleanly diffable. `tea pulls edit --title "WIP: ..."` shows the same misleading line. API confirms the root signal: ``` $ curl /api/v1/repos/owner/repo/pulls/N { "draft": true, "mergeable": false, ... } ``` Strip the WIP prefix, and `mergeable` flips back to `true`. So `mergeable=false` here means "blocked because draft," not "conflicts." ## Fix Distinguish the two reasons in `modules/print/pull.go`: ```go switch { case pr.Mergeable: out += "- No Conflicts\n" case pr.Draft: out += "- Draft (not mergeable until marked ready)\n" default: out += "- **Conflicting files**\n" } ``` Real conflicts still fall through to the existing "Conflicting files" message. ## Behavior matrix | PR state | API `mergeable` | Before | After | |---|---|---|---| | Open, clean, ready | true | No Conflicts | No Conflicts | | Open, draft, clean | false | **Conflicting files** (wrong) | **Draft (not mergeable until marked ready)** | | Open, conflicting | false | Conflicting files | Conflicting files | | Closed/merged | — | (no line shown) | (no line shown) | ## Verification Against `dinsmoor/tea-testing` PR #6 on gitea.com: - Set title to `WIP: ...` → API `mergeable=false`, `draft=true` → tea prints `Draft (not mergeable until marked ready)` ✓ - Strip WIP → API `mergeable=true`, `draft=false` → tea prints `No Conflicts` ✓ --- This patch was authored interactively with an AI assistant, driven and reviewed by a human (Tyler / @dinsmoor) every step. *pull request created by Tyler's lovingly wrangled demon machine <3* Reviewed-on: https://gitea.com/gitea/tea/pulls/1012 Reviewed-by: Lunny Xiao <[email protected]> Co-authored-by: Tyler <[email protected]> Co-committed-by: Tyler <[email protected]>## The bug `tea comment <idx> "body"` hangs forever in any non-TTY context — CI pipelines, subshells, agent harnesses, scripts — unless the user explicitly redirects stdin with `< /dev/null`. ### Reproduction (released `tea` 0.14.1) ``` # Plain positional body — hangs forever $ tea comment --repo owner/repo 1 "body text" # Heredoc body — hangs forever $ tea comment --repo owner/repo 1 "$(cat <<'EOM' body text EOM )" # Workaround that works (but shouldn't be necessary) $ tea comment --repo owner/repo 1 "body text" < /dev/null ``` Verified on `gitea.com` (server 1.26.0+dev) with `tea 0.14.1`. Both hanging cases hit a 30s timeout in testing; in normal shell use they hang indefinitely. ## Root cause `cmd/comment.go:58-65`: ```go body := strings.Join(ctx.Args().Tail(), " ") if interact.IsStdinPiped() { if bodyStdin, err := io.ReadAll(ctx.Reader); err != nil { return err } else if len(bodyStdin) != 0 { body = strings.Join([]string{body, string(bodyStdin)}, "\n\n") } } ``` `interact.IsStdinPiped()` is implemented as `!term.IsTerminal(os.Stdin)` — true for *any* non-TTY stdin, not just for piped data. When tea enters this branch in a subshell where stdin is open but no producer ever writes to it (the typical case for shell scripts and automation), `io.ReadAll` blocks waiting for an EOF that never arrives. ## Fix Only consume stdin when the user did **not** supply a positional body. If they passed a body via args, that's their content — ignore stdin entirely. ```go if len(body) == 0 && interact.IsStdinPiped() { // ... read stdin ... body = string(bodyStdin) } ``` ## Behavior matrix | Invocation | Before | After | |---|---|---| | `tea comment <idx> "body"` (TTY) | works | works | | `tea comment <idx> "body"` (non-TTY, no redirect) | **hangs forever** | **works** | | `tea comment <idx> "body" < /dev/null` | works | works | | `echo body \| tea comment <idx>` | works | works | | `tea comment <idx> "prefix"` + piped stdin | "prefix" + stdin concatenated | positional body wins, stdin ignored | | `tea comment <idx>` (TTY, no body, no pipe) | opens editor | opens editor | The one behavior change is the prefix-plus-stdin case (5th row). I couldn't find anyone relying on that pattern and it wasn't documented; defaulting to "positional body wins" matches the principle of least surprise. ## Verification Confirmed each row against `dinsmoor/tea-testing` issue #1 on `gitea.com` with the patched binary. Previously-hanging invocations now post in <0.5s. Piped-stdin path unchanged. --- This patch was authored interactively with an AI assistant, driven and reviewed by a human (Tyler / @dinsmoor) every step. *pull request created by Tyler's lovingly wrangled demon machine <3* --------- Co-authored-by: Lunny Xiao <[email protected]> Reviewed-on: https://gitea.com/gitea/tea/pulls/1011 Reviewed-by: Lunny Xiao <[email protected]> Co-authored-by: Tyler <[email protected]> Co-committed-by: Tyler <[email protected]>tea pulls createhonor--output json(#1111) b2bab268d7tea issues createhonor--output json(#1114) 9c12138d62Landed by force-updating
release/mirusto this branch (4e329c7), as agreed (rebase landing, linear history). The previous line is preserved at tagarchive/release-mirus-pre-0.16.Pull request closed