Skip to content

core: backslash / Windows-style anchor paths silently parse instead of erroring #144

Description

@cmcdonald99

Surfaced by the coverage work in #45.

The anchor grammar (§6.3) mandates forward slashes in the file path, but parse_anchor performs no separator validation. A Windows-style path is accepted verbatim:

parse_anchor("auth\\service.ts > Foo")
// => Ok(Anchor { file: "auth\\service.ts", segments: [Foo] })
parse_anchor("src\\auth.py > rotate")
// => Ok(Anchor { file: "src\\auth.py", segments: [rotate] })

The backslash is retained in Anchor::file, so downstream the file simply fails to match on disk — a silent non-match rather than the clear parse error the grammar implies.

Desired behaviour: reject backslashes (and any disallowed separator) in the file path with a dedicated AnchorParseError variant (e.g. BadSeparator), so the failure mode is the documented one.

Tests already in place: surf-core/src/anchor.rs has #[ignore]'d xfail tests (backslash_path_should_be_a_parse_error, mixed_separator_path_should_be_a_parse_error) that pin the current behaviour and document the target. When fixing, add the variant, flip those tests to assert on it, and remove the #[ignore].

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions