Repository navigation
feat(streaming): add event-driven ingestion for issue #891 - #1045
Merged
AmitoVrito merged 12 commits intoSep 20, 2026
Merged
AmitoVrito merged 12 commits into
AmitoVrito merged 12 commits into
Conversation
stop() tore the source down before an in-flight batch finished acking, so a source that had already committed its offset teardown (e.g. KafkaSource nulling its consumer) could silently no-op the ack for a batch already upserted into the target, causing spurious redelivery on restart. A batch lock now serializes the upsert+commit+ack sequence against stop()'s teardown, while still allowing stop() to interrupt a source blocked on its next-event wait. Co-authored-by: Dhruv Garg <[email protected]>
_document_ids only recognized metadata["document_id"], which was set exclusively by normalize_debezium_event. The default transform used by Kafka/Kinesis/Pulsar/JSON sources never set it, so delete/tombstone documents from those sources silently failed to remove the prior record from the vector store. Reuse the source's message key (the standard Kafka/Pulsar log-compacted-topic entity identity) as the default document_id when present, so non-CDC sources get working delete/tombstone support too. Co-authored-by: Dhruv Garg <[email protected]>
KafkaSource and PulsarSource never used the injected CheckpointStore to resume, unlike KinesisSource/PostgresCDCSource, and the docs implied uniform checkpoint-store-based resume for every source. They actually resume via their own native consumer-group/subscription offset commits. Document that distinction directly on the classes so it isn't silently discovered at restart time. Co-authored-by: Dhruv Garg <[email protected]>
KnowledgeMeshSink.upsert's post-ingest sequence (mark_file_chunks, stale-chunk delete, _save_vector_store) had no rollback: if rag.ingest succeeded but a later step raised, the on-disk mesh index was left stale relative to what the vector store already had, with no repair path. Wrap the sequence so _save_vector_store still runs on failure, persisting whatever mesh-index state was reached instead of losing it. Co-authored-by: Dhruv Garg <[email protected]>
docs/* is repo-gitignored (internal strategy/plan docs stay local only, per .gitignore's "Internal docs (not published)" section) with an explicit per-file allowlist. These two files were committed via git add -f, bypassing that. The usage guide belongs in the synapsekit-docs site, not this repo's internal docs/ tree. Co-authored-by: Dhruv Garg <[email protected]>
…tamps ingest() fell back to metadata["timestamp"]/["event_timestamp"] when "valid_at" was absent. Pre-existing loaders (Kafka, Slack, Teams, ...) already stamp a "timestamp" key for unrelated purposes (message send time, not extracted-fact validity), so any pre-existing KnowledgeMesh pipeline ingesting that content would have that value silently repurposed as valid_at, changing edge_id and time-travel query results with no streaming code involved. Only "valid_at" -- the key streaming's ingestor explicitly sets -- is used now. Co-authored-by: Dhruv Garg <[email protected]>
…dity upsert_relation forks a relation's edge_id when it re-ingests the same subject/predicate/object with a different valid_at. Preferring the extractor's valid_at over the document's own timestamp meant that path was live for LLM-based extraction: re-running extraction on redelivery (a checkpoint replay, say) can yield a slightly different LLM-derived valid_at each time, silently duplicating the edge. The document's own timestamp -- deterministic for a streamed event -- now wins when both are present. Co-authored-by: Dhruv Garg <[email protected]>
upsert_relation's merge branch only ever set edge.valid_until when it was previously unset, so once any bound was recorded it could never be corrected. Streaming makes this routine rather than rare: CDC/Kafka sources emit repeated updates to the same triple, and valid_until also gates live query filtering, so a wrong early bound would silently and permanently corrupt "is this fact still valid" results. A newly supplied valid_until now takes precedence over a stale one. Co-authored-by: Dhruv Garg <[email protected]>
Collaborator
|
Retriggering CI after pushing fixes from review — reopening immediately. |
# Conflicts: # .github/workflows/ci.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
StreamingIngestorpipeline with normalization, batching, backpressure, acknowledgements, retries, and graceful shutdown.valid_atand append distinct temporal WorldModel edges.Closes #891
Validation
uv sync --group dev --lockeduv run ruff check src/ tests/uv run ruff format --check src/ tests/uv run mypyuv run deptry src/uv run python scripts/check_async_blocking.pyuv lock --checkThe Kafka Testcontainers test is wired into the integration CI job. It could not be run locally because Docker is unavailable.