refactor: Rename algo to algorithm in page_rank(), feedback_arc_set() and feedback_vertex_set() - #2859
refactor: Rename algo to algorithm in page_rank(), feedback_arc_set() and feedback_vertex_set()#2859krlmlr wants to merge 2 commits into
algo to algorithm in page_rank(), feedback_arc_set() and feedback_vertex_set()#2859Conversation
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 12230f8 is merged into main:
|
…c_set()` and `feedback_vertex_set()` (#2788, #526) The legacy `algo` spelling is recovered by the generated ARG_HANDLE blocks and soft-deprecated; abbreviations of both spellings are guarded as ambiguous. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RTPj4qNv2FWui6etixZeuR
12230f8 to
3072632
Compare
`ambiguous_tags()` charmatched a candidate prefix against `match_names`, so any rename whose old name is a prefix of the new one (`algo` -> `algorithm`) flagged `a`, `al` and `alg` as ambiguous even though both candidates resolve to the same argument. Those calls used to work with a soft deprecation and hard-errored instead, with a message that was factually wrong. Dedupe on `match_to` so a prefix is ambiguous only when the names it matches resolve to different arguments of the new API. Regenerating narrows the `page_rank()` guard to `d` (`damping` vs `directed`, a real ambiguity), drops the guards from `feedback_arc_set()` and `feedback_vertex_set()` entirely, and also drops the same latent false positive from `migration_fixture()` (`weight` -> `weights`). `migration_fixture_shadow()` keeps rejecting `at =`, where the two candidates really do have distinct targets. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Reviewed the rename itself and it looks correct: no drift in the generated blocks, no stale I did find one regression in the generated ambiguity guard, fixed in 47d1fa6. The bug
page_rank(g, alg = "arpack") # soft deprecation before, hard error after
feedback_arc_set(g, alg = "exact_ip") # newly guarded by this PRThe error message was also factually wrong ("matches multiple arguments of The fixA prefix is ambiguous only when the names it matches resolve to different targets, so the predicate now dedupes on hits <- startsWith(names, p)
length(unique(entry$match_to[hits])) > 1LRegenerating narrows or drops four guards, and keeps the ones that matter:
Test changes
Full suite green locally: 9311 pass, 0 fail. I kept this in the same PR rather than splitting it: the bug only becomes user-visible through this rename, and the fix changes these three functions' generated blocks, so a separate PR would leave this one mergeable-but-broken and need a rebase on the generated code anyway. |
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 47d1fa6 is merged into main:
|
Part of #2788 (PR 1 of a stack of 6, least controversial first); implements the
algo→algorithmleg of #526.What this does
Renames the
algoargument toalgorithminpage_rank(),feedback_arc_set()andfeedback_vertex_set()— the three functions the Comprehensive plan: argument renames for 3.0.0 #2788 survey lists under thealgospelling. All three already carry their 3.0.0 keyword-only migration entries withalgoafter..., so the rename is a pure registry change (algo = algorithmbare-symbol rename intools/migrations/), and legacyalgo =callers are recovered with the same single soft-deprecation as positional callers:Abbreviations that could mean either spelling (
a,al,alg) are rejected as ambiguous by the regenerated ARG_HANDLE guards.The deprecated
page.rank()wrapper keeps its frozenalgoformal (now documented locally with a deprecated badge, since@inheritParams page_rankno longer carries it) and forwards toalgorithm.Tests: named uses updated, plus new coverage that the legacy name is recovered (snapshot for
page_rank(algo = ),expect_deprecatedfor the two feedback functions).Out of scope
method(12 algorithm-choice + 2 comparison-metric functions),implementation(2) andimpl(1) are the open "algorithm family" questions in #2788 and are not touched here.🤖 Generated with Claude Code
https://claude.ai/code/session_01RTPj4qNv2FWui6etixZeuR
Generated by Claude Code