Skip to content

test(platform): Add tests for document_list and document_retrieve tools #661

@larryro

Description

@larryro

Summary

Add comprehensive unit and integration tests for the document_list (#658) and document_retrieve (#659) agent tools.

Test Coverage

document_list tool

  • Happy paths: list all documents, filter by folder, filter by extension, filter by date range, combined filters
  • Sorting: sort by createdAt desc (default), sort by name asc
  • Pagination: limit parameter, hasMore flag, totalCount accuracy
  • Access control: only returns documents matching user's organizationId and teamTags
  • Edge cases: empty results, no matching filters, limit=0, invalid date format

document_retrieve tool

  • Happy paths: retrieve full document content, retrieve with pageRange
  • Pagination: pageRange="1-5", pageRange="20-30", single page pageRange="5-5"
  • Truncation: document exceeding ~50K chars returns truncated=true
  • Access control: rejects requests for documents outside user's organization/team
  • Error cases: non-existent documentId (404), document without RAG info, invalid pageRange format
  • Integration with RAG service: mock RAG endpoint, verify correct parameters passed

Dependencies

Acceptance Criteria

  • All happy path tests pass
  • Access control tests verify organization and team scoping
  • Edge case and error condition tests pass
  • Tests follow existing patterns (reference: services/platform/convex/workflow_engine/ test files)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions