feat: persist _marker cursor for gapless resume across restarts#23
Merged
carlosmmatos merged 3 commits intomainfrom Apr 13, 2026
Merged
feat: persist _marker cursor for gapless resume across restarts#23carlosmmatos merged 3 commits intomainfrom
carlosmmatos merged 3 commits intomainfrom
Conversation
Switch state persistence from wall-clock timestamps to the Falcon Intel API's opaque _marker cursor. This eliminates gaps from clock skew and indicators arriving between time.time() and the actual API response. - Add state.py module for JSON-based state load/save with atomic writes - Expose _marker from falcon.py generator as (batch, marker) tuples - Track last_marker_seen in FalconReaderThread, fall back to wall-clock only when no indicators are returned in a cycle - Wire up state loading in __main__.py with safe fallback for old state files (missing last_marker key triggers initial_sync_lookback) - Add per-indicator timestamps in chronicle.py using published_date - Add STATE_FILE env var support and Dockerfile volume for /ccib/data - Update README with state persistence docs and volume mount examples
The local data/state.json was leaking into the Docker image via COPY, and the non-recursive chown left it root-owned — causing permission denied errors when ccibuser tried to read it.
redhatrises
approved these changes
Apr 13, 2026
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.
Adds state persistence so the bridge resumes from its exact position in the Falcon indicator feed after a container restart, eliminating gaps and redundant re-fetches.
What changed:
ccib/state.pymodule with atomic file writes (tempfile+os.replace) to prevent corruption on mid-write killsFalconReaderThreadsaves the last_markercursor todata/state.jsonafter each fetch cycle and resumes from it on startupget_indicators()now yields(batch, last_marker)tuples so the marker propagates to the callerChronicle._indicator_ts()uses the indicator's ownpublished_date/last_updatedinstead of wall-clock time for more accurate Chronicle timestampsFigConfiggainsSTATE_FILEenv var support (optional, defaults todata/state.json)/ccib/datawith proper ownership and declares aVOLUME;.dockerignoreprevents local state from leaking into the imageWithout the volume mount the bridge still works — it falls back to
initial_sync_lookbackand the ICache deduplicates any overlap.