Skip to content

fix(eslint): resolve route/URL/control-flow lint violations in actions/setup/js#46100

Merged
pelikhan merged 13 commits into
mainfrom
copilot/fix-route-url-core-failure-control-lint
Jul 18, 2026
Merged

fix(eslint): resolve route/URL/control-flow lint violations in actions/setup/js#46100
pelikhan merged 13 commits into
mainfrom
copilot/fix-route-url-core-failure-control-lint

Conversation

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Three categories of custom ESLint rule violations across 10 files in actions/setup/js: interpolated github.request() routes, unguarded new URL() calls, and core.setFailed() without immediate control transfer.

Typed github.request() routes (no-github-request-interpolated-route)

Replaced whole-route interpolations and template-literal routes with typed placeholder form. This required refactoring resolveRestEndpoint / addReaction to return { route, params } objects instead of path strings, cascading through add_reaction_and_edit_comment.cjs and add_workflow_run_comment.cjs.

// Before
github.request(`POST ${endpoint}`, { content: reaction, ...context })
github.request(`POST /repos/${owner}/${repo}/issues/${issue_number}/reactions`, ...)

// After
github.request("POST /repos/{owner}/{repo}/issues/{issue_number}/reactions", {
  owner, repo, issue_number, content: reaction
})

Files: add_reaction.cjs, add_reaction_and_edit_comment.cjs, add_workflow_run_comment.cjs, route_slash_command.cjs

Guarded new URL() (require-new-url-try-catch)

Wrapped new URL(...) in try/catch in all flagged call sites.

Files: artifact_client.cjs (4 sites), generate_history_link.cjs, mcp_cli_bridge.cjs, mount_mcp_as_cli.cjs

Control transfer after core.setFailed() (require-return-after-core-setfailed)

  • check_team_member.cjs: moved setOutput before setFailed, added return
  • safe_output_handler_manager.cjs: captured failure message in a variable, deferred setFailed + return to after all output exports complete

Test updates

All affected test files updated to match the new { route, params } call signatures. 315 tests pass across 8 test files.

Copilot AI and others added 2 commits July 17, 2026 00:14
…up/js

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…etup/js

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix route and URL core failure control lint findings fix(eslint): resolve route/URL/control-flow lint violations in actions/setup/js Jul 17, 2026
Copilot AI requested a review from pelikhan July 17, 2026 00:48
@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage

Field Value
Category chore (ESLint batch 3/3)
Risk 🟡 Medium
Score 30/100
Action defer
Batch pr-batch:eslint-setup-js

Score breakdown: Impact 10 + Urgency 7 + Quality 13

Rationale: Resolves route/URL/control-flow ESLint violations in 10 files in actions/setup/js/. DRAFT. Part of 3-PR ESLint batch with #46102 and #46101.

Run §29545908133

Generated by 🔧 PR Triage Agent · 181.7 AIC · ⌖ 5.04 AIC · ⊞ 5.6K ·

@pelikhan
pelikhan marked this pull request as ready for review July 17, 2026 02:41
Copilot AI review requested due to automatic review settings July 17, 2026 02:41
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

⚠️ PR Code Quality Reviewer failed during code quality review.

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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

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

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

Updates JavaScript action helpers to satisfy custom ESLint rules while preserving GitHub API behavior.

Changes:

  • Replaces interpolated REST endpoints with typed routes and parameters.
  • Guards URL construction and adds explicit errors.
  • Adds control flow after core.setFailed() and updates tests.
Show a summary per file
File Description
.github/workflows/release.lock.yml Refreshes generated action metadata.
actions/setup/js/add_reaction.cjs Uses typed reaction routes.
actions/setup/js/add_reaction.test.cjs Updates reaction route tests.
actions/setup/js/add_reaction_and_edit_comment.cjs Uses typed reaction/comment routes.
actions/setup/js/add_reaction_and_edit_comment.test.cjs Updates combined-action tests.
actions/setup/js/add_workflow_run_comment.cjs Uses typed comment routes.
actions/setup/js/add_workflow_run_comment.test.cjs Updates comment route tests.
actions/setup/js/artifact_client.cjs Guards artifact URL construction.
actions/setup/js/check_team_member.cjs Returns after failure handling.
actions/setup/js/generate_history_link.cjs Guards history URL construction.
actions/setup/js/mcp_cli_bridge.cjs Rejects malformed bridge URLs.
actions/setup/js/mount_mcp_as_cli.cjs Rejects malformed mounted-server URLs.
actions/setup/js/route_slash_command.cjs Uses typed immediate-reaction routes.
actions/setup/js/route_slash_command.test.cjs Updates slash-command route tests.
actions/setup/js/safe_output_handler_manager.cjs Defers failure until outputs are exported.

Review details

Tip

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

  • Files reviewed: 15/15 changed files
  • Comments generated: 2
  • Review effort level: Medium

Comment thread actions/setup/js/artifact_client.cjs Outdated
Comment on lines +85 to +91
const url = (() => {
try {
return new URL(`/twirp/${TWIRP_ARTIFACT_SERVICE}/${method}`, getResultsServiceOrigin()).toString();
} catch {
throw new Error(`Failed to construct twirp URL for method: ${method}`);
}
})();

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 3bba3d7 and refined in 90c2fe7. twirpRequest now resolves getResultsServiceOrigin() before constructing the Twirp URL, so ACTIONS_RESULTS_URL validation errors remain visible instead of being masked by the construction guard.

Comment on lines +1640 to +1645
let failedOutputsMessage = null;
if (failureCount > 0) {
core.warning(`${failureCount} message(s) failed to process`);
const failedItemLines = fatalFailures.map(r => ` - ${r.type}: ${r.error || "Unknown error"}`);
const failedItems = failedItemLines.join("\n");
core.setFailed(`${failureCount} safe output(s) failed:\n${failedItems}`);
failedOutputsMessage = `${failureCount} safe output(s) failed:\n${failedItems}`;

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.

Addressed in 3bba3d7. I moved failedOutputsMessage to outer scope and updated the catch path to include it when later export logic throws, so primary safe-output failures are preserved alongside handler errors.

@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: ESLint lint-violation fixes

The changes correctly address all three lint violation categories:

Typed github.request() routesresolveRestEndpoint / resolveEventEndpoints now return { route, params } objects. The typed route strings use {placeholder} syntax and params are spread at the call site. Cascade updates to callers and tests are consistent.

Guarded new URL() — All 8 call sites in artifact_client.cjs, generate_history_link.cjs, mcp_cli_bridge.cjs, and mount_mcp_as_cli.cjs are wrapped in try/catch.

Control transfer after core.setFailed()check_team_member.cjs adds return after setFailed. safe_output_handler_manager.cjs correctly defers setFailed until after all outputs are exported, then returns — preventing any subsequent output after failure.

No correctness, security, or logic issues found. 315 tests pass.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · 26.7 AIC · ⌖ 5.21 AIC · ⊞ 5K

@github-actions github-actions Bot mentioned this pull request Jul 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

🧪 Test quality analysis by Test Quality Sentinel · 47.1 AIC · ⌖ 8.41 AIC · ⊞ 6.8K ·
Comment /review to run again

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

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

Unresolved review thre...

Addressed the unresolved feedback in commit 2f8937b.

Changes include:

  • artifact_client.cjs: resolve ACTIONS_RESULTS_URL before guarded Twirp URL construction so origin validation errors stay visible, plus shared URL parsing helper usage.
  • safe_output_handler_manager.cjs: preserve and surface primary safe-output failure details even if later export logic throws, and only log "completed" on success.
  • Added endpoint-shape runtime guards (replacing unsafe casts) in reaction/comment helpers, with regression coverage.
  • route_slash_command.cjs: tightened reaction typing to satisfy JS typecheck failures from CI.

I also reviewed the failing check logs:

  • js-typecheck / impacted-js-tests were failing on endpoint union typing and reaction typing errors now fixed in this commit.
  • agent failed with No log sources found in the captured job logs.

I can’t re-run CI from this cloud-agent push path; please re-trigger checks from a maintainer context (close/reopen PR, workflow_dispatch, or maintainer push).

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot July 17, 2026 08:25
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, resolve any still-unresolved review threads, and rerun checks once the branch is current. The latest replies indicate some prior feedback was addressed, but there are still open review threads on this PR that need explicit resolution or follow-up before a maintainer can verify merge readiness.

Generated by 👨‍🍳 PR Sous Chef · 11.9 AIC · ⌖ 6.58 AIC · ⊞ 7.5K ·
Comment /souschef to run again

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, resolve any still-unresolved review threads, and rerun checks once the branch is current. The latest replies indicate some prior feedback was addressed, bu...

Ran pr-finisher and completed a fresh pass.

  • I re-triaged the PR and reviewed all currently unresolved in-scope review threads (discussion_r3600053059, r3600053084, r3600069256, r3600069260, r3600069263, r3600069265). Each already has an @copilot follow-up reply tied to the latest fixes on 90c2fe7; no additional code changes were needed in this pass.
  • I investigated the previously failed checks from logs:
    • js-typecheck and impacted-js-tests failed on TS typing errors in add_reaction_and_edit_comment.cjs, add_workflow_run_comment.cjs, route_slash_command.cjs, and safe_output_handler_manager.cjs that are addressed by current HEAD.
    • agent failed with No log sources found.
  • Local validation on current HEAD is green: make fmt, make lint, make test-unit, make test, and make recompile all passed.

I still can’t re-run GitHub checks from this cloud-agent path, and unresolved-thread state itself is not writable through the available tool path here. Please have a maintainer re-trigger CI (close/reopen PR, workflow_dispatch, or maintainer push) and resolve threads if the existing follow-ups are satisfactory.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile

Copilot AI and others added 3 commits July 17, 2026 09:32
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot merge main and recompile

Done in 2da7bfbee6.

Merged origin/main into this branch and ran make recompile. I also ran make test-unit after the merge; it passed.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot lint js and fix js tests

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

Copilot AI commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

@copilot lint js and fix js tests

Addressed in a9bed6a.

I ran JS lint and fixed the JS type/test breakage by making normalizeReaction use a typed isReactionName guard backed by REACTION_MAP in actions/setup/js/route_slash_command.cjs.

Validated locally:

  • make lint-cjs
  • cd actions/setup/js && npm run typecheck
  • make test-impacted-js BASE_REF=origin/main

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, resolve any still-open review feedback, and rerun checks once the branch is ready.

The latest branch update says JS lint and impacted JS tests were fixed on current HEAD. Please confirm all previously-raised review threads are actually resolved or answered against the new head commit, then leave a concise maintainer handoff.

Failed checks:

  • none listed in compact prefilter snapshot

Generated by PR Sous Chef: https://github.com/github/gh-aw/actions/runs/29633801230

Generated by 👨‍🍳 PR Sous Chef · 17.1 AIC · ⌖ 7.54 AIC · ⊞ 7.5K ·
Comment /souschef to run again

@pelikhan
pelikhan merged commit 72b1988 into main Jul 18, 2026
14 of 15 checks passed
@pelikhan
pelikhan deleted the copilot/fix-route-url-core-failure-control-lint branch July 18, 2026 06:34
Copilot stopped work on behalf of gh-aw-bot due to an error July 18, 2026 06:35
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.13

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] [Code Quality] actions/setup/js: fix route/URL/core failure-control lint findings

4 participants