[Bugfix #1137] Fix gitea forge preset against the real tea CLI#1
Closed
pseudoseed wants to merge 4 commits into
Closed
[Bugfix #1137] Fix gitea forge preset against the real tea CLI#1pseudoseed wants to merge 4 commits into
pseudoseed wants to merge 4 commits into
Conversation
The gitea preset invoked `tea <entity> list/view/whoami/comment`, whose
flattened `--fields` output (or missing flags/subcommands) doesn't match the
Gitea REST shape that forge-contracts.ts and the jq normalizers assume. Route
the read concepts through `tea api`, the raw REST passthrough that returns
exactly that shape:
- user-identity: `tea api user | jq .login` (`tea whoami` has no --output json)
- pr-view: `tea api repos/<repo>/pulls/N` → PrViewResult
- pr-list: `tea api repos/<repo>/pulls?state=open` → PrListItem[]
(now also populates real reviewRequests/isDraft/body)
- pr-exists: `tea api repos/<repo>/pulls?state=all` with nested .head.ref/.merged
- issue-view: `tea api repos/<repo>/issues/N` + a second call for the comments
ARRAY (Gitea's issue object reports `comments` as an int count,
which would crash consumers' `.comments.filter(...)`)
- recently-merged: `tea api repos/<repo>/pulls?state=closed`, filter .merged,
using the real .merged_at
- issue-comment: `tea comments add` (`tea issues` has no `comment` subcommand)
`tea api` needs an explicit owner/repo path segment (unlike `tea <entity>`,
which auto-detects it from the local git remote), and most concepts are invoked
without CODEV_REPO set, so each api-based script derives owner/repo from the
origin remote, honoring CODEV_REPO when present.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Stubs a fake `tea` on PATH answering `api <endpoint>` with captured Gitea REST fixtures (tea isn't in CI, per cluesmith#920), points the scripts at a throwaway repo with a gitea remote, runs each real script, and asserts the normalized output conforms to forge-contracts.ts — incl. comments-as-array, merged-only filtering, open/merged/closed pr-exists cases, and CODEV_REPO override. Also updates the cluesmith#568 pr-exists assertion for gitea to match the new `state=all` query param (was `--state all` flag). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
|
Superseded by the upstream bugfix PR cluesmith#1146 (same branch, targeting the codev repo). Closing this fork-internal duplicate. |
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.
Summary
Fixes cluesmith#1137
The
giteaforge preset was authored against the Gitea REST API JSON shapebut invoked the
teaCLI, whosetea <entity> list/viewoutput is aflattened,
--fields-limited view (and in some cases the referencedflag/field/subcommand doesn't exist). Every read concept either errored or
emitted a shape that didn't match
forge-contracts.ts.Root Cause
teaexposes two divergent JSON surfaces:tea <entity> list/view --output json— flattened/limited (head/base arestrings, no body/description, merged state synthesized,
whoamihas no JSON).tea api <endpoint>— a raw passthrough returning the canonical Gitea RESTshape that codev's jq normalizers +
forge-contracts.tsalready assume.The scripts read from (1); the contracts expect (2).
Fix
Route the read concepts through
tea api:user-identitytea api user | jq .login(tea whoamihas no--output json)pr-viewtea api repos/<repo>/pulls/N→PrViewResultpr-listtea api repos/<repo>/pulls?state=open→PrListItem[]; now also populates realreviewRequests/isDraft/bodypr-existstea api repos/<repo>/pulls?state=allwith nested.head.ref+.mergedboolissue-viewtea api repos/<repo>/issues/N+ a second call for the comments ARRAY (Gitea's issue object reportscommentsas an int count, which would crash consumers'.comments.filter(...))recently-mergedtea api repos/<repo>/pulls?state=closed, filter.merged, use real.merged_atissue-commenttea comments add(tea issueshas nocommentsubcommand)tea apineeds an explicitowner/repopath segment (unliketea <entity>,which auto-detects it from the local git remote), and most concepts are invoked
without
CODEV_REPOset (e.g.pr-existsreceives onlyCODEV_BRANCH_NAME),so each api-based script derives
owner/repofrom theoriginremote, honoringCODEV_REPOwhen present.Left
issue-searchuntouched: it isn't in the issue's broken list, and its onlydifference from the working
issue-listis an unverifiedbodyfield — changingworking/unverified code on assumption would violate minimal-change.
Test Plan
bugfix-1137-gitea-tea-api.test.ts(11 cases): stubs afake
teaon PATH answeringapi <endpoint>with captured Gitea RESTfixtures (tea isn't in CI, per vscode: editor-tab webview for rich backlog search cluesmith/codev#920), points scripts at a throwaway repo
with a gitea remote, runs each real script, and asserts the normalized
output conforms to
forge-contracts.ts— incl. comments-as-array,merged-only filtering, open/merged/closed
pr-exists, andCODEV_REPOoverride.pr-existsgitea assertion (--state all→state=all).npm run buildpasses.Note on the full test suite
The full
npm testrun shows 9 failures in unrelated files(
team-updatecollectEvents ×7,team-github,team-cli) — all 5s-timeout I/Othat hangs in this resource-starved worktree/environment. Confirmed failing on
the clean base without these changes, so they are pre-existing and
environmental (they pass in CI). This PR touches none of those files.
🤖 Generated with Claude Code