fix(backfill): normalize commit_date via datetime() in time-proximity query
Some checks are pending
CI / lint-and-test (push) Waiting to run
Some checks are pending
CI / lint-and-test (push) Waiting to run
SQLite datetime comparison fails lexicographically across ISO-T and
space-separator formats: '2026-03-27 18:00:14' < '2026-03-27T17:43:04+00:00'
because space (0x20) < T (0x54). PRs merged same-day but earlier than the
commit hour were silently excluded from the time-proximity cascade.
Shaga's 3 stigmergic-coordination claims resolved to PR #2032 (later, wrong)
instead of #2025 (earlier, correct). Fixed by wrapping both sides in
datetime(), which normalizes to space-separator before comparison.
Verified: all 3 Shaga claims now resolve to #2025 via git_time_proximity.
No change to totals (126 originator events, 5 proximity hits) — the fix
corrects WHICH PR each proximity-matched claim resolves to, not whether.
Caught by Ganymede review of 1d6b515.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1d6b51527a
commit
10d5c275da
1 changed files with 9 additions and 2 deletions
|
|
@ -344,11 +344,18 @@ def find_pr_for_claim(
|
|||
)
|
||||
commit_date = date_out.strip() if date_out.strip() else None
|
||||
if commit_date:
|
||||
# git %aI returns ISO 8601 with T-separator; prs.merged_at
|
||||
# uses SQLite's space-separator. Lexicographic comparison
|
||||
# fails across formats (space<T), so normalize commit_date
|
||||
# via datetime() before comparing. Without this, PRs merged
|
||||
# within the same calendar day but earlier than the commit
|
||||
# hour are silently excluded (caught by Ganymede review —
|
||||
# Shaga's #2025 was dropped in favor of later #2032).
|
||||
row = conn.execute(
|
||||
"""SELECT number FROM prs
|
||||
WHERE status='merged'
|
||||
AND merged_at >= ?
|
||||
AND merged_at <= datetime(?, '+24 hours')
|
||||
AND merged_at >= datetime(?)
|
||||
AND merged_at <= datetime(datetime(?), '+24 hours')
|
||||
AND (branch LIKE 'leo/%' OR branch LIKE 'theseus/%'
|
||||
OR branch LIKE 'rio/%' OR branch LIKE 'astra/%'
|
||||
OR branch LIKE 'vida/%' OR branch LIKE 'clay/%')
|
||||
|
|
|
|||
Loading…
Reference in a new issue