Visitar URL original
fix(ci): do not call a file deleted when its clone may have failed by robcohen · Pull Request #2211 · rustledger/rustledger · GitHub
Skip to content

fix(ci): do not call a file deleted when its clone may have failed - #2211

Merged
robcohen merged 1 commit into
mainfrom
fix/drift-fetch-failures
Sep 1, 2026
Merged

robcohen merged 1 commit into
mainfrom
fix/drift-fetch-failures

Conversation

@robcohen

Copy link
Copy Markdown
Member

The corpus-drift job from #2196 had its first live run and filed #2199. Chasing that report found a hole in it.

A failed clone and a deleted file look identical

Once the fetch has finished, both leave a manifest path with nothing on disk. That run had 4 clone failures and reported 3 files as gone upstream.

The file-count slack cannot substitute for knowing: it fetched 734 of 735 — one file short, nowhere near the 50-file floor — so nothing fired.

That it can't be adjudicated now IS the argument

A later complete fetch found all three "gone" files present, and also lacked both files that run called new. So upstream moved between the two fetches, and there is no way to tell today which half of #2199 was real.

The marker is written at the only moment the difference is knowable — during the fetch, by the code that watched the clone fail.

The fix

fetch-compat-test-files.sh already counts its failures and prints them; it now writes the count into the corpus directory (gitignored). The drift script reads it and, on any failure, drops the "file is gone" group and logs why.

Only that group. A clone that did not happen cannot invent a new file or change a hash — it can only fail to produce one. So added and the two hash-change groups stay, and a run with failures still reports everything it can legitimately see.

Self-test

marker state reads as suppresses
absent (older script, corpus assembled another way) None no
0 0 no
4 4 yes
garbage None no

Ignoring the marker fails the test. The absent-vs-zero distinction matters: both must report everything, and conflating them with a default of 0 would silently disable the guard on any corpus the updated script didn't produce.

Note on #2199

I could not resolve it as filed. Against a complete corpus today the manifest has no drift — 735 files, 735 entries, regeneration yields no diff — so there is nothing to regenerate. The next scheduled run will re-report against whatever upstream looks like then, now without the deletion half being guesswork.

🤖 Generated with Claude Code

https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr

The drift job's first live run reported three files as gone upstream.
Chasing them found that a failed clone and a deleted file are
indistinguishable once the fetch has finished: both leave a path in the
manifest with nothing on disk. That run had four clone failures.

The file-count slack cannot substitute for knowing. It fetched 734 of
735 -- one short, nowhere near the 50-file floor -- so nothing fired.

`fetch-compat-test-files.sh` already counts its failures and prints
them. It now writes the count into the corpus, and the drift script
reads it: with any failure, the "file is gone" group is dropped and the
reason is logged. Only that group, because a clone that did not happen
cannot invent a new file or change a hash -- it can only fail to produce
one.

That the report cannot be adjudicated after the fact IS the argument.
A later complete fetch found all three files present, and also lacked
the two the run called new, so upstream moved in between; there is no
way to tell now which half was which. The marker is written at the only
moment the difference is knowable.

Self-tested: a missing marker reads as None (an older script, or a
corpus assembled another way) and suppresses nothing; 0 suppresses
nothing; a count suppresses; garbage reads as None rather than 0.
Ignoring the marker fails the test.
Copilot AI lite review requested due to automatic review settings August 31, 2026 20:06
@robcohen
robcohen requested a review from a team as a code owner August 31, 2026 20:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are small, consistent with the PR’s stated intent, and include a self-test that exercises the new marker parsing and suppression behavior.

Pull request overview

This PR hardens the scheduled “corpus baseline drift” CI reporting so it won’t misclassify missing corpus files as upstream deletions when some repository clones failed during the fetch, improving the accuracy of drift issues like #2199.

Changes:

  • Write a fetch-failure marker (.fetch-failures) into the fetched corpus directory at the end of fetch-compat-test-files.sh.
  • Teach corpus-baseline-drift.py to read that marker and, when non-zero, suppress only the "removed" (“file is gone”) drift group while still reporting additions and hash changes.
  • Extend the script self-test to pin correct marker parsing and the absent-vs-zero distinction.
File summaries
File Description
scripts/fetch-compat-test-files.sh Records clone-failure count into the corpus directory for downstream consumers.
scripts/corpus-baseline-drift.py Reads the marker, suppresses only deletion reports on partial fetches, and adds self-tests for the marker behavior.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown
Contributor

✅ Compatibility Test Results

Metric Result
Check Compatibility 100%
BQL Compatibility 100% (raw 93%, 170 masked)
Full AST Match 100%
Total Files 811
What's tested
  • Check: Exit codes and error counts match bean-check
  • BQL: Query results match bean-query
    The headline is the EFFECTIVE rate, after pairs where beanquery
    itself is wrong are masked. raw is the same run with nothing
    masked. A widening gap means the registry grew, not that rledger
    changed.
  • Files: ~800 test files downloaded from 10+ beancount repositories

Full results available in workflow artifacts

@robcohen
robcohen merged commit 31a7292 into main Sep 1, 2026
44 of 46 checks passed
@robcohen
robcohen deleted the fix/drift-fetch-failures branch September 1, 2026 03:06
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.

2 participants