[Dashboard] Prune unpublished run directories left by interrupted startup
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
Publishing `run.json` after schema initialization correctly prevents an incomplete run from appearing in history. However, a directory left after database initialization but before metadata publication has no valid metadata, so discovery ignores it and pruning never sees it.
These abandoned directories can accumulate indefinitely after interruptions during Dashboard startup.
### Expected Behavior
An unlocked, metadata-less run directory should eventually be removed as an abandoned startup attempt.
### Steps To Reproduce
1. Leave a run directory in the post-schema-initialization, pre-metadata-publication state.
2. Start and publish a later run for the same application.
3. Invoke normal run retention pruning.
4. The abandoned directory remains because it was never added to `_runs`.
### Exceptions (if any)
N/A
### Aspire doctor output
```plain
Aspire CLI 13.6.0-pr.18924.g5ee63941
Windows 10.0.26200
```
### Anything else?
Related to #18924. Source: `src/Aspire.Dashboard/ServiceClient/DashboardRunStore.cs:336-369,440-465`. A focused test reproduced the leak, and the same implementation remains on current `main`.
Contributor guide
Research direction
Read src/Aspire.Dashboard/ServiceClient/DashboardRunStore.cs around lines 336-369 and 440-465, then run or inspect the focused test that reproduces the abandoned-directory leak. Verify that an unlocked run directory without published metadata is included in normal retention pruning and removed after a later run is published.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100