Skip to content

test(cuda.core): run the host_callback_cfunc node attribute tests and drop empty - #3647

Merged
mdboom merged 1 commit into
NVIDIA:mainfrom
mdboom:issue3570
Nov 30, 2026
Merged

mdboom merged 1 commit into
NVIDIA:mainfrom
mdboom:issue3570

Conversation

@mdboom

@mdboom mdboom commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Closes #3570. Part of #2077.

Summary

test_node_attrs and test_node_attrs_preserved_by_nodes skipped any node spec with no expected attributes, so [empty] and [host_callback_cfunc] never ran anywhere.

 _build_host_callback_cfunc_node
-    return node, {}
+    return node, {"callback": lambda v: v is None}   # ctypes callbacks have no Python callable

 test_node_attrs / test_node_attrs_preserved_by_nodes
-    (node_spec)               if not expected_attrs: pytest.skip(...)
+    (node_spec_with_attrs)    assert expected_attrs     # every spec except `empty`
  • host_callback_cfunc now checks the documented contract of HostCallbackNode.callback: "The Python callable, or None for ctypes function pointer callbacks". test_graph_node_update.py's ctypes case relies on the same behavior.
  • empty has no type-specific attributes, so the two tests no longer collect it. node_spec_with_attrs shares its build code with node_spec.
  • The skip becomes an assertion, so a future spec with no expectations fails instead of silently skipping.
  • The "not currently run in any CI job" markers are removed.

Evidence

CI coverage: on main, the sibling [host_callback] spec (a Python callback, the same HostCallbackNode type) passes both tests in all 65 CI configurations that run this file. [host_callback_cfunc] builds the same node type with no extra requirements, so it should now run in those same 65 configurations. [empty] is no longer collected for these two tests.

Locally: both tests collect 36 cases (no [empty]), and all pass with no skips. The whole file passes.

Confirming in CI: in this PR's CI run, every cuda.core job should report test_node_attrs[host_callback_cfunc] and test_node_attrs_preserved_by_nodes[host_callback_cfunc] PASSED, where main reports them SKIPPED. For example:

gh run view <CI run id> --repo NVIDIA/cuda-python --log | grep -F "[host_callback_cfunc]" | grep -E "test_node_attrs"

Merge Danger

Door: two-way. Test-only change.

Blast Radius: two tests in cuda_core/tests/graph/test_graph_definition.py. Every case that ran before still runs.

Reviewers: please feel free to push commits directly to this PR to improve it.

🤖 Generated with Claude Code

… drop empty

test_node_attrs and test_node_attrs_preserved_by_nodes skipped any node
spec with no expected attributes, so [empty] and [host_callback_cfunc]
never ran.

- Give host_callback_cfunc a real expectation: a ctypes function pointer
  callback has no Python callable, so HostCallbackNode.callback is None.
- Run the two tests over node_spec_with_attrs, which leaves out the empty
  node, and assert that every spec has expected attributes instead of
  skipping.

Remove the "not currently run in any CI job" markers.

Closes NVIDIA#3570.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mdboom mdboom added this to the cuda.core 1.4.0 milestone Nov 30, 2026
@mdboom mdboom added test Improvements or additions to tests cuda.core Everything related to the cuda.core module labels Nov 30, 2026
@mdboom mdboom self-assigned this Nov 30, 2026
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

Summary

Summary by CodeRabbit

  • Tests
    • Updated graph-definition test coverage for reconstructed callback attributes and node specifications.
    • Attribute checks now use cases with non-empty attributes, while callback expectations reflect a None attribute value.

The graph-definition tests now expect a None callback attribute for ctypes host-callback nodes. A filtered fixture excludes empty-node specs from attribute tests, which now require nonempty expected attributes.

Changes: Graph node attribute tests

Layer / File(s) Summary
Node specs and attribute checks
cuda_core/tests/graph/test_graph_definition.py
The ctypes callback node spec expects a None callback. A new fixture excludes the empty-node spec, and both attribute tests use that fixture and require nonempty expected attributes.

Assessment against linked issues

Objective Addressed Explanation
[#3570] Exclude the empty-node spec from attribute tests and check the ctypes callback attribute in both tests. ✅

Suggested reviewers: andy-jost, jpascucci-nv

Change: Other · Severity of issue fixed: Low

Merge Risk: Low · up to 5e43d

This test-only change adds the ctypes callback expectation and removes the empty-node case from the attribute tests. It does not add the automated CI check that the linked issue requests. Merging is low risk, but owners should be aware that no check guards against these cases being skipped later.

Security architecture risk: Minimal · up to 5e43d

The PR changes which graph-node test cases run and what they assert. It does not change how applications create, inspect, or execute CUDA graphs.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1c9ed66 and 5e43db6.

Files selected for processing: 1

  • cuda_core/tests/graph/test_graph_definition.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 8 remain after this review.

# For node_spec values empty and host_callback_cfunc:
# This test is not currently run in any CI job
def test_node_attrs(node_spec):
def test_node_attrs(node_spec_with_attrs):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Heavy lift

Add an automated check for the host_callback_cfunc cases.

Issue #3570 requires a way to confirm automatically that both [host_callback_cfunc] attribute cases run in at least one CI configuration. This PR removes the "not run in CI" markers but adds no such check. The core job runs pytest ... tests/ without a selection filter (ci/tools/run-tests:190), so the cases run today. Nothing in the change, however, fails CI if either case is later deselected or skipped. The requirement stays unmet until a CI-side check exists.

Add a CI check that fails the run when either host_callback_cfunc case is missing from the results or is skipped. The check's form is open. Options include inspecting the JUnit output the core job already writes, or a test-level assertion on collection. Choose one and document the choice.

@github-actions

Copy link
Copy Markdown
Contributor

@jpascucci-nv jpascucci-nv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sol 6.1 high gives no actionable findings, I don't feel like the coderabbit findings are important, so Lgtm.

@mdboom
mdboom merged commit 9b4b261 into NVIDIA:main Nov 30, 2026
224 of 227 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.core Everything related to the cuda.core module test Improvements or additions to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(cuda.core): empty and host_callback_cfunc node specs never run in the node attribute tests

2 participants