gabriel / muse public
fix patch task/hub-list-envelopes #1 / 1
gabriel · 166 days ago · Apr 14, 2026 · Diff

fix: hub list commands return envelope objects not bare arrays

hub issue list --json, hub proposal list --json, and hub label list --json were stripping the server envelope and dumping a bare JSON array. This meant agents could not read total counts or advance pagination from the output — they silently discarded the data the server already provided.

All three handlers now emit the full envelope: hub issue list → {"issues": [...], "total": N, "next_cursor": str|null} hub proposal list → {"proposals": [...], "total": N, "next_cursor": str|null} hub label list → {"labels": [...], "total": N}

hub repo list was already correct and is included as a regression baseline.

- tests/test_hub_list_envelopes.py: 19 new TDD tests (one per envelope key per command + repo list baseline) - tests/test_cmd_hub_hardening.py: updated 10 stale assertions that verified the old broken bare-array behavior

sha256:92894e6968a8361c9f39aa9bfc0eeeea1e132eff1f47bd3177c4121daff17cfc sha
+47 ~19 −5 symbols
sha256:3c881bc297d4bd2aeba8f315e0c8615c12088ab6cbc574012d59fa96c43ad4fe snapshot
+47
symbols added
~19
symbols modified
−5
symbols removed
0
dead code introduced
Semantic Changes 71 symbols
~ tests/test_hub_list_envelopes.py .py 42 symbols added
+ TestIssueListEnvelope class class TestIssueListEnvelope L129–213
+ test_empty_list_still_wrapped method method test_empty_list_still_wrapped L195–203
+ test_issues_value_is_list method method test_issues_value_is_list L185–193
+ test_json_has_issues_key method method test_json_has_issues_key L155–163
+ test_json_has_next_cursor_key method method test_json_has_next_cursor_key L175–183
+ test_json_has_total_key method method test_json_has_total_key L165–173
+ test_json_is_object_not_array method method test_json_is_object_not_array L144–153
+ test_next_cursor_propagated method method test_next_cursor_propagated L205–213
+ TestLabelListEnvelope class class TestLabelListEnvelope L301–353
+ test_empty_list_still_wrapped method method test_empty_list_still_wrapped L345–353
+ test_json_has_labels_key method method test_json_has_labels_key L321–327
+ test_json_has_total_key method method test_json_has_total_key L329–335
+ test_json_is_object_not_array method method test_json_is_object_not_array L312–319
+ test_labels_value_is_list method method test_labels_value_is_list L337–343
+ TestProposalListEnvelope class class TestProposalListEnvelope L221–293
+ test_empty_list_still_wrapped method method test_empty_list_still_wrapped L275–283
+ test_json_has_next_cursor_key method method test_json_has_next_cursor_key L265–273
+ test_json_has_proposals_key method method test_json_has_proposals_key L245–253
+ test_json_has_total_key method method test_json_has_total_key L255–263
+ test_json_is_object_not_array method method test_json_is_object_not_array L234–243
+ test_next_cursor_propagated method method test_next_cursor_propagated L285–293
+ TestRepoListEnvelopeBaseline class class TestRepoListEnvelopeBaseline L361–391
+ test_json_is_object_not_array method method test_json_is_object_not_array L381–391
+ _HUB variable variable _HUB L39–39
+ _REPO_REF variable variable _REPO_REF L121–121
+ _api_mock function function _api_mock L101–109
+ _first_json_object function function _first_json_object L112–118
+ _make_identity function function _make_identity L69–72
+ _setup function function _setup L96–98
+ _store_identity_for function function _store_identity_for L75–93
+ cli variable variable cli L36–36
+ CliRunner import import CliRunner L34–34
+ InvokeResult import import InvokeResult L34–34
+ MagicMock import import MagicMock L31–31
+ annotations import import annotations L26–26
+ json import import json L28–28
+ patch import import patch L31–31
+ pathlib import import pathlib L29–29
+ pytest import import pytest L33–33
+ mock import import unittest.mock L30–30
+ repo function function repo L48–66
+ runner variable variable runner L37–37
~ tests/test_cmd_hub_hardening.py .py 5 symbols added, 5 symbols removed, 16 symbols modified
− test_empty_list_json_is_empty_array method method test_empty_list_json_is_empty_array L6061–6069
− test_json_output_is_array method method test_json_output_is_array L6030–6040
− test_json_output_is_array method method test_json_output_is_array L7412–7421
− test_proposal_list_empty_json_is_empty_array method method test_proposal_list_empty_json_is_empty_array L1217–1227
− test_proposal_list_json_is_array method method test_proposal_list_json_is_array L1198–1215
+ test_empty_list_json_is_wrapped_object method method test_empty_list_json_is_wrapped_object L6070–6080
+ test_json_output_is_object method method test_json_output_is_object L6037–6049
+ test_json_output_is_object method method test_json_output_is_object L7423–7434
+ test_proposal_list_empty_json_is_wrapped_object method method test_proposal_list_empty_json_is_wrapped_object L1220–1232
+ test_proposal_list_json_is_object method method test_proposal_list_json_is_object L1198–1218
← Older Oldest on task/hub-list-envelopes
All commits
Newer → Latest on task/hub-list-envelopes

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:92894e6968a8361c9f39aa9bfc0eeeea1e132eff1f47bd3177c4121daff17cfc --body "your comment"