Files
ratatoskr/pyproject.toml
T
vh 0fbbeb171c fix(sessions): unwrap FastAPI detail envelope in get_persona_state (v0.15.1)
Live smoke against personal:8081 during the v0.15.0 web-companion
verification surfaced that real Worldtree returns persona_state
errors in the FastAPI default envelope shape:

    {"detail": {"error_code": "auth_scope_denied", "message": "..."}}

The v0.12.0 `get_persona_state` parser only inspected the top-level
`error_code` key. When the field was nested under `detail`, the
typed exception (AuthScopeDenied / PersonaNotConfigured /
AgentNotAvailable) wasn't raised; the call fell through to
SessionApiFailed, which then surfaced through the web companion as
an opaque HTTP 500 on /api/agents/{id}/persona_state.

The original test_sessions.py mocks used the flat-shape envelope, so
the bug was invisible in unit tests until the real-wire smoke.

Fix: extract error_code from either `err.get("error_code")` (flat)
OR `err.get("detail", {}).get("error_code")` (FastAPI default).

Patch per SemVer discipline — bug fix to v0.12.0 surface, no public
signature change, no new behavior. Callers that were getting the
wrong exception now get the right one; callers that were already
getting the right exception (flat-shape paths) are unchanged.

Tests: 2 new regression cases in TestGetPersonaState — one each for
the detail-envelope shape of 403 auth_scope_denied and 404
persona_not_configured. Suite: 358 passing.
2026-05-27 19:11:16 -07:00

77 lines
2.2 KiB
TOML

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "ratatoskr"
version = "0.15.1"
description = "Worldtree Conversation API debug TUI — multi-pane observability dashboard"
readme = "README.md"
requires-python = ">=3.12"
license = { file = "LICENSE" }
authors = [{ name = "Vuong Hoang" }]
keywords = ["worldtree", "tui", "debug", "sse", "textual"]
# Network + SSE consumer + TUI framework.
# See docs/design-brief.md §1 (Textual), §3 (httpx-sse).
dependencies = [
"httpx>=0.27",
"httpx-sse>=0.4",
"textual>=0.85",
]
[project.optional-dependencies]
web = [
"starlette>=0.40",
"uvicorn[standard]>=0.30",
]
dev = [
"pytest>=8",
"pytest-asyncio>=0.24",
"respx>=0.21", # httpx mocking for SSE-recorded snapshot tests
"ruff>=0.6",
"mypy>=1.11",
"textual-dev>=1.5", # textual console + live reload during dev
"pyyaml>=6", # used by docs/contracts/contract_parser.py and scripts/contract_drift_check.py
"ratatoskr[web]", # web extras included in dev so test_web_* can import starlette
]
[project.scripts]
ratatoskr = "ratatoskr.cli:main"
ratatoskr-web = "ratatoskr.web.entrypoint:main"
[project.urls]
Repository = "https://gitea.phasefinal.com/vh/ratatoskr"
"Design Brief" = "https://gitea.phasefinal.com/vh/brokkr-smithy/src/branch/main/docs/ratatoskr-design-brief.md"
# Worldtree spec pin — see docs/SPEC-PIN.md for the full bump procedure.
# Ratatoskr is built against Worldtree at this commit; the vendored
# spec snapshot in docs/ reflects that SHA.
[tool.ratatoskr.spec-pin]
worldtree-spec-rev = "562001af28d752c3a60d449c7ddd09f44fa9dc9a"
worldtree-version = "v0.29.0"
pinned-on = "2026-05-26"
[tool.hatch.build.targets.wheel]
packages = ["src/ratatoskr"]
# Issue #16: ship the web companion's static HTML in the wheel so
# importlib.resources can locate it post-install.
[tool.hatch.build.targets.wheel.force-include]
"src/ratatoskr/web/static" = "ratatoskr/web/static"
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]
[tool.ruff]
line-length = 100
target-version = "py312"
[tool.ruff.lint]
select = ["E", "F", "I", "B", "UP", "RUF"]
[tool.mypy]
python_version = "3.12"
strict = true