gabriel / musehub public
fix patch fix/201-proposal-divergence-stub #1 / 1
AI Agent gabriel · 1 day ago · Oct 22, 2026 · Diff

fix: proposal detail page's % divergence figure was a hardcoded stub, never computed (musehub#201)

proposal_detail_page() called musehub_divergence.build_zero_diff_response( ..., include_dimensions=False) unconditionally for both the HTML render path and the JSON content-negotiation path -- a hardcoded placeholder that always returns overall_score=None, which the template then renders as 0% divergence regardless of how divergent the branches actually are.

The real computation, compute_hub_divergence, already exists and is used correctly elsewhere (proposals.py's REST diff endpoint, repos.py's divergence endpoints) -- the proposal detail page itself just never called it.

Added _compute_proposal_diff(), mirroring the exact compute-then-fallback pattern already used by the REST diff endpoint: call compute_hub_divergence(), fall back to build_zero_diff_response() only on the documented ValueError case (a branch with no commits yet), used by both the HTML and JSON-negotiated code paths that previously each had their own copy of the hardcoded stub call.

sha256:6981b7e95adb546ef85b0392504801eb3a74c2bc962dae3960fda4ec7f1242c3 sha
+5 ~1 symbols
2 changed · 1113 in snapshot files
sha256:7a80961363202d1a0cc020fd59e86eeebd8f4e8ee517dc9d25585ef919754b20 snapshot
+5
symbols added
~1
symbol modified
2
files changed
1113
files in snapshot
0
dead code introduced
Semantic Changes 6 symbols
~ musehub/api/routes/musehub/ui_proposals.py .py 1 symbol added, 1 symbol modified
+ _compute_proposal_diff function async_function _compute_proposal_diff L307–342
+ TestDivergencePanelComputed class class TestDivergencePanelComputed L393–476
+ test_falls_back_to_zero_diff_when_branch_has_no_commits method async_method test_falls_back_to_zero_diff_when_branch_has_no_commits L465–476
+ test_html_page_shows_real_divergence_not_hardcoded_zero method async_method test_html_page_shows_real_divergence_not_hardcoded_zero L399–427
+ test_json_negotiated_response_has_computed_overall_score method async_method test_json_negotiated_response_has_computed_overall_score L429–463
Files Changed
~2
1113 in snapshot
← Older Oldest on fix/201-proposal-divergence-stub
All commits
Newer → Latest on fix/201-proposal-divergence-stub

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:6981b7e95adb546ef85b0392504801eb3a74c2bc962dae3960fda4ec7f1242c3 --body "your comment"