toXlsx: the same input gives a different file on every call (zip timestamps)

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript

調査の方向性

packages/pivotkit-core/src/xlsx.js の250行目付近を読み、更新日時フィールドに関するfflateのzipオプションを確認してください。toXlsx に modified オプションを追加し、各zipエントリに渡してください。テストでは固定の日付を使用します。同じグリッドと更新日時で繰り返し呼び出したときに同一のファイルバイト列が生成され、ワークブックの内容は変わらないことを完了条件とします。

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

説明

area:core enhancement

toXlsx produces a different file on every call for the same input, because the zip entries carry the current time. A workbook can't be compared by hash, and a scheduled report sends a "changed" file even when the data did not change.

Where: packages/pivotkit-core/src/xlsx.js line 250 calls zipSync(zipped, { level: 6 }) without a modification time, so fflate stamps each entry with the time of the call.

Not affected: the workbook content. Unzipped, every entry is byte-identical between runs; Excel and other readers don't care about the timestamps. Nothing has broken so far because no test or feature compares whole files.

Reproduce: call toXlsx twice on the same grid, compare SHA-256 of the two results: they differ; compare the unzipped entries: they match.

Fix: an option such as toXlsx(grid, { modified }) (a Date) that is passed as mtime to every zip entry, with a fixed default in tests. Check fflate's zip options for the exact field before building it. The headless report runner would pass the run's fire time, so a rerun of the same report gives the same bytes.

Found while probing headless runtimes for scheduled reports.

主要言語
JavaScript
スター
1
フォーク
1
平均マージ
3時間 34分
マージ済み PR(30日)
213

環境構築

はじめの一歩

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

eizedev/pivotkit のほかの issue

eizedev/pivotkit の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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