feat: DEFERRED records audit trail (ARCH-003)#105
Merged
Muizzkolapo merged 3 commits intomainfrom Apr 2, 2026
Merged
Conversation
Close the audit trail gap where records entering batch processing had no durable disposition in the storage backend. - Add DISPOSITION_DEFERRED constant and Disposition.DEFERRED enum member - Write DEFERRED disposition in ResultCollector with source_guid + task_id - Add deferred count to CollectionStats and ResultCollectionCompleteEvent - Clear DEFERRED dispositions when batch results arrive (processing_recovery) - Add orphan detection: warn if DEFERRED records remain after batch completion - Add 5 new tests covering disposition write, stats, and mixed-status scenarios Closes #84
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
DISPOSITION_DEFERREDdisposition to the storage backend when a record is queued for batch processing, closing the observability gap where DEFERRED was the only status without a durable trailChanges (7 files)
storage/backend.pyDISPOSITION_DEFERREDconstant +Disposition.DEFERREDenum memberprocessing/result_collector.py_safe_set_disposition(), adddeferredtoCollectionStats, fireResultCollectedEventlogging/events/data_pipeline_events.pytotal_deferred: int = 0toResultCollectionCompleteEvent(defaulted for backward compat)llm/batch/services/processing_recovery.pyworkflow/managers/batch.py_warn_orphaned_deferred()— diagnostic warning after batch processingtests/unit/core/test_result_collector.pytests/unit/wave3/test_enrichment_complete_event.pyDesign decisions
source_guidas record_id — matches every other disposition in the codebase; enables correlation when batch results come back (also keyed bysource_guid)clear_disposition()before writing final status — avoids UNIQUE constraint issues and ensures clean state regardless of final outcome (success records get no disposition, only the DEFERRED is cleared)Test plan
ruff check .— all cleanpytest— 4305 passed, 2 skipped, 0 failuresCloses #84
🤖 Generated with Claude Code