Skip to content

fix(mcp): Bound cancellable project scans - #93

Draft
reneleonhardt wants to merge 1 commit into
JordanCoin:mainfrom
reneleonhardt:fix/mcp-scan-cancellation
Draft

fix(mcp): Bound cancellable project scans#93
reneleonhardt wants to merge 1 commit into
JordanCoin:mainfrom
reneleonhardt:fix/mcp-scan-cancellation

Conversation

@reneleonhardt

Copy link
Copy Markdown
Contributor

What does this PR do?

Propagates request cancellation through scanner, Git, handoff, and MCP traversals, and bounds project and manifest discovery.

Type of change

  • Bug fix
  • New feature
  • New language support
  • Documentation
  • Other (describe below)

Checklist

  • I've tested this locally with go build && ./codemap .
  • I've read CONTRIBUTING.md (for new language support)
  • I've updated documentation if needed

Additional notes

Legacy non-cancellation scan failures remain best-effort.

Co-Authored-By: GPT-5.6 Sol codex@openai.com

Propagate cancellation through scanner, Git, handoff, and MCP traversal paths.
Bound project and manifest discovery without changing legacy fallback behavior.

Signed-off-by: GPT-5.6 Sol <codex@openai.com>
Co-Authored-By: GPT-5.6 Sol <codex@openai.com>
@JordanCoin

Copy link
Copy Markdown
Owner

Reviewed — this is strong. Threading cancellation so a client-aborted MCP call actually kills the sg/git subprocesses is a real gap, cmd.WaitDelay is the right call, and traversalRoot incidentally fixes the relative-vs-abs inconsistency where handlers passed input.Path to some scanners and absRoot to others.

Two notes:

1. This collides semantically with #97, not just textually. Both rewrite ScanForDepsWithFilters and the same error block in ScanDirectory#93 keeps graceful degradation (return nil, nil on timeout) while #97 turns those exact lines into hard errors. Whichever lands second has to reconcile the intent, not just the text. Landing #93 first and rebasing #97 on top seems cleanest, since fail-closed can then be expressed inside the Context variants.

2. The XxxContext twins are back-compat we don't need. module codemap has no external importers, so ScanFiles/ScanForDeps/ScanConfiguredFiles/GitDiffInfo/AnalyzeImpact/ReadExternalDeps could each just take a ctx instead of gaining a sibling. As-is we're accumulating axes: with #97 also adding an Outcome variant, ScanForDeps ends up as WithFilters × Context × Outcome. A single ScanForDeps(ctx, root, filters) (ScanOutcome, error) collapses all three — worth doing while there are only two callers' worth of churn.

No objection to the substance; both are shape questions.

@reneleonhardt
reneleonhardt marked this pull request as draft August 2, 2026 19:21
reneleonhardt added a commit to reneleonhardt/codemap that referenced this pull request Aug 2, 2026
Consolidate the JordanCoin#93, JordanCoin#96, JordanCoin#97, and JordanCoin#99 maintainer corrections into one compatible scanner, graph, CLI, and MCP contract.\n\nPreserve provenance across recoverable scans and fallbacks, apply configured filters consistently, reuse one dependency graph inventory for coverage and rendering, and make unmatched Rust source coverage explicit.\n\nCo-Authored-By: GPT-5.6 Sol <codex@openai.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.

2 participants