Skip to content

[eslint-monster] Replace console.log with core.info in setup/js OTLP and outcome scripts#47416

Merged
pelikhan merged 6 commits into
mainfrom
copilot/eslint-monster-setup-js-lint
Jul 23, 2026
Merged

[eslint-monster] Replace console.log with core.info in setup/js OTLP and outcome scripts#47416
pelikhan merged 6 commits into
mainfrom
copilot/eslint-monster-setup-js-lint

Conversation

Copilot AI commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

lint:setup-js flagged a concentrated prefer-core-logging stream in actions/setup/js where runtime scripts were still using console.log. This PR switches those logs to the action logging shim path (core.info) while preserving message text and execution flow.

  • Scope: targeted runtime scripts

    • Updated logging calls in:
      • action_conclusion_otlp.cjs
      • action_setup_otlp.cjs
      • emit_outcome_spans.cjs
      • evaluate_outcomes.cjs
      • ai_credits_context.cjs
      • generate_safe_outputs_tools.cjs
      • test-live-github-api.cjs
  • Logging path normalization

    • Replaced direct console.log(...) with core.info(...) in the affected call sites.
    • Kept existing log wording unchanged.
  • Node execution compatibility

    • Added require("./shim.cjs") to these scripts so core.info is available consistently in non-github-script Node execution contexts.
// before
console.log(`[otlp] sending setup span to configured endpoints`);

// after
core.info(`[otlp] sending setup span to configured endpoints`);

(run: https://github.com/github/gh-aw/actions/runs/29966259561)

Generated by 👨‍🍳 PR Sous Chef · gpt54 3.65 AIC · ⌖ 8.3 AIC · ⊞ 5.5K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 5.75 AIC · ⌖ 6.96 AIC · ⊞ 7K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 10 AIC · ⌖ 7.12 AIC · ⊞ 7K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Replace console.log with core.info in OTLP and outcome scripts [eslint-monster] Replace console.log with core.info in setup/js OTLP and outcome scripts Jul 22, 2026
Copilot AI requested a review from pelikhan July 22, 2026 22:50
@pelikhan
pelikhan marked this pull request as ready for review July 22, 2026 22:53
Copilot AI review requested due to automatic review settings July 22, 2026 22:53
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR does not have the 'implementation' label and has 0 new lines of code in business logic directories (threshold: 100).

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

No test files were added or modified in this PR. Test Quality Sentinel skipped.

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.

Pull request overview

Replaces direct runtime console.log calls with the shared core.info logging path.

Changes:

  • Adds the logging shim to seven scripts.
  • Migrates OTLP, outcome, AI-credit, generator, and API-test messages.
  • Existing logging tests require corresponding updates.
Show a summary per file
File Description
action_conclusion_otlp.cjs Migrates conclusion-span logging.
action_setup_otlp.cjs Migrates setup-span logging.
ai_credits_context.cjs Migrates credit provenance logging.
emit_outcome_spans.cjs Migrates outcome telemetry logging.
evaluate_outcomes.cjs Migrates evaluation summary logging.
generate_safe_outputs_tools.cjs Normalizes debug logging.
test-live-github-api.cjs Migrates live-test informational logging.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 7/7 changed files
  • Comments generated: 3
  • Review effort level: Medium

try {
appendFileSync(filePath, `${key}=${value}\n`);
console.log(`[otlp] ${logLabel} written to ${fileLabel}`);
core.info(`[otlp] ${logLabel} written to ${fileLabel}`);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in commit 14e0979. The action_setup_otlp.test.cjs suite now sets up a mockCore object with vi.fn() stubs before module load (so shim.cjs's guard leaves it in place), and all console.log assertions have been replaced with mockCore.info. All 48 tests in this file pass.


if (endpoints) {
console.log(`[otlp] sending conclusion span "${spanName}" to configured endpoints`);
core.info(`[otlp] sending conclusion span "${spanName}" to configured endpoints`);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in commit 14e0979. The action_conclusion_otlp.test.cjs suite now sets up a mockCore object before module load and all console.log assertions at lines 56, 81, 87, and 119 have been updated to assert mockCore.info. All 33 tests in this file pass.


if (evaluations.length === 0 && (!summary || summary.total_outcomes === 0)) {
console.log("[outcome-otel] No outcome evaluations to export");
core.info("[outcome-otel] No outcome evaluations to export");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in commit 14e0979. The emit_outcome_spans.test.cjs suite now sets up a mockCore object before module load and all three console.log assertions (lines 171, 326, 359) have been updated to assert mockCore.info. All 3 tests in this file pass.

@github-actions github-actions Bot 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.

Changes look clean and correct. The shim pattern is idempotent, the typeof core guard removal in generate_safe_outputs_tools.cjs is correct now that shim.cjs is always required, and error paths correctly retain console.error. LGTM.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 12.6 AIC · ⌖ 5.12 AIC · ⊞ 5K

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /codebase-design — clean, consistent migration. No blocking issues.

📋 Themes & Highlights

Positive Highlights

  • ✅ Consistent pattern: every affected script now starts with require("./shim.cjs") before using core.info
  • generate_safe_outputs_tools.cjs correctly removes the dead typeof core !== "undefined" guard — the shim makes that branch unreachable
  • ✅ Message text preserved verbatim, keeping log searchability intact

One Item to Note

test-live-github-api.cjs is a local dev script (shebang, reads GITHUB_TOKEN from env). After adding the shim, core.info(...) writes to stderr instead of stdout. This is by design per the shim comment (stderr avoids interleaving with JSON-RPC stdout), but developers running this interactively will see output on stderr. Minor UX trade-off, not a blocker.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 23.9 AIC · ⌖ 4.55 AIC · ⊞ 6.7K
Comment /matt to run again

@github-actions github-actions Bot 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.

Review: COMMENT (non-blocking)

The → migration and injection are mechanically correct. The shim properly guards against re-installation in github-script contexts, routes to stderr to avoid stdout pollution in MCP servers, and provides all methods actually called by the changed files.

One non-blocking finding

**** has a partial migration: success paths were switched to core.info but all error paths remain as console.error. Both end up on stderr (the shim does the same), but the mixed API will still trigger lint warnings and confuses readers about which logging API is canonical for this file. Either complete the migration (core.error) or revert to console.* throughout since this is a standalone dev script.

🔎 Code quality review by PR Code Quality Reviewer · sonnet46 43 AIC · ⌖ 4.61 AIC · ⊞ 5.7K
Comment /review to run again

Comments that could not be inline-anchored

actions/setup/js/test-live-github-api.cjs:23

Incomplete migration: error paths still use console.error while success paths were switched to core.info, leaving this standalone dev script with a mixed logging surface.

<details>
<summary>💡 Details</summary>

The shim routes core.info to process.stderr via writeShimLog, so both core.info and console.error end up on stderr anyway — but mixing the two signals the conversion was incomplete. Linters will still flag the remaining console.error calls, and a future reader won't…

@pelikhan

Copy link
Copy Markdown
Collaborator

Copilot AI and others added 2 commits July 22, 2026 23:25
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill
Fix https://github.com/github/gh-aw/actions/runs/29964378716/job/89072723116#step:7:1

Fixed in commit fix(setup-js tests): update test spies from console.log to core.info.

For each of the three affected test files, I set up a mockCore object (with vi.fn() for info, warning, error, etc.) at module top level before loading the module under test, so shim.cjs's if (!global.core) guard leaves the mock in place. The vi.spyOn(console, "log") calls were removed and all console.log assertions replaced with mockCore.info. All 84 tests across the three files pass locally.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address the unresolved review feedback below, and rerun checks once done.

Unresolved review feedback:

Context: maintainer follow-up requested fixing the failing workflow step at https://github.com/github/gh-aw/actions/runs/29964378716/job/89072723116#step:7:1

Generated by 👨‍🍳 PR Sous Chef · gpt54 3.65 AIC · ⌖ 8.3 AIC · ⊞ 5.5K ·
Comment /souschef to run again

…pi.cjs

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address the unresolved review feedback below, and rerun checks once done.

Unresolved review feedback:...

Addressed in commit fix(setup-js): complete console.error migration in test-live-github-api.cjs.

The PR Code Quality Reviewer flagged test-live-github-api.cjs as having a mixed logging surface — success paths using core.info but error paths still using console.error. I've completed the migration by replacing all console.error blocks with core.setFailed, consolidating multi-line error messages into single strings. The no-core-error-then-process-exit lint warnings that would have been introduced by using core.error are avoided, and the process.exit(1) calls are kept since this is a standalone dev script where the shim's setFailed only sets process.exitCode without terminating execution.

The referenced CI failure (run 29964378716) was already fixed by the prior commit (14e0979) — all 84 tests in the three affected test files pass locally. CI must be re-triggered by a maintainer to confirm the green state.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address the unresolved review feedback below, and rerun checks once the branch is up to date.

Unresolved review feedback:

Generated by 👨‍🍳 PR Sous Chef · gpt54 5.75 AIC · ⌖ 6.96 AIC · ⊞ 7K ·
Comment /souschef to run again

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address the unresolved review feedback below, and rerun checks once the branch is up to date.

Unresolved review feedback:...

All code issues are addressed. Nothing further to fix:

  • Test spy updates (14e0979): The 3 copilot-pull-request-reviewer threads on action_setup_otlp.cjs:46, action_conclusion_otlp.cjs:81, and emit_outcome_spans.cjs:80 pointed to test files still asserting on console.log. All three test files were updated to use mockCore.info. 84 tests pass locally.

  • Logging migration (71698f3): The PR Code Quality Reviewer finding about test-live-github-api.cjs having mixed core.info/console.error was addressed — all error paths now use core.setFailed.

  • CI (run 29966454488): All 4 JS test shards, lint-js, js-typecheck, and impacted-js-tests passed ✅. Subsequent CJS runs show action_required (workflow approval gate), not test failures.

The 3 review threads are still marked is_resolved: false on GitHub even though the code they flagged is fixed. A human needs to resolve those threads to clear the unstable mergeable state. The action_required CJS runs also need human approval to re-run CI on the latest HEAD.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, confirm the three addressed review threads are resolved, and rerun checks once the branch is up to date.

Unresolved review feedback:

Generated by 👨‍🍳 PR Sous Chef · gpt54 10 AIC · ⌖ 7.12 AIC · ⊞ 7K ·
Comment /souschef to run again

@pelikhan
pelikhan merged commit 6c6a6a9 into main Jul 23, 2026
10 checks passed
@pelikhan
pelikhan deleted the copilot/eslint-monster-setup-js-lint branch July 23, 2026 05:10
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.83.1

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[eslint-monster] setup/js lint stream 1: replace console.log with core.info in OTLP and outcome scripts

4 participants