Skip to content

fix: exclude NetworkVolume from undeploy list command#164

Merged
deanq merged 22 commits intomainfrom
deanq/ae-1965-bug-undeploy-should-only-show-endpoints
Feb 2, 2026
Merged

fix: exclude NetworkVolume from undeploy list command#164
deanq merged 22 commits intomainfrom
deanq/ae-1965-bug-undeploy-should-only-show-endpoints

Conversation

@deanq
Copy link
Copy Markdown
Member

@deanq deanq commented Jan 31, 2026

Prerequisite: #158

Summary

  • Fixed flash undeploy list incorrectly showing NetworkVolumes as serverless endpoints
  • Added _get_serverless_resources() filter to exclude non-serverless resources
  • Updated tests to properly verify serverless-only filtering

Changes

  • src/tetra_rp/cli/commands/undeploy.py: Added filtering for serverless resources only
  • tests/unit/cli/test_undeploy.py: Updated test to use spec=ServerlessResource for proper isinstance checks

Test plan

  • All quality checks pass (format, lint, type, tests, coverage)
  • NetworkVolume resources no longer appear in undeploy list
  • Serverless endpoints still appear and can be undeployed normally

deanq and others added 14 commits January 28, 2026 07:39
- Add Python AST indexer (ast_to_sqlite.py) to extract framework symbols
- Add fast query CLI interface (code_intel.py) with Rich formatted output
- SQLite database with optimized indexes for symbol lookup
- Extract classes, functions, methods, decorators, type hints, docstrings
- Update Makefile with index/query targets
- Update CONTRIBUTING.md with setup and usage documentation
- Performance: 466 symbols indexed in 0.09s, database size 260KB
- Reduces token usage by ~85% when exploring framework structure

Commands:
  make index              - Generate/update code intelligence index
  make query SYMBOL=name  - Find symbol by name
  make query-classes      - List all classes
  make query-all          - List all symbols
…ude Code

Adds Model Context Protocol (MCP) server integration to expose the SQLite code
intelligence database as native Claude Code tools. This enables Claude to query
framework symbols, classes, and structure without reading full files, reducing
token usage by ~85% for code exploration tasks.

## Changes

- Add mcp_code_intel_server.py: MCP server with 5 specialized tools
  - find_symbol: Search for classes, functions, methods
  - list_classes: Browse all framework classes
  - get_class_interface: View class methods without implementations
  - list_file_symbols: Explore file structure
  - find_by_decorator: Find decorated symbols

- Create .mcp.json: MCP server configuration for automatic Claude Code discovery
- Add tetra-explorer skill: Guidance for using code intelligence tools
- Update CONTRIBUTING.md: Document MCP integration for developers
- Add mcp>=1.0.0 dependency to pyproject.toml
- Update .gitignore for .claude/ directory

## Benefits

- Zero-configuration Claude Code integration via MCP
- 85% token reduction for code exploration (from ~10k to ~2k tokens)
- <10ms query performance with SQLite indexing
- Type-safe tool interfaces with MCP schemas
- Automatic tool discovery by Claude Code

## Technical Details

- Database: 466 symbols indexed from tetra-rp source
- Storage: .code-intel/flash.db (~250KB)
- Transport: stdio for Claude Code integration
- Python 3.10+ compatible

All quality checks passed. Tests: 34 passed, code coverage: 68.78%
Allow additional open-source licenses used by transitive dependencies:
- Python-2.0: Python standard library and some tools
- Unlicense: Some utility libraries
- MPL-2.0: Some utility packages (certifi, pathspec)

These are all permissive licenses compatible with MIT distribution.
- Extract hardcoded LIMIT values into named constants for maintainability
- Rename handle_list_tools to list_tools for naming consistency
- Extract duplicated error handling into _log_indexing_error helper
- Add clarification about which dependencies require non-standard licenses
@deanq deanq requested a review from Copilot January 31, 2026 19:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where NetworkVolume resources incorrectly appeared in the flash undeploy list command output. The fix adds filtering to only show serverless endpoints and includes code intelligence tooling to help Claude Code explore the codebase more efficiently.

Changes:

  • Fixed flash undeploy list to filter out non-serverless resources like NetworkVolume
  • Updated test mocks to properly use spec=ServerlessResource for isinstance checks
  • Added AST-based code intelligence system with MCP server integration for Claude Code

Reviewed changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/tetra_rp/cli/commands/undeploy.py Added _get_serverless_resources() filter function to exclude NetworkVolume from undeploy list
tests/unit/cli/test_undeploy.py Updated test mocks to use spec=ServerlessResource instead of setting __class__.__name__
scripts/mcp_code_intel_server.py New MCP server providing code intelligence tools for Claude Code integration
scripts/code_intel.py New CLI for querying code intelligence database
scripts/ast_to_sqlite.py New AST-based indexer that extracts symbols to SQLite database
pyproject.toml Added mcp dependency for code intelligence server
Makefile Added code intelligence targets (index, query commands)
CONTRIBUTING.md Added documentation for code intelligence system
.mcp.json Added MCP server configuration for Claude Code
.github/workflows/dependency-review.yml Updated allowed licenses for new dependencies
.claude/skills/tetra-explorer/SKILL.md Added Claude Code skill documentation for framework exploration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

deanq added 7 commits January 31, 2026 12:16
Implement two features for the code intelligence MCP server:

1. Smart Re-indexing
   - Index auto-rebuilds on MCP server startup when stale
   - Checks if any Python files in src/ changed since last index
   - Compares file mtimes against index_timestamp in metadata table
   - Triggers rebuilding only when necessary
   - Fast: only checks file mtimes, no AST parsing until rebuild needed

2. Test Output Parser MCP Tool
   - New tool parses pytest output and returns structured data
   - Extracts test summary (passed/failed/errors/skipped counts)
   - Lists failed tests with file locations and error messages
   - Parses coverage statistics if present
   - Returns markdown-formatted summary for easy reading
   - Reduces token usage by ~85% vs reading full test output

Changes to ast_to_sqlite.py:
- Track latest_file_mtime and file_count in metadata table
- Enables staleness detection in MCP server

Changes to mcp_code_intel_server.py:
- Add should_reindex() function for checking if index is stale
- Add smart re-indexing in main() before server starts
- Add parse_test_output() function to parse pytest output
- Add format_test_summary() for markdown formatting
- Add new parse_test_output MCP tool with clear description
- Tool description teaches Claude when/why to use it
- Add parse_test_output tool documentation with usage examples
- Add explicit prohibition of bash commands (tail/grep/cat) for MCP-compatible tasks
- Document bad patterns with token cost comparisons (99% reduction for test output)
- Expand skill file with:
  - Step 1.5: NEVER use bash commands for MCP tool tasks
  - Analyzing Test Results section with good/bad examples
  - Available MCP Tools reference list
  - Strong enforcement notes in Important Notes
- Add 200-token example showing difference between MCP tool vs bash approaches

This forces Claude Code to consistently use parse_test_output (~200 tokens) instead
of bash commands (~20,000+ tokens) when analyzing test output, reducing token usage
by 99% for test analysis workflows.
- Add .claude/settings.json with pre-approved permissions for all contributors
- Update code coverage requirement from 35% to 65% in CONTRIBUTING.md
- Simplify authors to generic Runpod email in pyproject.toml
- Remove empty [tool.ruff] section from pyproject.toml
- Remove outdated docs/PRD.md
- Update dependency lock file (uv.lock)
Manual dependency review during PR review is sufficient.
Removes automated license check that adds friction for legitimate dependencies.
The undeploy command was incorrectly showing NetworkVolumes in the
'Tracked RunPod Serverless Endpoints' list. NetworkVolumes are not
serverless endpoints and shouldn't be managed by the undeploy command.

Added _get_serverless_resources() filter function to exclude non-serverless
resources from undeploy operations. Updated test to use spec=ServerlessResource
for proper isinstance() checks.
@deanq deanq force-pushed the deanq/ae-1965-bug-undeploy-should-only-show-endpoints branch from 68dc23b to 24b8953 Compare January 31, 2026 23:43
@deanq deanq changed the base branch from main to deanq/ae-1923-code-intel-mcp-skill February 2, 2026 12:27
Base automatically changed from deanq/ae-1923-code-intel-mcp-skill to main February 2, 2026 22:36
@deanq deanq merged commit b0960d9 into main Feb 2, 2026
7 of 12 checks passed
@deanq deanq deleted the deanq/ae-1965-bug-undeploy-should-only-show-endpoints branch February 2, 2026 23:27
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.

3 participants