rigraph icon indicating copy to clipboard operation
rigraph copied to clipboard

docs(revdep): Analyze and document reverse dependency problems

Open Copilot opened this issue 3 months ago • 6 comments

Analyzed three packages with newly broken checks to determine root causes and assess whether issues stem from igraph bugs or downstream package issues.

Analysis

Created revdep/problems-analysis.md with detailed findings:

1. Cascade - Namespace Collision (Minor)

New circulant() export conflicts with magic::circulant. Non-breaking warning only.

Root cause: make_circulant() added in v2.2.1.9003 exports constructor alias that collides with magic package.

2. jewel - Integer Validation (High Impact)

Package breaks on non-integer niter values:

# Fails with "not representable as an integer"
rewire(g, keeping_degseq(niter = 2.45))

Root cause: rewire_impl() uses as.numeric() but C code now strictly validates integers. Previously silently truncated.

Recommendation: Add as.integer(round(niter)) in rewire_keeping_degseq() for backward compatibility.

3. rSpectral - Modularity Changes (Medium Impact)

Tests fail due to different modularity values.

Root cause: modularity_impl() auto-detects weight attribute when weights = NULL:

if (is.null(weights) && "weight" %in% edge_attr_names(graph)) {
  weights <- E(graph)$weight
}

Workaround discovered: Passing weights = numeric() effectively disables auto-detection:

modularity(g, membership, weights = numeric())  # Forces unweighted calculation

This works because numeric() is not NULL (skips auto-detection), but !all(is.na(numeric())) is FALSE, causing the code to set weights <- NULL internally.

Deliverables

  • revdep/problems-analysis.md: Root cause analysis, assessment, and recommendations for each issue
  • revdep/examples/*.R: Runnable minimal reproducible examples demonstrating each problem, including the weights = numeric() workaround
  • revdep/notify-maintainers.sh: Automation script to notify package maintainers via GitHub issues or email drafts
  • revdep/NOTIFY-README.md: Documentation for using the notification script

Maintainer Notification Script

Created notify-maintainers.sh to automate notifying package maintainers:

  • Intelligent routing: Determines upfront whether package is on GitHub, then creates either a GitHub issue or an email draft (not both)
  • GitHub Integration: Uses gh CLI to create GitHub issues directly for packages hosted on GitHub (Cascade, jewel, rSpectral)
  • Email Fallback: Generates email draft templates only for packages not accessible via GitHub
  • Efficient output:
    • For GitHub packages: Issues created directly, no local files saved
    • For non-GitHub packages: Only email draft files created in notifications/ directory
  • Template-based: Creates well-formatted issue/email content with:
    • Problem summary and error messages
    • Root cause analysis
    • Minimal reproducible examples
    • Suggested fixes with code examples
    • Severity ratings
    • References to igraph repository

Usage: ./notify-maintainers.sh

The script checks repository accessibility first and creates only the appropriate output type per package, eliminating redundant files.

See NOTIFY-README.md for detailed instructions on using the script, authentication setup, and troubleshooting.


  • [x] By submitting this pull request, I assign the copyright of my contribution to The igraph development team.

  • Fixes igraph/rigraph#2499

Original prompt

This section details on the original issue you should resolve

<issue_title>Verify revdep problems</issue_title> <issue_description>The file revdep/problems.md contains packages that now fail their checks, compared to the most recent CRAN version. Create minimal reproducible examples for the underlying problems and assess whether we uncovered a bug in a downstream package or if we inadvertently changed behavior.</issue_description>

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

  • Fixes igraph/rigraph#2499

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot avatar Nov 16 '25 15:11 Copilot

@copilot: Check if passing weights = numeric() would work for rSpectral. Update code and assessment as needed.

krlmlr avatar Nov 16 '25 16:11 krlmlr

@copilot: Check if passing weights = numeric() would work for rSpectral. Update code and assessment as needed.

Yes! weights = numeric() works perfectly as a workaround.

The mechanism: numeric() is not NULL (skips auto-detection), but !all(is.na(numeric())) evaluates to FALSE, causing the code to set weights <- NULL internally.

Updated analysis and examples to document this workaround. Commit: 3351e96

Copilot avatar Nov 16 '25 16:11 Copilot

@copilot: Create a script that uses gh and creates issues or PRs in the corresponding repositories. If not on GitHub, create a script that creates a GMail draft.

krlmlr avatar Nov 16 '25 20:11 krlmlr

@copilot: Create a script that uses gh and creates issues or PRs in the corresponding repositories. If not on GitHub, create a script that creates a GMail draft.

Created notify-maintainers.sh script that:

  1. Uses gh CLI to create GitHub issues for all three packages (Cascade, jewel, rSpectral)
  2. Falls back to generating email drafts when GitHub is not accessible
  3. Creates well-formatted issue templates with root cause, examples, and fixes

Usage: ./notify-maintainers.sh

Outputs to notifications/ directory:

  • {Package}-issue.md - GitHub issue template
  • {Package}-email.txt - Email draft

See NOTIFY-README.md for detailed instructions. Commit: 7ad2400

Copilot avatar Nov 16 '25 20:11 Copilot

@copilot: Determine now if the package is on GitHub or not, the script should either create an issue or draft an e-mail, not both.

krlmlr avatar Nov 16 '25 20:11 krlmlr

@copilot: Determine now if the package is on GitHub or not, the script should either create an issue or draft an e-mail, not both.

Updated script to determine upfront if package is on GitHub:

  • Checks repository accessibility first
  • Creates either GitHub issue (via gh) or email draft, not both
  • For GitHub repos: Issue created directly, no local files
  • For non-GitHub repos: Only email draft file created

Previously created 6 files (3 issue templates + 3 emails), now creates only what's needed. Commit: 1ad205a

Copilot avatar Nov 16 '25 20:11 Copilot