gabriel / musehub public
test_docs_getting_started_version.py python
62 lines 2.8 KB
Raw
sha256:71e7849472a1545f06b42a349e127eb355fd30953cb39a182a5ae0c5e2da7fb0 docs(getting-started): QA contract v2 audit — no-release pa… Opus 5.5 minor ⚠ breaking 9 days ago
1 """TDD — musehub#191 (acceptance criterion 3): the "muse --version" sample
2 output on /muse/getting-started must show the real installable muse CLI
3 tarball version, not musehub's own unrelated app version.
4
5 The page's example output block used the global Jinja variable
6 MUSE_VERSION, which despite its name is musehub.protocol.version.MUSE_VERSION
7 -- musehub's own package version (importlib.metadata.version("musehub")),
8 completely independent of the actual muse CLI tarball install.sh serves
9 (muse and musehub version independently; see docs/deploy.md). The correct
10 source is install.py's _latest_published_muse_version(), which reads the
11 instance's explicit active-release pointer.
12 """
13 from __future__ import annotations
14
15 from pathlib import Path
16 from unittest.mock import patch
17
18 import pytest
19 from httpx import AsyncClient
20
21
22 class TestGettingStartedVersionDisplay:
23 @pytest.mark.asyncio
24 async def test_shows_latest_published_muse_version_not_musehub_app_version(
25 self, client: AsyncClient
26 ) -> None:
27 from musehub.protocol.version import MUSE_VERSION
28
29 with patch(
30 "musehub.api.routes.musehub.ui_docs._latest_published_muse_version",
31 return_value="9.9.9-fake-muse-cli-version",
32 ):
33 r = await client.get("/muse/getting-started")
34 assert r.status_code == 200
35 assert "muse 9.9.9-fake-muse-cli-version" in r.text
36 # The regression this fixes: musehub's own app version must not
37 # leak into this specific example-output block.
38 if MUSE_VERSION != "9.9.9-fake-muse-cli-version":
39 assert f"muse {MUSE_VERSION}" not in r.text
40
41 @pytest.mark.asyncio
42 async def test_fails_closed_when_no_active_release_is_selected(
43 self, client: AsyncClient, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
44 ) -> None:
45 """No pointer means no verified release: the version fails closed, the page does not.
46
47 musehub#244 DOC_GS_06 (owner ruling 2026-11-07): the page returns 200 with an explicit
48 "no verified release" notice and shows no version at all -- never musehub's app version.
49 The installer stays fail-closed (tests/test_release_selection.py pins /install.sh → 503).
50 """
51 from musehub.config import settings
52 from musehub.protocol.version import MUSE_VERSION
53
54 monkeypatch.setattr(settings, "musehub_releases_dir", str(tmp_path))
55 r = await client.get("/muse/getting-started")
56 assert r.status_code == 200
57 assert 'data-release-state="unavailable"' in r.text
58 assert "No verified Muse release is available on this instance" in r.text
59 assert f"muse {MUSE_VERSION}" not in r.text
60 assert "<pre>muse " not in r.text
61 installer = await client.get("/install.sh")
62 assert installer.status_code == 503
File History 3 commits
sha256:71e7849472a1545f06b42a349e127eb355fd30953cb39a182a5ae0c5e2da7fb0 docs(getting-started): QA contract v2 audit — no-release pa… Opus 5.5 minor ⚠ 9 days ago
sha256:7626f7726b75381c2fc1cc637fc1eff985dc031df13ee8a7c6ce2735e27d5a20 feat(release): select the served muse by an explicit active… Opus 5.5 minor ⚠ 12 days ago
sha256:129f74fcd6c7aee4beba9f9a924569b3f910090a9d8f3eb5e4ec294fb70bc604 fix: getting-started page's muse --version sample output sh… Sonnet 5 minor ⚠ 25 days ago