Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Dialectic URL parser doesn't handle spaces in regex patterns #24

@nikomatsakis

Description

@nikomatsakis

Problem

Dialectic URLs with spaces in regex patterns fail to parse correctly. The Rust MCP server should automatically URL-encode spaces to %20 but currently doesn't.

Example

This walkthrough contains a broken dialectic URL:

# Action Button Code Flow Walkthrough

Let's trace what happens when you click an action button in the walkthrough system.

**Current Status**: Buttons render but clicking fails due to CSP violations and missing message handlers.

## Current Implementation

These links should now work properly:

**Step 1**: Button HTML generation in [renderSection](dialectic:extension/src/walkthroughWebview.ts?regex=onclick.*handleAction)

**Step 2**: JavaScript handleAction function in [webview script](dialectic:extension/src/walkthroughWebview.ts?regex=function handleAction)

**Step 3**: Message sent to extension via [vscode.postMessage](dialectic:extension/src/walkthroughWebview.ts?regex=vscode.postMessage)

**Step 4**: Extension receives message in [handleWebviewMessage](dialectic:extension/src/walkthroughWebview.ts?regex=handleWebviewMessage)

## The Problem

**CSP Issue**: Inline `onclick` handlers violate Content Security Policy
**Missing Handler**: Extension doesn't handle `'action'` message type  
**No IPC**: No communication back to MCP server/AI assistant

Broken URL

dialectic:extension/src/walkthroughWebview.ts?regex=function handleAction

The space in function handleAction causes the URL parsing to fail.

Working Workaround

dialectic:extension/src/walkthroughWebview.ts?regex=function.*handleAction

Using .* instead of a space works.

Expected Behavior

The Rust dialectic URL processor should:

  1. Automatically URL-encode spaces in regex patterns (function handleActionfunction%20handleAction)
  2. Parse URLs with spaces correctly
  3. Give clear error messages when URL parsing fails

Current Behavior

URLs with spaces in regex patterns silently fail - no navigation occurs and no error is shown.

Impact

This affects the usability of walkthrough system when trying to search for multi-word patterns in code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions