Allow local Node subclasses without registering them process-wide
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 32/100
Research direction
The registration hook is __init_subclass__ in src/graphon/nodes/base/node.py (~L505-530); read it with the accessor contract at ~L158-175 to see which callers depend on import-time discovery. First write a test mirroring the reproduction: subclass AnswerNode and assert get_node_type_classes_mapping() stays unchanged. Use the subprocess pattern in tests/test_protocols_exports.py for tests that must still exercise import-time registration. Done means hosts register implementations in a registry they own while built-in latest lookups stay stable.
Written by the indexing model from the issue text.
Description
AI disclosure — Drafted with Codex using gpt-6.2-astra from the reporter’s review of node registration.
Problem
Defining a concrete Node subclass immediately registers it in the process-wide Node._registry through __init_subclass__. A test can define a helper solely to construct an instance directly, yet importing that test module changes what later registry lookups return. The same coupling applies to two hosts sharing a Python process.
The existing module-prefix check preserves a built-in implementation at its existing type and version. An external subclass can still add another version and change the shared latest entry. Two external subclasses claiming the same key also resolve according to import order. Registration code on main
Minimal reproduction
Run in a fresh Python interpreter with Graphon installed.
from graphon.nodes.answer.answer_node import AnswerNode
from graphon.nodes.base.node import Node
class PreviewAnswer(AnswerNode):
@classmethod
def version(cls) -> str:
return "999"
versions = Node.get_node_type_classes_mapping()["answer"]
print(versions["1"].__name__) # AnswerNode
print(versions["999"].__name__) # PreviewAnswer
print(versions["latest"].__name__) # PreviewAnswer
The lookup changes before any graph is built or any instance of PreviewAnswer is created.
Desired behavior
A test or host should be able to define and use a local node class while leaving unrelated registry lookups unchanged. One option is to let the host or test explicitly register its implementations in a registry it owns. Tests specifically exercising import-time registration can run in a fresh interpreter, as the existing public-protocol import test does.
The current accessor documents import-based discovery for host extensions. Any change to that behavior should account for existing callers. Accessor contract · Existing subprocess test
- Dominant language
- Python
- Stars
- 90
- Forks
- 47
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 19
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from langgenius/graphon
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
langgenius/graphon#443 ·
Maintainers usually reply within 2 days
-
Complete LLM results disappear from streamed answersPossibly taken @WH-2099 claimed this 13 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
langgenius/graphon#389 · 1 comment · 1 assignee ·
Maintainers usually reply within 2 days
-
bug(utils): parse_json_markdown drops a valid payload when the text contains a backtickPossibly taken @WH-2099 claimed this 9 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
langgenius/graphon#380 · 1 assignee ·
Maintainers usually reply within 2 days
-
project#graphon
Difficulty 4/5 3-5 days Newbie friendliness 40/100
langgenius/graphon#442 ·
Maintainers usually reply within 2 days
-
project#graphon
Difficulty 3/5 1-2 days Newbie friendliness 50/100
langgenius/graphon#438 · 1 comment ·
Maintainers usually reply within 2 days
All issues in langgenius/graphon
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
micronaut-projects/micronaut-core#14585 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
[BUG]: Management endpoints /v1/memory/stats and /v1/memory/counts bypass API key authenticationOpen
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
docling-project/docling-serve#788 ·
Maintainers usually reply within 1 day
-
Mend: dependency security vulnerability untriaged
Difficulty 1/5 Under an hour Newbie friendliness 78/100
opensearch-project/cross-cluster-replication#1805 ·
Maintainers usually reply within 1 day
-
load_advbench() re-raises HTTPError as the bare class, so a failed download ends in a TypeErrorOpenneeds-triage
Difficulty 1/5 Under an hour Newbie friendliness 82/100
Maintainers usually reply within 2 days