Skip to content

Gitea forge: issue/PR field names not normalized - Tower shows #undefined, NaNd #750

@pseudoseed

Description

@pseudoseed

Gitea forge: issue/PR field names not normalized - Tower shows #undefined, NaNd

Summary

After locally patching the labels.map crash (issue #749), Tower overview loads but displays #undefined for every
issue number and NaNd for every age. The gitea preset scripts (issue-list.sh, pr-list.sh, recently-closed.sh,
recently-merged.sh) pipe raw tea --output json to the overview, but tea uses different field names than the
overview expects (which assumes GitHub's format).

Image

Field mismatches

Overview expects (GitHub) tea returns (Gitea)
number (int) index (string)
createdAt created
closedAt not present (only updated)
mergedAt not present (only updated)
author: {login: "..."} author: "..." (flat string)
labels: [{name: "..."}] labels: "" or CSV string
assignees: [{login: "..."}] assignees: "" or CSV string
body not in default fields
url not in default fields

Reproduction

  1. forge.provider: "gitea" in .codev/config.json
  2. Repo has open issues on the Forgejo instance
  3. Open Tower → Work tab
  4. Result: every backlog item shows #undefined, type defaults to project, age shows NaNd

Suggested fix

Each gitea preset script should request the full field set via tea --fields ... and pipe through jq to normalize
to the GitHub-compatible shape the overview expects. For example, issue-list.sh:

tea issues list --limit 200 \
  --fields index,title,state,author,url,created,labels,assignees \
  --output json | \
  jq '[.[] | {
    number: (.index | tonumber),
    title, state, url,
    createdAt: .created,
    author: {login: .author},
    labels: (if .labels == "" then []
             else (.labels | split(",") | map({name: ltrimstr(" ")})) end),
    assignees: (if .assignees == "" then []
                else (.assignees | split(",") | map({login: ltrimstr(" ")})) end)
  }]'

Same pattern needed for pr-list.sh, recently-closed.sh (map updated → closedAt), and recently-merged.sh (map updated →
 mergedAt, filter state == "merged").

Affected scripts

- scripts/forge/gitea/issue-list.sh
- scripts/forge/gitea/pr-list.sh
- scripts/forge/gitea/recently-closed.sh
- scripts/forge/gitea/recently-merged.sh

Affected version: v3.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions