Skip to content

Fix Windows path-separator mismatch in vault_graph(); bump to 0.6.3#47

Merged
TroyHernandez merged 2 commits into
mainfrom
fix/vault-graph-windows-dirname
May 19, 2026
Merged

Fix Windows path-separator mismatch in vault_graph(); bump to 0.6.3#47
TroyHernandez merged 2 commits into
mainfrom
fix/vault-graph-windows-dirname

Conversation

@TroyHernandez

Copy link
Copy Markdown
Contributor

0.6.2 fixed the regex backreference in category_from_path(). That was masking a second Windows bug: vault_graph()'s control-file filter compared normalizePath(vault) (backslashes on Windows) against dirname(file) (forward slashes from dirname's normalisation). The comparison was always false, control files leaked, the 'No pages in vault' error never fired. CRAN's win-builder caught it on 0.6.2 with: 'expect_error(vault_graph(vault = empty), "No pages in vault")' returning 'No error'. Fix uses winslash = '/' in normalizePath. The empty-vault test also moves above the graph_svg gate so it runs on machines whose saber is at CRAN's current 0.3.0.

vault_graph() filtered out control files (schema.md, index.md, log.md)
at the vault root with:

  all_md[!basename(all_md) %in% control | dirname(all_md) != vault]

On Linux dirname() returns paths with the system separator (/), which
matches normalizePath()'s output. On Windows dirname() converts
backslashes to forward slashes in its OUTPUT while normalizePath()
defaults to backslashes -- so the comparison was always false and
control files leaked into the graph. CRAN's win-builder caught it on
0.6.2 with: expect_error(vault_graph(vault = empty), "No pages in
vault") returning "No error" because the empty-vault check never
fired.

Normalise vault with winslash = "/" so it matches dirname()'s
forward-slash output on both platforms.

Test reorganisation: the empty-vault regression test moves between
the saber-installed gate and the saber-graph_svg gate, since
vault_graph() errors before reaching the renderer and doesn't need
graph_svg(). That way the test runs on machines whose saber is still
at the current CRAN release (0.3.0).

Same class of bug as 0.6.2 -- Windows path conventions diverging from
Linux -- but a different mechanism. The 0.6.2 regex fix was masking
this one.
@TroyHernandez TroyHernandez merged commit 31f4222 into main May 19, 2026
2 checks passed
@TroyHernandez TroyHernandez deleted the fix/vault-graph-windows-dirname branch May 19, 2026 06:26
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.

1 participant