fix(pr-management-triage): centralize terminal PR links - #1049
Conversation
Use one formatter for canonical pull-request targets and terminal fallback behavior across every triage output path. Generated-by: Codex (GPT-5)
potiuk
left a comment
There was a problem hiding this comment.
LGTM on the change itself — centralising this is right, and the fallback matrix is the part most implementations get wrong. One structural note about where the tests live, which is not really about this PR but lands here because this PR is the first to hit it.
The change is sound
Golden rule 10 in SKILL.md requires every PR number to render as a full clickable URL, and until now each surface did that by hand. One formatter that resolves both short (#1049) and full-URL forms to a canonical /pull/<number> is the correct shape, and applying it across triage progress, proposals, grouped results, and dry-run output is what makes the rule actually hold rather than hold in the places someone remembered.
The fallback handling is the good part. OSC 8 hyperlinks degrade badly when emitted blindly — NO_COLOR, TERM=dumb, and non-terminal output each need the readable URL instead of an escape sequence that renders as line noise in a log or a piped file. All three have their own fixture (case-3-no-color, case-4-dumb-terminal, plus the non-tty path), which is more care than this usually gets.
I ran the tests: 9 passed. mypy is clean on pr_link.py.
The tests will not run in CI
skills/pr-management-triage/tests/test_pr_link.py is the first test file anywhere under skills/ — there are currently zero others. The workspace checks that run ruff, mypy, and pytest are scoped to uv workspace members, and their hook is filed under ^(tools/[^/]+(/[^/]+)?/(src|tests|pyproject\.toml)|pyproject\.toml|…). skills/** matches none of it.
So on merge:
- those 9 tests never execute in CI — revert
pr_link.pytomorrow and the checks stay green; - the 133-line script is neither linted nor type-checked there.
Not hypothetical: running ruff over the new files by hand already finds RUF100 Unused 'noqa' directive (unused: E402) at tests/test_pr_link.py:26. Trivial in itself — the point is that it is exactly the class of thing the repo lints for everywhere else and would have flagged automatically had the path been covered.
This is the third instance of the same shape this week: #1011 shipped a regression test that nothing collected (fixed by making ai-tutors/ a workspace member), and #982 / #1043 dealt with eval cases silently falling back to MANUAL. Different mechanisms, same failure: a check that looks present and never runs.
I am not asking you to fix it here. The ai-tutors remedy — make the directory a uv workspace member — is the wrong shape for skills/, since skills are agent-facing markdown plus helper scripts that get symlinked into adopter repos, not Python packages. The right answer is probably a single pytest invocation over skills/**/tests/ wired into the existing job, and that is a maintainer decision about repo structure rather than something to bolt onto a feature PR. Worth its own issue, and I will raise one.
The noqa is worth deleting while you are here, though, since it is already stale.
This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.More on how Apache Magpie handles maintainer review:
CONTRIBUTING.md § Opening a pull request.
Summary
/pull/<number>URL.NO_COLOR,TERM=dumb, and non-terminal output.Type of change
.claude/skills/<name>/) — eval fixtures updated belowtools/<system>/*.md)tools/*/withpyproject.toml)docs/,README.md,CONTRIBUTING.md)projects/_template/)prek, workflows, validators)Test plan
prek run --all-filespassesuv run pytest/ruff check/mypypassesRFC-AI-0004 compliance
Ai Assistance
took help from Codex for testing.
Linked issues
Closes #73
Notes for reviewers
The helper deliberately keeps the visible reference compact in capable terminals while ensuring the canonical URL remains visible everywhere else.