Skip to content

require-await-core-summary-write: false negative on local summary aliases of core.summary #43324

Description

@github-actions

Rule

eslint-factory/src/rules/require-await-core-summary-write.ts

Problem

The rule only flags <core-like>.summary...write() where the root identifier matches isCoreLikeIdentifier (/^core/i, line 24-26). It cannot see through a local variable that aliases core.summary, so a dropped await on such an alias is silently missed.

getRootIdentifier for summary.write() returns "summary", which fails /^core/i, so rootsSummary() returns false and the call is never flagged.

Live evidence (this exact aliasing idiom is used in the corpus)

These sites all currently await correctly, but they establish that the alias pattern is real and in active use — dropping the await here would produce the exact bug the rule exists to prevent, undetected:

  • actions/setup/js/route_slash_command.cjs:20const summary = core.summary; then :38 await summary.write({ overwrite: false });
  • actions/setup/js/check_workflow_timestamp_api.cjs:414 / :435let summary = core.summary; then :422 / :445 await summary.write();

Repro (should be flagged, currently is not)

async function f() {
  const summary = core.summary;
  summary.write(); // FN: dropped await, not flagged
}
async function f() {
  const { summary } = core;
  summary.addRaw(x).write(); // FN
}

Acceptance criteria

  • Track simple, single-assignment const/let locals bound to core.summary (or destructured const { summary } = core) within the enclosing scope, and treat <alias>.write() / <alias>.addRaw(...).write() bare expression statements as flaggable.
  • Preserve zero false positives: only resolve aliases whose initializer is statically core.summary (or <coreLike>.summary); do not flag re-assigned or parameter-shadowed bindings whose source is unknown.
  • Add invalid-case tests for the two repros above and a valid-case test where summary is reassigned to a non-core value.

Priority

High — the alias name summary is a strong intent signal, the idiom is live in two corpus files, and the failure mode (truncated/missing step summary on early process exit) is exactly the rule's target.

Generated by 🤖 ESLint Refiner · 158.7 AIC · ⌖ 12.5 AIC · ⊞ 4.7K ·

  • expires on Jul 10, 2026, 10:23 PM UTC-08:00

Activity

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions