Skip to content

Remove getRunnerLogger - #4235

Open
mbg wants to merge 4 commits into
mainfrom
mbg/deprecate-getRunnerLogger
Open

mbg wants to merge 4 commits into
mainfrom
mbg/deprecate-getRunnerLogger

Conversation

@mbg

@mbg mbg commented Oct 14, 2026

Copy link
Copy Markdown
Member

Follow-up to #4198 (comment), which cherry-picks the commit with the Logger improvement and addresses the getRunnerLogger point.

The getRunnerLogger function is only used in tests where it is largely superseded by getRecordingLogger / the RecordingLogger class. The Logger returned by getRunnerLogger outputs log messages to stdout. In setupTests, we install test hooks which ensure that all stdout/stderr output is captured and printed if a test fails.

The recording logger is able to both record log messages and output them to stdout. The former is useful for assertions while the latter mirrors the behaviour of getRecordingLogger. While RecordingLogger always uses console.debug to output to stdout, this doesn't matter because we capture the output with the hooks installed by setupTests. The debug-level filter of getRunnerLogger was only used by one file and not practically useful -- the tests still pass and the increased output isn't an issue if tests fail. This PR replaces getRunnerLogger with new RecordingLogger.

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?

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

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.

Copilot AI balanced review requested due to automatic review settings October 14, 2026 14:05
@mbg
mbg requested a review from a team as a code owner October 14, 2026 14:05
@github-actions github-actions Bot added the size/XL May be very hard to review label Oct 14, 2026

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.

Warning

  • Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.

🟡 Changes recommended

RecordingLogger formats array messages differently in its recorded and console outputs.

1 open finding
What changed in this PR

Removes the test-only getRunnerLogger, standardizing tests on RecordingLogger.

Changes:

  • Adds array-message normalization to the logging interface.
  • Moves getCodeQLForTesting into testing utilities.
  • Updates affected tests and helpers to use RecordingLogger.
File Description
lib/​entry-points.js Excluded generated file; contents unavailable for review.
src/​logging.ts Removes getRunnerLogger and supports array messages.
src/​logging.test.ts Tests message normalization.
src/​testing-utils.ts Extends RecordingLogger and adds the CodeQL test helper.
src/​codeql.ts Exposes the underlying CodeQL factory and removes its test helper.
src/​codeql.test.ts Uses relocated test utilities.
src/​workflow.test.ts Uses relocated CodeQL test helper.
src/​tracer-config.test.ts Uses relocated CodeQL test helper.
src/​init-action-post-helper.test.ts Uses new test logger and CodeQL helper.
src/​feature-flags/​testing-util.ts Defaults feature tests to RecordingLogger.
src/​actions-util.test.ts Replaces runner logger.
src/​analyses.test.ts Replaces runner logger.
src/​analyze.test.ts Replaces runner logger.
src/​artifact-scanner.test.ts Replaces runner logger.
src/​cli/​output-cache.test.ts Replaces runner logger.
src/​config-utils.test.ts Replaces runner logger.
src/​config/​db-config.test.ts Replaces runner logger.
src/​diff-informed-analysis-utils.test.ts Replaces runner logger.
src/​feature-flags/​properties.test.ts Replaces runner logger.
src/​fingerprints.test.ts Replaces runner logger.
src/​overlay/​caching.test.ts Replaces runner logger.
src/​overlay/​index.test.ts Replaces runner logger.
src/​setup-codeql.test.ts Replaces runner logger.
src/​start-proxy.test.ts Replaces runner logger.
src/​status-report.test.ts Replaces runner logger.
src/​tar.test.ts Replaces runner logger.
src/​tools-download.test.ts Replaces runner logger.
src/​trap-caching.test.ts Replaces runner logger.
src/​upload-lib.test.ts Replaces runner logger.
src/​upload-sarif.test.ts Replaces runner logger.
src/​util.test.ts Replaces runner logger.
Files excluded by content exclusion policy (1)
  • lib/entry-points.js

🧠 Review effort: Balanced


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

Comment thread src/testing-utils.ts Outdated
Comment thread src/testing-utils.ts Dismissed

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/XL May be very hard to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants