Skip to content

refactor: move optional arguments of flow functions behind the ellipsis#2767

Open
krlmlr wants to merge 2 commits into
mainfrom
claude/ellipsis-flow
Open

refactor: move optional arguments of flow functions behind the ellipsis#2767
krlmlr wants to merge 2 commits into
mainfrom
claude/ellipsis-flow

Conversation

@krlmlr

@krlmlr krlmlr commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Part of the repo-wide ellipsis migration coordinated in #2757
see that PR for the full rationale (CONTRIBUTING.md, Argument Order and the Ellipsis).
Based directly on main (the registry split landed via #2779); a single topic commit.

What this does

Inserts ... between the defining arguments (head) and the optional
modifiers
(tail) of 9 exported flow functions.
Arguments after ... become keyword-only.

  • Legacy positional or abbreviated calls are recovered by the generated
    ARG_HANDLE block and emit a single lifecycle::deprecate_soft("3.0.0", …)
    behavior is unchanged.
  • No defaults change, no arguments are renamed, deprecated functions untouched.
  • Registry: tools/migrations/flow.R; blocks regenerated via
    Rscript tools/generate-migrations.R (idempotent, CI-checked).
  • Rd usage/arguments updated mechanically (see note below).

New signatures

function head (positional) keyword-only tail
cohesive_blocks() graph labels
export_pajek() blocks, graph, file project.file
adhesion() graph checks
dominator_tree() graph, root mode
edge_connectivity() graph, source, target checks
max_flow() graph, source, target capacity
min_cut() graph, source, target capacity, value.only
st_min_cuts() graph, source, target capacity
vertex_connectivity() graph, source, target checks

Notes for review

  • The environment used to prepare this PR cannot install igraph.r2cdocs
    (GitHub API unreachable), so man/*.Rd files were updated mechanically
    (usage + ... argument item) instead of via devtools::document().
    R CMD check's usage↔formals validation passes; a follow-up
    devtools::document() run may reflow whitespace but should produce no
    semantic diff.
  • Package tests that called these functions positionally were updated to
    named arguments (they are the same soft-deprecation user code will see).

@krlmlr
krlmlr force-pushed the claude/ellipsis-flow branch 2 times, most recently from 6493371 to 87bd356 Compare July 26, 2026 11:09
@github-actions

Copy link
Copy Markdown
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 87bd356 is merged into main:

  • ✔️as_adjacency_matrix: 882ms -> 879ms [-1.26%, +0.58%]
  • ✔️as_biadjacency_matrix: 841ms -> 839ms [-0.78%, +0.36%]
  • ✔️as_data_frame_both: 1.71ms -> 1.72ms [-1.49%, +1.87%]
  • ✔️as_long_data_frame: 4.42ms -> 4.53ms [-2.09%, +7.05%]
  • ❗🐌es_attr_filter: 3.17ms -> 3.25ms [+0.07%, +4.96%]
  • ✔️graph_from_adjacency_matrix: 135ms -> 137ms [-0.34%, +2.91%]
  • ✔️graph_from_data_frame: 3.68ms -> 3.66ms [-2.06%, +1.08%]
  • ✔️vs_attr_filter: 1.8ms -> 1.81ms [-1.56%, +2.26%]
  • ✔️vs_by_name: 1.2ms -> 1.18ms [-3.03%, +1.19%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@krlmlr
krlmlr marked this pull request as ready for review July 26, 2026 15:03
@krlmlr krlmlr closed this Jul 26, 2026
@krlmlr
krlmlr force-pushed the claude/ellipsis-flow branch from 87bd356 to 0f7d122 Compare July 26, 2026 16:24
Insert `...` between the defining arguments and the optional
modifiers of 9 functions,
following the zoning rules in CONTRIBUTING.md.
Legacy positional and abbreviated calls are recovered
by the generated ARG_HANDLE blocks
(registry: tools/migrations/flow.R)
and emit a single soft deprecation for igraph 3.0.0.
No defaults change and no arguments are renamed.

Functions: adhesion, cohesive_blocks, dominator_tree, edge_connectivity, export_pajek, max_flow, min_cut, st_min_cuts, vertex_connectivity

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016M32izVHZPfxAqemAe4BrX
@krlmlr krlmlr reopened this Jul 26, 2026
Add argument-coverage tests for the 9 functions of the flow
ellipsis migration (R/flow.R and R/cohesive.blocks.R):
every keyword-only tail argument is passed by name with a
non-default value and asserted on,
and the legacy positional form is exercised through
lifecycle::expect_deprecated() with an equality check
against the equivalent named call.
tests/testthat/test-cohesive.blocks.R is new,
mirroring its source file per the testing conventions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016M32izVHZPfxAqemAe4BrX
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