Skip to content

Commit 4ccdfdc

Browse files
fix: switch pathspec to gitignore patterns
1 parent 41d6d91 commit 4ccdfdc

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

.beads/issues.jsonl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
{"id":"bd-3lz","title":"Optimize historical inbox snapshot commit traversal","description":"get_historical_inbox_snapshot iterates up to 10k commits without path scoping; consider limiting to inbox path or using git rev-list with path filter to reduce cost on large archives.","status":"closed","priority":3,"issue_type":"task","created_at":"2026-01-20T04:11:51.610711768Z","created_by":"ubuntu","updated_at":"2026-01-20T04:48:11.933110087Z","closed_at":"2026-01-20T04:48:11.933067517Z","close_reason":"Completed","source_repo":".","compaction_level":0,"original_size":0}
1616
{"id":"bd-3ss","title":"Handle Z-suffixed timestamps in write_message_bundle","description":"write_message_bundle uses datetime.fromisoformat without handling trailing Z; add robust parsing (accept Z and offsets) and tests.","status":"closed","priority":2,"issue_type":"task","created_at":"2026-01-20T04:11:19.761582730Z","created_by":"ubuntu","updated_at":"2026-01-20T04:42:58.006562906Z","closed_at":"2026-01-20T04:42:58.006519023Z","close_reason":"Completed","source_repo":".","compaction_level":0,"original_size":0}
1717
{"id":"bd-7z9","title":"Review server-side file reservation enforcement semantics","description":"send_message enforcement checks reservation patterns against mail archive paths (agents/*/inbox/outbox). Docs describe reservations as project file paths; review mismatch, decide intended enforcement surface, and update logic or docs.","status":"closed","priority":3,"issue_type":"task","created_at":"2026-01-20T04:12:09.220672324Z","created_by":"ubuntu","updated_at":"2026-01-20T04:52:57.758727711Z","closed_at":"2026-01-20T04:52:57.758685491Z","close_reason":"Completed","source_repo":".","compaction_level":0,"original_size":0}
18-
{"id":"bd-bh8","title":"Investigate pathspec gitwildmatch deprecation warnings in tests","description":"Pytest emits DeprecationWarning from pathspec GitWildMatchPattern (gitwildmatch deprecated; use gitignore). Investigate dependency update or config to silence and ensure future compatibility.","status":"in_progress","priority":4,"issue_type":"task","created_at":"2026-02-01T23:28:08.586160697Z","created_by":"ubuntu","updated_at":"2026-02-02T00:09:33.559381481Z","source_repo":".","compaction_level":0,"original_size":0}
18+
{"id":"bd-bh8","title":"Investigate pathspec gitwildmatch deprecation warnings in tests","description":"Pytest emits DeprecationWarning from pathspec GitWildMatchPattern (gitwildmatch deprecated; use gitignore). Investigate dependency update or config to silence and ensure future compatibility.","status":"closed","priority":4,"issue_type":"task","created_at":"2026-02-01T23:28:08.586160697Z","created_by":"ubuntu","updated_at":"2026-02-02T00:12:50.963202911Z","closed_at":"2026-02-02T00:12:50.963178685Z","close_reason":"Updated pathspec to gitignore","source_repo":".","compaction_level":0,"original_size":0,"comments":[{"id":8,"issue_id":"bd-bh8","author":"Dicklesworthstone","text":"Replaced pathspec 'gitwildmatch' usage with 'gitignore' across app/cli/guard and benchmarks to remove deprecation warnings. Updated guard templates accordingly. Ran uvx ty check (pass) and pytest tests/test_pathspec_overlap.py (pass).","created_at":"2026-02-02T00:12:46Z"}]}
1919
{"id":"bd-icd","title":"Add web UI routing support","description":"## Summary\nAdd web UI routing support to serve static files and handle SPA routing alongside MCP API endpoints.\n\n## Context\n- GitHub Issue #71 provides patch outline for web UI routing\n- Need to serve static files from web/ directory\n- Need /api/ prefix for MCP endpoints\n- Need SPA fallback routing\n\n## Requirements\n1. Serve static files from web/ directory at root\n2. Prefix all MCP tool endpoints with /api/\n3. SPA fallback: non-API routes return index.html\n4. CORS headers for local development\n\n## Technical Approach\nUsing FastAPI/Starlette:\n```python\napp.mount(\"/api\", mcp_router)\napp.mount(\"/\", StaticFiles(directory=\"web\", html=True))\n\[email protected]_handler(404)\nasync def spa_fallback(request, exc):\n if not request.url.path.startswith(\"/api\"):\n return FileResponse(\"web/index.html\")\n raise exc\n```\n\n## Files to Modify \n- src/mcp_agent_mail/server.py - Add routing logic\n- Create web/ directory structure\n\n## Acceptance Criteria\n- [ ] Static files served at /\n- [ ] MCP endpoints at /api/*\n- [ ] SPA routes return index.html\n- [ ] Development CORS working","status":"closed","priority":2,"issue_type":"feature","created_at":"2026-01-23T05:03:13.490874378Z","created_by":"ubuntu","updated_at":"2026-02-01T19:45:57.592876552Z","closed_at":"2026-02-01T19:45:57.592802813Z","source_repo":".","compaction_level":0,"original_size":0}
2020
{"id":"bd-p6n","title":"Integrate TOON into MCP Agent Mail (MCP server)","description":"## Goal\nAdd TOON (Token-Optimized Object Notation) output format to MCP Agent Mail tools/resources while keeping MCP JSON-RPC semantics intact.\n\n## Current Implementation (2026-01-22)\n\n### Output Envelope (when format=toon)\n- Return a **compact envelope** instead of the original JSON payload:\n```json\n{\n \"format\": \"toon\",\n \"data\": \"<toon string>\",\n \"meta\": {\n \"requested\": \"toon\",\n \"source\": \"param|default|implicit\",\n \"encoder\": \"tru\",\n \"toon_stats\": {\"json_tokens\": 10, \"toon_tokens\": 5, \"saved_tokens\": 5, \"saved_percent\": 50.0}\n }\n}\n```\n- The envelope is **JSON** (required by MCP), but the payload is **TOON** (token-optimized).\n- When format is omitted and no defaults are set, outputs are unchanged (JSON as before).\n\n### Format Resolution\nPrecedence: tool/resource `format` param > `MCP_AGENT_MAIL_OUTPUT_FORMAT` > `TOON_DEFAULT_FORMAT` > json.\nInvalid values raise a ValueError (expected json|toon).\n\n### Config / Env Vars\n- `MCP_AGENT_MAIL_OUTPUT_FORMAT` - default format for tool outputs.\n- `TOON_DEFAULT_FORMAT` - global fallback default for all tools/resources.\n- `TOON_TRU_BIN` - override `tru` binary path (highest precedence).\n- `TOON_BIN` - secondary override for `tru` path/command.\n- `TOON_STATS` - enable `tru --stats` and parse stderr into `meta.toon_stats`.\n\n## Implementation Summary (Done)\n- **config**: Added defaults and env mapping in `src/mcp_agent_mail/config.py`.\n- **format helpers**: `_normalize_output_format`, `_resolve_output_format` in `app.py`.\n- **TOON encode**: `_run_toon_encode`, `_encode_payload_to_toon_sync` with graceful fallback.\n- **tools**: Optional `format` param added to all MCP tools; wrapper applies TOON when requested.\n- **resources**: `?format=toon` supported for resources; format param supported in resource handlers.\n- **internal calls**: Macros and auto-handshake pass `format=\"json\"` to avoid nested TOON.\n- **docs**: README updated (Tools + Resources sections) and `resource://tooling` schemas include output format hints.\n\n## Tests (Added)\n- `tests/test_toon_formatting.py` (unit): tool & resource envelope + fallback.\n- `tests/e2e/test_toon_format_e2e.py` (e2e): smoke coverage with detailed logging.\n\n## Remaining Tasks\n1) Run quality gates (requires explicit command approval):\n - `uvx ty check`\n - `uvx ruff check --fix --unsafe-fixes`\n - `pytest tests/test_toon_formatting.py tests/e2e/test_toon_format_e2e.py`\n2) Ensure `tru` binary exists (build `toon_rust` or set `TOON_TRU_BIN` or `TOON_BIN`).\n3) Manual verification:\n - `format=toon` returns envelope with TOON payload.\n - `format=json` returns unchanged shape.\n - TOON payload decodes to JSON-equivalent.\n\n## Acceptance Criteria\n- format=toon works for tools/resources without breaking JSON defaults.\n- Envelope has minimal overhead and includes TOON payload + metadata.\n- README/Tooling schemas document format usage.\n- Unit tests + E2E pass with detailed logs.","notes":"Status update (2026-01-23):\n- Resource URI templates now include {?format,...} so FastMCP accepts query params.\n- Added test_resource_format_query_param_fastmcp.\n- README now notes optional format query param for resources.\n- Fixtures captured in /dp/toon_test_fixtures/real_world: mcp_agent_mail_health_check.{json,toon}, mcp_agent_mail_projects.{json,toon}.\n- Quality gates: uvx ty check, uvx ruff check, pytest (5 tests) all pass.\n- tru binary path resolved to /tmp/cargo-target/release/tru (CARGO_TARGET_DIR).\n- NOTE: FastMCP does not accept resource://projects without a query param; use ?format=json or ?format=toon.","status":"in_progress","priority":1,"issue_type":"task","created_at":"2026-01-22T21:49:12.340633763Z","created_by":"ubuntu","updated_at":"2026-02-02T00:07:29.310326264Z","source_repo":".","compaction_level":0,"original_size":0,"comments":[{"id":1,"issue_id":"bd-p6n","author":"QuietCanyon","text":"Updated description to tru naming (TOON_TRU_BIN/TOON_BIN, encoder=tru). Note: prior note about tr path is legacy; use tru path/env now.","created_at":"2026-01-24T20:40:01Z"},{"id":2,"issue_id":"bd-p6n","author":"Dicklesworthstone","text":"Code review pass: fixed ty type errors in tests/test_concurrency_agents.py (require_dict_result helper + cast + boolean asserts). uvx ty check now passes; pytest tests/test_concurrency_agents.py passed (14 tests, pathspec deprecation warnings only). UBS python scan on tests/test_concurrency_agents.py: 0 warnings/critical. Ruff --fix --unsafe-fixes still pending (needs explicit command).","created_at":"2026-02-01T23:26:40Z"},{"id":3,"issue_id":"bd-p6n","author":"Dicklesworthstone","text":"Ran TOON tests: passed (5 tests). binary present at /home/ubuntu/.local/bin/tru. Remaining: ruff --fix --unsafe-fixes (needs explicit command) + manual TOON verification (format=toon/json parity).","created_at":"2026-02-01T23:30:39Z"},{"id":6,"issue_id":"bd-p6n","author":"Dicklesworthstone","text":"Manual TOON verification (local server on :8770): resources/read for returns JSON envelope with TOON payload; returns normal JSON. Tool call with returns envelope in structuredContent + text. Note: resource payload still reports http.port=8765 from settings, even when server bound to 8770. Ruff unsafe fixes still pending.","created_at":"2026-02-02T00:07:04Z"},{"id":7,"issue_id":"bd-p6n","author":"Dicklesworthstone","text":"Manual TOON verification (local server on :8770): resource://config/environment?format=toon returns JSON envelope with TOON payload; resource://config/environment?format=json returns normal JSON. Tool call health_check with format=toon returns envelope in structuredContent + text. Note: resource payload still reports http.port=8765 from settings even when server bound to 8770. Ruff unsafe fixes still pending.","created_at":"2026-02-02T00:07:29Z"}]}
2121
{"id":"bd-ycg","title":"Harden CLI ISO parsing for Z/offset timestamps","description":"CLI commands (e.g., file_reservations check) use datetime.fromisoformat without handling 'Z' suffix; add a helper to accept Z/offset and reuse for expiry comparisons and since filters.","status":"closed","priority":3,"issue_type":"task","created_at":"2026-01-20T04:20:41.524010312Z","created_by":"ubuntu","updated_at":"2026-01-20T21:53:09.444366371Z","closed_at":"2026-01-20T21:53:09.444289776Z","close_reason":"Add ISO parser helper for Z/offset in CLI","source_repo":".","compaction_level":0,"original_size":0}

tests/benchmarks/bench_pathspec.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
# Import the actual functions we're benchmarking
3636
try:
3737
from mcp_agent_mail.app import (
38-
GitWildMatchPattern,
3938
PathSpec,
4039
_compile_pathspec,
4140
_normalize_pathspec_pattern,
@@ -45,7 +44,6 @@
4544
except ImportError:
4645
PATHSPEC_AVAILABLE = False
4746
PathSpec = None
48-
GitWildMatchPattern = None
4947

5048
def _compile_pathspec(pattern: str):
5149
return None
@@ -501,7 +499,7 @@ def test_union_pathspec_speedup(self) -> None:
501499
individual_specs = [_compile_pathspec(p) for p in normalized_patterns]
502500

503501
# Build union PathSpec
504-
if PathSpec is not None and GitWildMatchPattern is not None:
502+
if PathSpec is not None:
505503
union_spec = PathSpec.from_lines("gitignore", normalized_patterns)
506504
else:
507505
union_spec = None
@@ -610,7 +608,7 @@ def test_union_pathspec_filtering_efficiency(self) -> None:
610608

611609
# Build union spec
612610
normalized_patterns = [_normalize_pathspec_pattern(p) for p in patterns]
613-
if PathSpec is not None and GitWildMatchPattern is not None:
611+
if PathSpec is not None:
614612
union_spec = PathSpec.from_lines("gitignore", normalized_patterns)
615613
else:
616614
pytest.skip("PathSpec not available")
@@ -675,7 +673,7 @@ def test_guard_hook_realistic_workload(self) -> None:
675673
compiled_patterns = [(p, _compile_pathspec(p)) for p in normalized_patterns]
676674

677675
# Build union spec for fast-path rejection
678-
if PathSpec is not None and GitWildMatchPattern is not None:
676+
if PathSpec is not None:
679677
union_spec = PathSpec.from_lines("gitignore", normalized_patterns)
680678
else:
681679
union_spec = None

0 commit comments

Comments
 (0)