Repository navigation
Fix citation generation workflow and remove debug-only timeout issue - #2
Conversation
Co-authored-by: jxchen01 <7811075+jxchen01@users.noreply.github.com>
Co-authored-by: jxchen01 <7811075+jxchen01@users.noreply.github.com>
|
@copilot resolve the merge conflicts in this pull request |
|
…PR branch Co-authored-by: jxchen01 <7811075+jxchen01@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new Crossref fallback indexes get_safe(...)[0] and date_parts[0] without guarding for empty lists, so sparse Crossref responses raise uncaught IndexErrors that defeat the fallback's purpose.
Review effort: Balanced
Findings: 3
Open (4)
What changed in this PR
This PR aims to make the citation-update CI flow more reliable. The citation job (_cite/cite.py → cite_with_manubot) depends on Manubot/DOI resolution, which can fail transiently and leave _data/citations.yaml unchanged while the workflow still reports success. The PR adds a Crossref metadata fallback so a failed Manubot lookup can still yield a citation, hardens the Manubot subprocess handling, and tweaks the workflow (removes a debug step, raises the citation build step's timeout).
Changes:
- Added
crossref_citation_fallbackin_cite/util.pyto fetch CSL-like metadata from the Crossref API when Manubot/DOI resolution fails. - Refactored
cite_with_manubotto capture stderr, detect empty Manubot output, and fall back to Crossref before raising. - Removed the
Debug dumpstep and raised the "Build updated citations" step timeout from 15 to 60 minutes.
| File | Description |
|---|---|
_cite/util.py |
Adds Crossref fallback and reworks the Manubot subprocess/parse/error path; the fallback has unguarded list indexing that can raise IndexError on sparse Crossref records and drops previous error logging. |
.github/workflows/update-citations.yaml |
Removes the debug-dump step and raises the citation build step timeout to 60 minutes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| return None | ||
|
|
||
| message = get_safe(payload, "message", {}) | ||
| title = get_safe(message, "title", [""])[0] |
| month = date_parts[0][1] if len(date_parts[0]) > 1 else "1" | ||
| day = date_parts[0][2] if len(date_parts[0]) > 2 else "1" |
| manubot = json.loads(stdout)[0] | ||
| except Exception: | ||
| raise Exception("Couldn't parse Manubot response") | ||
| manubot = crossref_citation_fallback(_id) |
| output = subprocess.Popen(commands, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() | ||
| stdout = output[0] or b"" | ||
| if not stdout: | ||
| raise ValueError("No stdout from Manubot") | ||
| manubot = json.loads(stdout)[0] | ||
| except Exception: | ||
| raise Exception("Couldn't parse Manubot response") | ||
| manubot = crossref_citation_fallback(_id) | ||
| if not manubot: | ||
| raise Exception("Manubot could not generate citation") |


Summary
Fix the GitHub CI citation update flow so it actually publishes updated citations instead of silently succeeding with no file diff.
Changes
_cite/util.pyso DOI citation generation still succeeds when Manubot/DOI resolution is flaky or unavailable.Why
The citation job was relying on a brittle Manubot/DOI lookup path that could fail without producing a changed
_data/citations.yaml, leaving the site stale while the workflow reported success.