diff --git a/local/scripts/verify-fork-functions.sh b/local/scripts/verify-fork-functions.sh index e23ae6c834..d5e852eeb3 100755 --- a/local/scripts/verify-fork-functions.sh +++ b/local/scripts/verify-fork-functions.sh @@ -146,19 +146,32 @@ for fork in "${TARGET_FORKS[@]}"; do [[ "$QUIET" -eq 0 ]] && missing_details+=(" $f: fn $fn → EXCLUDED (RB intentional)") continue fi - # Strip modifiers to get bare function name for cross-file search + # Common function names (constructors, trait impls, patterns) appear + # in many unrelated files — cross-file search produces false MOVED matches. bare_fn=$(echo "$fn" | sed -E 's/^(pub |async |unsafe )+//') - found_elsewhere=$(cd "$fork_dir" && \ - grep -rlP "(?:pub )?(?:async )?(?:unsafe )?fn ${bare_fn}\b" \ - --include='*.rs' --exclude-dir='.git' --exclude-dir='target' --exclude-dir='stage' . 2>/dev/null | \ - grep -v "^\./${f}$" | head -1 | sed 's|^\./||') - if [[ -n "$found_elsewhere" ]]; then - [[ "$QUIET" -eq 0 ]] && missing_details+=(" $f: fn $fn → MOVED to $found_elsewhere") - else - missing_details+=(" $f: fn $fn") - fork_missing=$((fork_missing + 1)) - TOTAL_MISSING=$((TOTAL_MISSING + 1)) - fi + case "$bare_fn" in + new|default|read|write|parse|open|close|run|init|main|\ + get|set|remove|insert|delete|start|stop|send|recv|\ + connect|bind|listen|accept|clone|drop|eq|hash|fmt|\ + from|into|next|count|len|is_empty|clear|contains|\ + daemon|allocate|index|try_from|from_psf|into_object|\ + get_unique|set_plane) + # Too ambiguous — treat as truly missing (operator must decide) + ;; + *) + found_elsewhere=$(cd "$fork_dir" && \ + grep -rlP "(?:pub )?(?:async )?(?:unsafe )?fn ${bare_fn}\b" \ + --include='*.rs' --exclude-dir='.git' --exclude-dir='target' --exclude-dir='stage' . 2>/dev/null | \ + grep -v "^\./${f}$" | head -1 | sed 's|^\./||') + if [[ -n "$found_elsewhere" ]]; then + [[ "$QUIET" -eq 0 ]] && missing_details+=(" $f: fn $fn → MOVED to $found_elsewhere") + continue + fi + ;; + esac + missing_details+=(" $f: fn $fn") + fork_missing=$((fork_missing + 1)) + TOTAL_MISSING=$((TOTAL_MISSING + 1)) done <<< "$missing" fi done