You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sync_lane_feed: overlapping ingests can lose or tear data/lanes.json #262
The second round of independent review on #261 found this.
scorecard_db.ingest_harvest.sync_lane_feed reads data/lanes.json, updates the lanes it was given, and writes the whole file back with Path.write_text. 26 modules call it, each after its SQLite transaction has committed, so nothing serializes the file:
Lost update: two ingests that overlap can both read the old feed, so the second write drops the first one's lane.
Torn read: an ingest that reads between another's truncation and its write sees an empty or partial file and fails to parse it.
build_db runs the ingests one after another in one process, so the committed feed is safe today. The risk is two standalone ingests run at the same time. #261's overlap test stubs the mirror, so it covers only the database rows.
Fixing it in sync_lane_feed would cover every caller:
hold an exclusive lock on a sibling lock file across the read, merge and write;
write through a temporary file in the same folder, then os.replace.
Activity
Answer review round 2: employer premiums, BHP, MSP, fetch, reruns