Skip to content

feat(mcp): implement fail-closed foundup_id validation in S2#659

Open
Foundup wants to merge 2 commits into
mainfrom
feat/mcp-foundup-scope-s2-validation
Open

feat(mcp): implement fail-closed foundup_id validation in S2#659
Foundup wants to merge 2 commits into
mainfrom
feat/mcp-foundup-scope-s2-validation

Conversation

@Foundup
Copy link
Copy Markdown
Member

@Foundup Foundup commented May 22, 2026

Summary

  • Implement MCP_FOUNDUP_SCOPE_S2_VALIDATION_IMPL_PHASE1: fail-closed foundup_id validation in holo_search
  • Add lazy singleton registry loader using importlib.util for dynamic loading
  • Add _build_s2_validation_error_envelope() for consistent error responses
  • Update existing tests to use valid registry IDs and new warning semantics
  • Fix severity enum in unrelated test

WSP 97 Labels

  • MCP_SCOPE_VALIDATION_ONLY
  • REGISTRY_READONLY
  • FAIL_CLOSED_REQUIRED
  • NO_HOLOINDEX_INDEX_MUTATION
  • NO_REGISTRY_MUTATION

Test plan

  • 20/20 dedicated validation tests pass
  • 5 previously failing tests updated and pass
  • 121 total bridge tests pass (background run)

Files Changed

  • modules/infrastructure/foundups_mcp_bridge/src/holo_tools.py (+95 lines)
  • modules/infrastructure/foundups_mcp_bridge/tests/test_holo_tools_foundup_validation.py (NEW, 240 lines)
  • modules/infrastructure/foundups_mcp_bridge/tests/test_mcp_bridge.py (+33/-23 lines)
  • docs/audits/mcp_system/MCP_FOUNDUP_SCOPE_S2_VALIDATION_IMPL_PHASE1.md (NEW)

🤖 Generated with Claude Code

Foundups Agent and others added 2 commits May 22, 2026 10:58
Implements registry-backed fail-closed validation per
MCP_FOUNDUP_SCOPE_S2_INTEGRATION_SPEC_PHASE1.

Changes:
- Add lazy registry loader singleton in holo_tools.py
- Add validation between empty-query check and backend path
- Return INVALID_FOUNDUP_ID for unknown foundup_id values
- Return REGISTRY_UNAVAILABLE if registry cannot load
- Add validation error envelope with full data context
- Add Phase 2 deferral warning for valid foundup_id

Behavior:
- foundup_id=None: skip validation, proceed to search
- foundup_id valid: add warning, proceed to search
- foundup_id invalid: fail closed, INVALID_FOUNDUP_ID
- Registry unavailable: fail closed, REGISTRY_UNAVAILABLE

Tests: 20/20 validation tests pass
       28/28 registry loader tests pass (no regression)

WSP 97: MCP_SCOPE_VALIDATION_ONLY, FAIL_CLOSED_REQUIRED,
        NO_REGISTRY_MUTATION, NO_HOLOINDEX_INDEX_MUTATION

Worker-Lane: W6
Slice: MCP_FOUNDUP_SCOPE_S2_VALIDATION_IMPL_PHASE1

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updates existing tests to match MCP_FOUNDUP_SCOPE_S2_VALIDATION_IMPL_PHASE1
behavior changes:

- Use valid registry ID `gotjunk_001` instead of invalid `gotjunk`
- Update warning assertions: "validated against registry; deferred to Phase 2"
  instead of old "not yet enforced" phrasing
- Add `warning` to valid severity enum for test_active_risks_severity_values
- Rename test methods to reflect new validation semantics

WSP 97: FAIL_CLOSED_REQUIRED

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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