Skip to content

Remove dead HistorianStore Protocol, reset query.completed to v1, add HTTP batch/search tests - #43

Merged
randileeharper merged 1 commit into
mainfrom
fix/cleanup-issues-25-31-32
Jul 1, 2026
Merged

Remove dead HistorianStore Protocol, reset query.completed to v1, add HTTP batch/search tests#43
randileeharper merged 1 commit into
mainfrom
fix/cleanup-issues-25-31-32

Conversation

@randileeharper

Copy link
Copy Markdown
Owner

Summary

Three issues bundled together — all are small, self-contained cleanup items.

Issue #25 — Delete dead HistorianStore Protocol

The HistorianStore Protocol in storage.py was never used as a type annotation anywhere. HistorianService and AppContext both reference SQLiteHistorianStore directly. The Protocol signatures had also drifted from the concrete class (wrong search/get_event params, missing ~9 methods). Removed the Protocol class and the now-unused Protocol import.

Issue #31 — Reset historian.query.completed to version 1

historian.query.completed was registered at version 2 in builtin_manifest.json with no version 1 ever existing. All other builtin schemas use version 1. Reset the manifest to "version": 1 and updated "schemaversion": 2"1" in service.py _record_query to match.

Issue #32 — Add HTTP batch and search endpoint tests

No test coverage existed for POST /v1/events:batch or POST /v1/search. Added four tests in tests/test_http.py:

Test What it covers
test_batch_endpoint_ingests_valid_batch Valid batch through POST /v1/events:batch — response shape, event IDs, duplicate flags
test_batch_endpoint_rejects_missing_events_array Malformed body (no events array) → 422
test_search_endpoint_filters_by_fields POST /v1/search with apps/exact_phrases/limit — returns only matching events
test_search_endpoint_rejects_invalid_spec Invalid search fields → 422

Closes #25, closes #31, closes #32.

Test commands run

uv run pytest -q
uv run python -m compileall historian tests

All 88 tests pass (4 new); compile check clean.

… HTTP batch/search tests

Issue #25: The HistorianStore Protocol in storage.py was never used as a
type annotation — HistorianService and AppContext both use
SQLiteHistorianStore directly. The Protocol signatures had also drifted
from the concrete class. Removed the Protocol and the unused Protocol
import.

Issue #31: historian.query.completed was registered at version 2 with
no version 1 ever existing in the codebase. Reset the manifest version
to 1 and updated schemaversion in _record_query to match. All other
builtin schemas already use version 1.

Issue #32: Added test coverage for POST /v1/events:batch and POST
/v1/search in test_http.py:
- Valid batch ingests and returns event IDs with duplicate flags
- Malformed batch (missing events array) rejected with 422
- Search filters by SearchSpec fields and returns matching events
- Invalid search spec rejected with 422

Closes #25, closes #31, closes #32.
@randileeharper
randileeharper merged commit 86c452b into main Jul 1, 2026
1 check passed
@randileeharper
randileeharper deleted the fix/cleanup-issues-25-31-32 branch July 1, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant