8000 fix: build osa_docs paths relative to the repository root by Shtirmann · Pull Request #511 · aimclub/OSA · GitHub
[go: up one dir, main page]

Skip to content

fix: build osa_docs paths relative to the repository root - #511

Merged
DRMPN merged 1 commit into
mainfrom
fix/osa-docs-paths
Oct 24, 2026
Merged

DRMPN merged 1 commit into
mainfrom
fix/osa-docs-paths

Conversation

@Shtirmann
Copy link
Copy Markdown
Collaborator

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. The whole
filesystem prefix then ended up inside osa_docs, producing trees such as
osa_docs/Users/<user>/AppData/.../osa_docs that git refuses to open on Windows because
they exceed the 260-character path limit.

Reproduce: run OSA with --output and inspect the generated osa_docs directory, or
run git status in the result and watch it report Filename 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 mkdir and write_text, so it could not see where
anything was written. The new test builds a real tree in tmp_path and asserts that
osa_docs mirrors only the in-repo structure.

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.
@DRMPN DRMPN left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@DRMPN
DRMPN merged commit aad8cc9 into main Oct 24, 2026
5 checks passed
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.

2 participants

0