Skip to content

feat: extract TaskStore into pluggable store abstraction layer#40

Merged
tjb-tech merged 1 commit intoHKUDS:mainfrom
he-yufeng:feat/taskstore-abstraction
Mar 26, 2026
Merged

feat: extract TaskStore into pluggable store abstraction layer#40
tjb-tech merged 1 commit intoHKUDS:mainfrom
he-yufeng:feat/taskstore-abstraction

Conversation

@he-yufeng
Copy link
Copy Markdown
Contributor

Summary

  • Mirrors the existing transport/ pattern (Transport ABC → FileTransport → factory) for task storage
  • Extracts BaseTaskStore ABC into clawteam/store/base.py with a default get_stats() implementation
  • Moves the file-based implementation into FileTaskStore at clawteam/store/file.py (behavior unchanged)
  • Adds get_task_store() factory that checks CLAWTEAM_TASK_STORE env var / config before falling back to file
  • Adds task_store field to ClawTeamConfig + env var mapping in get_effective()
  • Existing imports (from clawteam.team.tasks import TaskStore) keep working via lazy re-export

This is Phase 1 from the roadmap — it unblocks adding Redis/SQL backends later without touching any existing callers.

New layout

clawteam/store/
├── __init__.py   # get_task_store() factory + re-exports
├── base.py       # BaseTaskStore ABC
└── file.py       # FileTaskStore (extracted from team/tasks.py)

Test plan

  • 17 new tests covering ABC, factory, backward compat, config integration, round-trip CRUD
  • All 201 tests passing (184 existing + 17 new)
  • Ruff clean

Mirrors the existing transport/ pattern (Transport ABC + FileTransport +
factory). Existing imports (`from clawteam.team.tasks import TaskStore`)
keep working via lazy re-export.

New layout:
  store/base.py   — BaseTaskStore ABC with get_stats default impl
  store/file.py   — FileTaskStore (moved from team/tasks.py, unchanged)
  store/__init__   — get_task_store() factory, reads CLAWTEAM_TASK_STORE
  config.py       — task_store field + env var mapping

17 new tests, 201 total passing.
@tjb-tech tjb-tech merged commit b324429 into HKUDS:main Mar 26, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants