chore: document type system conventions + enforce ABC/Protocol rules (AC-492)#590
Merged
jayscambler merged 2 commits intomainfrom Mar 31, 2026
Merged
chore: document type system conventions + enforce ABC/Protocol rules (AC-492)#590jayscambler merged 2 commits intomainfrom
jayscambler merged 2 commits intomainfrom
Conversation
…(AC-492) Added 'Type System Conventions' section to CONTRIBUTING.md covering: - ABC vs Protocol boundaries - dict[str, Any] as sole dict convention - Sequence/Mapping for read-only params - LlmFn type alias - StrEnum import style - Logger naming Added test_interface_conventions.py with 2 contract tests: - Protocols don't use @AbstractMethod (redundant) - ABC classes have at least one @AbstractMethod Current codebase already follows the convention — tests pass on existing code. 2 files changed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Documents the type system conventions that emerged from the cleanup sweep and adds contract tests to enforce them going forward.
Changes
CONTRIBUTING.md — new "Type System Conventions" section
Codifies the conventions already established by PRs #576-589:
dict[str, Any]as sole convention (notdict[str, object]), preferTypedDictfor known shapesSequence[X]for read-only list params,Mapping[str, X]for read-only dict paramsLlmFn, StrEnum import style, logger namingtest_interface_conventions.py — 2 contract tests
test_protocols_do_not_use_abstractmethod— Protocol classes shouldn't have@abstractmethod(it's redundant for structural typing)test_abc_classes_have_abstractmethod— ABC classes must have at least one@abstractmethod(otherwise use Protocol)Both tests pass on current code — the convention is already followed.
Verification
ruff check src— all checks passedmypy src— zero errorspytest tests/— all tests pass (including 2 new convention tests)Issue
Resolves AC-492