fix(correlation): key versioned 1:1 correlation id on source_guid, not position#773
Conversation
|
Staff review — approve. Verified the root cause, the fix, and the no-regression surface by fetching the branch and running the affected suites (87 passed: correlator + enrichment + core/utils; Root cause — confirmed
Fix — correctKeying versioned 1:1 on Behavior change is real but safeThe id value for versioned 1:1 records changes from position-based to guid-based. This is a silent change to the
Tests — high qualityThe 6 new tests include anti-cheat pins (shared-id == guid-helper output; versioned+ Non-blocking notes
No merge-blocking issues. Ship it. |
…_correlation_id docstring
Drop the 'records without a source_guid' clause: for versioned 1:1 records source_guid is present (stamped at ingestion), and expansion children get one unconditionally from LineageEnricher before this runs. The no-source_guid position fallback is defensive, not a real path worth advertising in a minimal docstring.
Summary
Parallel versions of the same source record intermittently received different
version_correlation_ids, so aversion_consumption: mergeconsumer would abort withMissing required field: version_correlation_idon fresh runs.Root cause:
VersionIdEnricher.enrichalways passesrecord_index, soadd_version_correlation_idalways took the position-based keying branch. Underversions: {mode: parallel}, each version filters/orders records independently, so the same source record lands at a differentrecord_indexper version -> different registry key -> different id.Fix (keying decision lives in
version_id.py, where the discriminators are available):is_versioned_agentand notforceandsource_guidpresent) -> key onsource_guid, so all N parallel versions share one id regardless of per-version position.force=True) and no-source_guidrecords keep position keying (unique per item / per position) — expansion uniqueness is preserved.No behavior change for expansions; the enricher and the correlator grouping logic are untouched (only the abort's message string).
Verification
tests/unit/utils/correlation/test_version_id_keying.py(6 tests): shared-id-across-positions (the RED repro), distinct-guid, expansion-uniqueness, versioned-expansion-uniqueness, no-guid position fallback, and a pin that the shared id equals the GUID helper's output (kills inline-hash / clamp-to-0 shortcuts).tests/core/graph/test_version_correlator.py: asserts the abort message (not just context dict) names the source_guid and version agent.ruff check+ruff format --checkclean acrossagent_actionsandtests.