feat: add StorageAdapter abstraction and InMemoryAdapter with full test suite
- Introduce StorageAdapter protocol and InMemoryAdapter (thread-safe, in-memory) in engine/adapter.py to decouple storage from sync logic - Refactor SyncEngine to accept a StorageAdapter, replacing the previous stub that returned an empty list - Wire server to use SyncEngine + InMemoryAdapter, removing hardcoded SYNC_OPERATIONS fixtures - Add tests for engine, adapter, generator, and types (tests/) - Add pre-commit config (.pre-commit-config.yaml) with linting/formatting hooks - Update pyproject.toml and uv.lock with new dev dependencies - Clean up type annotations and CLI help strings across generator, server, and utils
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
# Pre-commit hooks for sync-protocol.
|
||||
#
|
||||
# Install: uv run --group dev pre-commit install
|
||||
# Run once: uv run --group dev pre-commit run --all-files
|
||||
|
||||
default_language_version:
|
||||
python: python3.12
|
||||
|
||||
repos:
|
||||
# ---------------------------------------------------------------------------
|
||||
# General hygiene
|
||||
# ---------------------------------------------------------------------------
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-toml
|
||||
- id: check-json
|
||||
- id: check-merge-conflict
|
||||
- id: debug-statements
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Black — code formatter
|
||||
# ---------------------------------------------------------------------------
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 26.5.1
|
||||
hooks:
|
||||
- id: black
|
||||
language_version: python3.12
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Ruff — linter + import sorter (auto-fix on commit)
|
||||
# ---------------------------------------------------------------------------
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.16.4
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--fix, --exit-non-zero-on-fix]
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Mypy — static type checker
|
||||
# ---------------------------------------------------------------------------
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v2.3.1
|
||||
hooks:
|
||||
- id: mypy
|
||||
args: [--config-file, pyproject.toml]
|
||||
additional_dependencies:
|
||||
- "pydantic>=2.13.4"
|
||||
- "pydantic-settings>=2.15.0"
|
||||
- "click>=8.4.2"
|
||||
- "jinja2>=3.1.6"
|
||||
- "pytest>=9.1.1"
|
||||
Reference in New Issue
Block a user