Skip to content

Address code review feedback: extract magic numbers and fix variable reassignment bug#15

Merged
royisme merged 3 commits intoclaude/auto-extract-memories-011CUq28jWKZ2GA714gTGsj2from
copilot/sub-pr-14
Nov 5, 2025
Merged

Address code review feedback: extract magic numbers and fix variable reassignment bug#15
royisme merged 3 commits intoclaude/auto-extract-memories-011CUq28jWKZ2GA714gTGsj2from
copilot/sub-pr-14

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 5, 2025

Addresses code review comments from PR #14, fixing a variable reassignment bug, potential IndexError, and extracting hard-coded limits to named constants. Also updates test to reflect correct tool count (30 instead of 25).

Bug Fixes

Variable reassignment causing potential AttributeError:

# Before: response_text reassigned to Match object or None
response_text = re.search(r"```json\s*(.*?)\s*```", response_text, re.DOTALL)
if response_text:
    response_text = response_text.group(1)  # Crashes if None

# After: separate variable for match result
match = re.search(r"```json\s*(.*?)\s*```", response_text, re.DOTALL)
if match:
    response_text = match.group(1)

IndexError for files without extensions:

# Before: always accesses [1:] even on empty string
tags = base_tags + [Path(file_path).suffix[1:]]

# After: conditional check
file_suffix = Path(file_path).suffix
if file_suffix:
    tags = base_tags + [file_suffix[1:]]

Code Quality Improvements

Extracted 7 magic numbers to class-level constants in MemoryExtractor:

  • MAX_COMMITS_TO_PROCESS = 20 - batch processing limit
  • MAX_FILES_TO_SAMPLE = 30 - file scanning limit
  • MAX_ITEMS_PER_TYPE = 3 - top results per memory type
  • MAX_README_LINES = 20 - documentation parsing limit
  • MAX_STRING_EXCERPT_LENGTH = 200 - log/response excerpts
  • MAX_CONTENT_LENGTH = 500 - memory content field limit
  • MAX_TITLE_LENGTH = 100 - memory title field limit

Test Updates

  • Updated tool count assertion: 25 → 30 tools
  • Added assertions for 5 new automatic extraction tools (v0.7 features)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@royisme royisme marked this pull request as ready for review November 5, 2025 19:06
@royisme royisme requested a review from Copilot November 5, 2025 19:06
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.

Copilot wasn't able to review any files in this pull request.


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

…ble reassignment, update test count

Co-authored-by: royisme <350731+royisme@users.noreply.github.com>
@royisme royisme requested a review from Copilot November 5, 2025 19:11
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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


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

Copilot AI changed the title [WIP] Implement automatic memory extraction features Address code review feedback: extract magic numbers and fix variable reassignment bug Nov 5, 2025
Copilot AI requested a review from royisme November 5, 2025 19:12
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@royisme royisme merged commit ec5315f into claude/auto-extract-memories-011CUq28jWKZ2GA714gTGsj2 Nov 5, 2025
@royisme royisme deleted the copilot/sub-pr-14 branch November 5, 2025 19:16
royisme pushed a commit that referenced this pull request Nov 6, 2025
…n system

BREAKING CHANGE: Default docker-compose.yml now points to minimal mode

## Docker Infrastructure

### Multi-Mode Deployment
- **Minimal**: Code Graph only (No LLM required) - 500MB image
- **Standard**: Code Graph + Memory (Embedding required) - 600MB image
- **Full**: All features (LLM + Embedding) - 800MB image

### Files Added
- docker/Dockerfile.{base,minimal,standard,full}
- docker/docker-compose.{minimal,standard,full}.yml
- docker/.env.template/.env.{minimal,standard,full}
- docker-compose.yml (default, points to minimal)

### Automation
- Makefile with convenience commands (docker-minimal, docker-standard, docker-full)
- scripts/docker-deploy.sh - Interactive deployment wizard
- GitHub Actions for automated Docker builds (royisme/codebase-rag)
- Multi-arch support (AMD64, ARM64)

## Documentation System

### MkDocs Material
- Configured for docs.vantagecraft.dev
- English-first documentation
- Dark mode support
- Search, code highlighting, Mermaid diagrams

### Documentation Pages
- index.md - Homepage with feature comparison table
- getting-started/quickstart.md - 5-minute quick start guide
- deployment/overview.md - Comprehensive mode comparison
- deployment/production.md - Production deployment (K8s, Docker Swarm, Nginx)

### CI/CD
- .github/workflows/docs-deploy.yml - Auto-deploy to GitHub Pages
- .github/workflows/docker-build.yml - Auto-build Docker images
- docs/CNAME - Domain configuration

## Features by Mode

| Feature | Minimal | Standard | Full |
|---------|---------|----------|------|
| Code Graph | ✅ | ✅ | ✅ |
| Memory Store | ❌ | ✅ | ✅ |
| Auto Extraction | ❌ | ❌ | ✅ |
| Knowledge RAG | ❌ | ❌ | ✅ |
| LLM Required | ❌ | ❌ | ✅ |
| Embedding Required | ❌ | ✅ | ✅ |

## Quick Start

```bash
# Minimal deployment (no LLM needed)
make docker-minimal

# Standard deployment (embedding needed)
make docker-standard

# Full deployment (LLM + embedding needed)
make docker-full
```

## Next Steps

Code changes required for dynamic mode switching:
- config.py: Add DeploymentMode enum and validation
- start_mcp.py: Add --mode argument parsing
- mcp_server.py: Dynamic tool registration based on mode

See DOCKER_IMPLEMENTATION_SUMMARY.md for details.

## Documentation

Will be available at: https://docs.vantagecraft.dev

Related: #14, #15
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