-
Notifications
You must be signed in to change notification settings - Fork 0
Fix frontmatter parsing, verbose workaround matching, and doc alignment #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -53,13 +53,24 @@ def parse_frontmatter(text: str) -> tuple[dict[str, Any], str]: | |||||||||||||||||
| if not stripped.startswith("---"): | ||||||||||||||||||
| return {}, text | ||||||||||||||||||
|
|
||||||||||||||||||
| # Find the closing --- | ||||||||||||||||||
| end_idx = stripped.find("---", 3) | ||||||||||||||||||
| if end_idx == -1: | ||||||||||||||||||
| # Split into lines and find the closing '---' on its own line | ||||||||||||||||||
| lines = stripped.splitlines(keepends=True) | ||||||||||||||||||
| if not lines: | ||||||||||||||||||
| return {}, text | ||||||||||||||||||
|
|
||||||||||||||||||
| yaml_block = stripped[3:end_idx].strip() | ||||||||||||||||||
| body = stripped[end_idx + 3:].lstrip("\n") | ||||||||||||||||||
| closing_idx: int | None = None | ||||||||||||||||||
| for i, line in enumerate(lines[1:], start=1): | ||||||||||||||||||
| if line.strip() == "---": | ||||||||||||||||||
|
||||||||||||||||||
| if line.strip() == "---": | |
| # Match closing delimiter only when '---' starts at column 0 | |
| # and is followed only by optional whitespace/newline. | |
| if line.startswith("---") and line[3:].strip() == "": |
Copilot
AI
Feb 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new line-by-line delimiter scan changes parsing behavior but there’s no unit test covering the previously-broken case (e.g., a YAML value containing --- that should not terminate frontmatter). Adding a regression test would help prevent this from reappearing.
| if line.strip() == "---": | |
| # Only treat '---' as a closing delimiter when it appears at the start | |
| # of the line (column 0) with no other non-whitespace characters. | |
| if line.startswith("---") and line.strip() == "---": |
Copilot
AI
Feb 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lstrip("\n") will leave a leading \r when parsing files with CRLF line endings, so body can start with \r\n. Consider stripping both \r and \n here (and keep behavior consistent across platforms).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workaround matching is still brittle because it relies on the (normalized) workaround dict key being a substring of the warning text. Several current pairs don’t match (e.g.,
globs_lostvs "Glob-scoped instruction converted…",user_invokable_removedvs "user-invokable flag removed.",mcp_servers_removedvs "MCP server configuration…"). Consider standardizing warnings to include a stable token/id, or mapping explicit substrings/regexes instead of deriving from the key name.