gabriel / musehub public
test_ui_agents_no_commit_meta.py python
62 lines 1.8 KB
Raw
sha256:a34090cc4a394a78bd72cbbe34b08cc59525141e19135b6c0ab154f10611b9ef debug(push/stream): instrument O-frame decode path with INF… Sonnet 4.6 patch 121 days ago
1 """TDD — ui_agents must not read commit_meta."""
2 from __future__ import annotations
3
4 import pytest
5 from muse.core.types import blob_id
6 from datetime import datetime, timezone
7 from sqlalchemy.ext.asyncio import AsyncSession
8
9 from musehub.db import musehub_models as db
10 from tests.factories import create_repo
11
12
13 def _utc() -> datetime:
14 return datetime.now(tz=timezone.utc)
15
16
17 async def _add_commit(session: AsyncSession, repo_id: str, seed: str, **kwargs) -> db.MusehubCommit:
18 row = db.MusehubCommit(
19 commit_id=blob_id(seed.encode()),
20 repo_id=repo_id,
21 branch="dev",
22 parent_ids=[],
23 message=f"feat: {seed}",
24 author="gabriel",
25 timestamp=_utc(),
26 **kwargs,
27 )
28 session.add(row)
29 session.add(db.MusehubBranch(
30 branch_id=blob_id(f"br-{seed}".encode()),
31 repo_id=repo_id,
32 name="dev",
33 head_commit_id=row.commit_id,
34 ))
35 await session.commit()
36 return row
37
38
39 # ---------------------------------------------------------------------------
40 # AG1 — agent profile route does not crash with AttributeError on commit_meta
41 # ---------------------------------------------------------------------------
42
43 @pytest.mark.asyncio
44 async def test_ag1_agent_profile_no_commit_meta_error(
45 db_session: AsyncSession,
46 client,
47 auth_headers,
48 ) -> None:
49 """Agent profile page must not raise AttributeError on commit_meta reads."""
50 repo = await create_repo(db_session, owner="gabriel", visibility="public")
51 await _add_commit(
52 db_session, repo.repo_id, "ag-c1",
53 agent_id="claude-code", model_id="claude-sonnet-4-6",
54 toolchain_id="muse-1",
55 )
56
57 resp = await client.get(
58 f"/gabriel/{repo.slug}/agents/claude-code",
59 headers=auth_headers,
60 follow_redirects=True,
61 )
62 assert resp.status_code != 500
File History 1 commit
sha256:a34090cc4a394a78bd72cbbe34b08cc59525141e19135b6c0ab154f10611b9ef debug(push/stream): instrument O-frame decode path with INF… Sonnet 4.6 patch 121 days ago