feat(mcp): implement fail-closed foundup_id validation in S2#659
Open
Foundup wants to merge 2 commits into
Open
feat(mcp): implement fail-closed foundup_id validation in S2#659Foundup wants to merge 2 commits into
Foundup wants to merge 2 commits into
Conversation
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>
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
foundup_idvalidation inholo_searchimportlib.utilfor dynamic loading_build_s2_validation_error_envelope()for consistent error responsesWSP 97 Labels
Test plan
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