Skip to content

Fix docs hook link rewriting regression for non-sibling paths#710

Open
github-actions[bot] wants to merge 2 commits intomainfrom
fix-708-docs-hook-link-rewrite-47621298be69dde4
Open

Fix docs hook link rewriting regression for non-sibling paths#710
github-actions[bot] wants to merge 2 commits intomainfrom
fix-708-docs-hook-link-rewrite-47621298be69dde4

Conversation

@github-actions
Copy link
Contributor

Summary

This PR fixes issue #708 by tightening link rewriting in docs/hooks.py so only sibling workflow links are rewritten.

What changed

  • Added _rewrite_sibling_workflow_links(readme: str) to rewrite only markdown links with these targets:
    • ../(workflow)/README.md -> (workflow).md
    • ../(workflow)/ -> (workflow).md
  • Replaced the previous broad regex substitutions in _generate_page(...) with this scoped rewrite helper.
  • Added regression tests in tests/test_docs_hooks.py:
    • rewrites sibling README links
    • rewrites sibling directory links with anchors
    • preserves non-sibling relative docs links like ../../docs/workflows/detector-fixer-chaining.md

Why

The previous regex-based rewrites could corrupt valid non-sibling relative links (for example producing malformed paths like ../docs.mdworkflows/...). This broke generated documentation links for workflow guidance.

Validation

  • Created a dedicated venv and ran tests:
    • /tmp/gh-aw/agent/venv/bin/python -m pytest -q
  • Result: 35 passed

Fixes #708.


What is this? | From workflow: Trigger Test Coverage Detector

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

github-actions bot and others added 2 commits March 16, 2026 10:33
Restrict README link rewrites in docs/hooks.py to markdown links that target sibling workflow README/directory paths, preserving broader relative links such as ../../docs/workflows/... Add regression tests for sibling rewrites and non-sibling preservation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions bot added the small_boom Small PR blast radius; usually low human-review need label Mar 16, 2026
@strawgate strawgate marked this pull request as ready for review March 16, 2026 13:45
@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1019a271-ff43-4ac7-b914-1a5f760fc0f8

📥 Commits

Reviewing files that changed from the base of the PR and between 90e7641 and 2fa3efd.

📒 Files selected for processing (2)
  • docs/hooks.py
  • tests/test_docs_hooks.py

📝 Walkthrough

Walkthrough

Refactored link-rewriting logic in docs/hooks.py by extracting targeted sibling workflow link transformations into a new helper function _rewrite_sibling_workflow_links. This centralizes two separate regex substitutions that convert relative paths like ../other-workflow/README.md to other-workflow.md. Added corresponding test file test_docs_hooks.py with three test cases validating that sibling workflow links are rewritten correctly while non-sibling relative paths (e.g., ../../docs/workflows/) remain unchanged.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The pull request fully addresses all coding requirements from issue #708: implements scoped link rewriting for sibling workflows only, refactors logic into a dedicated helper function, and adds comprehensive regression tests covering sibling rewrites and non-sibling link preservation.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the stated objectives: docs/hooks.py refactoring targets the specific link-rewriting regression, and tests/test_docs_hooks.py provides focused coverage for the identified gap without introducing unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-708-docs-hook-link-rewrite-47621298be69dde4
  • 🛠️ Update Documentation: Commit on current branch
  • 🛠️ Update Documentation: Create PR
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

small_boom Small PR blast radius; usually low human-review need

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[test-coverage] Test coverage gaps (2026-03-16)

0 participants