Skip to content

refactor(protocol): enforce abstract contracts and static checks#137

Closed
QuantumGhost wants to merge 2 commits into
langgenius:mainfrom
QuantumGhost:codex/protocol-abstract-contracts
Closed

refactor(protocol): enforce abstract contracts and static checks#137
QuantumGhost wants to merge 2 commits into
langgenius:mainfrom
QuantumGhost:codex/protocol-abstract-contracts

Conversation

@QuantumGhost
Copy link
Copy Markdown
Contributor

@QuantumGhost QuantumGhost commented May 13, 2026

AI Disclosure: This PR was generated with Codex and GPT-5.5.

Important

  1. Make sure you have read our contribution guidelines
  2. Search existing issues and pull requests to confirm this change is not a duplicate
  3. Open or identify the issue this pull request resolves or advances
  4. Use a Conventional Commits title for this pull request, and mark breaking changes with !
  5. Remember that the pull request title will become the squash merge commit message
  6. If CLA Assistant prompts you, sign CLA.md in the pull request conversation

Related Issue

Closes #136

Summary

  • Added @abstractmethod to protocol members that previously lacked it across src/graphon protocol definitions.
  • Added static implementation assertions (under if TYPE_CHECKING) for in-repo protocol implementations, following the _assert_readonly_variable_pool pattern.
  • Added tests/test_protocol_abstract_contracts.py to enforce protocol abstraction rules and guard against accidental implementation via partial or indirect subclassing.
  • Updated type-only imports so imports used only by static assertions are scoped inside the corresponding if TYPE_CHECKING assertion blocks.

Validation run:

  • uv run ruff check src tests/test_protocol_abstract_contracts.py
  • uv run pytest tests/test_protocol_abstract_contracts.py tests/test_protocols_exports.py tests/graph_engine/test_response_coordinator.py tests/nodes/test_human_input_runtime_binding.py tests/nodes/human_input/test_human_input_node.py tests/nodes/human_input/test_human_input_node_internal.py

Checklist

  • This pull request links the issue it resolves or advances
  • This pull request title follows Conventional Commits, and any breaking change is marked with !
  • If CLA Assistant prompted me, I signed CLA.md in the pull request conversation

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label May 13, 2026
@QuantumGhost
Copy link
Copy Markdown
Contributor Author

QuantumGhost commented May 13, 2026

The massive if TYPE_CHECKING statements are ugly. I'll split static assertions to dedicated files and submit another PR.

@QuantumGhost
Copy link
Copy Markdown
Contributor Author

superseded by #138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harden Protocol contracts with abstract methods and regression checks

1 participant