Skip to content

Conversation

@mbg
Copy link
Member

@mbg mbg commented Jan 20, 2026

The post action for start-proxy uploads the authentication proxy's logs in debug mode. However, it currently uses a fixed name for this (always proxy-log-file). This is a problem in e.g. matrix'ed workflows where multiple CodeQL jobs may want to upload the respective proxy logs.

This PR lightly refactors our existing code for uploading debug artifacts, where we already address this problem for other debug artifacts, so that the same functions can then be used for the start-proxy post action.

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, CCR, ...).

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.

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?

  • Rollback - Change can only be disabled by rolling back the release or releasing a new version with a fix.

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.

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.

@mbg mbg requested a review from a team as a code owner January 20, 2026 12:57
Copilot AI review requested due to automatic review settings January 20, 2026 12:57
@github-actions github-actions bot added the size/S Should be easy to review label Jan 20, 2026
@mbg mbg self-assigned this Jan 20, 2026
@mbg mbg requested a review from henrymercer January 20, 2026 12:58
Copy link
Contributor

Copilot AI left a 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 refactors the debug artifact upload code to ensure proxy log artifacts have unique names in matrix workflows. Previously, the start-proxy post action used a fixed artifact name "proxy-log-file", which caused upload failures in matrix workflows where multiple jobs would attempt to upload artifacts with the same name.

Changes:

  • Extracted the matrix suffix generation logic into a reusable getArtifactSuffix() function
  • Created a new uploadArtifacts() function that handles artifact uploads with matrix suffix support
  • Updated start-proxy-action-post.ts to use the new uploadArtifacts() function instead of manually managing artifact uploads

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

File Description
src/start-proxy-action-post.ts Simplified to call the new uploadArtifacts() function instead of manually creating an uploader and uploading with a fixed name
src/debug-artifacts.ts Extracted getArtifactSuffix() function and created new uploadArtifacts() function to handle uploads with matrix suffix support
src/debug-artifacts.test.ts Added comprehensive tests for the new getArtifactSuffix() function
lib/*.js Generated JavaScript files updated to match TypeScript changes

@mbg
Copy link
Member Author

mbg commented Jan 20, 2026

I re-ran the "Start proxy" PR check in debug mode to exercise the new logic. This worked as expected: https://github.com/github/codeql-action/actions/runs/21172332497/job/60892639862?pr=3409#step:12:79

esbena
esbena previously approved these changes Jan 20, 2026
Copy link
Contributor

@esbena esbena left a comment

Choose a reason for hiding this comment

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

LGTM with some comments on the existing code that I made before I realised it was just moving around..

@mbg mbg requested a review from esbena January 20, 2026 13:27
esbena
esbena previously approved these changes Jan 20, 2026
henrymercer
henrymercer previously approved these changes Jan 20, 2026
Comment on lines +275 to +279
// Enumerates different, possible outcomes for artifact uploads.
export type UploadArtifactsResult =
| "no-artifacts-to-upload"
| "upload-successful"
| "upload-failed";
Copy link
Contributor

Choose a reason for hiding this comment

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

How about using an enum?

Copy link
Member Author

Choose a reason for hiding this comment

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

I probably would've gone for an enum if this was new, but I stuck with what we already had here (just named it for reusability).

let suffix = "";
if (matrix) {
try {
const matrixObject = JSON.parse(matrix) as any[][];
Copy link
Contributor

Choose a reason for hiding this comment

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

For improved type safety, should this be unknown[][]?

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed this to not assume anything about what JSON.parse might return, since for user-specified input it could be any valid JSON value. Instead, I added a check that matrixObject is actually a JS object and then just assume that it is an object after that.

@mbg mbg dismissed stale reviews from henrymercer and esbena via 1df1c9f January 20, 2026 13:55
@github-actions github-actions bot added size/M Should be of average difficulty to review and removed size/S Should be easy to review labels Jan 20, 2026
@mbg mbg enabled auto-merge January 20, 2026 14:20
@mbg mbg merged commit d60bbdf into main Jan 20, 2026
244 checks passed
@mbg mbg deleted the mbg/start-proxy/make-unique-artifact branch January 20, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Should be of average difficulty to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants