Skip to content

fix(tests): test_public_chat_history.py::test_sessions_returns_list_shape — handle list-shaped link response #766

Closed

Description

@AndriiPasternak31

Summary

tests/test_public_chat_history.py::TestPublicSessionsEndpoints::test_sessions_returns_list_shape calls links_resp.json().get("links", []) but the public-links endpoint (/api/agents/{name}/public-links) returns a bare list, so .get(...) raises:

AttributeError: 'list' object has no attribute 'get'

Context

Discovered via full test suite run on 2026-05-09:

FAILED test_public_chat_history.py::TestPublicSessionsEndpoints::test_sessions_returns_list_shape
E   AttributeError: 'list' object has no attribute 'get'
test_public_chat_history.py:79

The test should either (a) tolerate both shapes or (b) consume the bare list directly if that's the intended contract.

Acceptance Criteria

  • Confirm intended response shape by reading routers/public_links.py (GET /api/agents/{name}/public-links handler).
  • Fix the test:
    • If the endpoint returns a bare list (current behavior): links = links_resp.json().
    • If the endpoint should return {links: [...]}: fix the endpoint instead, then leave the test as-is.
    • If both shapes are valid: links = data["links"] if isinstance(data, dict) else data.
  • Test passes when run (a) standalone, (b) in the full integration suite.

Reproduction

cd tests && source .venv/bin/activate
pytest test_public_chat_history.py::TestPublicSessionsEndpoints::test_sessions_returns_list_shape -v

Why this is small

A 1-2 line test fix once the endpoint contract is confirmed. Likely a test bug (envelope assumption) introduced when public-links endpoint shape stabilized.

Related

  • routers/public_links.py — owns the contract.
  • Public chat history feature flow: docs/memory/feature-flows/public-chat.md.

Activity

  1. added
    status-in-progress
    on May 11, 2026
  2. self-assigned this
    on May 11, 2026
  3. added
    status-in-dev
    and removed
    status-in-progress
    on May 28, 2026
  4. vybe commented on Jun 1, 2026

    @vybe
    Contributor

    Shipped in v0.6.0 (released via #998).

  5. added
    theme-devex
    and removed
    status-in-dev
    on Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority-p3theme-devextype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions