Skip to content

Make the fetchall guard line-number-independent (stop the recurring baseline drift) #6872

Description

@Scottcjn

Problem

scripts/check_fetchall.sh / tests/test_fetchall_guard.py record each legacy raw .fetchall() site in scripts/baselines/fetchall_existing.txt keyed by file:line:content. The line number makes the baseline fragile: any PR that adds/removes lines in node/rustchain_v2_integrated_v2.2.1_rip200.py above a baselined call shifts that call's line number, so it no longer matches its baseline entry and the guard reports it as a 'new unannotated' site — turning the blocking test check RED on main and on every open PR.

This has now required manual resyncs twice in one day (#6870, then #6871 after #6866 shifted lines again). It's whack-a-mole.

Proposed fix

Key the baseline by content, not file:line:

  • Store file:normalized_content (drop the line number) in the baseline.
  • In the guard, transform both the scan and the baseline the same way before comparing.
  • To preserve detection of a newly-added call whose content duplicates an existing one, compare as a multiset (e.g. sort | uniq -c counts per file:content) rather than sort -u, so adding an Nth identical-content call still trips the guard.

Acceptance

  • Adding/removing unrelated lines in a node file does NOT change the guard result (no false 'new' from line shifts).
  • A genuinely-new .fetchall() (new content, or an additional instance of existing content) IS still flagged.
  • tests/test_fetchall_guard.py updated to cover: (a) a line-shift produces no error, (b) a new distinct call is caught, (c) a duplicate-content new call is caught.
  • Migrate scripts/baselines/fetchall_existing.txt to the new format.

Why it matters

This is the same class of recurring CI tax as the miner-checksum manifest (fixed structurally by the auto-regen hook #6857) and the clawrtc flaky test (#6863). A line-independent guard ends the resync treadmill for good.

Filed after resyncing the baseline twice (#6870, #6871) in one session.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triagedReviewed and categorized

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions