Skip to content

feat: Complete event-bus ingestion integration#107

Merged
evansenter merged 3 commits into
mainfrom
feat/bus-events-integration-issue-106
Feb 9, 2026
Merged

feat: Complete event-bus ingestion integration#107
evansenter merged 3 commits into
mainfrom
feat/bus-events-integration-issue-106

Conversation

@evansenter

Copy link
Copy Markdown
Owner

Summary

  • Wires up event-bus ingestion end-to-end: adds get_bus_events and ingest_bus_events MCP tools, integrates bus ingestion into the server startup and 5-minute background loop, stores raw event JSON in raw_bus_events table (migration v15) for future re-parsing
  • Fixes pre-existing bug in query_bus_events type breakdown query where where_parts slicing incorrectly dropped the last filter when using event_type/repo/session_id filters
  • Adds CLI formatter, benchmark entry, guide.md and SCHEMA.md documentation, and 22 comprehensive tests

Closes #106

Test plan

  • All 22 new tests pass (ingestion, incremental sync, raw storage, deduplication, query filters, schema validation)
  • Full test suite passes (434 passed, 10 skipped)
  • make check passes (ruff format + lint + tests)
  • CI passes on GitHub
  • After deploy: verify get_bus_events() returns data from event-bus
  • After deploy: verify ingest_bus_events() force-refresh works

🤖 Generated with Claude Code

Wire up event-bus ingestion end-to-end: MCP tools, background loop,
raw JSON storage, CLI formatter, and comprehensive tests.

- Add get_bus_events and ingest_bus_events MCP tools in server.py
- Add bus event ingestion to server startup and 5-minute background loop
- Store raw event JSON in raw_bus_events table (migration v15) for
  future re-parsing, mirroring the raw_entries pattern
- Add CLI formatter for bus events and benchmark entry
- Fix pre-existing bug in query_bus_events type breakdown query
  (where_parts slicing incorrectly dropped last filter)
- Align default limit to 50 across MCP, CLI, and queries layers
- Update guide.md and SCHEMA.md documentation
- Add 22 tests covering ingestion, incremental sync, raw storage,
  deduplication, querying with filters, and schema validation

Closes #106

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude

claude Bot commented Feb 9, 2026

Copy link
Copy Markdown

Prompt: evansenter/dotfiles/.../claude-review.md

Code Review

Summary

Wires up event-bus ingestion end-to-end: adds get_bus_events and ingest_bus_events MCP tools, integrates bus ingestion into the server startup and 5-minute background loop, stores raw event JSON in raw_bus_events table (migration v15), fixes a pre-existing bug in query_bus_events type breakdown query, and adds 22 tests.

Issues Found

Critical

None

Important

  • cli.py:844-846 - Potential TypeError crash when payload is None. The bus_events schema allows payload TEXT without NOT NULL, so event.get("payload", "") returns None when the key exists with a None value. Then len(payload) at line 846 raises TypeError: object of type 'NoneType' has no len(). Fix: use payload = event.get("payload") or "" instead.

Suggestions

  • queries.py:1936 - Docstring says limit: Maximum events to return (default: 100) but the actual default was changed to 50. Should be updated to match.

Verdict

REQUEST_CHANGES - One potential runtime crash in the CLI formatter when payload is null, and a minor docstring inconsistency.


Automated review by Claude Code

- Fix potential TypeError when payload is None in CLI formatter
  (use `or ""` pattern instead of default arg)
- Update docstring to reflect limit default changed from 100 to 50

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@evansenter

Copy link
Copy Markdown
Owner Author

Feedback Addressed

Implemented

  • [Important] cli.py:844 — Fixed potential TypeError when payload is None by using event.get("payload") or "" instead of event.get("payload", "")
  • [Suggestion] queries.py:1936 — Updated docstring to reflect limit default changed from 100 to 50

@claude

claude Bot commented Feb 9, 2026

Copy link
Copy Markdown

Prompt: evansenter/dotfiles/.../claude-review.md

Code Review

Summary

Completes event-bus ingestion integration: adds get_bus_events and ingest_bus_events MCP tools, wires bus ingestion into server startup and 5-minute background loop, stores raw event JSON in raw_bus_events table (migration v15), fixes a pre-existing bug in the query_bus_events type breakdown query, and adds 22 tests. All Phase 1 and Phase 2 requirements from issue #106 are addressed.

Issues Found

Critical

None

Important

None

Suggestions

  • tests/test_bus_ingest.py - The test_query_type_breakdown test (line 239) only queries without filters (days=30, no event_type/repo/session_id). The bug fix in queries.py:1997 corrected where_parts[:-1] slicing that dropped the last filter from the type breakdown sub-query — but this only manifests when filters are applied (2+ where_parts). A test like query_bus_events(storage, days=30, repo="dotfiles") followed by asserting result["event_types"] only contains the filtered repo's event types would directly validate the fix.

Previously Addressed (Filtered)

  • cli.py:844 — Potential TypeError when payload is None (Implemented: now uses or "" pattern)
  • queries.py:1936 — Docstring default mismatch (Implemented: updated to reflect limit=50)

2 items from prior feedback rounds were not re-raised.

Verdict

REQUEST_CHANGES - One suggestion to add a test case that directly validates the type-breakdown bug fix with filtered queries.


Automated review by Claude Code

Directly validates the query_bus_events type breakdown bug fix by
testing with repo filter, ensuring breakdown only includes filtered
events' types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@evansenter

Copy link
Copy Markdown
Owner Author

Feedback Addressed (Round 2)

Implemented

  • [Suggestion] tests/test_bus_ingest.py — Added test_query_type_breakdown_with_filter that queries with repo="dotfiles" and asserts the type breakdown only contains filtered events' types, directly validating the where_parts bug fix regression path

@claude

claude Bot commented Feb 9, 2026

Copy link
Copy Markdown

Prompt: evansenter/dotfiles/.../claude-review.md

Code Review

Summary

Completes event-bus ingestion integration: adds get_bus_events and ingest_bus_events MCP tools, wires bus ingestion into server startup and 5-minute background loop, stores raw event JSON in raw_bus_events table (migration v15), fixes a pre-existing bug in the query_bus_events type breakdown query (where_parts slicing), and adds 22 comprehensive tests. All Phase 1 and Phase 2 requirements from issue #106 are addressed.

Issues Found

Critical

None

Important

None

Suggestions

None

Previously Addressed (Filtered)

  • cli.py:844 — Potential TypeError when payload is None (Implemented: now uses or "" pattern)
  • queries.py:1936 — Docstring default mismatch (Implemented: updated to reflect limit=50)
  • tests/test_bus_ingest.py — Missing filtered type breakdown test (Implemented: added test_query_type_breakdown_with_filter)

3 items from prior feedback rounds were not re-raised.

Verdict

APPROVE - All prior feedback has been addressed. The implementation is clean, follows project conventions (migration pattern, MCP+CLI parity, benchmark entry, guide.md docs), and has thorough test coverage. The where_parts bug fix is correct and now has a direct regression test.


Automated review by Claude Code

@evansenter evansenter merged commit 30eceef into main Feb 9, 2026
3 checks passed
@evansenter evansenter deleted the feat/bus-events-integration-issue-106 branch February 9, 2026 02:37
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.

RFC: Complete event-bus ingestion integration (MCP tools, background ingest, multi-machine analysis)

1 participant