Skip to content

Fix workflow push races, stale-data commits, and duplicate refresh#2

Open
LukasWallrich wants to merge 2 commits into
mainfrom
audit/workflow-fixes
Open

Fix workflow push races, stale-data commits, and duplicate refresh#2
LukasWallrich wants to merge 2 commits into
mainfrom
audit/workflow-fixes

Conversation

@LukasWallrich

Copy link
Copy Markdown
Contributor

Part of a repo audit (bugs + easy enhancements). Workflow-only changes:

  • Rebase before push in refresh-flora.yml and refresh-impact-factor.yml (mirroring refresh-data.yml). Previously a concurrent push to main caused a rejected non-fast-forward push that discarded the whole run's output.
  • Fail fast on OpenAlex enrichment failure: removed continue-on-error: true from the compute_omc.py step. Before, a failed enrichment let the R render commit a fresh-timestamped Mean Citedness analysis built from stale data, with a green check.
  • Removed the duplicate FLoRA snapshot step from the weekly impact-factor workflow — the daily refresh-flora.yml owns data/flora.csv; the weekly job now consumes the committed snapshot (also dropped those files from its git add).
  • Moved the impact-factor cron from Mon 05:00 to Mon 11:00 UTC, past refresh-data.yml's worst-case finish (04:00 + 350-min timeout), removing the push race window.
  • Deleted clean-json.yml: dead safety net — its three target files are written with allow_nan=False + clean_for_json, so NaN/Infinity can never be emitted (and it pushed without rebasing, adding another race).

All remaining workflow YAML validated with PyYAML.

🤖 Generated with Claude Code

LukasWallrich and others added 2 commits July 18, 2026 23:49
- refresh-flora.yml, refresh-impact-factor.yml: add `git pull --rebase
  origin main` before push, mirroring refresh-data.yml, so concurrent
  pushes to main no longer cause rejected non-fast-forward pushes that
  discard a run's output.
- refresh-impact-factor.yml: drop continue-on-error from the compute_omc
  step. render_impact_factor.R strictly reads its flora_with_omc.csv
  output; without the guard a failed enrichment let R commit a "fresh"
  analysis from stale/absent data. Failing fast is safer than committing
  misleading output.
- refresh-impact-factor.yml: remove the redundant refresh_flora.py step
  and drop flora.csv / flora_meta.json from the commit; the daily
  refresh-flora.yml owns that snapshot.
- refresh-impact-factor.yml: move cron from Mon 05:00 to Mon 11:00 UTC
  (after refresh-data's up-to-~6h window) with an explanatory comment.
- Delete clean-json.yml: dead safety net. Its targets (meta.json,
  aggregate.json, originals.json) are all written by refresh_data.py with
  allow_nan=False via clean_for_json, so no NaN/Infinity tokens are ever
  emitted.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…uard

- All three data workflows now share concurrency group flora-data-main
  (queued, not cancelled), giving true mutual exclusion for pushes to
  main; the rebase-before-push remains as a belt for non-workflow pushes.
- The weekly Mean Citedness job fails fast if data/flora.csv is older
  than 48h, so a broken daily refresh can't feed stale input into a
  fresh-timestamped analysis.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@LukasWallrich

Copy link
Copy Markdown
Contributor Author

Codex review (gpt, read-only): REQUEST_CHANGES — findings and how they were addressed in dcbd52d:

  1. High — push race reduced, not fixed (single rebase-then-push can still lose to a concurrent run; rebase conflicts possible). ✅ Addressed: all three data workflows now share the concurrency group flora-data-main (cancel-in-progress: false), so their runs are serialized by GitHub and never push concurrently. The rebase remains as a belt for pushes from outside the workflows.
  2. Medium — compute_omc.py swallows network/HTTP failures, so removing continue-on-error doesn't catch a widespread OpenAlex outage that yields incompletely enriched but fresh-timestamped data. ➡️ Being addressed in the companion pipeline-robustness PR (no caching of transient failures + retries + failure-rate guard) — script changes are out of scope for this workflow-only PR.
  3. Medium — removing the weekly FLoRA download leaves an unchecked stale-input path if the daily refresh has been failing. ✅ Addressed: the weekly job now fails fast when data/flora_meta.json shows the snapshot is older than 48 h.

Codex also confirmed the commit-then-rebase placement is sound and the 11:00 UTC schedule clears refresh-data's timeout window.

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.

1 participant