GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: always include files from diff in overlay changed files by sam-robson · Pull Request #3554 · github/codeql-action

Conversation

@sam-robson

@sam-robson sam-robson commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Ensure that overlay changes always include all PR diff files used for diff-informed analysis.

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:

  • Managed - Impacts users with dynamic workflows (Default Setup, Code Quality, ...).

Products:

  • Code Scanning - The changes impact analyses when analysis-kinds: code-scanning.
  • Code Quality - The changes impact analyses when analysis-kinds: code-quality.

Environments:

  • Dotcom - Impacts CodeQL workflows on github.com and/or GitHub Enterprise Cloud with Data Residency.
  • GHES - Impacts CodeQL workflows on GitHub Enterprise Server.

How did/will you validate this change?

  • Unit tests - I am depending on unit test coverage (i.e. tests in .test.ts files).
  • End-to-end tests - I am depending on PR checks (i.e. tests in pr-checks).

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

  • Feature flags - All new or changed code paths can be fully disabled with corresponding feature flags.

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

  • Telemetry - I rely on existing telemetry or have made changes to the telemetry.
    • Dashboards - I will watch relevant dashboards for issues after the release. Consider whether this requires this change to be released at a particular time rather than as part of a regular release.
    • Alerts - New or existing monitors will trip if something goes wrong with this change.

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

  • No special considerations - This change can be merged at any time.
  • Special considerations - This change should only be merged once certain preconditions are met. Please provide details of those or link to this PR from an internal issue.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot added the size/M Should be of average difficulty to review label Mar 6, 2026
@sam-robson
sam-robson force-pushed the sam-robson/overlay-include-diff branch from ecde788 to d135b9c Compare March 6, 2026 16:11
Base automatically changed from kaspersv/move-diff-range-absolute-path-conversion to main March 18, 2026 12:02
@sam-robson
sam-robson force-pushed the sam-robson/overlay-include-diff branch from d135b9c to 0b55f65 Compare March 24, 2026 10:23
@sam-robson
sam-robson marked this pull request as ready for review March 24, 2026 10:44
@sam-robson
sam-robson requested a review from a team as a code owner March 24, 2026 10:44
Copilot AI review requested due to automatic review settings March 24, 2026 10:44
Copilot started reviewing on behalf of sam-robson March 24, 2026 10:45
View session
Copilot AI reviewed Mar 24, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pull request overview

This PR ensures overlay analysis always includes all files present in the PR diff by persisting PR diff-range data during init, reusing it during analyze, and merging diff-derived paths into the overlay “changed files” list to cover cases like revert PRs.

Changes:

  • Persist PR diff ranges to pr-diff-range.json during init when diff-informed analysis is enabled.
  • Update analyze to read precomputed diff ranges from disk instead of recomputing via API calls.
  • Merge diff-derived file paths into overlay changed files and add unit tests covering diff-only/revert-like cases.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/overlay/index.ts Merges OID-changed files with PR diff-derived file paths for overlay changes.
src/overlay/index.test.ts Adds tests verifying diff-derived files are merged/deduplicated and behavior is unchanged when the diff file is absent.
src/init-action.ts Computes and persists PR diff ranges during init (non-fatal on failure).
src/analyze.ts Switches diff-informed setup to read precomputed diff ranges from disk.
src/analyze-action.ts Simplifies diff-informed setup call to rely on precomputed diff file presence.
lib/* Generated JavaScript output corresponding to the TypeScript changes.
Comments suppressed due to low confidence (1)

src/overlay/index.ts:185

  • getDiffRangeFilePaths will throw if pr-diff-range.json is missing required fields, malformed JSON, or not an array. Since this file is optional and lives in the temp directory, it would be safer for overlay mode to treat parse/shape errors as non-fatal (log a warning/debug and return []) so overlay database creation doesn’t fail due to a stale/corrupted temp file.
function getDiffRangeFilePaths(logger: Logger): string[] {
  const jsonFilePath = path.join(getTemporaryDirectory(), "pr-diff-range.json");
  if (!fs.existsSync(jsonFilePath)) {
    return [];
  }
  const diffRanges = JSON.parse(
    fs.readFileSync(jsonFilePath, "utf8"),
  ) as Array<{ path: string }>;
  logger.debug(
    `Read ${diffRanges.length} diff range(s) from ${jsonFilePath} for overlay changes.`,
  );
  return [...new Set(diffRanges.map((r) => r.path))];

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/overlay/index.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/analyze.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sam-robson
sam-robson force-pushed the sam-robson/overlay-include-diff branch from 0b55f65 to 335dcf5 Compare March 24, 2026 14:17
@github-actions github-actions Bot added size/L May be hard to review and removed size/M Should be of average difficulty to review labels Mar 24, 2026
@sam-robson
sam-robson force-pushed the sam-robson/overlay-include-diff branch 2 times, most recently from 0fc9e98 to cfa00b1 Compare March 24, 2026 15:09
redsun82
redsun82 reviewed Mar 25, 2026
View reviewed changes
Comment thread src/overlay/index.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

sam-robson added 2 commits March 25, 2026 15:51
@sam-robson
feat: always include files from diff in overlay changed files
521c353
@sam-robson
refactor: single source of truth for getDiffRangesJsonFilePath and si…
d5bb39f
…mplified getDiffRangeFilePaths
@sam-robson
sam-robson force-pushed the sam-robson/overlay-include-diff branch from e14fd5d to d5bb39f Compare March 25, 2026 15:52
@sam-robson
sam-robson requested a review from redsun82 March 25, 2026 16:16
henrymercer
henrymercer previously approved these changes Mar 25, 2026
View reviewed changes
Comment thread src/init-action.ts Outdated
logger: Logger,
): Promise<void> {
try {
await withGroupAsync("Compute PR diff ranges", async () => {

@henrymercer henrymercer Mar 25, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Suggested change
await withGroupAsync("Compute PR diff ranges", async () => {
await withGroupAsync("Computing PR diff ranges", async () => {

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/init-action.ts Outdated
Comment on lines +873 to +875
logger.warning(
`Failed to compute and persist PR diff ranges: ${getErrorMessage(e)}`,
);

@henrymercer henrymercer Mar 25, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Nit: ideally this would be logged within the log group started above

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sam-robson reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread src/overlay/index.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/overlay/index.ts
Comment on lines +206 to +209
logger.warning(
"Cannot determine git root; returning diff range paths as-is.",
);
return [...new Set(diffRanges.map((r) => r.path))];

@henrymercer henrymercer Mar 25, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We might want to fail here if the source-root input was provided, otherwise we risk omitting files from the analysis. If the source root input wasn't provided, this seems like a sensible fallback.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sam-robson reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread src/overlay/index.ts

let diffRanges: Array<{ path: string }>;
try {
diffRanges = JSON.parse(contents) as Array<{ path: string }>;

@henrymercer henrymercer Mar 25, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Minor: This can be addressed as followup, but it would be good to better validate what the JSON looks like here. This is something we're gradually improving across the codebase — see the parts of the code that use json.ts.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sam-robson
fix: improve error handling and logging for diff range path resolution
23a0098
@sam-robson
sam-robson dismissed henrymercer’s stale review via 23a0098 March 25, 2026 20:32
@sam-robson
sam-robson requested a review from henrymercer March 25, 2026 21:11
henrymercer
henrymercer approved these changes Mar 26, 2026
View reviewed changes

@henrymercer henrymercer left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sam-robson
sam-robson added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 4bdd4e7 Mar 26, 2026
225 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@sam-robson
sam-robson deleted the sam-robson/overlay-include-diff branch March 26, 2026 11:16
This was referenced Mar 27, 2026
Merge main into releases/v4 #3774
Closed
Merge main into releases/v4 #3776
Merged
@github-actions github-actions Bot mentioned this pull request Mar 27, 2026
Merge releases/v4 into releases/v3 #3778
Merged
5 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@henrymercer henrymercer henrymercer approved these changes
@redsun82 redsun82 Awaiting requested review from redsun82

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size/L May be hard to review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@sam-robson @redsun82 @henrymercer
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.