microsoft / microsoft/MSBuildCache
Materialize outputs after recursively memoized cache hits
まだ誰も着手していません。
- 主要言語
- C#
- スター
- 64
- フォーク
- 24
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 2
説明
Summary
Recursive cache results are memoized only by NodeContext, but each memoized Lazy<Task<CacheResult>> captures whether outputs should be materialized.
Impact
With MSBuildCacheGetResultsForUnqueriedDependencies=true, a recursive query that does not require outputs can populate the memoized result first. A later direct query for the same node reuses that cache hit without materializing required files, allowing MSBuild to proceed with missing reference assemblies or other outputs.
Evidence
src/Common/MSBuildCachePluginBase.cs stores recursive results in ConcurrentDictionary<NodeContext, Lazy<Task<CacheResult>>>. materializeOutputs is not part of the key or separately tracked. The implementation comments assume the node will not later be queried directly, while the setting is documented for builds that are not executed in graph order.
Suggested fix
Separate result lookup from materialization state. A direct caller requiring outputs should be able to materialize a previously memoized non-materialized hit without repeating fingerprint/cache lookup. Alternatively, include the materialization requirement in memoization while preventing duplicate result mutation.
Acceptance criteria
- A recursive non-materializing hit followed by a direct query materializes outputs exactly once.
- The fix covers out-of-order dependency queries and multi-targeting inner builds.
- Default and non-recursive behavior remains unchanged.
- A deterministic concurrency/order test covers the regression.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
src/Common/MSBuildCachePluginBase.cs を読み、ConcurrentDictionary<NodeContext, Lazy<Task>> の再帰的な結果パスと、materializeOutputs の扱いに注目してください。再帰的なクエリと直接のクエリを追跡し、その後、依存関係クエリの順不同実行と multi-targeting の inner build を対象とする、決定論的な並行性/順序テストを追加してください。再帰的で materialize を行わないヒットによって必要な出力が正確に 1 回だけ materialize され、デフォルトの動作と非再帰的な動作が変更されないことが完了条件です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp
- 領域
- build-system
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100