microsoft / microsoft/MSBuildCache
Bound Azure Pipelines selector history and publish cost
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 64
- Forks
- 24
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 2
Description
Summary
The Azure Pipelines cache backend carries forward every selector ever observed for a weak fingerprint and republishes the complete set on each new selector.
Impact
For a recurring weak fingerprint whose path set or strong selector changes over time, each miss fetches the prior selector manifest, downloads every unique historical path set, writes temporary files, and republishes the full set. Publish work grows linearly with selector history rather than remaining bounded. Azure retention and selector deduplication limit some scenarios, but a long-lived cache universe can still accumulate substantial sequential remote I/O.
Evidence
src/AzurePipelines/PipelineCachingCacheClient.cs calls GetSelectors(...).ToHashSetAsync, adds the current selector, then iterates all selectors and republishes them. The implementation already contains TODO: limit the number of selectors we store. Timestamped selector keys carry the newest set across builds.
Suggested fix
Introduce a bounded retention policy for selectors per weak fingerprint, preserving the most useful/recent entries. Avoid downloading historical path-set content that will not be retained. Add instrumentation or tests demonstrating bounded manifest size and remote requests.
Acceptance criteria
- Selector count and manifest size remain bounded under repeated selector churn.
- Existing selectors still provide expected cache hits within the retention policy.
- Publishing a new selector performs bounded remote work.
- Tests cover churn, deduplication, and eviction behavior.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/AzurePipelines/PipelineCachingCacheClient.cs at GetSelectors(...).ToHashSetAsync and the TODO about limiting stored selectors. Trace how timestamped selector keys, manifests, and path-set downloads are handled, then add tests for selector churn, deduplication, eviction, bounded manifest size, and remote requests. Done means retention and publishing work remain bounded while retained selectors still provide expected cache hits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100