Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 25, 2025

Replace _impl aliases in R/topology.R with explicit wrapper functions

Summary:
Successfully replaced all direct _impl function aliases with explicit wrapper functions that properly preserve the missing state of optional parameters.

Changes completed:

  • Applied if (missing(arg)) missing_arg() else arg pattern to all color-related parameters
  • Updated graph.isomorphic.bliss - colors1, colors2
  • Updated graph.isomorphic.vf2 - vertex.color1, vertex.color2, edge.color1, edge.color2
  • Updated graph.subisomorphic.vf2 - vertex.color1, vertex.color2, edge.color1, edge.color2
  • Updated graph.count.isomorphisms.vf2 - vertex.color1, vertex.color2, edge.color1, edge.color2
  • Updated graph.count.subisomorphisms.vf2 - vertex.color1, vertex.color2, edge.color1, edge.color2
  • Updated canonical_permutation - colors
  • Updated count_automorphisms - colors (already done in previous commit)
  • Updated automorphism_group - colors
  • All tests passing (6952 pass, 0 fail)

Pattern applied:
The pattern uses rlang::missing_arg() to preserve the missing state of optional parameters. When a wrapper function receives an optional parameter that wasn't provided by the caller, it forwards a missing argument marker to the _impl function, allowing the _impl function's is_missing() check to work correctly.

Example:

canonical_permutation <- function(graph, colors = NULL, sh = c("fm", "f", "fs", "fl", "flm", "fsm")) {
  canonical_permutation_impl(
    graph = graph,
    colors = if (missing(colors)) missing_arg() else colors,
    sh = sh
  )
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Replace _impl aliases in R/topology.R</issue_title>
<issue_description>Goal
Review the code in R/topology.R and replace all direct _impl function aliases with explicit wrapper functions.

Functions to update:

  • graph.isomorphic.bliss <- isomorphic_bliss_impl
  • graph.isomorphic.vf2 <- isomorphic_vf2_impl
  • graph.subisomorphic.vf2 <- subisomorphic_vf2_impl
  • graph.count.isomorphisms.vf2 <- count_isomorphisms_vf2_impl
  • graph.count.subisomorphisms.vf2 <- count_subisomorphisms_vf2_impl
  • graph.isoclass <- isoclass_impl
  • graph_from_isomorphism_class <- isoclass_create_impl
  • canonical_permutation <- canonical_permutation_bliss_impl
  • permute <- permute_vertices_impl
  • graph.isomorphic <- isomorphic_impl
  • count_automorphisms <- count_automorphisms_bliss_impl
  • automorphism_group <- automorphism_group_impl

Instructions

  1. Review the code to understand the function signatures
  2. Create explicit wrapper functions that forward to the _impl functions
  3. Forward each argument individually and explicitly using arg = arg notation
  4. Do not use ... unless the _impl function itself uses ...

Pattern
Replace direct aliasing like:

func_name <- func_name_impl

With an explicit wrapper:

func_name <- function(arg1, arg2, ...) {
  func_name_impl(
    arg1 = arg1,
    arg2 = arg2,
    ...
  )
}

File
R/topology.R</issue_description>

<agent_instructions>A few functions have been replaced already. IMPORTANT: For this issue, failing tests are acceptable. Implement a simple forwarding and come back with the result, even if the tests fail.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Replace _impl aliases in R/topology.R Replace _impl aliases with explicit wrapper functions in R/topology.R Oct 25, 2025
Copilot AI requested a review from krlmlr October 25, 2025 23:36
Copilot finished work on behalf of krlmlr October 25, 2025 23:36
@krlmlr krlmlr marked this pull request as ready for review October 26, 2025 07:55
@krlmlr krlmlr changed the title Replace _impl aliases with explicit wrapper functions in R/topology.R refactor: Replace _impl aliases with explicit wrapper functions in R/topology.R Oct 26, 2025
@krlmlr krlmlr enabled auto-merge (squash) October 26, 2025 07:55
@krlmlr
Copy link
Contributor

krlmlr commented Oct 26, 2025

@copilot: Apply the pattern from the last commit across all relevant arguments. IMPORTANT: Do not use other patterns. Test and report if successful.

auto-merge was automatically disabled October 26, 2025 08:55

Head branch was pushed to by a user without write access

Copy link
Contributor Author

Copilot AI commented Oct 26, 2025

@copilot: Apply the pattern from the last commit across all relevant arguments. IMPORTANT: Do not use other patterns. Test and report if successful.

Applied the if (missing(arg)) missing_arg() else arg pattern to all color-related parameters in the wrapper functions. All tests now pass (6952 pass, 0 fail). Fixed in commit e9ba27c.

Copilot finished work on behalf of krlmlr October 26, 2025 08:56
@krlmlr krlmlr enabled auto-merge (squash) October 26, 2025 09:12
@krlmlr krlmlr merged commit c9a03be into main Oct 26, 2025
1 check passed
@krlmlr krlmlr deleted the copilot/replace-impl-aliases-topology-another-one branch October 26, 2025 09:30
krlmlr added a commit that referenced this pull request Oct 26, 2025
…`R/topology.R` (#2398)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: krlmlr <[email protected]>
Co-authored-by: Kirill Müller <[email protected]>
Co-authored-by: Kirill Müller <[email protected]>
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.

Replace _impl aliases in R/topology.R

2 participants