Repository navigation
fix: build osa_docs paths relative to the repository root - #511
Merged
Merged
Conversation
generate_documentation_mkdocs dropped only the leading component of each analysed path. That works when the paths are relative and start with the repository directory, but OSA passes absolute paths whenever it runs with --output, which is always the case under OSA.Web. The whole filesystem prefix then ended up inside osa_docs, producing trees like osa_docs/Users/<user>/AppData/... that git refuses to open on Windows because they exceed the path length limit. Resolve each path against the repository root instead, falling back to the old behaviour for callers that pass a repository-prefixed relative path. The existing test mocked mkdir and write_text, so it could not see where anything was written; the new one builds a real tree in tmp_path and checks it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
generate_documentation_mkdocsdropped only the leading component of eachanalysed path. That works when the paths are relative and start with the repository
directory, but OSA passes absolute paths whenever it runs with
--output. The wholefilesystem prefix then ended up inside
osa_docs, producing trees such asosa_docs/Users/<user>/AppData/.../osa_docsthat git refuses to open on Windows becausethey exceed the 260-character path limit.
Reproduce: run OSA with
--outputand inspect the generatedosa_docsdirectory, orrun
git statusin the result and watch it reportFilename too long.Fix: resolve each path against the repository root, falling back to the previous
behaviour for callers that pass a repository-prefixed relative path. The same helper is
used for the module pages and for the dotted module reference handed to mkdocstrings.
Tests: the existing test mocked
mkdirandwrite_text, so it could not see whereanything was written. The new test builds a real tree in
tmp_pathand asserts thatosa_docsmirrors only the in-repo structure.