You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "breymander (via GitHub)" <gi...@apache.org> on 2026/03/23 17:48:16 UTC
[PR] fix(gh-copilot): skip empty report responses for dates without Copilot data [incubator-devlake]
breymander opened a new pull request, #8804:
URL: https://github.com/apache/incubator-devlake/pull/8804
## Summary
GitHub's Copilot Usage Metrics Reports API returns HTTP 200 with body `""` for dates before usage data was available, instead of returning a 404. The existing `ignore404` callback does not catch this, so the `ResponseParser` attempts `json.Unmarshal` on `""` which fails and crashes the collector pipeline.
**Changes:**
- Add an `isEmptyReport(body []byte) bool` helper in `report_download_helper.go` that detects empty, `""`, or `null` bodies
- Guard the `ResponseParser` in all three collectors (`enterprise_metrics_collector.go`, `org_metrics_collector.go`, `user_metrics_collector.go`) to return `nil, nil` when an empty report is detected, so the collector silently skips those days
- Add unit tests for `isEmptyReport` covering empty body, `""`, `null`, whitespace, and valid metadata cases
Fixes #8789
## Test Plan
- [x] Unit tests added for `isEmptyReport` covering edge cases (empty body, `""`, `null`, whitespace, valid JSON)
- [ ] Manual verification: configure a Copilot connection with a `since` date predating available usage data and confirm the collector no longer crashes
Made with [Cursor](https://cursor.com)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(gh-copilot): skip empty report responses for dates without Copilot data [incubator-devlake]
Posted by "ewega (via GitHub)" <gi...@apache.org>.
ewega merged PR #8804:
URL: https://github.com/apache/incubator-devlake/pull/8804
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(gh-copilot): skip empty report responses for dates without Copilot data [incubator-devlake]
Posted by "breymander (via GitHub)" <gi...@apache.org>.
breymander commented on PR #8804:
URL: https://github.com/apache/incubator-devlake/pull/8804#issuecomment-4155372894
@ewega any concerns with accepting this PR?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(gh-copilot): skip empty report responses for dates without Copilot data [incubator-devlake]
Posted by "klesh (via GitHub)" <gi...@apache.org>.
klesh commented on PR #8804:
URL: https://github.com/apache/incubator-devlake/pull/8804#issuecomment-4155578387
Hi, @ewega . Can you have a look at the PR when you find time? Thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org