Skip to content

fix: anchor GitHub annotation path to GITHUB_WORKSPACE#60

Open
exo-mv wants to merge 2 commits into
mainfrom
fix/reporter-annotation-workspace-path
Open

fix: anchor GitHub annotation path to GITHUB_WORKSPACE#60
exo-mv wants to merge 2 commits into
mainfrom
fix/reporter-annotation-workspace-path

Conversation

@exo-mv
Copy link
Copy Markdown

@exo-mv exo-mv commented Jun 1, 2026

Summary

  • Test failures now surface as inline PR annotations under lerna/nx. The reporter's ::error file=,line=,col=:: path was computed with relative(cwd, …); since lerna/nx run each package with cwd = the package dir, the path came out package-relative (bar.test.js) and GitHub — which resolves annotation paths from the repo root — never mapped it onto the diff.
  • In CI, anchor the path to GITHUB_WORKSPACE so it's repo-root-relative (packages/foo/bar.test.js). Non-CI runs stay cwd-relative. Logic extracted into resolveAnnotationFile.

Test plan

deno failure is pre-existing on master

The reporter emits `::error file=,line=,col=::` workflow commands so test
failures show as inline annotations on the PR diff. GitHub resolves the
`file=` path from the repo root (GITHUB_WORKSPACE), but the reporter computed
it with `relative(cwd, ...)`. Under lerna/nx the cwd is the package dir, so the
path came out package-relative (e.g. `file=bar.test.js`) and never mapped onto
the diff — no annotation appeared.

Anchor the path to GITHUB_WORKSPACE in CI so it is repo-root-relative
(`packages/foo/bar.test.js`); local runs stay cwd-relative. The logic lives in
a new node:path-only `bin/github.js`, so the unit test can import it without
dragging in the node:test reporter internals (which don't bundle for the
barebone engines). Adds unit coverage for the CI and non-CI cases.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@exo-mv exo-mv force-pushed the fix/reporter-annotation-workspace-path branch from aa698a4 to d8cef00 Compare June 1, 2026 19:04
resolveAnnotationFile ran the path through node:path relative()/resolve(),
which produce backslash separators on Windows runners. GitHub matches
`::error file=` annotation paths with forward slashes, so on Windows the
annotation never landed on the repo file (and reporter.js's stack-line
matcher, which assumes `/`, also missed). Normalize the result to POSIX
separators so the annotation maps onto the PR diff on every platform.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@exo-mv exo-mv marked this pull request as ready for review June 1, 2026 19:30
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