Skip to content

Convert providers/curation/ to TypeScript#1549

Open
JamieMagee wants to merge 4 commits intots-providers/harvestfrom
ts-providers/curation
Open

Convert providers/curation/ to TypeScript#1549
JamieMagee wants to merge 4 commits intots-providers/harvestfrom
ts-providers/curation

Conversation

@JamieMagee
Copy link
Copy Markdown
Contributor

@JamieMagee JamieMagee commented Apr 11, 2026

Merge 7 .js + .d.ts pairs into .ts in providers/curation/.

Review commit-by-commit. Stacked on #1548.

@JamieMagee JamieMagee changed the title ts providers/curation Convert providers/curation/ to TypeScript Apr 11, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Converts the providers/curation/ modules from paired .js + .d.ts files into consolidated .ts sources, updating runtime and test imports accordingly.

Changes:

  • Replaced providers/curation/process.js + process.d.ts with process.ts (typed queue processor interfaces included).
  • Converted curation store/config modules (memoryStore, mongoCurationStore, mongoConfig, githubConfig, azureQueueConfig) to TypeScript and removed their .d.ts companions.
  • Updated application/tests/type imports to reference the new .ts modules.
Show a summary per file
File Description
test/providers/curation/processTest.ts Updates test import to process.ts.
test/providers/curation/mongoCurationStore.ts Updates test import to mongoCurationStore.ts.
test/providers/curation/githubPRs.ts Updates test imports and esmock target to github.ts.
test/providers/curation/github.ts Updates test imports to github.ts/memoryStore.ts.
providers/index.js Switches curation provider imports from .js to .ts.
providers/curation/process.ts New TS implementation replacing prior .js + .d.ts.
providers/curation/process.js Removed legacy JS implementation.
providers/curation/process.d.ts Removed legacy declaration file (now inlined via TS).
providers/curation/mongoCurationStore.ts Type migration and minor error-handling changes.
providers/curation/mongoCurationStore.d.ts Removed legacy declaration file.
providers/curation/mongoConfig.ts Updated imports/types for TS store module.
providers/curation/mongoConfig.d.ts Removed legacy declaration file.
providers/curation/memoryStore.ts Type migration for in-memory store.
providers/curation/memoryStore.d.ts Removed legacy declaration file.
providers/curation/githubConfig.ts Type migration and updated imports for TS GitHub service.
providers/curation/githubConfig.d.ts Removed legacy declaration file.
providers/curation/github.ts Type migration for GitHub curation service.
providers/curation/github.d.ts Removed legacy declaration file.
providers/curation/azureQueueConfig.ts Type migration and updated imports for TS queue module.
providers/curation/azureQueueConfig.d.ts Removed legacy declaration file.
bin/config.d.ts Updates type-only import to process.ts.
app.js Updates runtime import to process.ts.

Copilot's findings

Tip

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

Comments suppressed due to low confidence (2)

providers/curation/memoryStore.ts:35

  • getContribution returns undefined when a PR isn’t present, but the curation store contract (ICurationStore.getContribution) documents returning null when not found. Returning null here would keep behavior consistent across store implementations and simplify callers.
    providers/curation/mongoCurationStore.ts:55
  • The error handling assumes the thrown value is an Error ((error as Error).message). If a non-Error is thrown, this can log undefined or even throw while handling the exception. Consider using error instanceof Error ? error.message : String(error) (and optionally include the full error as metadata) before calling retry.
  • Files reviewed: 14/22 changed files
  • Comments generated: 1

@JamieMagee JamieMagee force-pushed the ts-providers/harvest branch from 569f162 to d912865 Compare April 11, 2026 21:36
@JamieMagee JamieMagee force-pushed the ts-providers/curation branch 2 times, most recently from 1d826cf to 1b2c208 Compare April 11, 2026 21:52
@JamieMagee JamieMagee force-pushed the ts-providers/harvest branch from 17f3527 to aec304a Compare April 11, 2026 21:53
@JamieMagee JamieMagee force-pushed the ts-providers/curation branch from 1b2c208 to 9619521 Compare April 11, 2026 21:53
@JamieMagee JamieMagee force-pushed the ts-providers/curation branch from 9619521 to 2751711 Compare April 11, 2026 22:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Converts the providers/curation/ implementation from paired .js + .d.ts files into unified .ts modules, updating imports across the app and tests accordingly.

Changes:

  • Replaced curation provider implementations (process, github, mongoCurationStore, configs, etc.) with TypeScript equivalents.
  • Updated application wiring and provider registry imports to reference the new .ts modules.
  • Updated curation-related tests to import the new TypeScript modules and adjusted related comments.
Show a summary per file
File Description
test/providers/curation/processTest.ts Updates test import to the new process.ts.
test/providers/curation/mongoCurationStore.ts Updates test import to the new mongoCurationStore.ts.
test/providers/curation/githubPRs.ts Updates imports and esmock target to github.ts.
test/providers/curation/github.ts Updates imports to the new curation TypeScript modules.
providers/index.js Switches curation provider imports from .js to .ts.
providers/curation/process.ts New TS implementation merging prior process.js + process.d.ts.
providers/curation/process.js Removes old JS implementation.
providers/curation/process.d.ts Removes old declaration file (now in TS).
providers/curation/mongoCurationStore.ts Converts Mongo curation store to TS and removes JSDoc typedefs.
providers/curation/mongoCurationStore.d.ts Removes old declaration file (now in TS).
providers/curation/mongoConfig.ts Converts config wiring to TS types/imports.
providers/curation/mongoConfig.d.ts Removes old declaration file (now in TS).
providers/curation/memoryStore.ts Converts in-memory store to TS and adds declarations/types.
providers/curation/memoryStore.d.ts Removes old declaration file (now in TS).
providers/curation/githubConfig.ts Converts GitHub curation config factory to TS typings/imports.
providers/curation/githubConfig.d.ts Removes old declaration file (now in TS).
providers/curation/github.ts Converts GitHub curation service to TS, adding explicit types and some @ts-expect-error bridges.
providers/curation/github.d.ts Removes old declaration file (now in TS).
providers/curation/azureQueueConfig.ts Converts Azure queue config factory to TS typings/imports.
providers/curation/azureQueueConfig.d.ts Removes old declaration file (now in TS).
bin/config.d.ts Updates type-only import to process.ts.
app.js Updates curation processing import to process.ts.

Copilot's findings

Tip

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

Comments suppressed due to low confidence (5)

providers/curation/github.ts:440

  • autoCurate assumes this.list() returns a CurationListResult (it is forced via @ts-expect-error), but ICurationStore.list() can also return CurationData[] (MemoryStore). If the service is configured with the memory store, this will throw at runtime when accessing curationAndContributions.curations. Consider normalizing list() to always return CurationListResult (e.g., wrap CurationData[] into { curations, contributions: [] }) or branching on Array.isArray(data) here instead of suppressing the type error.
    providers/curation/github.ts:296
  • _calculateMatchingRevisionAndReason forces await this.list(...) into a CurationListResult via @ts-expect-error, but list() can return CurationData[] | null depending on the store. This can lead to runtime failures when accessing .curations / .contributions if the memory store is used. Prefer handling the union result explicitly (e.g., Array.isArray(...) / null check) or adjust list() to consistently return CurationListResult.

This issue also appears in the following locations of the same file:

  • line 438
  • line 943
    providers/curation/github.ts:954
  • listAll is declared to return Record<string, CurationListResult>, but it assigns the result of this.list() which is typed as CurationListResult | CurationData[] | null and is currently silenced with @ts-expect-error. Either widen the return type (e.g., include CurationData[]) or normalize this.list() results so callers always receive a CurationListResult; this will avoid suppressions and make the API contract accurate.
    providers/curation/memoryStore.ts:35
  • MemoryStore.getContribution returns undefined for missing entries, while the curation store contract elsewhere (e.g., Mongo store / ICurationStore docs) uses null to represent “not found”. Returning null here would make behavior consistent across store implementations and simplify consumers that differentiate between “no doc” vs other falsy values.
    providers/curation/mongoCurationStore.ts:55
  • In the Mongo initialization retry log, (error as Error).message assumes the caught value is an Error. If a non-Error is thrown (string/object), this logs undefined and loses useful context. Consider using error instanceof Error ? error.message : String(error) (and optionally include the full error object in metadata) before calling retry(error).
  • Files reviewed: 14/22 changed files
  • Comments generated: 0 new

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.

2 participants