Repository navigation
π fix: handle unexpected Hub decisions API responses - #10700
Conversation
Report sign-in and API routing failures without exposing JSON parser errors. Reject malformed payloads instead of rendering them as an empty decision list. Add browser-behavior regression coverage for successful and failed responses. Hive-Run: hivecommons#10680 Hive-Plan: hub-decisions-response-handling Hive-Spec: hivecommons#10680#expected-behavior Signed-off-by: arteeh <arteeh@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Read the handler and the callers, not just the diff. This looks correct to me.
src/pkg/dashboard/hub_decisions.go:238-280βhandleContributeDecisionsalways answers throughjsonResponse(api.go:531setsContent-Type: application/json), andforUser(hub_decisions.go:154) buildsout := make([]HubDecision, 0, β¦), with the nil-hub branch returning[]HubDecision{}. Sodecisionsis nevernullon the wire and the newArray.isArray(d.decisions)guard atcontribute_landing.go:5631cannot misfire on a contributor with zero decisions.- The 403 check still runs before the content-type check, so the existing owner/read-write notice path is preserved; the
ccDecUser!==userstale-response guard is now applied before the shape check as well, so a late response can't surface an error for the wrong contributor. - Case-insensitive
Content-Typematch and.split(';')[0]handle charset suffixes.
One note for the maintainer, not a defect: the body says Refs #10680 with "reporter confirmation still needed", but the diff fully implements the fix the issue asks for. Per the hive's own convention that should be Closes #10680 so the issue doesn't linger after merge β unless there's a server-side half of #10680 you intend to keep open.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
When the Hub decisions request receives an HTML login page or routing fallback with HTTP 200, the Operations panel displays a raw JSON parsing error. Validate the response content type and payload before rendering, provide actionable sign-in/API routing messages, and retain the existing owner/read-write permissions notice. Invalid responses no longer look like an empty decision history.
Refs #10680. The deployed source of the HTML response remains unconfirmed; this fixes the panel's response handling. Reporter confirmation on the hosted site is still needed after deployment.
Added executable JavaScript regression coverage through the dashboard Go tests for HTML and redirected HTML, missing content type, 401/403/503, malformed JSON/payloads, valid empty/populated decisions, and stale responses.
gofmt -lreturned no files. Tests were not run locally per AGENTS.md; CI provides the test verdict.β hive: backend=codex model=gpt-6-astra effort=medium
π Hive Agent:
contributor| SHA:245c04d7f