Fix critical issues in WHOOSH Gitea issue monitoring and task creation

This commit resolves multiple blocking issues that were preventing WHOOSH from
properly detecting and converting bzzz-task labeled issues from Gitea:

## Issues Fixed:

1. **JSON Parsing Error**: Gitea API returns repository owner as string in issue
   responses, but code expected User object. Added IssueRepository struct to
   handle this API response format difference.

2. **Database Error Handling**: Code was using database/sql.ErrNoRows but
   system uses pgx driver. Updated imports and error constants to use
   pgx.ErrNoRows consistently.

3. **NULL Value Scanning**: Database fields (repository, project_id,
   estimated_hours, complexity_score) can be NULL but Go structs used
   non-pointer types. Added proper NULL handling with pointer scanning
   and safe conversion.

## Results:
-  WHOOSH now successfully detects bzzz-task labeled issues
-  Task creation pipeline working end-to-end
-  Tasks API functioning properly
-  First bzzz-task converted: "Logic around registered agents faulty"

The core issue monitoring workflow is now fully operational and ready for
CHORUS integration.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude Code
2025-09-10 12:57:11 +10:00
parent 4173c0c8c8
commit b5c0deb6bc
3 changed files with 58 additions and 30 deletions

View File

@@ -22,19 +22,19 @@ type Client struct {
// Issue represents a Gitea issue
type Issue struct {
ID int64 `json:"id"`
Number int64 `json:"number"`
Title string `json:"title"`
Body string `json:"body"`
State string `json:"state"`
Labels []Label `json:"labels"`
Assignees []User `json:"assignees"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ClosedAt *time.Time `json:"closed_at"`
HTMLURL string `json:"html_url"`
User User `json:"user"`
Repository Repository `json:"repository,omitempty"`
ID int64 `json:"id"`
Number int64 `json:"number"`
Title string `json:"title"`
Body string `json:"body"`
State string `json:"state"`
Labels []Label `json:"labels"`
Assignees []User `json:"assignees"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ClosedAt *time.Time `json:"closed_at"`
HTMLURL string `json:"html_url"`
User User `json:"user"`
Repository IssueRepository `json:"repository,omitempty"`
}
// Label represents a Gitea issue label
@@ -68,6 +68,14 @@ type Repository struct {
Language string `json:"language"`
}
// IssueRepository represents the simplified repository info in issue responses
type IssueRepository struct {
ID int64 `json:"id"`
Name string `json:"name"`
FullName string `json:"full_name"`
Owner string `json:"owner"` // Note: This is a string, not a User object
}
// NewClient creates a new Gitea API client
func NewClient(cfg config.GITEAConfig) *Client {
token := cfg.Token
@@ -167,10 +175,10 @@ func (c *Client) GetIssues(ctx context.Context, owner, repo string, opts IssueLi
// Set repository information on each issue for context
for i := range issues {
issues[i].Repository = Repository{
issues[i].Repository = IssueRepository{
Name: repo,
FullName: fmt.Sprintf("%s/%s", owner, repo),
Owner: User{Login: owner},
Owner: owner, // Now a string instead of User object
}
}
@@ -193,10 +201,10 @@ func (c *Client) GetIssue(ctx context.Context, owner, repo string, issueNumber i
}
// Set repository information
issue.Repository = Repository{
issue.Repository = IssueRepository{
Name: repo,
FullName: fmt.Sprintf("%s/%s", owner, repo),
Owner: User{Login: owner},
Owner: owner, // Now a string instead of User object
}
return &issue, nil