Skip to content

fix(g2-followup): tiebreak newest-first journal scans on event_id#159

Merged
brownjuly2003-code merged 1 commit into
mainfrom
fix/g2-followup-newest-first-tiebreak
Jul 6, 2026
Merged

fix(g2-followup): tiebreak newest-first journal scans on event_id#159
brownjuly2003-code merged 1 commit into
mainfrom
fix/g2-followup-newest-first-tiebreak

Conversation

@brownjuly2003-code

Copy link
Copy Markdown
Owner

Summary

  • The bounded journal scan added in S4 (G2 S4: hardening — bounded journal scan, node-token guard, doc/test follow-ups #158) ordered newest-first-scan results by {time_column} DESC with no secondary key, unlike the pre-existing ascending path (ASC, event_id ASC), which is a total order.
  • Two rows for the same entity sharing an identical timestamp resolve to whichever the backend happens to emit first — nondeterministic across backends/reloads, weakening the reconciliation idempotency guarantee on ties.
  • Adds , event_id DESC to the descending branch to restore a total order, matching old last-write-wins behavior deterministically.

Found during an Opus review pass (standing in for the currently-unavailable Codex review step) of merged PR #158. Low severity / non-blocking per that review — only reachable with two different-status rows for one order at a byte-identical timestamp, which the demo seed never produces — but cheap and correct to close now.

Test plan

  • ruff check / ruff format --check clean
  • Targeted tests: test_pipeline_events_scan.py, test_stuck_orders.py, test_exceptions_inbox.py — 28 passed
  • CI (lint/mypy/unit/integration) to confirm on this PR

🤖 Generated with Claude Code

The bounded journal scan added in S4 (PR #158) ordered by
`{time_column} DESC` with no secondary key, unlike the existing
ascending path's `ASC, event_id ASC` total order. Two rows sharing an
identical timestamp for the same entity resolved to whichever the
backend happened to emit first — nondeterministic across backends and
across reloads. Add `, event_id DESC` to restore a total order and
match the old last-write-wins tie behavior deterministically.

Found in an Opus review pass standing in for the unavailable Codex
review step.
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

DORA Metrics

  • Window: last 30 days
  • Branch: main
  • Deployment frequency: 86 total / 20.07 per week
  • Lead time for changes: avg 0.57h / median 0.0h
  • Change failure rate: 56.98% (49/86)
  • MTTR: n/a across 0 incident(s)

MTTR note: No failed mainline CI runs in the selected window.

@brownjuly2003-code brownjuly2003-code merged commit b332778 into main Jul 6, 2026
23 checks passed
@brownjuly2003-code brownjuly2003-code deleted the fix/g2-followup-newest-first-tiebreak branch July 6, 2026 02:18
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.

2 participants