Skip to content

test(sdk): add coverage for #195-landed cross-society types#199

Merged
dp-web4 merged 1 commit into
mainfrom
worker/web4-20260516-000007
May 17, 2026
Merged

test(sdk): add coverage for #195-landed cross-society types#199
dp-web4 merged 1 commit into
mainfrom
worker/web4-20260516-000007

Conversation

@dp-web4
Copy link
Copy Markdown
Owner

@dp-web4 dp-web4 commented May 16, 2026

Summary

Completes integration wiring + test coverage for the cross-society MCP types
that landed on main via PR #195 but lacked tests, error registry entries, and
package exports. Re-scoped per PR #196 rejection directive.

  • errors.py: CrossSocietyError class (was in __all__ but undefined), 6 ErrorMeta
    registry entries for §7.6 cross-society codes, _CATEGORY_SUBCLASS dispatch
  • init.py: Export 6 cross-society MCP types + CrossSocietyError (369→376 exports)
  • test_mcp_cross_society.py (NEW, 37 tests): enum values, construction, defaults,
    to_dict/from_dict round-trips, frozen checks, package-level import verification
  • test_errors.py: Updated assertions (24→30 codes, 6→7 categories), cross-society
    subclass/metadata/serialization tests

No mcp.py formatting churn. No version bump. No CLI changes.

Quality gates

  • 2746 passed, 8 xfailed (conformance gaps, pre-existing)
  • mypy --strict: 0 errors across 26 source files
  • ruff check: 0 errors
  • ruff format --check (changed files): 0 changes
  • GitNexus detect_changes: risk level LOW, 0 affected processes

Test plan

  • python -m pytest tests/test_errors.py tests/test_mcp_cross_society.py -v — 87 passed
  • python -m pytest tests/ -q — full suite 2746 passed, 8 xfailed
  • python -m mypy --strict web4/ — clean
  • python -m ruff check web4/ tests/ — clean
  • Package exports verified: import web4; len(web4.__all__) == 376

🤖 Generated with Claude Code

Completes integration wiring for the cross-society MCP types
(OutcomeClass, PropagationScope, CrossSocietyInteractionType,
CrossSocietyContext, ReputationEnvelope, MCPContextResource) that
landed on main via PR #195 but lacked tests, error registry entries,
and package exports.

errors.py:
- Add CrossSocietyError subclass (was in __all__ but undefined)
- Add 6 ErrorMeta registry entries for §7.6 cross-society codes
- Add _CATEGORY_SUBCLASS dispatch for CROSS_SOCIETY

__init__.py:
- Export 6 cross-society MCP types + CrossSocietyError (369→376 exports)

test_mcp_cross_society.py (NEW):
- 37 tests: enum values, construction, defaults, to_dict/from_dict
  round-trips, frozen checks, package-level import verification

test_errors.py:
- Update assertions: 24→30 codes, 6→7 categories, per-category counts
- Add CrossSocietyError subclass/metadata/serialization tests

Re-scoped per PR #196 rejection directive: tests + integration
wiring only, no mcp.py formatting churn.

2746 passed, 8 xfailed. mypy --strict clean. ruff lint/format clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dp-web4
Copy link
Copy Markdown
Owner Author

dp-web4 commented May 17, 2026

APPROVED: Fixes a real defect on main — CrossSocietyError is exported in web4/errors.py all (origin/main line 36) but the class was never defined, an import/AttributeError hazard for any consumer touching that name. This PR defines the class, adds the 6 §7.6 cross-society ErrorMeta registry entries + _CATEGORY_SUBCLASS dispatch, exports the 6 cross-society MCP types (369→376, confirmed by CI 'Exports: 376'), and adds 37 new tests (test_mcp_cross_society.py) plus correctly updates test_errors.py assertions (24→30 codes, 6→7 categories). Diff matches description exactly; re-scoped per the prior #196 rejection directive (reviewer already engaged this work). CI: 2742 passed, 8 xfailed (documented pre-existing). The only 4 failures (test_cli version, test_package_api version) are a systemic CI-infra problem — the package reports 'web4 0.0.0' because the version isn't injected during the CI editable install — and reproduce identically on every web4 PR regardless of content. The lint 'Would reformat: web4/mcp.py' is pre-existing unformatted code on main (this PR does not touch mcp.py), and the wheel-filename error is a CI workflow glob bug — all systemic, none introduced here. Not bottlenecking a correct, well-tested bug fix on repo-wide infra noise; the version-injection / mcp.py-format / wheel-glob issues should be filed as a separate CI-hardening task.

@dp-web4 dp-web4 merged commit 39fb411 into main May 17, 2026
0 of 6 checks passed
@dp-web4 dp-web4 deleted the worker/web4-20260516-000007 branch May 17, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant