Skip to content

Allocate history job IDs atomically - #928

Merged
wangyinz merged 3 commits into
masterfrom
codex/issue-782-history-jobid
Aug 24, 2026
Merged

wangyinz merged 3 commits into
masterfrom
codex/issue-782-history-jobid

Conversation

@wangyinz

@wangyinz wangyinz commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Allocate history job IDs from one atomic MongoDB counter.
  • Keep legacy scanning out of normal allocation; provide an explicit, idempotent bootstrap for the historical high-water mark.
  • Reserve explicit IDs and reject booleans/non-integers before database access.
  • Add contract, concurrency, and real-Mongo coverage.

Closes #782

@codecov

codecov Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.96%. Comparing base (9704f48) to head (b7263fc).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #928      +/-   ##
==========================================
+ Coverage   72.90%   72.96%   +0.05%     
==========================================
  Files         182      182              
  Lines       36127    36144      +17     
  Branches     2532     2532              
==========================================
+ Hits        26337    26371      +34     
+ Misses       8885     8868      -17     
  Partials      905      905              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wangyinz
wangyinz marked this pull request as draft August 14, 2026 05:59

Copy link
Copy Markdown
Member Author

Draft decision required (renewed review)

A persistence owner must define how the atomic counter is bootstrapped above job IDs already stored by legacy deployments, including explicit-ID behavior. Fresh-database concurrency tests are insufficient; this PR stays draft until a migration or namespace policy guarantees global uniqueness.

@wangyinz

Copy link
Copy Markdown
Member Author

Review status: Draft. Required code fix: validate every explicit job ID as a non-bool integer before any Mongo operation; invalid BSON values can otherwise mutate and corrupt the numeric counter. Deployment decision: use an idempotent one-time bootstrap to the maximum legacy history.jobid before rollout, while the runtime allocator never scans history. Maintainer confirmation requested.

@wangyinz
wangyinz force-pushed the codex/issue-782-history-jobid branch from f75af90 to b7263fc Compare August 23, 2026 17:34
@wangyinz

Copy link
Copy Markdown
Member Author

Review decision: ready after final CI. Runtime allocation uses one atomic counter and never scans legacy history. Legacy high-water initialization is explicit and idempotent; explicit IDs reserve the counter, and invalid ID types fail before database access. The branch now contains only the three #782 commits rebased on current master.

@wangyinz
wangyinz marked this pull request as ready for review August 23, 2026 17:34
@wangyinz
wangyinz merged commit 167fa56 into master Aug 24, 2026
18 checks passed
@wangyinz
wangyinz deleted the codex/issue-782-history-jobid branch August 24, 2026 05:00
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.

[P1][History] Allocate globally unique job IDs with one atomic Mongo counter

1 participant