Skip to content

Inline comments aren't stripped from config rules (silently breaks every directive) #153

Description

@ldayton

Summary

Configuration.md documents inline comments as supported:

# Full line comment
allow git status  # Inline comment

But the parser never strips inline # comments — they become part of the pattern/value, silently breaking the directive. Full-line comments work; mid-line ones don't.

Blast radius (every directive type)

Line Parsed result
allow git status # x pattern = git status # x → never matches git status
deny rm -rf "trash" # x pattern corrupted and message lost (None)
allow-redirect /tmp/** # x pattern = /tmp/** # x
deny-mcp mcp__*__delete_* "m" # x pattern + message both broken
alias mygit git # x alias silently dropped
set log-full # x setting silently skipped
set log ~/audit.log # x log path = …/audit.log # x

End-to-end proof (no handler involved):

parse_config("allow zzz foo")              # zzz foo -> allow
parse_config("allow zzz foo  # comment")   # zzz foo -> ask  (rule dead)

Root cause

parse_config (src/dippy/core/config.py:250-257) skips full-line comments via line.startswith("#"), but rest (everything after the directive) flows into the pattern untouched — no inline-comment stripping anywhere.

Fix constraint

# can legitimately appear in quoted content (deny git commit -m "#wip") or paths, so a fix must strip only an unquoted, whitespace-preceded # (shell-style), not a naive split("#"). Either fix the parser to do that, or correct Configuration.md if literal # support is intentional.

Surfaced by

#125 — an annotated example config whose inline-commented rules are all silently dead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions