Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Runs are never pruned, so every branch that ever ran keeps its own table row forever and the app data file grows without bound #313

Closed

Description

@matt-edmondson

What's wrong

Each build poll fetches the newest 10 runs and adds any it hasn't seen before:

  • GitHub: PageSize = 10 (Providers/GitHub.cs:423), then build.Runs.GetOrCreate(runId, ...) (GitHub.cs:430)
  • Azure DevOps: top: 10 (Providers/AzureDevOps.cs:317), then build.Runs.GetOrCreate(...) (AzureDevOps.cs:326)

A run is removed from Build.Runs in only two ways:

  • GitHub.UpdateRunAsync, when the API returns 404 for that run (GitHub.cs:463)
  • File -> Clear Data

Azure DevOps has no removal path at all. Build.Runs is also persisted: it is a public property, and ktsu.AppDataStorage serializes it with ReferenceHandler.Preserve. So every run seen since the data was last cleared stays in memory and in the app data file.

The main table builds one row per (build, branch) by grouping all of build.Runs by branch (BuildMonitor.cs:573-583). As a result, every Dependabot, feature or PR branch that ever ran keeps its own row indefinitely, long after the branch is merged and deleted.

The growing history is also reprocessed all the time:

  • IsBuildVisible (BuildMonitor.cs:656) enumerates and de-duplicates every run's branch, for every build, on every update pass.
  • The table regroups and re-sorts every run on every frame.
  • QueueSaveAppData() runs after every run update (GitHub.cs:538), so the growing file is re-serialized each time a run changes.

Meanwhile the features that use run history need very little of it. The estimator uses at most the 20 most recent successful runs (MaxSamplesToConsider, DurationEstimator.cs:18), and the History column shows 5 runs (recentRuns, BuildMonitor.cs:707).

CLAUDE.md lists "No data accumulation from stale entities" as a property of the update strategy (CLAUDE.md:122). That holds for repositories and builds, but not for runs.

Concrete scenario

Monitor a repository with Dependabot enabled. Every week Dependabot opens branches such as dependabot/nuget/..., CI runs on each one, and then the PR is merged and the branch deleted. Each of those branches keeps a row in the All tab and in the owner tab indefinitely, showing its last status (possibly a stale failure), and its runs stay in the JSON file. Only Clear Data removes them, and Clear Data also discards the history the estimator needs.

Suggested fix / acceptance criteria

  • After each UpdateBuildAsync, trim build.Runs to a bounded history. For example, keep:
    • the newest N runs per build, with N >= 20 so the estimator keeps its full sample
    • the newest run for each branch that has run within a retention window (for example 14-30 days)
    • every ongoing run, which is never dropped
  • Rows for branches that have no retained runs disappear from the table.
  • The app data file stays bounded when a busy workflow is polled over time. A test feeds a Build more runs than the cap and checks which ones are kept.
  • Update the "Entity Update Strategy" section of CLAUDE.md to describe the retention rule.

Activity

  1. matt-edmondson commented on Sep 28, 2026

    @matt-edmondson
    ContributorAuthor

    Triage


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions