Skip to content

Fix path-resolution bug in changenotes.mts validate by using getChangenotes - #4156

Open
mario-campos wants to merge 1 commit into
mainfrom
mario-campos/fix-validate-cmd
Open

mario-campos wants to merge 1 commit into
mainfrom
mario-campos/fix-validate-cmd

Conversation

@mario-campos

@mario-campos mario-campos commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

isValidChangenoteFile receives a file name (no leading path) and then attempts to read that file, regardless of the CWD. If the user's CWD is not in unreleased-change-notes, then the command will likely fail to open the file.

Incidentally, for #4155, I've added getChangenotes, which consolidates some duplicative code between the assemble and validate commands. We can take advantage of that here in validate, and in so doing, fix the bug.

Risk assessment

For internal use only. Please select the risk level of this change:

  • Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.

Which use cases does this change impact?

Workflow types:

  • N/A

Products:

  • N/A

Environments:

  • Testing/None - This change does not impact any CodeQL workflows in production.

How did/will you validate this change?

  • Unit tests - I am depending on unit test coverage (i.e. tests in .test.ts files).

If something goes wrong after this change is released, what are the mitigation and rollback strategies?

  • Development/testing only - This change cannot cause any failures in production.

How will you know if something goes wrong after this change is released?

  • N/A

Are there any special considerations for merging or releasing this change?

  • No special considerations - This change can be merged at any time.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Consider adding a changelog entry for this change.
  • Confirm the readme and docs have been updated if necessary.

@github-actions github-actions Bot added the size/XS Should be very easy to review label Sep 18, 2026
@mario-campos
mario-campos force-pushed the mario-campos/fix-validate-cmd branch from fc0dbb2 to dedce4e Compare September 18, 2026 20:09
@github-actions github-actions Bot added size/L May be hard to review and removed size/XS Should be very easy to review labels Sep 18, 2026
@mario-campos mario-campos changed the title Fix path-resolution bug in changenotes.mts validate command Fix path-resolution bug in changenotes.mts validate by using getChangenotes Sep 18, 2026
Comment thread pr-checks/changelog/validate.mts Fixed
@mario-campos
mario-campos force-pushed the mario-campos/fix-validate-cmd branch 2 times, most recently from bf6da6f to 609b22f Compare September 22, 2026 13:14
@github-actions github-actions Bot added size/S Should be easy to review and removed size/L May be hard to review labels Sep 22, 2026
@mario-campos
mario-campos force-pushed the mario-campos/fix-validate-cmd branch from 609b22f to e1b1575 Compare September 22, 2026 13:17
This reduces duplicate code between `assemble` and `validate`. It also has the benefit of fixing a bug in the current implementation of `validate`, where `isValidChangenoteFile` receives a relative file name where it should receive an absolute one.
@mario-campos
mario-campos force-pushed the mario-campos/fix-validate-cmd branch from e1b1575 to 738bd62 Compare September 22, 2026 14:01
@mario-campos
mario-campos marked this pull request as ready for review September 22, 2026 14:16
@mario-campos
mario-campos requested a review from a team as a code owner September 22, 2026 14:16
Copilot AI balanced review requested due to automatic review settings September 22, 2026 14:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused change correctly fixes working-directory-dependent path resolution without leaving unresolved usages.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes changenote validation from arbitrary working directories by validating repository-rooted paths.

Changes:

  • Uses getChangenotes() to resolve changenote paths.
  • Removes the obsolete aggregate validator and its tests.
File Description
pr-checks/​changenotes.mts Validates changenotes using resolved paths.
pr-checks/​changelog/​validate.mts Removes the unused aggregate validator.
pr-checks/​changelog/​validate.test.mts Removes tests for the deleted helper.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch has not been deployed

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

Labels

size/S Should be easy to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants