fix(server): survive null elements in Forgejo list responses #263
No reviewers
Labels
No labels
Agent
Ignore
Agent
In Progress
Agent
Planned
Agent
Planning
Agent
Ready
Agent
Triage
Compat
Breaking
Kind
Bug
Kind
Documentation
Kind
Enhancement
Kind
Feature
Kind
Security
Kind
Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lucas/omp-deck!263
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/issue-262-null-timeline-entries"
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?
Closes: #262
issue_labeldispatch crashed withnull is not an object (evaluating 'c.label')whenever an issue's timeline contained an entry Forgejo could not serialise — those arrive as JSONnull. The trigger was recordedfailedand no session started, permanently, for every label event on such an issue.The fix is central, not at the crash site:
compactList(new,tools/shared.ts) drops onlynull/undefinedelements and returns[]for a non-array body;jsonListwraps a single array request with it, preservingmetaand passing error results through unchanged.fetchAllPagescompacts what it accumulates but keeps using the raw page length for the short-page break, so a full page containing a null is not mistaken for the last page (13 call sites, no changes needed).client.json<X[]>fetches indispatch-api.ts,tools/{issues,prs,ci,pr-diff}.tsnow usejsonList; theArray.isArray(res.data) ? … : []follow-ups are gone.ApiCombinedStatus.statusesis compacted in both places it is read.createDispatchApi(injected?)accepts a client, solistLabelEventscan be exercised without the stored config or a database. Existing callers are unaffected.Tests
tools/shared.test.ts:compactListsemantics (order, falsy values kept, non-array →[]),jsonListcompaction/meta/error pass-through, and thatfetchAllPagespages on the raw length.dispatch-api.test.ts(new):listLabelEventsover a timeline with anullbetween two label rows resolves with both events in order instead of throwing, plus a case where the null sits on a full first page to prove paging is not cut short.Verified:
bun testinapps/server(1327 pass, 0 fail) andbun run typecheckat the root.