Skip to content

Fix add_labels strict-mode narrowing for CJS lint/typecheck#46589

Merged
pelikhan merged 3 commits into
mainfrom
copilot/fix-lint-js-issues
Jul 19, 2026
Merged

Fix add_labels strict-mode narrowing for CJS lint/typecheck#46589
pelikhan merged 3 commits into
mainfrom
copilot/fix-lint-js-issues

Conversation

Copilot AI commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

The CJS workflow was failing on actions/setup/js/add_labels.cjs because the strict issue_intent metadata check did not narrow mixed label inputs cleanly for TypeScript. This change keeps the existing validation semantics while making the structured-label path explicit to the checker.

  • Problem

    • message.labels accepts both strings and structured label objects.
    • In strict issue_intent mode, the missing-metadata check left label.name on a union type that TypeScript could not prove was object-shaped.
  • Change

    • Replace the filter(...).map(...) path with a single loop that:
      • skips plain-string entries,
      • inspects only object labels,
      • records labels missing rationale or confidence.
  • Behavior preserved

    • Strict mode still rejects label objects missing required intent metadata.
    • Error messages still include a stable fallback for malformed objects via "<unnamed>".
  • Illustrative snippet

    const missingMetadataLabelNames = [];
    for (const label of requestedLabelInputs) {
      if (typeof label !== "object" || label === null) continue;
      if (!label.rationale || !label.confidence) {
        missingMetadataLabelNames.push(JSON.stringify(label.name ?? "<unnamed>"));
      }
    }

Copilot AI and others added 2 commits July 19, 2026 10:06
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Fix lint js issue in add_labels handler Fix add_labels strict-mode narrowing for CJS lint/typecheck Jul 19, 2026
Copilot AI requested a review from pelikhan July 19, 2026 10:16
@pelikhan
pelikhan marked this pull request as ready for review July 19, 2026 10:21
Copilot AI review requested due to automatic review settings July 19, 2026 10:21

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

Refactors strict-mode label validation so TypeScript correctly narrows structured label inputs without changing runtime behavior.

Changes:

  • Replaces filter().map() with explicit object narrowing.
  • Preserves metadata validation and fallback label naming.
Show a summary per file
File Description
actions/setup/js/add_labels.cjs Makes strict-mode structured-label validation type-safe.

Review details

Tip

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

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Medium

@pelikhan
pelikhan merged commit 463e4bc into main Jul 19, 2026
9 checks passed
@pelikhan
pelikhan deleted the copilot/fix-lint-js-issues branch July 19, 2026 10:24
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill and rerun checks once the branch is up to date.

Run: https://github.com/github/gh-aw/actions/runs/29683215651

Warning

Firewall blocked 1 domain

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

  • pi.dev

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

network:
  allowed:
    - defaults
    - "pi.dev"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · 12.4 AIC · ⌖ 10.3 AIC · ⊞ 6K ·
Comment /souschef to run again

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.14

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants