getSalesSummary CSV drops the name column when the top group is unnamed

オープン 初心者向け
#106 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
api, data

調査の方向性

バグは src/tools/getSalesSummary.ts の toCsv にあり、列集合を Object.keys(rows[0]) からのみ取得しています。そこから始めて、name キーを条件付きで追加するグループマッピングを読んでください。src/tools/tests/sales.test.ts に、より下位の行だけが名前を持つテストを追加し、名前のない行に対して空のセルを持つ name 列が生成されることを確認してください。npm test を実行してください。

索引モデルが issue の本文から書いたものです。

説明

bug good first issue priority: low

Summary

steam_getSalesSummary with format: "csv" takes its columns from the first row only. When the top group has no name but later groups do, the name column is left out of the whole CSV.

Where

  • src/tools/getSalesSummary.ts (toCsv: const cols = Object.keys(rows[0]);)
  • src/tools/getSalesSummary.ts (group mapping: ...(name ? { name } : {}))

Details

function toCsv(rows: Array<Record<string, unknown>>): string {
  if (rows.length === 0) return "";
  const cols = Object.keys(rows[0]);
  ...
}

Each group only gets a name key when app_info, package_info, or country_info named it. Rows are sorted by net revenue, so whether the CSV has a name column depends on whether the top earner happened to be named. If row 0 is named and others are not, those get an empty cell, which is fine; the reverse loses every name.

Impact

Low. Steam normally returns names for the countries, apps, and packages on the page, so this needs an unnamed group at the top. When it happens, a spreadsheet export silently drops the names column.

Steps to reproduce

  1. Stub GetDetailedSales so the top-revenue row's country_code has no country_info entry and a smaller row's does.
  2. Call steam_getSalesSummary { start_date, format: "csv" }.
  3. The header has no name column.

Suggested fix

Build cols as the union of keys across all rows, in first-seen order, or always set name (empty string when unknown) so every row has the same keys.

Acceptance criteria

  • A test where only a lower row is named produces a name column with that name and an empty cell for the unnamed row.

Getting started

  • Relevant files: src/tools/getSalesSummary.ts, src/tools/__tests__/sales.test.ts
  • How to run tests: npm test

Filed by repo-audit/fix-issues at a23ec21. Severity: low. Effort: S. audit-key: bug|src/tools/getSalesSummary.ts|toCsv

主要言語
TypeScript
スター
5
フォーク
2
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TMHSDigital/steam-mcp のほかの issue

TMHSDigital/steam-mcp の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。