Skip to content

Fix TypeScript error in close_expired_discussions: add duplicateCount to return type#12206

Merged
pelikhan merged 2 commits intomainfrom
copilot/investigate-js-job-typecheck-failure
Jan 28, 2026
Merged

Fix TypeScript error in close_expired_discussions: add duplicateCount to return type#12206
pelikhan merged 2 commits intomainfrom
copilot/investigate-js-job-typecheck-failure

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

The searchDiscussionsWithExpiration function returns a stats object with duplicateCount (added for deduplication tracking), but the JSDoc type annotation only declared pageCount and totalScanned, causing typecheck to fail.

Changes

  • Updated JSDoc @returns annotation for searchDiscussionsWithExpiration to include duplicateCount: number in the stats object type
// Before
@returns {Promise<{..., stats: {pageCount: number, totalScanned: number}}>}

// After  
@returns {Promise<{..., stats: {pageCount: number, totalScanned: number, duplicateCount: number}}>}
Original prompt

This section details on the original issue you should resolve

<issue_title>[CI Failure Doctor] Investigate js job typecheck failure</issue_title>
<issue_description># 🏥 CI Failure Investigation - Run githubnext/gh-aw#32188

Summary

TypeScript typecheck in the js job now fails after the change that adds a duplicateCount accumulator in close_expired_discussions.cjs. The stats return object is still declared as containing only pageCount and totalScanned, so npm run typecheck crashes before running any tests.

Failure Details

  • Run: 21427643999
  • Commit: 8ef509b
  • Trigger: push
  • Job: js
  • Step: Run tests (npm run typecheck)
  • Log access: gh is unauthenticated and the API returned 403 Must have admin rights when downloading job logs.

Root Cause Analysis

close_expired_discussions.cjs now tracks a duplicateCount value when deduplicating discussions, but the return type annotated in the JSDoc still only lists pageCount and totalScanned. TypeScript rejects the literal as it is no longer assignable to the declared type, so the typecheck script fails before the rest of the test suite executes.

Failed Jobs and Errors

  • jsRun tests: error TS2353: Object literal may only specify known properties, and 'duplicateCount' does not exist in type '{ pageCount: number; totalScanned: number; }'.

Investigation Findings

  • Reproduced locally with cd actions/setup/js && npm test (fails in npm run typecheck).
  • The error points to the return value of searchDiscussionsWithExpiration near the end of close_expired_discussions.cjs.
  • No prior similar failures were found in cached investigations.

Recommended Actions

  • Update the JSDoc (and any TypeScript interface) for searchDiscussionsWithExpiration to include duplicateCount in stats.
  • Re-run npm run typecheck (and dependent tests) to verify the fix.

Prevention Strategies

Keep type annotations in sync with any new properties added to returned data structures, ideally with a lint or typecheck gate that runs locally before pushing.

AI Team Self-Improvement

When extending objects returned to TypeScript tooling, simultaneously expand their documented/annotated shapes so the type system can verify the new fields.

Historical Context

No matching incidents were found in prior investigations for this exact typecheck error.

AI generated by CI Failure Doctor

To add this workflow in your repository, run gh aw add githubnext/agentics/workflows/ci-doctor.md@ea350161ad5dcc9624cf510f134c6a9e39a6f94d. See usage guide.

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…turn type

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate js job typecheck failure in CI Fix TypeScript error in close_expired_discussions: add duplicateCount to return type Jan 28, 2026
Copilot AI requested a review from pelikhan January 28, 2026 07:06
@pelikhan pelikhan marked this pull request as ready for review January 28, 2026 09:38
@pelikhan pelikhan merged commit 8059837 into main Jan 28, 2026
@pelikhan pelikhan deleted the copilot/investigate-js-job-typecheck-failure branch January 28, 2026 09:38
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.

[CI Failure Doctor] Investigate js job typecheck failure

2 participants