fix: allowlist adapter registry + test coverage (#18, #19, #20)#29
Closed
jphein wants to merge 2 commits into
Closed
fix: allowlist adapter registry + test coverage (#18, #19, #20)#29jphein wants to merge 2 commits into
jphein wants to merge 2 commits into
Conversation
Replace the 8-branch if-chain with per-adapter drop-lists with a declarative _ADAPTER_SPECS registry. Each adapter declares its module path, class name, aliases, and kwarg renames. The actual set of accepted kwargs is discovered via inspect.signature() at construction time, so the allowlist never drifts from the constructor. Root cause fix for the PR #7 regression where stale drop-lists silently swallowed CLI kwargs that should have been forwarded. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three measurement-critical modules shipped with zero direct unit tests. Adds 42 tests: - test_multi_hop.py: score_cat2c aggregation, delta/ratio math, verdict heuristics, format_report, to_dict serialization - test_topology.py: structural_health, community_structure, filtered_subgraph, edge_type_components - test_graph_mapping.py: project_graph wing/room/tunnel/KG projection, edge cases (empty payload, missing IDs, general room filtering) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Addresses three open issues in one PR:
_load_adapter: invert drop-list pattern to allowlist registry (root cause of the PR #7 cat5 regression) #20
_load_adapterallowlist registry: Replaces the 8-branch if-chain with per-adapter drop-lists with a declarative_AdapterSpecregistry. Each adapter declares its module path, class name, aliases, and kwarg renames. The actual set of accepted kwargs is discovered viainspect.signature()at construction time, so the allowlist never drifts from the constructor. This was the root cause of the PR feat(adapters): RlmAdapter + Qwen-7B/Llama-70B baselines #7 regression where stale drop-lists silently swallowed CLI kwargs.get_harness_manifest() referenced from cmd_cat9 but not in SMEAdapter ABC; only 2/8 adapters implement it #19
get_harness_manifest()contract: Already present onSMEAdapterwithreturn []default (lines 176-189 ofbase.py). Added regression tests verifying the contract: base class default returns[], and real adapters (FullContextAdapter,KarpathyCompiledAdapter) honor it. Thetest_load_adapter.pysuite also parametrically tests that every registered adapter can be constructed with the CLI's full kwarg superset withoutTypeError.Test coverage gaps for measurement-critical modules (multi_hop, ontology_coherence, topology, adapters) #18 test coverage for measurement-critical modules: 42 new tests across three previously-untested modules:
test_multi_hop.py—score_cat2caggregation, delta/ratio math, verdict heuristics,format_report,to_dictserializationtest_topology.py—structural_health,community_structure,filtered_subgraph,edge_type_componentstest_graph_mapping.py—project_graphwing/room/tunnel/KG projection, edge cases (empty payload, missing IDs, general room filtering)Test plan
ruff checkclean on all new/modified files_load_adapterchange is backwards-compatible: same adapter names, same CLI behavior🫏 Generated with Claude Code